Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

ConditionType.java 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * ====================================================================
  3. * Licensed to the Apache Software Foundation (ASF) under one or more
  4. * contributor license agreements. See the NOTICE file distributed with
  5. * this work for additional information regarding copyright ownership.
  6. * The ASF licenses this file to You under the Apache License, Version 2.0
  7. * (the "License"); you may not use this file except in compliance with
  8. * the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. * ====================================================================
  18. */
  19. package org.apache.poi.ss.usermodel;
  20. import java.util.HashMap;
  21. import java.util.Map;
  22. /**
  23. * Represents a type of a conditional formatting rule
  24. */
  25. public class ConditionType {
  26. private static Map<Integer,ConditionType> lookup = new HashMap<>();
  27. /**
  28. * This conditional formatting rule compares a cell value
  29. * to a formula calculated result, using an operator
  30. */
  31. public static final ConditionType CELL_VALUE_IS =
  32. new ConditionType(1, "cellIs");
  33. /**
  34. * This conditional formatting rule contains a formula to evaluate.
  35. * When the formula result is true, the cell is highlighted.
  36. */
  37. public static final ConditionType FORMULA =
  38. new ConditionType(2, "expression");
  39. /**
  40. * This conditional formatting rule contains a color scale,
  41. * with the cell background set according to a gradient.
  42. */
  43. public static final ConditionType COLOR_SCALE =
  44. new ConditionType(3, "colorScale");
  45. /**
  46. * This conditional formatting rule sets a data bar, with the
  47. * cell populated with bars based on their values
  48. */
  49. public static final ConditionType DATA_BAR =
  50. new ConditionType(4, "dataBar");
  51. /**
  52. * This conditional formatting rule that files the values
  53. */
  54. public static final ConditionType FILTER =
  55. new ConditionType(5, null);
  56. /**
  57. * This conditional formatting rule sets a data bar, with the
  58. * cell populated with bars based on their values
  59. */
  60. public static final ConditionType ICON_SET =
  61. new ConditionType(6, "iconSet");
  62. public final byte id;
  63. public final String type;
  64. public String toString() {
  65. return id + " - " + type;
  66. }
  67. public static ConditionType forId(byte id) {
  68. return forId((int)id);
  69. }
  70. public static ConditionType forId(int id) {
  71. return lookup.get(id);
  72. }
  73. private ConditionType(int id, String type) {
  74. this.id = (byte)id; this.type = type;
  75. lookup.put(id, this);
  76. }
  77. }