Class ConversionSpecifier<I,O>
java.lang.Object
uk.ac.starlink.ttools.plot2.config.ConversionSpecifier<I,O>
- All Implemented Interfaces:
Specifier<O>
Specifier implementation that adapts an existing one to dispense
values of a different parameterised type.
Implementations of methods to convert between the input (
I
)
and output (O
) types must be provided.- Since:
- 13 Feb 2014
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addActionListener
(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.protected abstract O
Converts a value from input (base) to output type.boolean
isXFill()
Whether the GUI component should fill the available width of a panel.protected abstract I
Converts a value from output to input (base) type.void
removeActionListener
(ActionListener listener) Removes a listener previously added byaddActionListener
.void
setSpecifiedValue
(O outValue) Sets the typed value represented by the graphical component.void
submitReport
(ReportMap report) Accepts information about a completed plot that was drawn with input from this specifier.
-
Constructor Details
-
ConversionSpecifier
Constructor.- Parameters:
baseSpec
- specifier on which this one is based
-
-
Method Details
-
inToOut
Converts a value from input (base) to output type.- Parameters:
inValue
- input type value- Returns:
- output type value
-
outToIn
Converts a value from output to input (base) type.- Parameters:
outValue
- output type value- Returns:
- input type value
-
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<I>
- Returns:
- specifier component
-
getSpecifiedValue
Description copied from interface:Specifier
Returns the typed value currently specified by the graphical component.- Specified by:
getSpecifiedValue
in interfaceSpecifier<I>
- Returns:
- specified value
-
setSpecifiedValue
Description copied from interface:Specifier
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 ofgetSpecifiedValue
should 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.
- Specified by:
setSpecifiedValue
in interfaceSpecifier<I>
- Parameters:
outValue
- new value
-
addActionListener
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<I>
- Parameters:
listener
- listener to add
-
removeActionListener
Description copied from interface:Specifier
Removes a listener previously added byaddActionListener
.- Specified by:
removeActionListener
in interfaceSpecifier<I>
- Parameters:
listener
- listener to remove
-
submitReport
Description copied from interface:Specifier
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.- Specified by:
submitReport
in interfaceSpecifier<I>
- Parameters:
report
- report of a plot partially specified by this object
-
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.
-