public class CfgPropItem extends java.lang.Object implements java.lang.Comparable, java.io.Serializable, PropItemInterface
Modifier and Type | Class and Description |
---|---|
static class |
CfgPropItem.ItemGroupSelector
Class ItemGroupSelector defines a run-time-configurable group
selector for 'CfgPropItem' objects.
|
(package private) class |
CfgPropItem.MapEntry |
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
auxiliaryObj |
protected boolean |
booleanValue |
protected boolean |
cmdLnEnbFlag |
protected boolean |
cmdLnLoadedFlag |
protected boolean |
cmdLnOnlyFlag |
protected java.lang.String |
cmdLnParamName |
protected java.awt.Color |
colorValue |
protected java.lang.Object |
defaultValue |
protected java.lang.String |
descriptionStr |
protected boolean |
emptyStringDefaultFlag |
protected java.lang.Object |
groupSelObj |
protected boolean |
helpScreenFlag |
protected boolean |
ignoreItemFlag |
protected long |
lastChangeTime |
protected java.util.Vector |
listenersVec |
protected boolean |
loadedFlag |
protected java.lang.String |
name |
protected boolean |
noSaveItemFlag |
protected java.lang.Number |
numberValue |
protected boolean |
requiredFlag |
protected boolean |
startupConfigFlag |
protected java.lang.String |
stringValue |
static char |
SWITCH1_CHAR |
static char |
SWITCH2_CHAR |
protected CfgPropValidator |
validatorObj |
protected java.lang.Object |
value |
sepCh
Constructor and Description |
---|
CfgPropItem(java.lang.String name,
java.lang.Object defaultValue)
Creates a configuration property item.
|
CfgPropItem(java.lang.String name,
java.lang.Object defaultValue,
boolean requiredFlag)
Creates a configuration property item.
|
CfgPropItem(java.lang.String name,
java.lang.Object defaultValue,
boolean requiredFlag,
java.lang.String cmdLnParamName,
java.lang.String descriptionStr)
Creates a configuration property item.
|
CfgPropItem(java.lang.String name,
java.lang.Object defaultValue,
boolean requiredFlag,
java.lang.String paramNameStr,
java.lang.String descriptionStr,
boolean cmdLnEnbFlag,
boolean helpScreenFlag,
boolean cmdLnOnlyFlag)
Creates a configuration property item.
|
CfgPropItem(java.lang.String name,
java.lang.Object defaultValue,
java.lang.String cmdLnParamName)
Creates a configuration property item.
|
CfgPropItem(java.lang.String name,
java.lang.Object defaultValue,
java.lang.String cmdLnParamName,
java.lang.String descriptionStr)
Creates a configuration property item.
|
CfgPropItem(java.lang.String name,
java.lang.Object defaultValue,
java.lang.String cmdLnParamName,
java.lang.String descriptionStr,
boolean cmdLnEnbFlag,
boolean helpScreenFlag)
Creates a configuration property item.
|
CfgPropItem(java.lang.String name,
java.lang.Object defaultValue,
java.lang.String cmdLnParamName,
java.lang.String descriptionStr,
boolean cmdLnEnbFlag,
boolean helpScreenFlag,
boolean cmdLnOnlyFlag)
Creates a configuration property item.
|
Modifier and Type | Method and Description |
---|---|
CfgPropItem |
addDataChangedListener(DataChangedListener listenerObj)
Registers the given 'DataChangedListener' object to be notified
when this object is changed.
|
boolean |
booleanValue()
Returns the value of the property object as a boolean, or false if
the object cannot be converted.
|
byte |
byteValue()
Returns the value of the property object as a byte, or zero if
the object cannot be converted.
|
boolean |
checkType(java.lang.Object obj)
Checks the class type of the given object against the class type of
default object for the property item.
|
java.lang.Object |
clone()
Creates and returns a clone of this object.
|
java.awt.Color |
colorValue()
Returns the value of the property object as a Color, or null if
the object cannot be converted.
|
int |
compareTo(java.lang.Object obj)
Compares the value object of this property item with the given
object.
|
boolean |
compareValueString(java.lang.String str)
Interprets the given string and compares it to the value Object for
this property item.
|
java.lang.Object |
convertValueString(java.lang.String str)
Interprets the given string and returns it as a data value Object
that could be entered for this property item.
|
double |
doubleValue()
Returns the value of the property object as a double, or zero if
the object cannot be converted.
|
CfgPropItem |
duplicate()
Returns a duplicate of this object.
|
boolean |
equals(java.lang.Object obj)
Returns true if the given object is a 'CfgPropItem' whose value is
equal to the value object of the property item or if the given
object itself is equal to the value object of the property item.
|
void |
fireDataChanged()
Called to indicate that this object has changed.
|
float |
floatValue()
Returns the value of the property object as a float, or zero if
the object cannot be converted.
|
java.lang.Object |
getAuxiliaryObj()
Returns the "auxiliary" object for this item (usually a
'CfgPropComponent' object).
|
boolean |
getCmdLnEnbFlag()
Returns the "enable via command line" flag.
|
boolean |
getCmdLnLoadedFlag()
Returns the loaded-from-command-line flag for the property item.
|
boolean |
getCmdLnOnlyFlag()
Returns the "via command line only" flag.
|
java.lang.String |
getCmdLnParamName()
Returns the command-line parameter name for item.
|
java.lang.Object |
getDefaultValue()
Returns the default value object for the property item.
|
java.lang.String |
getDescriptionStr()
Returns the property item description string.
|
boolean |
getEmptyStringDefaultFlag()
Returns the empty-string-default flag for the property item.
|
java.lang.Object |
getGroupSelObj()
Returns the group-select object for this item.
|
boolean |
getHelpScreenFlag()
Returns the "show in help screen data" flag.
|
boolean |
getIgnoreItemFlag()
Returns the ignore flag for the property item.
|
long |
getLastChangeTime()
Returns the time of last change to this item's value, in milliseconds
since 1/1/1970.
|
boolean |
getLoadedFlag()
Returns the 'loaded' flag for the property item.
|
java.util.Map.Entry |
getMapEntry()
Map Entry interface
|
java.lang.String |
getName()
Returns the name of the property item.
|
boolean |
getNoSaveItemFlag()
Returns the no save flag for the property item.
|
boolean |
getRequiredFlag()
Returns the 'required' flag for the property item.
|
CfgPropValidator |
getValidator()
Gets the validator object for this item.
|
java.lang.Object |
getValue()
Returns the value object for the property item.
|
java.lang.Class |
getValueClass()
Returns a class object representing the data type used for the
property item's value and default-value.
|
int |
hashCode()
Returns a hash code for the value object of the property item.
|
int |
intValue()
Returns the value of the property object as an int, or zero if
the object cannot be converted.
|
boolean |
isBoolean()
Determines if this value is a boolean value.
|
boolean |
isDefaultValue()
Determines if the current value is the same as the default value.
|
boolean |
isStartupConfigFlag()
Determines if the item should be selected at startup.
|
static boolean |
isSwitchChar(char c)
Determines if the specified character is a switch character ('-' or '/').
|
long |
longValue()
Returns the value of the property object as a long, or zero if
the object cannot be converted.
|
void |
removeDataChangedListener(DataChangedListener listenerObj)
Unregisters the given 'DataChangedListener' object from the list of
listeners for this object.
|
boolean |
reset()
Reset to the default value.
|
CfgPropItem |
setAuxiliaryObj(java.lang.Object obj)
Sets the "auxiliary" object for this item (usually a
'CfgPropComponent' object).
|
CfgPropItem |
setCmdLnLoadedFlag(boolean flg)
Sets the loaded-from-command-line flag for the property item.
|
void |
setDefaultAndValue(java.lang.Object valueObj)
Sets the default value and the value object for the property item
to the given value.
|
void |
setDefaultValue(java.lang.Object defaultValue)
Sets the default value object for the property item.
|
boolean |
setDefaultValueString(java.lang.String str)
Interprets the given string and enters it as the default value Object for
the property item.
|
CfgPropItem |
setEmptyStringDefaultFlag(boolean flg)
Sets the empty-string-default flag for the property item.
|
CfgPropItem |
setGroupSelObj(java.lang.Object obj)
Sets the group-select object for this item.
|
CfgPropItem |
setHelpScreenFlag(boolean flg)
Sets the "show in help screen data" flag for the property item.
|
CfgPropItem |
setIgnoreItemFlag(boolean flg)
Sets the ignore flag for the property item.
|
CfgPropItem |
setLoadedFlag(boolean flg)
Sets the 'loaded' flag for the property item.
|
CfgPropItem |
setNoSaveItemFlag(boolean flg)
Sets the no save flag for the property item.
|
CfgPropItem |
setRequiredFlag(boolean flg)
Sets the 'required' flag for the property item.
|
CfgPropItem |
setStartupConfigFlag(boolean b)
Sets the startup config flag.
|
CfgPropItem |
setValidator(byte minValue,
byte maxValue)
Sets the validator for this item.
|
CfgPropItem |
setValidator(CfgPropValidator validatorObj)
Sets the validator for this item.
|
CfgPropItem |
setValidator(java.lang.Comparable minValueCompObj,
java.lang.Comparable maxValueCompObj)
Sets the validator for this item.
|
CfgPropItem |
setValidator(double minValue,
double maxValue)
Sets the validator for this item.
|
CfgPropItem |
setValidator(float minValue,
float maxValue)
Sets the validator for this item.
|
CfgPropItem |
setValidator(int minValue,
int maxValue)
Sets the validator for this item.
|
CfgPropItem |
setValidator(long minValue,
long maxValue)
Sets the validator for this item.
|
CfgPropItem |
setValidator(java.lang.Object[] objArr)
Sets the validator for this item.
|
CfgPropItem |
setValidator(short minValue,
short maxValue)
Sets the validator for this item.
|
boolean |
setValue(boolean flg)
Sets the value object for the property item.
|
boolean |
setValue(byte val)
Sets the value object for the property item.
|
boolean |
setValue(double val)
Sets the value object for the property item.
|
boolean |
setValue(float val)
Sets the value object for the property item.
|
boolean |
setValue(int val)
Sets the value object for the property item.
|
boolean |
setValue(long val)
Sets the value object for the property item.
|
boolean |
setValue(java.lang.Object valueObj)
Sets the value object for the property item.
|
boolean |
setValue(short val)
Sets the value object for the property item.
|
protected void |
setValueObject(java.lang.Object valueObj)
Sets the value object for the property item.
|
boolean |
setValueString(java.lang.String str)
Interprets the given string and enters it as the value Object for
the property item.
|
boolean |
setValueString(java.lang.String str,
boolean defaultFlag)
Interprets the given string and enters it as the default value Object for
the property item.
|
static java.lang.Object |
setValueString(java.lang.String str,
java.lang.Object defValObj)
Interprets the given string and enters it as the value object for
the property item.
|
short |
shortValue()
Returns the value of the property object as a short, or zero if
the object cannot be converted.
|
java.lang.String[] |
stringArrayValue()
Returns a String array object representing the value of the property item.
|
java.lang.String |
stringValue()
Returns a String object representing the value of the property item.
|
java.lang.String |
toArchivedForm()
Returns the archivable representation for this object.
|
java.lang.String |
toString()
Returns a String object representing the value of the property item.
|
static boolean |
validateValue(CfgPropValidator validatorObj,
java.lang.Object valueObj)
Checks that the given object is a valid data value using the specified
validator.
|
boolean |
validateValue(java.lang.Object valueObj)
Checks that the given object is a valid data value using this item's
validator.
|
public static final char SWITCH1_CHAR
public static final char SWITCH2_CHAR
protected final java.lang.String name
protected java.lang.Object value
protected java.lang.Number numberValue
protected boolean booleanValue
protected java.lang.String stringValue
protected java.awt.Color colorValue
protected java.lang.Object defaultValue
protected boolean loadedFlag
protected boolean requiredFlag
protected boolean cmdLnLoadedFlag
protected final java.lang.String cmdLnParamName
protected final java.lang.String descriptionStr
protected final boolean cmdLnEnbFlag
protected boolean helpScreenFlag
protected final boolean cmdLnOnlyFlag
protected boolean ignoreItemFlag
protected boolean noSaveItemFlag
protected boolean emptyStringDefaultFlag
protected CfgPropValidator validatorObj
protected final java.util.Vector listenersVec
protected long lastChangeTime
protected java.lang.Object groupSelObj
protected java.lang.Object auxiliaryObj
protected boolean startupConfigFlag
public CfgPropItem(java.lang.String name, java.lang.Object defaultValue, boolean requiredFlag, java.lang.String paramNameStr, java.lang.String descriptionStr, boolean cmdLnEnbFlag, boolean helpScreenFlag, boolean cmdLnOnlyFlag)
name
- property name.defaultValue
- default value for the property.requiredFlag
- the value for the item's required-flag (see
'setRequiredFlag()').paramNameStr
- command-line parameter name for item.descriptionStr
- description text for item.cmdLnEnbFlag
- true to enable use of item as command-line
parameter.helpScreenFlag
- true to include item in help screen data.cmdLnOnlyFlag
- true for item via command line only.public CfgPropItem(java.lang.String name, java.lang.Object defaultValue, boolean requiredFlag, java.lang.String cmdLnParamName, java.lang.String descriptionStr)
name
- property name.defaultValue
- default value for the property.requiredFlag
- the value for the item's required-flag (see
'setRequiredFlag()').cmdLnParamName
- command-line parameter name for item.descriptionStr
- description text for item.public CfgPropItem(java.lang.String name, java.lang.Object defaultValue, boolean requiredFlag)
name
- property name.defaultValue
- default value for the property.requiredFlag
- the value for the item's required-flag (see
'setRequiredFlag()').public CfgPropItem(java.lang.String name, java.lang.Object defaultValue, java.lang.String cmdLnParamName, java.lang.String descriptionStr, boolean cmdLnEnbFlag, boolean helpScreenFlag)
name
- property name.defaultValue
- default value for the property.cmdLnParamName
- command-line parameter name for item.descriptionStr
- description text for item.cmdLnEnbFlag
- true to enable use of item as command-line
parameter.helpScreenFlag
- true to include item in help screen data.public CfgPropItem(java.lang.String name, java.lang.Object defaultValue, java.lang.String cmdLnParamName, java.lang.String descriptionStr, boolean cmdLnEnbFlag, boolean helpScreenFlag, boolean cmdLnOnlyFlag)
name
- property name.defaultValue
- default value for the property.cmdLnParamName
- command-line parameter name for item.descriptionStr
- description text for item.cmdLnEnbFlag
- true to enable use of item as command-line
parameter.helpScreenFlag
- true to include item in help screen data.cmdLnOnlyFlag
- true for item via command line only.public CfgPropItem(java.lang.String name, java.lang.Object defaultValue, java.lang.String cmdLnParamName, java.lang.String descriptionStr)
name
- property name.defaultValue
- default value for the property.cmdLnParamName
- command-line parameter name for item.descriptionStr
- description text for item.public CfgPropItem(java.lang.String name, java.lang.Object defaultValue, java.lang.String cmdLnParamName)
name
- property name.defaultValue
- default value for the property.cmdLnParamName
- command-line parameter name for item.public CfgPropItem(java.lang.String name, java.lang.Object defaultValue)
name
- property name.defaultValue
- default value for the property.public java.lang.String getName()
getName
in interface IstiNamedValueInterface
public java.lang.Object getDefaultValue()
getDefaultValue
in interface IstiNamedValueInterface
public final void setDefaultValue(java.lang.Object defaultValue)
defaultValue
- the default value object.public boolean setDefaultValueString(java.lang.String str)
str
- the string value to interpret.public void setDefaultAndValue(java.lang.Object valueObj)
valueObj
- the value object to use.public java.lang.Object getValue()
getValue
in interface IstiNamedValueInterface
public boolean reset()
protected final void setValueObject(java.lang.Object valueObj)
valueObj
- the value of the object.public boolean setValue(java.lang.Object valueObj)
setValue
in interface IstiNamedValueInterface
valueObj
- the value of the object.public boolean setValue(int val)
val
- the value of the object.public boolean setValue(long val)
val
- the value of the object.public boolean setValue(float val)
val
- the value of the object.public boolean setValue(double val)
val
- the value of the object.public boolean setValue(byte val)
val
- the value of the object.public boolean setValue(short val)
val
- the value of the object.public boolean setValue(boolean flg)
flg
- the value of the object.public static java.lang.Object setValueString(java.lang.String str, java.lang.Object defValObj)
str
- the string value to interpret.defValObj
- the default value object to use for type checking
(this parameter allows for multiple values and types to be dealt
with).public boolean setValueString(java.lang.String str, boolean defaultFlag)
str
- the string value to interpret.defaultFlag
- true to update the default value, false otherwise.public boolean setValueString(java.lang.String str)
setValueString
in interface IstiNamedValueInterface
str
- the string value to interpret.public boolean compareValueString(java.lang.String str)
str
- the string value to interpret.public java.lang.Object convertValueString(java.lang.String str)
str
- the string value to interpret.public boolean checkType(java.lang.Object obj)
obj
- the object to check.public java.lang.Class getValueClass()
public boolean isBoolean()
public CfgPropItem setLoadedFlag(boolean flg)
flg
- the 'loaded' flag value.public boolean getLoadedFlag()
public CfgPropItem setRequiredFlag(boolean flg)
flg
- the 'required' flag value.public boolean getRequiredFlag()
public CfgPropItem setCmdLnLoadedFlag(boolean flg)
flg
- value for the loaded-from-command-line flag.public boolean getCmdLnLoadedFlag()
public CfgPropItem setIgnoreItemFlag(boolean flg)
flg
- value for the ignore-item flag, true==ignore.public boolean getIgnoreItemFlag()
public CfgPropItem setNoSaveItemFlag(boolean flg)
flg
- value for the no save-item flag.public boolean getNoSaveItemFlag()
public CfgPropItem setHelpScreenFlag(boolean flg)
flg
- value for the "show in help screen data" flag.public CfgPropItem setEmptyStringDefaultFlag(boolean flg)
flg
- the flag value to use.public boolean getEmptyStringDefaultFlag()
public java.lang.String toArchivedForm()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare.public int intValue()
public long longValue()
public float floatValue()
public double doubleValue()
public byte byteValue()
public short shortValue()
public boolean booleanValue()
public java.lang.String stringValue()
stringValue
in interface IstiNamedValueInterface
public java.lang.String[] stringArrayValue()
public java.lang.Object clone()
clone
in interface IstiNamedValueInterface
clone
in class java.lang.Object
public java.awt.Color colorValue()
public int compareTo(java.lang.Object obj) throws java.lang.ClassCastException
compareTo
in interface java.lang.Comparable
obj
- the value of the object.java.lang.ClassCastException
- if the specified object's type
prevents it from being compared to this Object.public java.lang.String getCmdLnParamName()
public java.lang.String getDescriptionStr()
getDescriptionStr
in interface PropItemInterface
public boolean getCmdLnEnbFlag()
public boolean getHelpScreenFlag()
public boolean getCmdLnOnlyFlag()
public CfgPropItem duplicate()
public CfgPropItem setValidator(CfgPropValidator validatorObj)
validatorObj
- a 'CfgPropValidator' object.public CfgPropItem setValidator(java.lang.Comparable minValueCompObj, java.lang.Comparable maxValueCompObj)
minValueCompObj
- a "minimum" value object that implements
the 'Comparable' interface (or null for no minimum).maxValueCompObj
- a "maximum" value object that implements
the 'Comparable' interface (or null for no maximum).public CfgPropItem setValidator(java.lang.Object[] objArr)
objArr
- an array of acceptable-value 'Object's.public CfgPropItem setValidator(int minValue, int maxValue)
minValue
- minimum valid value.maxValue
- maximum valid value.public CfgPropItem setValidator(long minValue, long maxValue)
minValue
- minimum valid value.maxValue
- maximum valid value.public CfgPropItem setValidator(short minValue, short maxValue)
minValue
- minimum valid value.maxValue
- maximum valid value.public CfgPropItem setValidator(byte minValue, byte maxValue)
minValue
- minimum valid value.maxValue
- maximum valid value.public CfgPropItem setValidator(float minValue, float maxValue)
minValue
- minimum valid value.maxValue
- maximum valid value.public CfgPropItem setValidator(double minValue, double maxValue)
minValue
- minimum valid value.maxValue
- maximum valid value.public CfgPropValidator getValidator()
getValidator
in interface PropItemInterface
public static boolean validateValue(CfgPropValidator validatorObj, java.lang.Object valueObj)
validatorObj
- a 'CfgPropValidator' object.valueObj
- the value of the object.public boolean validateValue(java.lang.Object valueObj)
valueObj
- the value of the object.public CfgPropItem addDataChangedListener(DataChangedListener listenerObj)
listenerObj
- the 'DataChangedListener' object.public void removeDataChangedListener(DataChangedListener listenerObj)
listenerObj
- the 'DataChangedListener' object.public void fireDataChanged()
public long getLastChangeTime()
public CfgPropItem setGroupSelObj(java.lang.Object obj)
obj
- the group-select object to use.public java.lang.Object getGroupSelObj()
getGroupSelObj
in interface PropItemInterface
public CfgPropItem setAuxiliaryObj(java.lang.Object obj)
obj
- the value of the object.public java.lang.Object getAuxiliaryObj()
getAuxiliaryObj
in interface PropItemInterface
public CfgPropItem setStartupConfigFlag(boolean b)
b
- true if the item should be selected at startup.public boolean isDefaultValue()
isDefaultValue
in interface IstiNamedValueInterface
public boolean isStartupConfigFlag()
public static boolean isSwitchChar(char c)
str
- stringpublic java.util.Map.Entry getMapEntry()