Package net.sf.freecol.client.gui.option
Class ListOptionUI<T>
- java.lang.Object
-
- net.sf.freecol.client.gui.option.OptionUI<ListOption<T>>
-
- net.sf.freecol.client.gui.option.ListOptionUI<T>
-
- All Implemented Interfaces:
java.util.EventListener
,javax.swing.event.ListSelectionListener
,OptionUpdater
public final class ListOptionUI<T> extends OptionUI<ListOption<T>> implements javax.swing.event.ListSelectionListener
This class provides visualization for a list ofAbstractOption
s in order to enable values to be both seen and changed.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.JButton
addButton
private javax.swing.JButton
downButton
private javax.swing.JButton
editButton
private javax.swing.JList<AbstractOption<T>>
list
private static java.util.logging.Logger
logger
private javax.swing.DefaultListModel<AbstractOption<T>>
model
private javax.swing.JPanel
panel
private javax.swing.JButton
removeButton
private javax.swing.JButton
upButton
-
Constructor Summary
Constructors Constructor Description ListOptionUI(GUI gui, ListOption<T> option, boolean editable)
Creates a newListOptionUI
for the givenListOption
.
-
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.JLabel
getJLabel()
private java.util.List<AbstractOption<T>>
getValue()
void
reset()
Reset the value of the UI's component from the Option.private void
setCellRenderer(GUI gui, AbstractOption<T> o, boolean editable)
void
updateOption()
Update the value of the Option from the UI's component.void
valueChanged(javax.swing.event.ListSelectionEvent e)
-
Methods inherited from class net.sf.freecol.client.gui.option.OptionUI
getListCellRenderer, getOption, getOptionUI, initialize, isEditable, setEditable, setEnabler, setLabel, setOption
-
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
panel
private final javax.swing.JPanel panel
-
list
private final javax.swing.JList<AbstractOption<T>> list
-
model
private final javax.swing.DefaultListModel<AbstractOption<T>> model
-
editButton
private final javax.swing.JButton editButton
-
addButton
private final javax.swing.JButton addButton
-
removeButton
private final javax.swing.JButton removeButton
-
upButton
private final javax.swing.JButton upButton
-
downButton
private final javax.swing.JButton downButton
-
-
Constructor Detail
-
ListOptionUI
public ListOptionUI(GUI gui, ListOption<T> option, boolean editable)
Creates a newListOptionUI
for the givenListOption
.- Parameters:
gui
- TheGUI
to display on.option
- TheListOption
to display.editable
- boolean whether user can modify the setting
-
-
Method Detail
-
setCellRenderer
private void setCellRenderer(GUI gui, AbstractOption<T> o, boolean editable)
-
getValue
private java.util.List<AbstractOption<T>> getValue()
-
getJLabel
public final javax.swing.JLabel getJLabel()
- Overrides:
getJLabel
in classOptionUI<ListOption<T>>
-
getComponent
public javax.swing.JPanel getComponent()
Get theComponent
used to set the value of the Option.- Specified by:
getComponent
in classOptionUI<ListOption<T>>
- 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<ListOption<T>>
-
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<ListOption<T>>
-
valueChanged
public void valueChanged(javax.swing.event.ListSelectionEvent e)
- Specified by:
valueChanged
in interfacejavax.swing.event.ListSelectionListener
-
-