Class CoordPanel

  • Direct Known Subclasses:
    PositionCoordPanel

    public class CoordPanel
    extends java.lang.Object
    GUI component for entry of Coord values as table column expressions.
    Since:
    13 Mar 2013
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      CoordPanel​(uk.ac.starlink.ttools.plot2.data.Coord[] coords)
      Constructs a CoordPanel for selecting just Coords.
      CoordPanel​(uk.ac.starlink.ttools.plot2.data.Coord[] coords, uk.ac.starlink.ttools.plot2.config.ConfigKey[] configKeys)
      Constructs a CoordPanel for selecting Coords and Config values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addActionListener​(java.awt.event.ActionListener listener)
      Adds a listener which will be notified when the coordinate selection changes.
      void autoPopulate()
      Makes some attempt to fill in the fields with non-blank values.
      java.awt.event.ActionListener getActionForwarder()
      Returns an object which will forward actions to listeners registered with this panel.
      ColumnDataComboBoxModel getColumnSelector​(int ic, int iu)
      Returns the selector component model for a given user coordinate.
      javax.swing.JComponent getComponent()
      Returns the graphical component for this object.
      uk.ac.starlink.ttools.plot2.config.ConfigMap getConfig()
      Returns the config map associated with this panel.
      ConfigSpecifier getConfigSpecifier()
      Returns this panel's config specifier.
      GuiCoordContent[] getContents()
      Returns the coordinate values currently selected in this panel.
      uk.ac.starlink.ttools.plot2.data.Coord[] getCoords()
      Returns the coordinates which this panel is getting values for.
      void removeActionListener​(java.awt.event.ActionListener listener)
      Removes a listener which was added previously.
      void setColumnSelector​(int ic, int iu, ColumnDataComboBoxModel model)
      Resets the selector component model for a given user coordinate.
      void setTable​(TopcatModel tcModel, boolean autoPopulate)
      Sets the table with reference to which this panel will resolve coordinate descriptions.
      • Methods inherited from class java.lang.Object

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

      • CoordPanel

        public CoordPanel​(uk.ac.starlink.ttools.plot2.data.Coord[] coords)
        Constructs a CoordPanel for selecting just Coords.
        Parameters:
        coords - coordinate definitions for which values are required
      • CoordPanel

        public CoordPanel​(uk.ac.starlink.ttools.plot2.data.Coord[] coords,
                          uk.ac.starlink.ttools.plot2.config.ConfigKey[] configKeys)
        Constructs a CoordPanel for selecting Coords and Config values.
        Parameters:
        coords - coordinate definitions for which values are required
        configKeys - config value keys
    • Method Detail

      • getCoords

        public uk.ac.starlink.ttools.plot2.data.Coord[] getCoords()
        Returns the coordinates which this panel is getting values for.
        Returns:
        coords
      • getConfigSpecifier

        public ConfigSpecifier getConfigSpecifier()
        Returns this panel's config specifier.
        Returns:
        specifier for config values, if there are any
      • getConfig

        public uk.ac.starlink.ttools.plot2.config.ConfigMap getConfig()
        Returns the config map associated with this panel.
        Returns:
        result of getConfigSpecifier().getSpecifiedValue()
      • getComponent

        public javax.swing.JComponent getComponent()
        Returns the graphical component for this object.
        Returns:
        component
      • addActionListener

        public void addActionListener​(java.awt.event.ActionListener listener)
        Adds a listener which will be notified when the coordinate selection changes.
        Parameters:
        listener - listener
      • removeActionListener

        public void removeActionListener​(java.awt.event.ActionListener listener)
        Removes a listener which was added previously.
        Parameters:
        listener - listener
      • getActionForwarder

        public java.awt.event.ActionListener getActionForwarder()
        Returns an object which will forward actions to listeners registered with this panel.
        Returns:
        action forwarder
      • setTable

        public void setTable​(TopcatModel tcModel,
                             boolean autoPopulate)
        Sets the table with reference to which this panel will resolve coordinate descriptions.

        If the existing selected coordinate values still make sense (if the new table has sufficiently compatible column names), they are retained. If the columns cannot be retained they are cleared, and in that case if the autopopulate parameter is set, some default columns will be used.

        Parameters:
        tcModel - table from which coordinate values will be drawn
        autoPopulate - whether to autopopulate columns when old ones can't be used or are absent
      • autoPopulate

        public void autoPopulate()
        Makes some attempt to fill in the fields with non-blank values. The default implementation fills in the first few suitable columns, but subclasses are encouraged to override this behaviour if something smarter is possible.
      • getContents

        public GuiCoordContent[] getContents()
        Returns the coordinate values currently selected in this panel. If there is insufficient information to contribute to a plot (not all of the required coord values are filled in) then null will be returned.
        Returns:
        nCoord-element array of coord contents, or null
      • getColumnSelector

        public ColumnDataComboBoxModel getColumnSelector​(int ic,
                                                         int iu)
        Returns the selector component model for a given user coordinate. If no columndata-specific model has been set, null may be returned.
        Parameters:
        ic - coord index
        iu - user info index for the given coord
        Returns:
        selector model, or null
      • setColumnSelector

        public void setColumnSelector​(int ic,
                                      int iu,
                                      ColumnDataComboBoxModel model)
        Resets the selector component model for a given user coordinate.
        Parameters:
        ic - coord index
        iu - user info index for the given coord
        model - new selector model