# Class SubsetConfigManager

java.lang.Object
uk.ac.starlink.topcat.plot2.SubsetConfigManager

public class SubsetConfigManager extends 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

Modifier and Type
Method
Description
`void`
`addActionListener(ActionListener listener)`
Adds a listener to be notified whenever the state of one of this manager's configuration components changes.
`Configger`
`getConfigger(RowSubset.Key rsKey)`
Lazily constructs and returns a SubsetConfigger for a given subset.
`JComponent`
`getConfiggerComponent(RowSubset.Key rsKey)`
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.Key rsKey)`
Indicates whether this manager currently has an initialised configuration object for the given subset.
`void`
`removeActionListener(ActionListener listener)`
Removes a previously added listener.
`void`
`setConfig(RowSubset.Key rsKey, uk.ac.starlink.ttools.plot2.config.ConfigMap config)`
Adjusts the configuration for a given row subset managed by this object.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### 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 Details

### getConfigKeys

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

### hasConfigger

public boolean hasConfigger(RowSubset.Key rsKey)
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:
  `rsKey` - row subset identifier
Returns:
  true iff getConfigger would do actual work

### getConfigger

public Configger getConfigger(RowSubset.Key rsKey)
Lazily constructs and returns a SubsetConfigger for a given subset.

Parameters:
  `rsKey` - identifier of subset for which the configger is required
Returns:
  configger

### setConfig

public void setConfig(RowSubset.Key rsKey, uk.ac.starlink.ttools.plot2.config.ConfigMap config)
Adjusts the configuration for a given row subset managed by this object.

Parameters:
  `rsKey` - identifier of subset whose configuration characteristcics are to be changed
  `config` - configuration options to be set; any irrelevant entries are ignored

### getConfiggerComponent

public JComponent getConfiggerComponent(RowSubset.Key rsKey)
Returns the GUI configuration component for a given row subset.

Parameters:
  `rsKey` - row subset identifier
Returns:
  configuration component

### addActionListener

public void addActionListener(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(ActionListener listener)
Removes a previously added listener.

Parameters:
  `listener` - to remove