Package org.apache.poi.hssf.usermodel
Class HSSFDataValidation
- java.lang.Object
-
- org.apache.poi.hssf.usermodel.HSSFDataValidation
-
- All Implemented Interfaces:
DataValidation
public final class HSSFDataValidation extends Object implements DataValidation
Utility class for creating data validation cells
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.poi.ss.usermodel.DataValidation
DataValidation.ErrorStyle
-
-
Constructor Summary
Constructors Constructor Description HSSFDataValidation(CellRangeAddressList regions, DataValidationConstraint constraint)
Constructor which initializes the cell range on which this object will be applied
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DVRecord
createDVRecord(HSSFSheet sheet)
void
createErrorBox(String title, String text)
Sets the title and text for the error box .void
createPromptBox(String title, String text)
Sets the title and text for the prompt box .DVConstraint
getConstraint()
boolean
getEmptyCellAllowed()
Retrieve the settings for empty cells allowedString
getErrorBoxText()
String
getErrorBoxTitle()
int
getErrorStyle()
oString
getPromptBoxText()
String
getPromptBoxTitle()
CellRangeAddressList
getRegions()
boolean
getShowErrorBox()
boolean
getShowPromptBox()
boolean
getSuppressDropDownArrow()
Useful only list validation objects .DataValidationConstraint
getValidationConstraint()
void
setEmptyCellAllowed(boolean allowed)
Sets if this object allows empty as a valid valuevoid
setErrorStyle(int error_style)
Sets the error style for error boxvoid
setShowErrorBox(boolean show)
Sets the behaviour when an invalid value is enteredvoid
setShowPromptBox(boolean show)
Sets the behaviour when a cell which belongs to this object is selectedvoid
setSuppressDropDownArrow(boolean suppress)
Useful for list validation objects .
-
-
-
Constructor Detail
-
HSSFDataValidation
public HSSFDataValidation(CellRangeAddressList regions, DataValidationConstraint constraint)
Constructor which initializes the cell range on which this object will be applied- Parameters:
regions
- A list of regions where the constraint is validated.constraint
- The constraints to apply for this validation.
-
-
Method Detail
-
getValidationConstraint
public DataValidationConstraint getValidationConstraint()
- Specified by:
getValidationConstraint
in interfaceDataValidation
-
getConstraint
public DVConstraint getConstraint()
-
getRegions
public CellRangeAddressList getRegions()
- Specified by:
getRegions
in interfaceDataValidation
-
setErrorStyle
public void setErrorStyle(int error_style)
Description copied from interface:DataValidation
Sets the error style for error box- Specified by:
setErrorStyle
in interfaceDataValidation
- See Also:
DataValidation.ErrorStyle
-
getErrorStyle
public int getErrorStyle()
Description copied from interface:DataValidation
o- Specified by:
getErrorStyle
in interfaceDataValidation
- Returns:
- the error style of error box
- See Also:
DataValidation.ErrorStyle
-
setEmptyCellAllowed
public void setEmptyCellAllowed(boolean allowed)
Description copied from interface:DataValidation
Sets if this object allows empty as a valid value- Specified by:
setEmptyCellAllowed
in interfaceDataValidation
- Parameters:
allowed
-true
if this object should treats empty as valid value ,false
otherwise
-
getEmptyCellAllowed
public boolean getEmptyCellAllowed()
Description copied from interface:DataValidation
Retrieve the settings for empty cells allowed- Specified by:
getEmptyCellAllowed
in interfaceDataValidation
- Returns:
- True if this object should treats empty as valid value , false otherwise
-
setSuppressDropDownArrow
public void setSuppressDropDownArrow(boolean suppress)
Description copied from interface:DataValidation
Useful for list validation objects .- Specified by:
setSuppressDropDownArrow
in interfaceDataValidation
- Parameters:
suppress
- True if a list should display the values into a drop down list , false otherwise . In other words , if a list should display the arrow sign on its right side
-
getSuppressDropDownArrow
public boolean getSuppressDropDownArrow()
Description copied from interface:DataValidation
Useful only list validation objects . This method always returns false if the object isn't a list validation object- Specified by:
getSuppressDropDownArrow
in interfaceDataValidation
- Returns:
true
if a list should display the values into a drop down list ,false
otherwise .
-
setShowPromptBox
public void setShowPromptBox(boolean show)
Description copied from interface:DataValidation
Sets the behaviour when a cell which belongs to this object is selected- Specified by:
setShowPromptBox
in interfaceDataValidation
- Parameters:
show
-true
if an prompt box should be displayed ,false
otherwise
-
getShowPromptBox
public boolean getShowPromptBox()
- Specified by:
getShowPromptBox
in interfaceDataValidation
- Returns:
true
if an prompt box should be displayed ,false
otherwise
-
setShowErrorBox
public void setShowErrorBox(boolean show)
Description copied from interface:DataValidation
Sets the behaviour when an invalid value is entered- Specified by:
setShowErrorBox
in interfaceDataValidation
- Parameters:
show
-true
if an error box should be displayed ,false
otherwise
-
getShowErrorBox
public boolean getShowErrorBox()
- Specified by:
getShowErrorBox
in interfaceDataValidation
- Returns:
true
if an error box should be displayed ,false
otherwise
-
createPromptBox
public void createPromptBox(String title, String text)
Description copied from interface:DataValidation
Sets the title and text for the prompt box . Prompt box is displayed when the user selects a cell which belongs to this validation object . In order for a prompt box to be displayed you should also use method setShowPromptBox( boolean show )- Specified by:
createPromptBox
in interfaceDataValidation
- Parameters:
title
- The prompt box's titletext
- The prompt box's text
-
getPromptBoxTitle
public String getPromptBoxTitle()
- Specified by:
getPromptBoxTitle
in interfaceDataValidation
- Returns:
- Prompt box's title or
null
-
getPromptBoxText
public String getPromptBoxText()
- Specified by:
getPromptBoxText
in interfaceDataValidation
- Returns:
- Prompt box's text or
null
-
createErrorBox
public void createErrorBox(String title, String text)
Description copied from interface:DataValidation
Sets the title and text for the error box . Error box is displayed when the user enters an invalid value int o a cell which belongs to this validation object . In order for an error box to be displayed you should also use method setShowErrorBox( boolean show )- Specified by:
createErrorBox
in interfaceDataValidation
- Parameters:
title
- The error box's titletext
- The error box's text
-
getErrorBoxTitle
public String getErrorBoxTitle()
- Specified by:
getErrorBoxTitle
in interfaceDataValidation
- Returns:
- Error box's title or
null
-
getErrorBoxText
public String getErrorBoxText()
- Specified by:
getErrorBoxText
in interfaceDataValidation
- Returns:
- Error box's text or
null
-
-