You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IconMultiStateFormatting.java 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. /**
  21. * High level representation for the Icon / Multi-State Formatting
  22. * component of Conditional Formatting settings
  23. */
  24. public interface IconMultiStateFormatting {
  25. enum IconSet {
  26. /** Green Up / Yellow Side / Red Down arrows */
  27. GYR_3_ARROW(0, 3, "3Arrows"),
  28. /** Grey Up / Side / Down arrows */
  29. GREY_3_ARROWS(1, 3, "3ArrowsGray"),
  30. /** Green / Yellow / Red flags */
  31. GYR_3_FLAGS(2, 3, "3Flags"),
  32. /** Green / Yellow / Red traffic lights (no background). Default */
  33. GYR_3_TRAFFIC_LIGHTS(3, 3, "3TrafficLights1"),
  34. /** Green / Yellow / Red traffic lights on a black square background.
  35. * Note, MS-XLS docs v20141018 say this is id=5 but seems to be id=4 */
  36. GYR_3_TRAFFIC_LIGHTS_BOX(4, 3, "3TrafficLights2"),
  37. /** Green Circle / Yellow Triangle / Red Diamond.
  38. * Note, MS-XLS docs v20141018 say this is id=4 but seems to be id=5 */
  39. GYR_3_SHAPES(5, 3, "3Signs"),
  40. /** Green Tick / Yellow ! / Red Cross on a circle background */
  41. GYR_3_SYMBOLS_CIRCLE(6, 3, "3Symbols"),
  42. /** Green Tick / Yellow ! / Red Cross (no background) */
  43. GYR_3_SYMBOLS(7, 3, "3Symbols2"),
  44. /** Green Up / Yellow NE / Yellow SE / Red Down arrows */
  45. GYR_4_ARROWS(8, 4, "4Arrows"),
  46. /** Grey Up / NE / SE / Down arrows */
  47. GREY_4_ARROWS(9, 4, "4ArrowsGray"),
  48. /** Red / Light Red / Grey / Black traffic lights */
  49. RB_4_TRAFFIC_LIGHTS(0xA, 4, "4RedToBlack"),
  50. RATINGS_4(0xB, 4, "4Rating"),
  51. /** Green / Yellow / Red / Black traffic lights */
  52. GYRB_4_TRAFFIC_LIGHTS(0xC, 4, "4TrafficLights"),
  53. GYYYR_5_ARROWS(0xD, 5, "5Arrows"),
  54. GREY_5_ARROWS(0xE, 5, "5ArrowsGray"),
  55. RATINGS_5(0xF, 5, "5Rating"),
  56. QUARTERS_5(0x10, 5, "5Quarters");
  57. /** Numeric ID of the icon set */
  58. public final int id;
  59. /** How many icons in the set */
  60. public final int num;
  61. /** Name (system) of the set */
  62. public final String name;
  63. public String toString() {
  64. return id + " - " + name;
  65. }
  66. public static IconSet byId(int id) {
  67. return values()[id];
  68. }
  69. public static IconSet byName(String name) {
  70. for (IconSet set : values()) {
  71. if (set.name.equals(name)) return set;
  72. }
  73. return null;
  74. }
  75. IconSet(int id, int num, String name) {
  76. this.id = id; this.num = num; this.name = name;
  77. }
  78. }
  79. /**
  80. * Get the Icon Set used
  81. */
  82. IconSet getIconSet();
  83. /**
  84. * Changes the Icon Set used
  85. *
  86. * <p>If the new Icon Set has a different number of
  87. * icons to the old one, you <em>must</em> update the
  88. * thresholds before saving!</p>
  89. */
  90. void setIconSet(IconSet set);
  91. /**
  92. * Should Icon + Value be displayed, or only the Icon?
  93. */
  94. boolean isIconOnly();
  95. /**
  96. * Control if only the Icon is shown, or Icon + Value
  97. */
  98. void setIconOnly(boolean only);
  99. boolean isReversed();
  100. void setReversed(boolean reversed);
  101. /**
  102. * Gets the list of thresholds
  103. */
  104. ConditionalFormattingThreshold[] getThresholds();
  105. /**
  106. * Sets the of thresholds. The number must match
  107. * {@link IconSet#num} for the current {@link #getIconSet()}
  108. */
  109. void setThresholds(ConditionalFormattingThreshold[] thresholds);
  110. /**
  111. * Creates a new, empty Threshold
  112. */
  113. ConditionalFormattingThreshold createThreshold();
  114. }