Class AxisEditor

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class AxisEditor extends JPanel
Axis configuration editor component. This provides boxes in which axis labels and data ranges can be entered. The data ranges are either some fixed numeric value, or Double.NaN; the latter means that the limit in question is to be assigned dynamically by the plot component (presumably by assessing the range of the available data).
Since:
27 Jan 2006
Author:
Mark Taylor
See Also:
  • Field Details

  • Method Details

    • setAxis

      public void setAxis(uk.ac.starlink.table.ValueInfo axis)
      Configures this component to edit the configuration of a given axis. Some of the fields will be initialised only if the submitted axis differs from the last one which was submitted in a call to this method. Thus it is important that the equals() method of axis is implemented properly.
      Parameters:
      axis - metadata of the axis to edit
    • getLabel

      public String getLabel()
      Returns the currently entered label for the axis in this editor.
      Returns:
      axis label string
    • addMaintainedRange

      public void addMaintainedRange(uk.ac.starlink.ttools.plot.Range range)
      Adds a range which will be modified in accordance with changes of the state of this editor. Note the converse does not apply: changes to range will not be refelected by this component.
      Parameters:
      range - range to maintain
    • removeMaintainedRange

      public void removeMaintainedRange(uk.ac.starlink.ttools.plot.Range range)
      Removes a range previously added by addMaintainedRange(uk.ac.starlink.ttools.plot.Range). Note that object identity not equality is used for removal.
      Parameters:
      range - to unmaintain
    • getAxisBounds

      public double[] getAxisBounds()
      Returns the currently requested data range. The result is a 2-element array giving lower, then upper bounds in that order. Either or both elements may be Double.NaN, indicating no preferred limit.
      Returns:
      (lo,hi) array
    • clearBounds

      public void clearBounds()
      Clears the upper and lower bounds in this editor.
    • addActionListener

      public void addActionListener(ActionListener listener)
      Registers a listener to be notified when the state of this component changes.
      Parameters:
      listener - listener to add
    • removeActionListener

      public void removeActionListener(ActionListener listener)
      Unregisters a listener added by addActionListener(java.awt.event.ActionListener).
      Parameters:
      listener - listener to remove
    • setTitle

      public void setTitle(String title)
      Sets the title of this editor. It is used to label the component's border.
      Parameters:
      title - title text
    • getLow

      protected double getLow()
      Returns the current lower bound, fixing state if necessary.
      Returns:
      lower bound, may be NaN
    • getHigh

      protected double getHigh()
      Returns the current upper bound, fixing state if necessary.
      Returns:
      upper bound, may be NaN
    • updateRanges

      public void updateRanges()
      Updates all of the Ranges currently maintained by this editor according to its current state.