Class SpecifierPanel<V>
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.config.SpecifierPanel<V>
-
- All Implemented Interfaces:
Specifier<V>
- Direct Known Subclasses:
BinSizer.BinSizerSpecifier
,ChooserColorSpecifier
,ComboBoxSpecifier
,MultiSpecifierPanel
,SliderSpecifier
,TextFieldSpecifier
,ToggleSpecifier
,UnitRangeSpecifier
public abstract class SpecifierPanel<V> extends java.lang.Object implements Specifier<V>
Partial Specifier implementation.- Since:
- 5 Mar 2013
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SpecifierPanel(boolean isXFill)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addActionListener(java.awt.event.ActionListener listener)
Adds a listener which will be informed when the user interacts with the graphical component to cause a (potential) change in the value.protected abstract javax.swing.JComponent
createComponent()
Abstract method called lazily duringgetComponent
to obtain the graphical component used by this specifier.protected void
fireAction()
Notifies all the registered action listeners of a non-specific event.protected java.awt.event.ActionListener
getActionForwarder()
Returns a listener which will take ActionEvents and forward them to any listeners registered with this panel.protected javax.swing.event.ChangeListener
getChangeForwarder()
Returns a listener which will take ChangeEvents and forward them to any listeners registered with this panel.javax.swing.JComponent
getComponent()
Returns the graphical component that the user can interact with to supply a value.boolean
isXFill()
Whether the GUI component should fill the available width of a panel.void
removeActionListener(java.awt.event.ActionListener listener)
Removes a listener previously added byaddActionListener
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.ac.starlink.ttools.plot2.config.Specifier
getSpecifiedValue, setSpecifiedValue, submitReport
-
-
-
-
Method Detail
-
isXFill
public boolean isXFill()
Description copied from interface:Specifier
Whether the GUI component should fill the available width of a panel. This rendering hint should on the whole this should be true for expandable components, and false for fixed size components. Components should have a fixed vertical size in any case.
-
createComponent
protected abstract javax.swing.JComponent createComponent()
Abstract method called lazily duringgetComponent
to obtain the graphical component used by this specifier. It will be called a maximum of once. It is not necessary that the component actually be created in this method, for instance it may be created at construction time if that's more convenient.- Returns:
- graphical component
-
getComponent
public javax.swing.JComponent getComponent()
Description copied from interface:Specifier
Returns the graphical component that the user can interact with to supply a value. It should be line-like (not tall).The returned component should preferably honour the JComponent
setEnabled
/isEnabled
methods.- Specified by:
getComponent
in interfaceSpecifier<V>
- Returns:
- specifier component
-
addActionListener
public void addActionListener(java.awt.event.ActionListener listener)
Description copied from interface:Specifier
Adds a listener which will be informed when the user interacts with the graphical component to cause a (potential) change in the value.- Specified by:
addActionListener
in interfaceSpecifier<V>
- Parameters:
listener
- listener to add
-
removeActionListener
public void removeActionListener(java.awt.event.ActionListener listener)
Description copied from interface:Specifier
Removes a listener previously added byaddActionListener
.- Specified by:
removeActionListener
in interfaceSpecifier<V>
- Parameters:
listener
- listener to remove
-
getActionForwarder
protected java.awt.event.ActionListener getActionForwarder()
Returns a listener which will take ActionEvents and forward them to any listeners registered with this panel.In general any input component which forms part of this panel's GUI should have as a listener the result of
getActionForwarder
orgetChangeForwarder
, so that changes in their state are propagated to listeners of this specifier.- Returns:
- action forwarder
-
getChangeForwarder
protected javax.swing.event.ChangeListener getChangeForwarder()
Returns a listener which will take ChangeEvents and forward them to any listeners registered with this panel.In general any input component which forms part of this panel's GUI should have as a listener the result of
getActionForwarder
orgetChangeForwarder
, so that changes in their state are propagated to listeners of this specifier.- Returns:
- change forwarder
-
fireAction
protected void fireAction()
Notifies all the registered action listeners of a non-specific event.
-
-