Class SubsetConfigManager


  • public class SubsetConfigManager
    extends java.lang.Object
    Maintains one configuration component each for a group of RowSubsets. The configuration items are split into two types; normal ones and ones that are centrally managed so that each time a new one is requested it has a different default. A typical usage is to allow a different default colour to be associated with each subset.
    Since:
    15 Mar 2013
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      SubsetConfigManager​(NextSupplier nextSupplier, uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] otherKeys)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addActionListener​(java.awt.event.ActionListener listener)
      Adds a listener to be notified whenever the state of one of this manager's configuration components changes.
      Configger getConfigger​(RowSubset subset)
      Lazily constructs and returns a SubsetConfigger for a given subset.
      javax.swing.JComponent getConfiggerComponent​(RowSubset subset)
      Returns the GUI configuration component for a given row subset.
      uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] getConfigKeys()
      Returns the config keys managed by this manager.
      boolean hasConfigger​(RowSubset subset)
      Indicates whether this manager currently has an initialised configuration object for the given subset.
      void removeActionListener​(java.awt.event.ActionListener listener)
      Removes a previously added listener.
      void setConfig​(RowSubset subset, uk.ac.starlink.ttools.plot2.config.ConfigMap config)
      Adjusts the configuration for a given row subset managed by this object.
      • Methods inherited from class java.lang.Object

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

      • SubsetConfigManager

        public SubsetConfigManager​(NextSupplier nextSupplier,
                                   uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] otherKeys)
        Constructor.
        Parameters:
        nextSupplier - manages dispensing different objects of the same type
        otherKeys - keys for config items not handled by the nextSupplier that should be handled by this managers configgers
    • Method Detail

      • getConfigKeys

        public uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[] getConfigKeys()
        Returns the config keys managed by this manager.
      • hasConfigger

        public boolean hasConfigger​(RowSubset subset)
        Indicates whether this manager currently has an initialised configuration object for the given subset. If not, then calling getConfigger would construct and initialise such an object.
        Parameters:
        subset - row subset
        Returns:
        true iff getConfigger would do actual work
      • getConfigger

        public Configger getConfigger​(RowSubset subset)
        Lazily constructs and returns a SubsetConfigger for a given subset.
        Parameters:
        subset - subset for which the configger is required
        Returns:
        configger
      • setConfig

        public void setConfig​(RowSubset subset,
                              uk.ac.starlink.ttools.plot2.config.ConfigMap config)
        Adjusts the configuration for a given row subset managed by this object.
        Parameters:
        subset - subset whose configuration characteristcics are to be changed
        config - configuration options to be set; any irrelevant entries are ignored
      • getConfiggerComponent

        public javax.swing.JComponent getConfiggerComponent​(RowSubset subset)
        Returns the GUI configuration component for a given row subset.
        Parameters:
        subset - row subset
        Returns:
        configuration component
      • addActionListener

        public void addActionListener​(java.awt.event.ActionListener listener)
        Adds a listener to be notified whenever the state of one of this manager's configuration components changes.
        Parameters:
        listener - listener to add
      • removeActionListener

        public void removeActionListener​(java.awt.event.ActionListener listener)
        Removes a previously added listener.
        Parameters:
        listener - to remove