java.awt.event.ActionListener
, java.util.EventListener
, javax.swing.ComboBoxModel
, javax.swing.ListModel<E>
, uk.ac.starlink.ttools.plot.ErrorModeSelection
public class ErrorModeSelectionModel
extends java.lang.Object
implements uk.ac.starlink.ttools.plot.ErrorModeSelection, javax.swing.ComboBoxModel, java.awt.event.ActionListener
ErrorMode
values.
Methods are provided for acquiring GUI controls which reflect this model.Constructor | Description |
---|---|
ErrorModeSelectionModel(int iaxis,
java.lang.String axisName) |
Constructor.
|
Modifier and Type | Method | Description |
---|---|---|
void |
actionPerformed(java.awt.event.ActionEvent evt) |
Updates model state and informs listeners as required.
|
void |
addActionListener(java.awt.event.ActionListener listener) |
Adds a listener which will be informed when the selection changes.
|
void |
addListDataListener(javax.swing.event.ListDataListener listener) |
No-op - the list never changes.
|
javax.swing.JMenuItem[] |
createMenuItems() |
Returns a set of menu items which allow selection of the state for
this model.
|
javax.swing.AbstractButton |
createOnOffButton() |
Returns a normal button which toggles the mode between no error bars
and symmetrical error bars.
|
javax.swing.AbstractButton |
createOnOffToolbarButton() |
Returns a toolbar button which toggles the mode between no error bars
and symmetrical error bars.
|
java.lang.Object |
getElementAt(int index) |
|
uk.ac.starlink.ttools.plot.ErrorMode |
getErrorMode() |
Returns the currently selected mode.
|
javax.swing.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.
|
java.lang.Object |
getSelectedItem() |
|
int |
getSize() |
|
boolean |
isEnabled() |
Indicates enabledness of this model.
|
void |
removeActionListener(java.awt.event.ActionListener listener) |
Removes a listener previously added by
addActionListener(java.awt.event.ActionListener) . |
void |
removeListDataListener(javax.swing.event.ListDataListener listener) |
No-op - the list never changes.
|
void |
setEnabled(boolean enabled) |
Toggles enabled state of any controls based on this model.
|
void |
setMode(uk.ac.starlink.ttools.plot.ErrorMode mode) |
Sets the selected mode.
|
void |
setSelectedItem(java.lang.Object mode) |
public ErrorModeSelectionModel(int iaxis, java.lang.String axisName)
iaxis
- index of the axis for which this model selects ErrorModesaxisName
- name of the axispublic uk.ac.starlink.ttools.plot.ErrorMode getErrorMode()
getErrorMode
in interface uk.ac.starlink.ttools.plot.ErrorModeSelection
public void setMode(uk.ac.starlink.ttools.plot.ErrorMode mode)
mode
- new error modepublic void setEnabled(boolean enabled)
enabled
- true iff user should be able to change statepublic boolean isEnabled()
public void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed
in interface java.awt.event.ActionListener
evt
- action whose command string names the new modepublic javax.swing.JMenuItem[] createMenuItems()
public javax.swing.AbstractButton createOnOffToolbarButton()
public javax.swing.AbstractButton createOnOffButton()
public java.lang.Object getElementAt(int index)
getElementAt
in interface javax.swing.ListModel<E extends java.lang.Object>
public int getSize()
getSize
in interface javax.swing.ListModel<E extends java.lang.Object>
public java.lang.Object getSelectedItem()
getSelectedItem
in interface javax.swing.ComboBoxModel
public void setSelectedItem(java.lang.Object mode)
setSelectedItem
in interface javax.swing.ComboBoxModel
public void addListDataListener(javax.swing.event.ListDataListener listener)
addListDataListener
in interface javax.swing.ListModel<E extends java.lang.Object>
public void removeListDataListener(javax.swing.event.ListDataListener listener)
removeListDataListener
in interface javax.swing.ListModel<E extends java.lang.Object>
public void addActionListener(java.awt.event.ActionListener listener)
addActionListener
in interface uk.ac.starlink.ttools.plot.ErrorModeSelection
listener
- listenerpublic void removeActionListener(java.awt.event.ActionListener listener)
addActionListener(java.awt.event.ActionListener)
.removeActionListener
in interface uk.ac.starlink.ttools.plot.ErrorModeSelection
listener
- listenerpublic javax.swing.Icon getIcon(uk.ac.starlink.ttools.plot.ErrorMode mode, int width, int height, int xpad, int ypad)
mode
- error modewidth
- total width of iconheight
- total height of iconxpad
- internal horizontal padding of iconypad
- internal vertical padding of iconCopyright ? 2003-2018 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.