org.apache.poi.hssf.usermodel
Class HSSFDataValidation

java.lang.Object
  extended by org.apache.poi.hssf.usermodel.HSSFDataValidation

public final class HSSFDataValidation
extends java.lang.Object

Utility class for creating data validation cells

Author:
Dragos Buleandra (dragos.buleandra@trade2b.ro)

Nested Class Summary
static class HSSFDataValidation.ErrorStyle
          Error style constants for error box
 
Constructor Summary
HSSFDataValidation(CellRangeAddressList regions, DVConstraint constraint)
          Constructor which initializes the cell range on which this object will be applied
 
Method Summary
 DVRecord createDVRecord(HSSFSheet sheet)
           
 void createErrorBox(java.lang.String title, java.lang.String text)
          Sets the title and text for the error box .
 void createPromptBox(java.lang.String title, java.lang.String text)
          Sets the title and text for the prompt box .
 DVConstraint getConstraint()
           
 boolean getEmptyCellAllowed()
          Retrieve the settings for empty cells allowed
 java.lang.String getErrorBoxText()
           
 java.lang.String getErrorBoxTitle()
           
 int getErrorStyle()
           
 java.lang.String getPromptBoxText()
           
 java.lang.String getPromptBoxTitle()
           
 boolean getShowErrorBox()
           
 boolean getShowPromptBox()
           
 boolean getSuppressDropDownArrow()
          Useful only list validation objects .
 void setEmptyCellAllowed(boolean allowed)
          Sets if this object allows empty as a valid value
 void setErrorStyle(int error_style)
          Sets the error style for error box
 void setShowErrorBox(boolean show)
          Sets the behaviour when an invalid value is entered
 void setShowPromptBox(boolean show)
          Sets the behaviour when a cell which belongs to this object is selected
 void setSuppressDropDownArrow(boolean suppress)
          Useful for list validation objects .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HSSFDataValidation

public HSSFDataValidation(CellRangeAddressList regions,
                          DVConstraint constraint)
Constructor which initializes the cell range on which this object will be applied

Parameters:
constraint -
Method Detail

getConstraint

public DVConstraint getConstraint()

setErrorStyle

public void setErrorStyle(int error_style)
Sets the error style for error box

See Also:
HSSFDataValidation.ErrorStyle

getErrorStyle

public int getErrorStyle()
Returns:
the error style of error box
See Also:
HSSFDataValidation.ErrorStyle

setEmptyCellAllowed

public void setEmptyCellAllowed(boolean allowed)
Sets if this object allows empty as a valid value

Parameters:
allowed - true if this object should treats empty as valid value , false otherwise

getEmptyCellAllowed

public boolean getEmptyCellAllowed()
Retrieve the settings for empty cells allowed

Returns:
True if this object should treats empty as valid value , false otherwise

setSuppressDropDownArrow

public void setSuppressDropDownArrow(boolean suppress)
Useful for list validation objects .

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()
Useful only list validation objects . This method always returns false if the object isn't a list validation object

Returns:
true if a list should display the values into a drop down list , false otherwise .

setShowPromptBox

public void setShowPromptBox(boolean show)
Sets the behaviour when a cell which belongs to this object is selected

Parameters:
show - true if an prompt box should be displayed , false otherwise

getShowPromptBox

public boolean getShowPromptBox()
Returns:
true if an prompt box should be displayed , false otherwise

setShowErrorBox

public void setShowErrorBox(boolean show)
Sets the behaviour when an invalid value is entered

Parameters:
show - true if an error box should be displayed , false otherwise

getShowErrorBox

public boolean getShowErrorBox()
Returns:
true if an error box should be displayed , false otherwise

createPromptBox

public void createPromptBox(java.lang.String title,
                            java.lang.String text)
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 )

Parameters:
title - The prompt box's title
text - The prompt box's text

getPromptBoxTitle

public java.lang.String getPromptBoxTitle()
Returns:
Prompt box's title or null

getPromptBoxText

public java.lang.String getPromptBoxText()
Returns:
Prompt box's text or null

createErrorBox

public void createErrorBox(java.lang.String title,
                           java.lang.String text)
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 )

Parameters:
title - The error box's title
text - The error box's text

getErrorBoxTitle

public java.lang.String getErrorBoxTitle()
Returns:
Error box's title or null

getErrorBoxText

public java.lang.String getErrorBoxText()
Returns:
Error box's text or null

createDVRecord

public DVRecord createDVRecord(HSSFSheet sheet)


Copyright 2012 The Apache Software Foundation or its licensors, as applicable.