qflib 0.98.0

de.qfs.lib.option
Class IntegerOption

java.lang.Object
  |
  +--java.util.Observable
        |
        +--de.qfs.lib.option.Option
              |
              +--de.qfs.lib.option.IntegerOption
All Implemented Interfaces:
java.lang.Cloneable, ConfigurableOption, java.io.Serializable

public class IntegerOption
extends Option
implements ConfigurableOption

An IntegerOption has a value of class Integer and an additional flag defining whether negative values are OK.

Version:
$Revision: 1.7 $
Author:
Gregor Schmid
See Also:
Serialized Form

Constructor Summary
IntegerOption()
          Create a new IntegerOption.
IntegerOption(java.lang.String name)
          Create a new IntegerOption with a name and the value null.
IntegerOption(java.lang.String name, int value)
          Create a new IntegerOption with a name and a value.
IntegerOption(java.lang.String name, int value, boolean nullOK, boolean negativeOK)
          Create a new IntegerOption with a name and a value and the nullOK and negativeOK flags.
IntegerOption(java.lang.String name, java.lang.Integer value, boolean nullOK, boolean negativeOK)
          Create a new IntegerOption with a name and a value and the nullOK and negativeOK flags.
 
Method Summary
 boolean checkValue(java.awt.Component component, java.lang.Object value)
          Check, whether the Option accepts a value.
 boolean equals(java.lang.Object object)
          Two IntegerOptions are considered equal if their names and values are equal.
 java.lang.String getConfigurableValue()
          Get the Option's value as a String.
 boolean isNegativeOK()
          Query wether negative values are allowed.
 void setConfigurableValue(java.lang.String value)
          Set the Option's value from a String.
 void setNegativeOK(boolean negativeOK)
          Set wether negative values are allowed.
 
Methods inherited from class de.qfs.lib.option.Option
addResources, addValidator, clone, getName, getResources, getValue, hashCode, isNullOK, removeValidator, setName, setNullOK, setResources, setValue, toString
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerOption

public IntegerOption()
Create a new IntegerOption.

IntegerOption

public IntegerOption(java.lang.String name)
Create a new IntegerOption with a name and the value null.
Parameters:
name - The name to use.

IntegerOption

public IntegerOption(java.lang.String name,
                     int value)
Create a new IntegerOption with a name and a value.
Parameters:
name - The name to use.
value - The value to use.

IntegerOption

public IntegerOption(java.lang.String name,
                     int value,
                     boolean nullOK,
                     boolean negativeOK)
Create a new IntegerOption with a name and a value and the nullOK and negativeOK flags.
Parameters:
name - The name to use.
value - The value to use.
nullOK - The nullOK flag to use.
negativeOK - Whether negative values are allowed.

IntegerOption

public IntegerOption(java.lang.String name,
                     java.lang.Integer value,
                     boolean nullOK,
                     boolean negativeOK)
Create a new IntegerOption with a name and a value and the nullOK and negativeOK flags.
Parameters:
name - The name to use.
value - The value to use.
nullOK - The nullOK flag to use.
negativeOK - Whether negative values are allowed.
Method Detail

isNegativeOK

public final boolean isNegativeOK()
Query wether negative values are allowed.
Returns:
True if negative values are OK.

setNegativeOK

public final void setNegativeOK(boolean negativeOK)
Set wether negative values are allowed.
Parameters:
negativeOK - Whether negative values are allowed.

checkValue

public boolean checkValue(java.awt.Component component,
                          java.lang.Object value)
Check, whether the Option accepts a value. If it does not, the reason should be explained in a message dialog unless component is null.
Overrides:
checkValue in class Option
Parameters:
component - The Component in which the Option is being edited.
value - The value to check.
Returns:
True, if the value is acceptable.

equals

public boolean equals(java.lang.Object object)
Two IntegerOptions are considered equal if their names and values are equal.
Overrides:
equals in class Option
Parameters:
object - The object to compare to.
Returns:
True if objects are equal

getConfigurableValue

public java.lang.String getConfigurableValue()
Get the Option's value as a String.
Specified by:
getConfigurableValue in interface ConfigurableOption
Returns:
The Option's value as a String.

setConfigurableValue

public void setConfigurableValue(java.lang.String value)
Set the Option's value from a String.
Specified by:
setConfigurableValue in interface ConfigurableOption
Parameters:
value - The value to set.

qflib 0.98.0