Class StyleEditor

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener
Direct Known Subclasses:
BarStyleEditor, DensityStyleEditor, LinesStyleEditor, MarkStyleEditor

public abstract class StyleEditor extends JPanel implements ActionListener, ChangeListener
Graphical component which provides a GUI for editing the characteristics of a Style object. This is an abstract superclass; a specialised implementation will be required for each Style implementation. Since Style objects are usually immutable, this doesn't (necessarily) edit a single style object; instead you configure it with an existing style using the setState(uk.ac.starlink.ttools.plot.Style, java.lang.String, boolean) method and later use the getStyle() method and others to obtain the new style which is a result of the editing.
Since:
10 Jan 2005
Author:
Mark Taylor
See Also:
  • Constructor Details

    • StyleEditor

      public StyleEditor()
      Constructor.
  • Method Details

    • setVisible

      public void setVisible(boolean visible)
      Overrides:
      setVisible in class JComponent
    • init

      protected void init()
      Performs initialisation after construction but before the first display of this component.
    • setState

      public void setState(uk.ac.starlink.ttools.plot.Style style, String label, boolean hideLegend)
      Sets the state of this component ready for editing.
      Parameters:
      style - style
      label - textual label to use in legends annotating the style being edited
      hideLegend - whether this style is to be excluded from plot legends
    • setStyle

      public abstract void setStyle(uk.ac.starlink.ttools.plot.Style style)
      Sets the style. Implementations should configure their visual state so that it matches the characteristics of the given style.
      Parameters:
      style - current style
    • getStyle

      public abstract uk.ac.starlink.ttools.plot.Style getStyle()
      Returns a style object derived from the current state of this component.
      Returns:
      current (edited) style
    • getHelpID

      public abstract String getHelpID()
      Returns the help ID associated with this editor.
      Returns:
      ID within TOPCAT HelpSet
    • getLabel

      public String getLabel()
      Returns the label currently entered in this component.
      Returns:
      label
    • getHideLegend

      public boolean getHideLegend()
      Returns whether the Hide Legend check box is currently selected.
      Returns:
      true iff legend will be hidden for this style
    • setSetId

      public void setSetId(SetId id)
      Sets the set identifier for the style which this editor is currently editing.
      Parameters:
      id - set identifier
    • getSetId

      public SetId getSetId()
      Returns the set identifier for the style which this editor is currently editing.
      Returns:
      set identifier
    • cancelChanges

      public void cancelChanges()
    • addActionListener

      public void addActionListener(ActionListener listener)
      Adds an action listener. It will be notified every time something the state described by this component changes.
      Parameters:
      listener - listener to add
    • removeActionListener

      public void removeActionListener(ActionListener listener)
      Removes an action listener which was previously added.
      Parameters:
      listener - listener to remove
      See Also:
    • actionPerformed

      public void actionPerformed(ActionEvent evt)
      Invoked every time the style described by the current state of this component changes.
      Specified by:
      actionPerformed in interface ActionListener
    • stateChanged

      public void stateChanged(ChangeEvent evt)
      Invoked every time the style described by the current state of this component changes.
      Specified by:
      stateChanged in interface ChangeListener
    • refreshState

      protected void refreshState()
      Ensures that all the visual components of this editor match its internal state.
    • getLegendIcon

      public Icon getLegendIcon()
      Returns the icon to be used for the display legend of this editor.
      Returns:
      legend icon