Package gr.zeus.ui.typesafe
Class TypeSafeVerifier
- java.lang.Object
-
- javax.swing.InputVerifier
-
- gr.zeus.ui.typesafe.TypeSafeVerifier
-
public final class TypeSafeVerifier extends javax.swing.InputVerifierThis class creates a custom verifier for JTextComponents by extending the InputVerifier. With this verifier we achieve the following data validation within a field:- min characters
- trimspaces or not
- byte,short,int and long numbers parsing
- float and double numbers parsing
- date parsing
- Since:
- 1.20
- Author:
- Gregory Kotsaftis
-
-
Constructor Summary
Constructors Constructor Description TypeSafeVerifier(java.lang.Class clsType)Constructor, define the class type of the field.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDatePattern()Gets the date pattern.bytegetDefaultByteValue()Gets the default byte value.java.util.DategetDefaultDateValue()Gets the default date value.doublegetDefaultDoubleValue()Gets the default double value.floatgetDefaultFloatValue()Gets the default float value.intgetDefaultIntegerValue()Gets the default integer value.longgetDefaultLongValue()Gets the default long value.shortgetDefaultShortValue()Gets the default short value.booleangetDefaultsOnError()Gets defaultsOnError status.bytegetMaxByteValue()Gets the max byte value.doublegetMaxDoubleValue()Gets the max double value.floatgetMaxFloatValue()Gets the max float value.intgetMaxIntegerValue()Gets the max integer value.longgetMaxLongValue()Gets the max long value.shortgetMaxShortValue()Gets the max short value.bytegetMinByteValue()Gets the min byte value.intgetMinChars()Gets min characters allowed.doublegetMinDoubleValue()Gets the min double value.floatgetMinFloatValue()Gets the min float value.intgetMinIntegerValue()Gets the min integer value.longgetMinLongValue()Gets the min long value.shortgetMinShortValue()Gets the min short value.booleangetTrimSpaces()Gets trimspaces status.java.lang.ClassgetVerifierClassType()Gets the class type.voidsetDatePattern(java.lang.String v)Sets the date pattern.voidsetDefaultByteValue(byte v)Sets the default byte value.voidsetDefaultDateValue(java.util.Date v)Sets the default date value.voidsetDefaultDoubleValue(double v)Sets the default double value.voidsetDefaultFloatValue(float v)Sets the default float value.voidsetDefaultIntegerValue(int v)Sets the default integer value.voidsetDefaultLongValue(long v)Sets the default long value.voidsetDefaultShortValue(short v)Sets the default short value.voidsetDefaultsOnError(boolean f)Sets defaultsOnError status.voidsetMaxByteValue(byte v)Sets the max byte value.voidsetMaxDoubleValue(double v)Sets the max double value.voidsetMaxFloatValue(float v)Sets the max float value.voidsetMaxIntegerValue(int v)Sets the max integer value.voidsetMaxLongValue(long v)Sets the max long value.voidsetMaxShortValue(short v)Sets the max short value.voidsetMinByteValue(byte v)Sets the min byte value.voidsetMinChars(int v)Sets min characters allowed.voidsetMinDoubleValue(double v)Sets the min double value.voidsetMinFloatValue(float v)Sets the min float value.voidsetMinIntegerValue(int v)Sets the min integer value.voidsetMinLongValue(long v)Sets the min long value.voidsetMinShortValue(short v)Sets the min short value.voidsetTrimSpaces(boolean f)Sets trimspaces status.booleanverify(javax.swing.JComponent input)Verify the component and return true in order to allow focus to progress to the next component or false to block the user inside this component until a valid input is entered.
-
-
-
Method Detail
-
verify
public boolean verify(javax.swing.JComponent input)
Verify the component and return true in order to allow focus to progress to the next component or false to block the user inside this component until a valid input is entered.- Specified by:
verifyin classjavax.swing.InputVerifier- Parameters:
input- The component to verify.- Returns:
- true/false.
-
getVerifierClassType
public java.lang.Class getVerifierClassType()
Gets the class type. no setXXX() method for this one, only set it through the constructor.- Returns:
- classType.
-
getDefaultsOnError
public boolean getDefaultsOnError()
Gets defaultsOnError status.- Returns:
- true/false.
-
setDefaultsOnError
public void setDefaultsOnError(boolean f)
Sets defaultsOnError status.- Parameters:
f- true/false.
-
getTrimSpaces
public boolean getTrimSpaces()
Gets trimspaces status.- Returns:
- true/false.
-
setTrimSpaces
public void setTrimSpaces(boolean f)
Sets trimspaces status.- Parameters:
f- true/false.
-
getMinChars
public int getMinChars()
Gets min characters allowed.- Returns:
- minChars.
-
setMinChars
public void setMinChars(int v)
Sets min characters allowed.- Parameters:
v- minChars.
-
getDatePattern
public java.lang.String getDatePattern()
Gets the date pattern.- Returns:
- datePattern.
-
setDatePattern
public void setDatePattern(java.lang.String v)
Sets the date pattern.- Parameters:
v- datePattern.
-
getDefaultDateValue
public java.util.Date getDefaultDateValue()
Gets the default date value.- Returns:
- defaultDateValue.
-
setDefaultDateValue
public void setDefaultDateValue(java.util.Date v)
Sets the default date value.- Parameters:
v- defaultDateValue.
-
getMinByteValue
public byte getMinByteValue()
Gets the min byte value.- Returns:
- minByteValue.
-
setMinByteValue
public void setMinByteValue(byte v)
Sets the min byte value.- Parameters:
v- minByteValue.
-
getMaxByteValue
public byte getMaxByteValue()
Gets the max byte value.- Returns:
- maxByteValue.
-
setMaxByteValue
public void setMaxByteValue(byte v)
Sets the max byte value.- Parameters:
v- maxByteValue.
-
getDefaultByteValue
public byte getDefaultByteValue()
Gets the default byte value.- Returns:
- defaultByteValue.
-
setDefaultByteValue
public void setDefaultByteValue(byte v)
Sets the default byte value.- Parameters:
v- defaultByteValue.
-
getMinShortValue
public short getMinShortValue()
Gets the min short value.- Returns:
- minShortValue.
-
setMinShortValue
public void setMinShortValue(short v)
Sets the min short value.- Parameters:
v- minShortValue.
-
getMaxShortValue
public short getMaxShortValue()
Gets the max short value.- Returns:
- maxShortValue.
-
setMaxShortValue
public void setMaxShortValue(short v)
Sets the max short value.- Parameters:
v- maxShortValue.
-
getDefaultShortValue
public short getDefaultShortValue()
Gets the default short value.- Returns:
- defaultShortValue.
-
setDefaultShortValue
public void setDefaultShortValue(short v)
Sets the default short value.- Parameters:
v- defaultShortValue.
-
getMinIntegerValue
public int getMinIntegerValue()
Gets the min integer value.- Returns:
- minIntegerValue.
-
setMinIntegerValue
public void setMinIntegerValue(int v)
Sets the min integer value.- Parameters:
v- minIntegerValue.
-
getMaxIntegerValue
public int getMaxIntegerValue()
Gets the max integer value.- Returns:
- maxIntegerValue.
-
setMaxIntegerValue
public void setMaxIntegerValue(int v)
Sets the max integer value.- Parameters:
v- maxIntegerValue.
-
getDefaultIntegerValue
public int getDefaultIntegerValue()
Gets the default integer value.- Returns:
- defaultIntegerValue.
-
setDefaultIntegerValue
public void setDefaultIntegerValue(int v)
Sets the default integer value.- Parameters:
v- defaultIntegerValue.
-
getMinLongValue
public long getMinLongValue()
Gets the min long value.- Returns:
- minLongValue.
-
setMinLongValue
public void setMinLongValue(long v)
Sets the min long value.- Parameters:
v- minLongValue.
-
getMaxLongValue
public long getMaxLongValue()
Gets the max long value.- Returns:
- maxLongValue.
-
setMaxLongValue
public void setMaxLongValue(long v)
Sets the max long value.- Parameters:
v- maxLongValue.
-
getDefaultLongValue
public long getDefaultLongValue()
Gets the default long value.- Returns:
- defaultLongValue.
-
setDefaultLongValue
public void setDefaultLongValue(long v)
Sets the default long value.- Parameters:
v- defaultLongValue.
-
getMinFloatValue
public float getMinFloatValue()
Gets the min float value.- Returns:
- minFloatValue.
-
setMinFloatValue
public void setMinFloatValue(float v)
Sets the min float value.- Parameters:
v- minFloatValue.
-
getMaxFloatValue
public float getMaxFloatValue()
Gets the max float value.- Returns:
- maxFloatValue.
-
setMaxFloatValue
public void setMaxFloatValue(float v)
Sets the max float value.- Parameters:
v- maxFloatValue.
-
getDefaultFloatValue
public float getDefaultFloatValue()
Gets the default float value.- Returns:
- defaultFloatValue.
-
setDefaultFloatValue
public void setDefaultFloatValue(float v)
Sets the default float value.- Parameters:
v- defaultFloatValue.
-
getMinDoubleValue
public double getMinDoubleValue()
Gets the min double value.- Returns:
- minDoubleValue.
-
setMinDoubleValue
public void setMinDoubleValue(double v)
Sets the min double value.- Parameters:
v- m_minDoubleValue.
-
getMaxDoubleValue
public double getMaxDoubleValue()
Gets the max double value.- Returns:
- maxDoubleValue.
-
setMaxDoubleValue
public void setMaxDoubleValue(double v)
Sets the max double value.- Parameters:
v- maxDoubleValue.
-
getDefaultDoubleValue
public double getDefaultDoubleValue()
Gets the default double value.- Returns:
- defaultDoubleValue.
-
setDefaultDoubleValue
public void setDefaultDoubleValue(double v)
Sets the default double value.- Parameters:
v- defaultDoubleValue.
-
-