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.

DataValidation.java 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.ss.usermodel;
  16. import org.apache.poi.ss.util.CellRangeAddressList;
  17. public interface DataValidation {
  18. /**
  19. * Error style constants for error box
  20. */
  21. public static final class ErrorStyle {
  22. /** STOP style */
  23. public static final int STOP = 0x00;
  24. /** WARNING style */
  25. public static final int WARNING = 0x01;
  26. /** INFO style */
  27. public static final int INFO = 0x02;
  28. }
  29. public abstract DataValidationConstraint getValidationConstraint();
  30. /**
  31. * Sets the error style for error box
  32. * @see ErrorStyle
  33. */
  34. public abstract void setErrorStyle(int error_style);
  35. /**o
  36. * @return the error style of error box
  37. * @see ErrorStyle
  38. */
  39. public abstract int getErrorStyle();
  40. /**
  41. * Sets if this object allows empty as a valid value
  42. *
  43. * @param allowed <code>true</code> if this object should treats empty as valid value , <code>false</code>
  44. * otherwise
  45. */
  46. public abstract void setEmptyCellAllowed(boolean allowed);
  47. /**
  48. * Retrieve the settings for empty cells allowed
  49. *
  50. * @return True if this object should treats empty as valid value , false
  51. * otherwise
  52. */
  53. public abstract boolean getEmptyCellAllowed();
  54. /**
  55. * Useful for list validation objects .
  56. *
  57. * @param suppress
  58. * True if a list should display the values into a drop down list ,
  59. * false otherwise . In other words , if a list should display
  60. * the arrow sign on its right side
  61. */
  62. public abstract void setSuppressDropDownArrow(boolean suppress);
  63. /**
  64. * Useful only list validation objects . This method always returns false if
  65. * the object isn't a list validation object
  66. *
  67. * @return <code>true</code> if a list should display the values into a drop down list ,
  68. * <code>false</code> otherwise .
  69. */
  70. public abstract boolean getSuppressDropDownArrow();
  71. /**
  72. * Sets the behaviour when a cell which belongs to this object is selected
  73. *
  74. * @param show <code>true</code> if an prompt box should be displayed , <code>false</code> otherwise
  75. */
  76. public abstract void setShowPromptBox(boolean show);
  77. /**
  78. * @return <code>true</code> if an prompt box should be displayed , <code>false</code> otherwise
  79. */
  80. public abstract boolean getShowPromptBox();
  81. /**
  82. * Sets the behaviour when an invalid value is entered
  83. *
  84. * @param show <code>true</code> if an error box should be displayed , <code>false</code> otherwise
  85. */
  86. public abstract void setShowErrorBox(boolean show);
  87. /**
  88. * @return <code>true</code> if an error box should be displayed , <code>false</code> otherwise
  89. */
  90. public abstract boolean getShowErrorBox();
  91. /**
  92. * Sets the title and text for the prompt box . Prompt box is displayed when
  93. * the user selects a cell which belongs to this validation object . In
  94. * order for a prompt box to be displayed you should also use method
  95. * setShowPromptBox( boolean show )
  96. *
  97. * @param title The prompt box's title
  98. * @param text The prompt box's text
  99. */
  100. public abstract void createPromptBox(String title, String text);
  101. /**
  102. * @return Prompt box's title or <code>null</code>
  103. */
  104. public abstract String getPromptBoxTitle();
  105. /**
  106. * @return Prompt box's text or <code>null</code>
  107. */
  108. public abstract String getPromptBoxText();
  109. /**
  110. * Sets the title and text for the error box . Error box is displayed when
  111. * the user enters an invalid value int o a cell which belongs to this
  112. * validation object . In order for an error box to be displayed you should
  113. * also use method setShowErrorBox( boolean show )
  114. *
  115. * @param title The error box's title
  116. * @param text The error box's text
  117. */
  118. public abstract void createErrorBox(String title, String text);
  119. /**
  120. * @return Error box's title or <code>null</code>
  121. */
  122. public abstract String getErrorBoxTitle();
  123. /**
  124. * @return Error box's text or <code>null</code>
  125. */
  126. public abstract String getErrorBoxText();
  127. public abstract CellRangeAddressList getRegions();
  128. }