Class ErrorModeSelectionModel
java.lang.Object
uk.ac.starlink.topcat.plot.ErrorModeSelectionModel
- All Implemented Interfaces:
ActionListener, EventListener, ComboBoxModel, ListModel, uk.ac.starlink.ttools.plot.ErrorModeSelection
public class ErrorModeSelectionModel
extends Object
implements uk.ac.starlink.ttools.plot.ErrorModeSelection, ComboBoxModel, ActionListener
Model for selecting
ErrorMode values.
Methods are provided for acquiring GUI controls which reflect this model.- Since:
- 26 Feb 2007
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidUpdates model state and informs listeners as required.voidaddActionListener(ActionListener listener) Adds a listener which will be informed when the selection changes.voidaddListDataListener(ListDataListener listener) No-op - the list never changes.Returns a set of menu items which allow selection of the state for this model.Returns a normal button which toggles the mode between no error bars and symmetrical error bars.Returns a toolbar button which toggles the mode between no error bars and symmetrical error bars.getElementAt(int index) uk.ac.starlink.ttools.plot.ErrorModeReturns the currently selected mode.getIcon(uk.ac.starlink.ttools.plot.ErrorMode mode, int width, int height, int xpad, int ypad) Returns an icon which can be used to represent a given error mode.intgetSize()booleanIndicates enabledness of this model.voidremoveActionListener(ActionListener listener) Removes a listener previously added byaddActionListener(ActionListener).voidremoveListDataListener(ListDataListener listener) No-op - the list never changes.voidsetEnabled(boolean enabled) Toggles enabled state of any controls based on this model.voidsetMode(uk.ac.starlink.ttools.plot.ErrorMode mode) Sets the selected mode.voidsetSelectedItem(Object mode)
-
Constructor Details
-
ErrorModeSelectionModel
Constructor.- Parameters:
iaxis- index of the axis for which this model selects ErrorModesaxisName- name of the axis
-
-
Method Details
-
getErrorMode
public uk.ac.starlink.ttools.plot.ErrorMode getErrorMode()Returns the currently selected mode.- Specified by:
getErrorModein interfaceuk.ac.starlink.ttools.plot.ErrorModeSelection- Returns:
- error mode
-
setMode
public void setMode(uk.ac.starlink.ttools.plot.ErrorMode mode) Sets the selected mode.- Parameters:
mode- new error mode
-
setEnabled
public void setEnabled(boolean enabled) Toggles enabled state of any controls based on this model.- Parameters:
enabled- true iff user should be able to change state
-
isEnabled
public boolean isEnabled()Indicates enabledness of this model.- Returns:
- true iff user should be able to change state
-
actionPerformed
Updates model state and informs listeners as required. The command string of the provided ActionEvent must match the name of one of the available ErrorModes.- Specified by:
actionPerformedin interfaceActionListener- Parameters:
evt- action whose command string names the new mode
-
createMenuItems
Returns a set of menu items which allow selection of the state for this model. Currently they are radio buttons, one for each known mode.- Returns:
- list of menu items for control
-
createOnOffToolbarButton
Returns a toolbar button which toggles the mode between no error bars and symmetrical error bars. This does not allow full control (not all modes are available).- Returns:
- toolbar button for toggling error bar status
-
createOnOffButton
Returns a normal button which toggles the mode between no error bars and symmetrical error bars. This does not allow full control (not all modes are available).- Returns:
- button for toggling error bar status
-
getElementAt
- Specified by:
getElementAtin interfaceListModel
-
getSize
-
getSelectedItem
- Specified by:
getSelectedItemin interfaceComboBoxModel
-
setSelectedItem
- Specified by:
setSelectedItemin interfaceComboBoxModel
-
addListDataListener
No-op - the list never changes.- Specified by:
addListDataListenerin interfaceListModel
-
removeListDataListener
No-op - the list never changes.- Specified by:
removeListDataListenerin interfaceListModel
-
addActionListener
Adds a listener which will be informed when the selection changes.- Specified by:
addActionListenerin interfaceuk.ac.starlink.ttools.plot.ErrorModeSelection- Parameters:
listener- listener
-
removeActionListener
Removes a listener previously added byaddActionListener(ActionListener).- Specified by:
removeActionListenerin interfaceuk.ac.starlink.ttools.plot.ErrorModeSelection- Parameters:
listener- listener
-
getIcon
public Icon getIcon(uk.ac.starlink.ttools.plot.ErrorMode mode, int width, int height, int xpad, int ypad) Returns an icon which can be used to represent a given error mode.- Parameters:
mode- error modewidth- total width of iconheight- total height of iconxpad- internal horizontal padding of iconypad- internal vertical padding of icon- Returns:
- icon
-