Class AbstractColumnConstraintEditor<T>
java.lang.Object
docking.widgets.table.constrainteditor.AbstractColumnConstraintEditor<T>
- Type Parameters:
T
- the column type
- All Implemented Interfaces:
ColumnConstraintEditor<T>
- Direct Known Subclasses:
BooleanConstraintEditor
,DataLoadingConstraintEditor
,DateRangeConstraintEditor
,DateValueConstraintEditor
,DoNothingColumnConstraintEditor
,DoubleRangeConstraintEditor
,DoubleValueConstraintEditor
,EnumConstraintEditor
,IntegerConstraintEditor
,IntegerRangeConstraintEditor
,StringConstraintEditor
,UnsignedLongConstraintEditor
,UnsignedLongRangeConstraintEditor
public abstract class AbstractColumnConstraintEditor<T>
extends Object
implements ColumnConstraintEditor<T>
Base class for many constraint editors, providing implementation for much of the interface.
-
Field Summary
Modifier and TypeFieldDescriptionprotected ColumnConstraint
<T> protected static final Color
Color indicating a invalid value is defined by the editor widget(s)protected static final Color
Color indicating a valid value is defined by the editor widget(s) -
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractColumnConstraintEditor
(ColumnConstraint<T> constraint) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Register a callback handler for responding to changes made within the editorprotected Component
Delegate the construction of the detail editor component.protected abstract Component
Delegate the construction of the inline editor component.protected abstract boolean
Template method that subclasses must implement.protected static final String
formatStatus
(String message, boolean error) Uses HTML to format and color a string depending on if it is an error or not.final Component
The detail component resides in the configuration interface below the column and constraint selection widgets, and is afforded greater space.final Component
The inline component resides in the configuration interface on the same visual line as the column and constraint selection widgets.final ColumnConstraint
<T> getValue()
Get the current value from the editor, in the form of a constraint.protected abstract ColumnConstraint
<T> Get the constraints' new value from the editor component.protected final boolean
Determine if the graphical elements of the editor have been constructed.final boolean
Determine if the editor contains a valid value; do the UI widgets and state match, is the state sensible for the constraint.protected void
Notify all monitors that the configuration of the constraint has changed.void
Remove a callback handler that was responding changes made within the editorfinal void
setValue
(ColumnConstraint<T> value) Set the current value within the editorprotected abstract void
Indicates to subclasses that the constraint has changed, and the user interface needs to be updated to reflect the new state.protected abstract void
updateInfoMessage
(boolean isValid) protected void
Notification that the editors' value has changed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface docking.widgets.table.constrainteditor.ColumnConstraintEditor
getErrorMessage, reset
-
Field Details
-
currentConstraint
-
VALID_INPUT_COLOR
Color indicating a valid value is defined by the editor widget(s) -
INVALID_INPUT_COLOR
Color indicating a invalid value is defined by the editor widget(s)
-
-
Constructor Details
-
AbstractColumnConstraintEditor
Constructor.- Parameters:
constraint
- the constraint this class is an editor for
-
-
Method Details
-
getValueFromComponent
Get the constraints' new value from the editor component. This expects the UI to have been constructed.- Returns:
- the value
- See Also:
-
buildInlineEditorComponent
Delegate the construction of the inline editor component.- Returns:
- the editors inline component
- See Also:
-
updateEditorComponent
protected abstract void updateEditorComponent()Indicates to subclasses that the constraint has changed, and the user interface needs to be updated to reflect the new state. -
buildDetailEditorComponent
Delegate the construction of the detail editor component.Subclasses should override this method if they choose to provide a detailed constraint editor. This is an optional feature, and this implementation returns null to satisfy the
ColumnConstraintEditor
contract.- Returns:
- the editors detail component; null in this implementation
- See Also:
-
getValue
Description copied from interface:ColumnConstraintEditor
Get the current value from the editor, in the form of a constraint.- Specified by:
getValue
in interfaceColumnConstraintEditor<T>
- Returns:
- the editors' current value
-
setValue
Description copied from interface:ColumnConstraintEditor
Set the current value within the editor- Specified by:
setValue
in interfaceColumnConstraintEditor<T>
- Parameters:
value
- the new value to set
-
addChangeListener
Description copied from interface:ColumnConstraintEditor
Register a callback handler for responding to changes made within the editor- Specified by:
addChangeListener
in interfaceColumnConstraintEditor<T>
- Parameters:
l
- listener callback
-
removeChangeListener
Description copied from interface:ColumnConstraintEditor
Remove a callback handler that was responding changes made within the editor- Specified by:
removeChangeListener
in interfaceColumnConstraintEditor<T>
- Parameters:
l
- listener callback
-
valueChanged
protected void valueChanged()Notification that the editors' value has changed. -
updateInfoMessage
protected abstract void updateInfoMessage(boolean isValid) -
checkEditorValueValidity
protected abstract boolean checkEditorValueValidity()Template method that subclasses must implement. This class will call this method whenever the value changes so that the validity state is updated.Only called when the editor component has been constructed and UI elements are defined.
- Returns:
- true if the UI defines a valid value, false otherwise
- See Also:
-
hasValidValue
public final boolean hasValidValue()Description copied from interface:ColumnConstraintEditor
Determine if the editor contains a valid value; do the UI widgets and state match, is the state sensible for the constraint.- Specified by:
hasValidValue
in interfaceColumnConstraintEditor<T>
- Returns:
- true if the configuration is valid, false otherwise
-
notifyConstraintChanged
protected void notifyConstraintChanged()Notify all monitors that the configuration of the constraint has changed. -
getInlineComponent
Description copied from interface:ColumnConstraintEditor
The inline component resides in the configuration interface on the same visual line as the column and constraint selection widgets. It is intended to be a relatively small and simple interface for configuring the constraints' values.- Specified by:
getInlineComponent
in interfaceColumnConstraintEditor<T>
- Returns:
- the inline editor component
-
getDetailComponent
Description copied from interface:ColumnConstraintEditor
The detail component resides in the configuration interface below the column and constraint selection widgets, and is afforded greater space. It is intended to be a more feature-rich editor that provides greater insight or control of the constraints value definition.- Specified by:
getDetailComponent
in interfaceColumnConstraintEditor<T>
- Returns:
- the detail editor component
-
hasEditorComponents
protected final boolean hasEditorComponents()Determine if the graphical elements of the editor have been constructed.- Returns:
- true if the inline or detail editors have been built, false otherwise
-
formatStatus
Uses HTML to format and color a string depending on if it is an error or not.- Parameters:
message
- the message to format.error
- true if the message is an error; false otherwise- Returns:
- an HTML string suitable for a JLabel.
-