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 ofAbstractOptions in order to enable values to be both seen and changed.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.JButtonaddButtonprivate javax.swing.JButtondownButtonprivate javax.swing.JButtoneditButtonprivate javax.swing.JList<AbstractOption<T>>listprivate static java.util.logging.Loggerloggerprivate javax.swing.DefaultListModel<AbstractOption<T>>modelprivate javax.swing.JPanelpanelprivate javax.swing.JButtonremoveButtonprivate javax.swing.JButtonupButton
-
Constructor Summary
Constructors Constructor Description ListOptionUI(GUI gui, ListOption<T> option, boolean editable)Creates a newListOptionUIfor the givenListOption.
-
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.JLabelgetJLabel()private java.util.List<AbstractOption<T>>getValue()voidreset()Reset the value of the UI's component from the Option.private voidsetCellRenderer(GUI gui, AbstractOption<T> o, boolean editable)voidupdateOption()Update the value of the Option from the UI's component.voidvalueChanged(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 newListOptionUIfor the givenListOption.- Parameters:
gui- TheGUIto display on.option- TheListOptionto 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:
getJLabelin classOptionUI<ListOption<T>>
-
getComponent
public javax.swing.JPanel getComponent()
Get theComponentused to set the value of the Option.- Specified by:
getComponentin classOptionUI<ListOption<T>>- 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<ListOption<T>>
-
reset
public void reset()
Reset the value of the UI's component from the Option.- Specified by:
resetin interfaceOptionUpdater- Specified by:
resetin classOptionUI<ListOption<T>>
-
valueChanged
public void valueChanged(javax.swing.event.ListSelectionEvent e)
- Specified by:
valueChangedin interfacejavax.swing.event.ListSelectionListener
-
-