net.sf.freecol.client.gui.panel
Class ChoiceItem<T>

java.lang.Object
  extended by net.sf.freecol.client.gui.panel.ChoiceItem<T>

public class ChoiceItem<T>
extends java.lang.Object

Can be used as a single choice for the choice dialog.


Constructor Summary
ChoiceItem(java.lang.String text, T object)
          Creates a new ChoiceItem with the given object.
ChoiceItem(java.lang.String text, T object, boolean enable)
          Creates a new ChoiceItem with the given object.
ChoiceItem(T object)
          Creates a new ChoiceItem with the given object.
 
Method Summary
 int getChoice()
          Gets the choice as an int.
 T getObject()
          Gets the Object contained by this choice.
 boolean isEnabled()
          Checks if the option should be enabled or not
 java.lang.String toString()
          Gets a textual presentation of this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChoiceItem

public ChoiceItem(java.lang.String text,
                  T object,
                  boolean enable)
Creates a new ChoiceItem with the given object.

Parameters:
text - The text that should be used to represent this choice.
object - The Object contained by this choice.
enable - Sets if the option should be enabled or not

ChoiceItem

public ChoiceItem(java.lang.String text,
                  T object)
Creates a new ChoiceItem with the given object.

Parameters:
text - The text that should be used to represent this choice.
object - The Object contained by this choice.

ChoiceItem

public ChoiceItem(T object)
Creates a new ChoiceItem with the given object.

Parameters:
object - The Object contained by this choice.
Method Detail

getObject

public T getObject()
Gets the Object contained by this choice.

Returns:
The Object.

getChoice

public int getChoice()
Gets the choice as an int.

Returns:
The number representing this object.
Throws:
java.lang.ClassCastException - if the object is not an Integer.

isEnabled

public boolean isEnabled()
Checks if the option should be enabled or not

Returns:
enable status

toString

public java.lang.String toString()
Gets a textual presentation of this object.

Overrides:
toString in class java.lang.Object
Returns:
The text set in the constructor.