Package adams.gui.core
Class NumberTextField.NumberCheckModel
- java.lang.Object
-
- adams.gui.core.CheckedTextField.AbstractCheckModel
-
- adams.gui.core.NumberTextField.NumberCheckModel
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
NumberTextField.BoundedNumberCheckModel
- Enclosing class:
- NumberTextField
public static class NumberTextField.NumberCheckModel extends CheckedTextField.AbstractCheckModel
A check model for numbers. The type of number to check for can be specified.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected NumberTextField.Typem_Typethe type of numbers to handle.-
Fields inherited from class adams.gui.core.CheckedTextField.AbstractCheckModel
m_DefaultValue
-
-
Constructor Summary
Constructors Constructor Description NumberCheckModel(NumberTextField.Type type)Initializes the model with 0 as default value.NumberCheckModel(NumberTextField.Type type, Number defValue)Initializes the model with the specified default value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NumberTextField.TypegetType()Returns the type of numbers being checked for.booleanisValid(String text)Checks whether the content is valid.StringtoString()Returns a short string representation.-
Methods inherited from class adams.gui.core.CheckedTextField.AbstractCheckModel
getDefaultValue, setDefaultValue
-
-
-
-
Field Detail
-
m_Type
protected NumberTextField.Type m_Type
the type of numbers to handle.
-
-
Constructor Detail
-
NumberCheckModel
public NumberCheckModel(NumberTextField.Type type)
Initializes the model with 0 as default value.- Parameters:
type- the type of number to handle
-
NumberCheckModel
public NumberCheckModel(NumberTextField.Type type, Number defValue)
Initializes the model with the specified default value.- Parameters:
type- the type of number to handledefValue- the default value, use "null" to use as null
-
-
Method Detail
-
isValid
public boolean isValid(String text)
Checks whether the content is valid.- Specified by:
isValidin classCheckedTextField.AbstractCheckModel- Parameters:
text- the string to check- Returns:
- true if valid
-
getType
public NumberTextField.Type getType()
Returns the type of numbers being checked for.- Returns:
- the type of numbers
-
toString
public String toString()
Returns a short string representation.- Overrides:
toStringin classCheckedTextField.AbstractCheckModel- Returns:
- the string representation
-
-