Package net.sf.freecol.client.gui.option
Class AbstractUnitOptionUI
- java.lang.Object
-
- net.sf.freecol.client.gui.option.OptionUI<AbstractUnitOption>
-
- net.sf.freecol.client.gui.option.AbstractUnitOptionUI
-
- All Implemented Interfaces:
java.awt.event.ItemListener,java.util.EventListener,OptionUpdater
public final class AbstractUnitOptionUI extends OptionUI<AbstractUnitOption> implements java.awt.event.ItemListener
This class provides visualization for anAbstractUnitOptionin order to enable values to be both seen and changed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classAbstractUnitOptionUI.AbstractUnitRendererprivate static classAbstractUnitOptionUI.RoleRenderer
-
Field Summary
Fields Modifier and Type Field Description private IntegerOptionUInumberUIprivate javax.swing.JPanelpanelprivate booleanroleEditableprivate StringOptionUIroleUIprivate UnitTypeOptionUItypeUI
-
Constructor Summary
Constructors Constructor Description AbstractUnitOptionUI(AbstractUnitOption option, boolean editable)Creates a newAbstractUnitOptionUIfor the givenAbstractUnitOption.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.swing.JPanelgetComponent()Get theComponentused to set the value of the Option.javax.swing.ListCellRenderergetListCellRenderer()Get a ListCellRenderer suitable for the wrapped Option.voiditemStateChanged(java.awt.event.ItemEvent e)voidreset()Reset the value of the UI's component from the Option.voidupdateOption()Update the value of the Option from the UI's component.-
Methods inherited from class net.sf.freecol.client.gui.option.OptionUI
getJLabel, getOption, getOptionUI, initialize, isEditable, setEditable, setEnabler, setLabel, setOption
-
-
-
-
Field Detail
-
panel
private final javax.swing.JPanel panel
-
numberUI
private final IntegerOptionUI numberUI
-
typeUI
private final UnitTypeOptionUI typeUI
-
roleUI
private final StringOptionUI roleUI
-
roleEditable
private final boolean roleEditable
-
-
Constructor Detail
-
AbstractUnitOptionUI
public AbstractUnitOptionUI(AbstractUnitOption option, boolean editable)
Creates a newAbstractUnitOptionUIfor the givenAbstractUnitOption.- Parameters:
option- TheAbstractUnitOptionto make a user interface foreditable- boolean whether user can modify the setting
-
-
Method Detail
-
itemStateChanged
public void itemStateChanged(java.awt.event.ItemEvent e)
- Specified by:
itemStateChangedin interfacejava.awt.event.ItemListener
-
getListCellRenderer
public javax.swing.ListCellRenderer getListCellRenderer()
Get a ListCellRenderer suitable for the wrapped Option.- Overrides:
getListCellRendererin classOptionUI<AbstractUnitOption>- Returns:
- A suitable ListCellRenderer.
-
getComponent
public javax.swing.JPanel getComponent()
Get theComponentused to set the value of the Option.- Specified by:
getComponentin classOptionUI<AbstractUnitOption>- Returns:
- a
JComponentvalue
-
updateOption
public void updateOption()
Update the value of the Option from the UI's component.- Specified by:
updateOptionin interfaceOptionUpdater- Specified by:
updateOptionin classOptionUI<AbstractUnitOption>
-
reset
public void reset()
Reset the value of the UI's component from the Option.- Specified by:
resetin interfaceOptionUpdater- Specified by:
resetin classOptionUI<AbstractUnitOption>
-
-