Class ControlStackModel

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.ListModel

    public class ControlStackModel
    extends javax.swing.AbstractListModel
    ListModel for the control stack. All the entries are Control objects.
    Since:
    13 Mar 2013
    Author:
    Mark Taylor
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class javax.swing.AbstractListModel

        listenerList
    • 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.
      java.lang.Object 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.
      • Methods inherited from class javax.swing.AbstractListModel

        addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ControlStackModel

        public ControlStackModel()
        Constructor.
    • Method Detail

      • getElementAt

        public java.lang.Object 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 - control
        isActive - 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 the activeOnly 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 index
        iTo - 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