Package net.sf.freecol.client.gui.option
Class OptionUI<T extends Option<?>>
- java.lang.Object
-
- net.sf.freecol.client.gui.option.OptionUI<T>
-
- All Implemented Interfaces:
OptionUpdater
- Direct Known Subclasses:
AbstractUnitOptionUI
,AudioMixerOptionUI
,BooleanOptionUI
,FileOptionUI
,FreeColActionUI
,IntegerOptionUI
,LanguageOptionUI
,ListOptionUI
,ModOptionUI
,SelectOptionUI
,SliderOptionUI
,StringOptionUI
,TextOptionUI
,UnitTypeOptionUI
public abstract class OptionUI<T extends Option<?>> extends java.lang.Object implements OptionUpdater
This class provides common methods for various Option UIs.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract javax.swing.JComponent
getComponent()
Get theComponent
used to set the value of the Option.javax.swing.JLabel
getJLabel()
javax.swing.ListCellRenderer
getListCellRenderer()
Get a ListCellRenderer suitable for the wrapped Option.T
getOption()
static OptionUI
getOptionUI(GUI gui, Option option, boolean editable)
Get an option UI for a given option.protected void
initialize()
Set up component.boolean
isEditable()
private boolean
isEnabled()
abstract void
reset()
Reset the value of the UI's component from the Option.void
setEditable(boolean newEditable)
void
setEnabler(BooleanOptionUI enabler)
protected void
setLabel(javax.swing.JLabel label)
void
setOption(T newOption)
abstract void
updateOption()
Update the value of the Option from the UI's component.
-
-
-
Field Detail
-
editable
private boolean editable
Whether the Option should be editable.
-
label
private javax.swing.JLabel label
The label to use for the Option.
-
enabler
private BooleanOptionUI enabler
-
-
Constructor Detail
-
OptionUI
protected OptionUI(T option, boolean editable)
Constructor.- Parameters:
option
- TheOption
to display.editable
- True if the option should be editable.
-
-
Method Detail
-
initialize
protected void initialize()
Set up component.
-
getOption
public final T getOption()
-
setOption
public final void setOption(T newOption)
-
isEditable
public final boolean isEditable()
-
isEnabled
private boolean isEnabled()
-
setEditable
public final void setEditable(boolean newEditable)
-
setEnabler
public void setEnabler(BooleanOptionUI enabler)
-
getJLabel
public javax.swing.JLabel getJLabel()
-
setLabel
protected void setLabel(javax.swing.JLabel label)
-
getListCellRenderer
public javax.swing.ListCellRenderer getListCellRenderer()
Get a ListCellRenderer suitable for the wrapped Option.- Returns:
- A suitable ListCellRenderer.
-
getComponent
public abstract javax.swing.JComponent getComponent()
Get theComponent
used to set the value of the Option.- Returns:
- a
JComponent
value
-
updateOption
public abstract void updateOption()
Update the value of the Option from the UI's component.- Specified by:
updateOption
in interfaceOptionUpdater
-
reset
public abstract void reset()
Reset the value of the UI's component from the Option.- Specified by:
reset
in interfaceOptionUpdater
-
-