Class TextInputPart
- java.lang.Object
-
- net.sf.okapi.common.uidescription.AbstractPart
-
- net.sf.okapi.common.uidescription.TextInputPart
-
- All Implemented Interfaces:
IParameterDescriptor
public class TextInputPart extends AbstractPart
UI part descriptor for a text input field. This UI part supports the following types: Integer and String.Use
setAllowEmpty(boolean)to specify if the text can be empty. by default empty text is not allowed.Use
setPassword(boolean)to specify if the text should be treated as a password text (e.g. hidden on input). By default the text is not treated as a password.Use
setHeight(int)to specify a height for the field (-1 sets the default).
-
-
Field Summary
-
Fields inherited from class net.sf.okapi.common.uidescription.AbstractPart
container, enabledOnSelection, labelFlushed, labelNextToInput, masterPart, paramDescriptor, vertical, withLabel
-
-
Constructor Summary
Constructors Constructor Description TextInputPart(ParameterDescriptor paramDescriptor)Creates a new TextInputPart object with a given parameter descriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckType()Checks the types supported by this UI part.intgetHeight()Gets the suggested height of this part (-1 for default)intgetMaximumValue()Gets the maximum value allowed (for integer input).intgetMinimumValue()Gets the minimum value allowed (for integer input).booleanisAllowEmpty()Indicates if the input text can be empty.booleanisPassword()Indicates if the input text should be treated like a password.voidsetAllowEmpty(boolean allowEmpty)Sets the flag indicating if the input text can be empty.voidsetHeight(int height)Sets the suggested height of this part (-1 for default)voidsetPassword(boolean password)Sets the flag indicating if the input text should be treated like a password.voidsetRange(int minimumValue, int maximumValue)Sets the minimum and maximum values allowed (for integer input).-
Methods inherited from class net.sf.okapi.common.uidescription.AbstractPart
getContainer, getDisplayName, getMasterPart, getName, getParent, getReadMethod, getShortDescription, getType, getWriteMethod, isEnabledOnSelection, isLabelFlushed, isLabelNextToInput, isVertical, isWithLabel, setContainer, setDisplayName, setLabelFlushed, setLabelNextToInput, setMasterPart, setShortDescription, setVertical, setWithLabel
-
-
-
-
Constructor Detail
-
TextInputPart
public TextInputPart(ParameterDescriptor paramDescriptor)
Creates a new TextInputPart object with a given parameter descriptor.- Parameters:
paramDescriptor- the parameter descriptor for this UI part.
-
-
Method Detail
-
checkType
protected void checkType()
Description copied from class:AbstractPartChecks the types supported by this UI part.- Overrides:
checkTypein classAbstractPart
-
isAllowEmpty
public boolean isAllowEmpty()
Indicates if the input text can be empty.- Returns:
- true if the input text can be empty, false otherwise.
-
setAllowEmpty
public void setAllowEmpty(boolean allowEmpty)
Sets the flag indicating if the input text can be empty.- Parameters:
allowEmpty- true if the input text can be empty, false otherwise.
-
isPassword
public boolean isPassword()
Indicates if the input text should be treated like a password.- Returns:
- true if the input text can be should be treated like a password.
-
setPassword
public void setPassword(boolean password)
Sets the flag indicating if the input text should be treated like a password.- Parameters:
password- true if the input text should be treated like a password, false otherwise.
-
getMinimumValue
public int getMinimumValue()
Gets the minimum value allowed (for integer input).- Returns:
- the minimum value allowed.
-
getMaximumValue
public int getMaximumValue()
Gets the maximum value allowed (for integer input).- Returns:
- the maximum value allowed.
-
setRange
public void setRange(int minimumValue, int maximumValue)Sets the minimum and maximum values allowed (for integer input). If the values are lesser or greater than the minimum and maximum values allowed by an Integer, they are reset to those values. If the maximum is less than the minimum it is reset to the minimum.- Parameters:
minimumValue- the minimum value allowed.maximumValue- the maximum value allowed.
-
getHeight
public int getHeight()
Gets the suggested height of this part (-1 for default)- Returns:
- the suggested height of this part or -1 for default.
-
setHeight
public void setHeight(int height)
Sets the suggested height of this part (-1 for default)- Parameters:
height- the suggested height of this part (use -1 for default)
-
-