Package uk.ac.starlink.topcat.plot2
Class ControlStackModel
- java.lang.Object
-
- javax.swing.AbstractListModel<Control>
-
- uk.ac.starlink.topcat.plot2.ControlStackModel
-
- All Implemented Interfaces:
java.io.Serializable
,javax.swing.ListModel<Control>
public class ControlStackModel extends javax.swing.AbstractListModel<Control>
ListModel for the control stack. All the entries areControl
objects.- Since:
- 13 Mar 2013
- Author:
- Mark Taylor
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ControlStackModel()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addControl(Control control)
Adds a control to this model.void
addPlotActionListener(java.awt.event.ActionListener listener)
Adds a listener which will be notified if this stack's state changes in such a way that the plot might be affected.Control
getControlAt(int ix)
Returns the control at a given index in this list.Control
getElementAt(int ix)
LayerControl[]
getLayerControls(boolean activeOnly)
Returns a list of the controls which can contribute layers to the plot, that is LayerControls.int
getSize()
boolean
isControlActive(Control control)
Indicates whether a given control is marked as active in this stack.void
moveControl(int iFrom, int iTo)
Relocates a control in this list.void
removeControl(Control control)
Removes a control from this model.void
removePlotActionListener(java.awt.event.ActionListener listener)
Removes a listener previously added.void
setControlActive(Control control, boolean isActive)
Sets the activeness of a control in this stack.
-
-
-
Method Detail
-
getElementAt
public Control getElementAt(int ix)
-
getSize
public int getSize()
-
getControlAt
public Control getControlAt(int ix)
Returns the control at a given index in this list.- Parameters:
ix
- list index
-
isControlActive
public boolean isControlActive(Control control)
Indicates whether a given control is marked as active in this stack.- Parameters:
control
- control- Returns:
- true iff active
-
setControlActive
public void setControlActive(Control control, boolean isActive)
Sets the activeness of a control in this stack.- Parameters:
control
- controlisActive
- true iff active
-
getLayerControls
public LayerControl[] getLayerControls(boolean activeOnly)
Returns a list of the controls which can contribute layers to the plot, that is LayerControls. If theactiveOnly
parameter is set, it is restricted further to controls which are currently marked as active and which are known to contribute at least one layer.- Parameters:
activeOnly
- if true, return only controls contributing layers; if false, return all- Returns:
- layer controls that would contribute to a plot
-
addControl
public void addControl(Control control)
Adds a control to this model.- Parameters:
control
- new control
-
removeControl
public void removeControl(Control control)
Removes a control from this model.- Parameters:
control
- previously added control
-
moveControl
public void moveControl(int iFrom, int iTo)
Relocates a control in this list.- Parameters:
iFrom
- source list indexiTo
- destination list index
-
addPlotActionListener
public void addPlotActionListener(java.awt.event.ActionListener listener)
Adds a listener which will be notified if this stack's state changes in such a way that the plot might be affected. That includes changes in the state of any of the controls contained in this stack.- Parameters:
listener
- listener to add
-
removePlotActionListener
public void removePlotActionListener(java.awt.event.ActionListener listener)
Removes a listener previously added.- Parameters:
listener
- listener to remove
-
-