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

Constructor Index

 o PrefFieldChoice()
Constructor called by newInstance when this object is internalized.
 o PrefFieldChoice(String, String)
Constructor for an empty choice with name and label with default constraints.
 o PrefFieldChoice(String, String, GridBagConstraints)
Constructor for an empty choice with label and name and specified constraints.

Method Index

 o addChoice(String)
This allows to add a new string for the possible choices.
 o applyModification()
Apply the user change.
 o cancel()
Cancels the last user change.
 o getItem(int)
Returns the string at a given index encoded with an int.
 o getItem(Object)
Returns the string at a given index.
 o getLabel()
Returns the Label associated with this Choice.
 o getValue()
Returns the index of the currently selected item for that field.
 o isModified()
Tells if the value has been modified by the user.
 o isOK()
Returns always true because no constraints are associated with a choice field.
 o myStreamSize()
Returns the size of the stream that would hold the externalized form of this field.
 o readObject(StreamInputInterface)
Internalizes this choice field.
 o setValue(int)
This set the selected value with int argument.
 o setValue(Integer)
This set the selelected value with Integer argument.
 o setValue(Object)
This set the selected value for that field either by specifying the index or the string of the item.
 o showme(PrefFrame)
This adds the approriate choice to a frame.
 o writeObject(StreamOutputInterface)
Externalizes this choice field.

Constructors

 o 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
 o 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
 o PrefFieldChoice
  public PrefFieldChoice()
Constructor called by newInstance when this object is internalized. Otherwise, you should not use this constructor.
Returns:
the new empty object.

Methods

 o 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.
 o 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
 o 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
 o 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.
 o 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.
 o 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
 o 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.
 o 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.
 o 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
 o 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
 o isOK
  public boolean isOK()
Returns always true because no constraints are associated with a choice field.
Returns:
true.
Overrides:
isOK in class PrefField
 o cancel
  public void cancel()
Cancels the last user change.
Returns:
none.
Overrides:
cancel in class PrefField
 o getLabel
  public String getLabel()
Returns the Label associated with this Choice.
Returns:
the label.
 o 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
 o 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
 o 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