Class semper.preferences.PrefFieldChoice
All Packages Class Hierarchy This Package Previous Next Index
Class semper.preferences.PrefFieldChoice
java.lang.Object
|
+----semper.preferences.PrefField
|
+----semper.preferences.PrefFieldChoice
- public class PrefFieldChoice
- extends PrefField
This represents a Choice field formed by a information string and a Choice
components.
- Version:
- $Revision: 1.10 $ $Date: 1997/01/21 14:56:37 $
- Author:
- Louis Salvail
- See Also:
- PrefFieldString, PrefFieldLabel, PrefFieldNegotiable, PrefFieldCheckBox
-
PrefFieldChoice()
- Constructor called by newInstance when this object is internalized.
-
PrefFieldChoice(String, String)
- Constructor for an empty choice with name and label with default constraints.
-
PrefFieldChoice(String, String, GridBagConstraints)
- Constructor for an empty choice with label and name and specified constraints.
-
addChoice(String)
- This allows to add a new string for the possible choices.
-
applyModification()
- Apply the user change.
-
cancel()
- Cancels the last user change.
-
getItem(int)
- Returns the string at a given index encoded with an int.
-
getItem(Object)
- Returns the string at a given index.
-
getLabel()
- Returns the Label associated with this Choice.
-
getValue()
- Returns the index of the currently selected item for that field.
-
isModified()
- Tells if the value has been modified by the user.
-
isOK()
- Returns always true because no constraints are associated
with a choice field.
-
myStreamSize()
- Returns the size of the stream that would hold the externalized form of this field.
-
readObject(StreamInputInterface)
- Internalizes this choice field.
-
setValue(int)
- This set the selected value with int argument.
-
setValue(Integer)
- This set the selelected value with Integer argument.
-
setValue(Object)
- This set the selected value for that field either by specifying
the index or the string of the item.
-
showme(PrefFrame)
- This adds the approriate choice to a frame.
-
writeObject(StreamOutputInterface)
- Externalizes this choice field.
PrefFieldChoice
public PrefFieldChoice(String fieldname,
String chLabel,
GridBagConstraints constraints) throws PreferencesException
- Constructor for an empty choice with label and name and specified constraints.
- Parameters:
- fieldname - is the string by which this component is accessed through the preferences manager.
- chLabel - is the string appearing at the right of the choice component.
- constraints - is the set of GridBagConstraints for that component.
- Returns:
- the new object.
- Throws: PreferencesException
- when one of fieldname or chLabel is null.
- See Also:
- GridBagConstraints
PrefFieldChoice
public PrefFieldChoice(String fieldname,
String chLabel) throws PreferencesException
- Constructor for an empty choice with name and label with default constraints.
- Parameters:
- fieldname - is the string by which this component is accessed through the preferences manager.
- chLabel - is the string appearing at the right of the choice component.
- Returns:
- the new empty object.
- Throws: PreferencesException
- when one of fieldname or chLabel is null.
- See Also:
- GridBagConstraints
PrefFieldChoice
public PrefFieldChoice()
- Constructor called by newInstance when this object is internalized.
Otherwise, you should not use this constructor.
- Returns:
- the new empty object.
addChoice
public void addChoice(String item)
- This allows to add a new string for the possible choices.
- Parameters:
- item - is the string describing this choice
- Returns:
- none.
showme
public void showme(PrefFrame p)
- This adds the approriate choice to a frame.
- Parameters:
- p - is the frame where the object will be shown.
- Returns:
- none.
- Overrides:
- showme in class PrefField
getValue
public Object getValue()
- Returns the index of the currently selected item for that field.
- Returns:
- the index of the selected item with an Integer object.
The first item is at index 0. The returned value is the last stored
selected item.
- Overrides:
- getValue in class PrefField
getItem
public String getItem(Object index)
- Returns the string at a given index. The call
getStringAt(getValue()) returned the string
actually selected for that field.
- Parameters:
- index - is an object encoding an Integer representing
the index to help the wrapping with getValue().
- Returns:
- the string located at the index of that field.
If the object does not encode a correct index (meaning an
appriopriate Integer) nulll is returned.
getItem
public String getItem(int index)
- Returns the string at a given index encoded with an int.
- Parameters:
- index - is the index of the string.
- Returns:
- the string lacated at the given index of that field.
if the value of the index is out of range a null string is returned.
setValue
public void setValue(Object newval)
- This set the selected value for that field either by specifying
the index or the string of the item.
- Parameters:
- newval - is an object encoding either an Integer encoding
the index of the item to select or the string corresponding to
the item to select. If the object does not encode an appropriate
String or Integer then nothing is done.
- Returns:
- none.
- Overrides:
- setValue in class PrefField
setValue
public void setValue(int newval)
- This set the selected value with int argument.
- Parameters:
- newval - is the index of the selected item. Nothing is done
if the index is not in the available range.
- Returns:
- none.
setValue
public void setValue(Integer newval)
- This set the selelected value with Integer argument.
- Parameters:
- newval - is the index of the new selected value.
- Returns:
- none.
isModified
public boolean isModified()
- Tells if the value has been modified by the user.
- Returns:
- true iff the new value selected by the user
is different from the previous one.
- Overrides:
- isModified in class PrefField
applyModification
public boolean applyModification()
- Apply the user change.
- Returns:
- true iff there was a change and it has been applied.
- Overrides:
- applyModification in class PrefField
isOK
public boolean isOK()
- Returns always true because no constraints are associated
with a choice field.
- Returns:
- true.
- Overrides:
- isOK in class PrefField
cancel
public void cancel()
- Cancels the last user change.
- Returns:
- none.
- Overrides:
- cancel in class PrefField
getLabel
public String getLabel()
- Returns the Label associated with this Choice.
- Returns:
- the label.
myStreamSize
public int myStreamSize() throws StreamIOException
- Returns the size of the stream that would hold the externalized form of this field.
- Returns:
- the size of the stream in bytes
- Overrides:
- myStreamSize in class PrefField
- See Also:
- Streamable
readObject
public void readObject(StreamInputInterface stream) throws StreamIOException
- Internalizes this choice field.
- Parameters:
- stream - is the stream of data the object state is retrieved from
- Returns:
- none.
- Overrides:
- readObject in class PrefField
- See Also:
- Streamable
writeObject
public void writeObject(StreamOutputInterface stream) throws StreamIOException
- Externalizes this choice field.
- Parameters:
- stream - is the stream of data the object state is recorded in
- Returns:
- none
- Overrides:
- writeObject in class PrefField
- See Also:
- Streamable
All Packages Class Hierarchy This Package Previous Next Index