Interface Specifier<V>
- All Known Implementing Classes:
BinSizer.BinSizerSpecifier, ChooserColorSpecifier, ComboBoxSpecifier, ConversionSpecifier, MultiSpecifierPanel, SliderSpecifier, SpecifierPanel, TextFieldSpecifier, ToggleSpecifier, UnitRangeSpecifier
public interface Specifier<V>
Can acquire a typed value from the GUI.
- Since:
- 5 Mar 2013
- Author:
- Mark Taylor
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddActionListener(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.Returns the graphical component that the user can interact with to supply a value.Returns the typed value currently specified by the graphical component.booleanisXFill()Whether the GUI component should fill the available width of a panel.voidremoveActionListener(ActionListener listener) Removes a listener previously added byaddActionListener.voidsetSpecifiedValue(V value) Sets the typed value represented by the graphical component.voidsubmitReport(ReportMap report) Accepts information about a completed plot that was drawn with input from this specifier.
-
Method Details
-
getComponent
JComponent getComponent()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/isEnabledmethods.- Returns:
- specifier component
-
getSpecifiedValue
V getSpecifiedValue()Returns the typed value currently specified by the graphical component.- Returns:
- specified value
-
setSpecifiedValue
Sets the typed value represented by the graphical component. Calling this method ought to make it clear to the user what value it is set at; in any case a subsequent call ofgetSpecifiedValueshould yield the same result.However if a value is set which is of the correct type but cannot be represented by this specifier, results are unpredictable.
- Parameters:
value- new value
-
submitReport
Accepts information about a completed plot that was drawn with input from this specifier. In many cases, the implementation of this method will be a no-op, but it gives this object a chance to update its state or its component's appearance based on the way the plot was actually drawn, which may provide information not otherwise available to this object.- Parameters:
report- report of a plot partially specified by this object
-
addActionListener
Adds a listener which will be informed when the user interacts with the graphical component to cause a (potential) change in the value.- Parameters:
listener- listener to add
-
removeActionListener
Removes a listener previously added byaddActionListener.- Parameters:
listener- listener to remove
-
isXFill
boolean isXFill()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.- Returns:
- true for horizontally expandable components
-