net.sf.freecol.client.gui.option
Class ListOptionUI<T>

java.lang.Object
  extended by net.sf.freecol.client.gui.option.OptionUI<ListOption<T>>
      extended by 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 of net.sf.freecol.common.option.AbstractOptions. In order to enable values to be both seen and changed.


Nested Class Summary
private  class ListOptionUI.EditDialog
           
 
Field Summary
private  javax.swing.JButton addButton
           
private  javax.swing.JButton[] buttons
           
private  javax.swing.JButton downButton
           
private  javax.swing.JButton editButton
           
private  FreeColClient freeColClient
           
private  javax.swing.JList list
           
private static java.util.logging.Logger logger
           
private  javax.swing.DefaultListModel model
           
private  javax.swing.JPanel panel
           
private  javax.swing.JButton removeButton
           
private  javax.swing.JButton upButton
           
 
Fields inherited from class net.sf.freecol.client.gui.option.OptionUI
gui
 
Constructor Summary
ListOptionUI(FreeColClient freeColClient, GUI gui, ListOption<T> option, boolean editable)
          Creates a new ListOptionUI for the given ListOption.
 
Method Summary
 javax.swing.JPanel getComponent()
          Get the Component used to set the value of the Option.
 javax.swing.JLabel getLabel()
          Returns null, since this OptionUI does not require an external label.
private  java.util.List<AbstractOption<T>> getValue()
           
 void reset()
          Reset with the value from the Option.
private  boolean showEditDialog(GUI gui, Option option)
           
 void updateOption()
          Updates the value of the net.sf.freecol.common.getOption().Option this object keeps.
 void valueChanged(javax.swing.event.ListSelectionEvent e)
           
 
Methods inherited from class net.sf.freecol.client.gui.option.OptionUI
getListCellRenderer, getOption, getOptionUI, initialize, isEditable, setEditable, setLabel, setOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static java.util.logging.Logger logger

panel

private javax.swing.JPanel panel

list

private javax.swing.JList list

model

private javax.swing.DefaultListModel model

editButton

private javax.swing.JButton editButton

addButton

private javax.swing.JButton addButton

removeButton

private javax.swing.JButton removeButton

upButton

private javax.swing.JButton upButton

downButton

private javax.swing.JButton downButton

buttons

private javax.swing.JButton[] buttons

freeColClient

private FreeColClient freeColClient
Constructor Detail

ListOptionUI

public ListOptionUI(FreeColClient freeColClient,
                    GUI gui,
                    ListOption<T> option,
                    boolean editable)
Creates a new ListOptionUI for the given ListOption.

Parameters:
option -
editable - boolean whether user can modify the setting
Method Detail

showEditDialog

private boolean showEditDialog(GUI gui,
                               Option option)

getLabel

public final javax.swing.JLabel getLabel()
Returns null, since this OptionUI does not require an external label.

Overrides:
getLabel in class OptionUI<ListOption<T>>
Returns:
null

getComponent

public javax.swing.JPanel getComponent()
Get the Component used to set the value of the Option.

Specified by:
getComponent in class OptionUI<ListOption<T>>
Returns:
a JComponent value

updateOption

public void updateOption()
Updates the value of the net.sf.freecol.common.getOption().Option this object keeps.

Specified by:
updateOption in interface OptionUpdater
Specified by:
updateOption in class OptionUI<ListOption<T>>

getValue

private java.util.List<AbstractOption<T>> getValue()

reset

public void reset()
Reset with the value from the Option.

Specified by:
reset in interface OptionUpdater
Specified by:
reset in class OptionUI<ListOption<T>>

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent e)
Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener