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 anAbstractUnitOption
in order to enable values to be both seen and changed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
AbstractUnitOptionUI.AbstractUnitRenderer
private static class
AbstractUnitOptionUI.RoleRenderer
-
Field Summary
Fields Modifier and Type Field Description private IntegerOptionUI
numberUI
private javax.swing.JPanel
panel
private boolean
roleEditable
private StringOptionUI
roleUI
private UnitTypeOptionUI
typeUI
-
Constructor Summary
Constructors Constructor Description AbstractUnitOptionUI(AbstractUnitOption option, boolean editable)
Creates a newAbstractUnitOptionUI
for the givenAbstractUnitOption
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.swing.JPanel
getComponent()
Get theComponent
used to set the value of the Option.javax.swing.ListCellRenderer
getListCellRenderer()
Get a ListCellRenderer suitable for the wrapped Option.void
itemStateChanged(java.awt.event.ItemEvent e)
void
reset()
Reset the value of the UI's component from the Option.void
updateOption()
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 newAbstractUnitOptionUI
for the givenAbstractUnitOption
.- Parameters:
option
- TheAbstractUnitOption
to 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:
itemStateChanged
in interfacejava.awt.event.ItemListener
-
getListCellRenderer
public javax.swing.ListCellRenderer getListCellRenderer()
Get a ListCellRenderer suitable for the wrapped Option.- Overrides:
getListCellRenderer
in classOptionUI<AbstractUnitOption>
- Returns:
- A suitable ListCellRenderer.
-
getComponent
public javax.swing.JPanel getComponent()
Get theComponent
used to set the value of the Option.- Specified by:
getComponent
in classOptionUI<AbstractUnitOption>
- Returns:
- a
JComponent
value
-
updateOption
public void updateOption()
Update the value of the Option from the UI's component.- Specified by:
updateOption
in interfaceOptionUpdater
- Specified by:
updateOption
in classOptionUI<AbstractUnitOption>
-
reset
public void reset()
Reset the value of the UI's component from the Option.- Specified by:
reset
in interfaceOptionUpdater
- Specified by:
reset
in classOptionUI<AbstractUnitOption>
-
-