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 java.lang.Object implements ColumnConstraintEditor<T>
Base class for many constraint editors, providing implementation for much of the interface.
-
-
Field Summary
Fields Modifier and Type Field Description protected ColumnConstraint<T>
currentConstraint
protected static java.awt.Color
INVALID_INPUT_COLOR
Color indicating a invalid value is defined by the editor widget(s)protected static java.awt.Color
VALID_INPUT_COLOR
Color indicating a valid value is defined by the editor widget(s)
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractColumnConstraintEditor(ColumnConstraint<T> constraint)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addChangeListener(javax.swing.event.ChangeListener l)
Register a callback handler for responding to changes made within the editorprotected java.awt.Component
buildDetailEditorComponent()
Delegate the construction of the detail editor component.protected abstract java.awt.Component
buildInlineEditorComponent()
Delegate the construction of the inline editor component.protected abstract boolean
checkEditorValueValidity()
Template method that subclasses must implement.protected static java.lang.String
formatStatus(java.lang.String message, boolean error)
Uses HTML to format and color a string depending on if it is an error or not.java.awt.Component
getDetailComponent()
The detail component resides in the configuration interface below the column and constraint selection widgets, and is afforded greater space.java.awt.Component
getInlineComponent()
The inline component resides in the configuration interface on the same visual line as the column and constraint selection widgets.ColumnConstraint<T>
getValue()
Get the current value from the editor, in the form of a constraint.protected abstract ColumnConstraint<T>
getValueFromComponent()
Get the constraints' new value from the editor component.protected boolean
hasEditorComponents()
Determine if the graphical elements of the editor have been constructed.boolean
hasValidValue()
Determine if the editor contains a valid value; do the UI widgets and state match, is the state sensible for the constraint.protected void
notifyConstraintChanged()
Notify all monitors that the configuration of the constraint has changed.void
removeChangeListener(javax.swing.event.ChangeListener l)
Remove a callback handler that was responding changes made within the editorvoid
setValue(ColumnConstraint<T> value)
Set the current value within the editorprotected abstract void
updateEditorComponent()
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
valueChanged()
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 Detail
-
currentConstraint
protected ColumnConstraint<T> currentConstraint
-
VALID_INPUT_COLOR
protected static final java.awt.Color VALID_INPUT_COLOR
Color indicating a valid value is defined by the editor widget(s)
-
INVALID_INPUT_COLOR
protected static final java.awt.Color INVALID_INPUT_COLOR
Color indicating a invalid value is defined by the editor widget(s)
-
-
Constructor Detail
-
AbstractColumnConstraintEditor
protected AbstractColumnConstraintEditor(ColumnConstraint<T> constraint)
Constructor.- Parameters:
constraint
- the constraint this class is an editor for
-
-
Method Detail
-
getValueFromComponent
protected abstract ColumnConstraint<T> getValueFromComponent()
Get the constraints' new value from the editor component. This expects the UI to have been constructed.- Returns:
- See Also:
getValue()
-
buildInlineEditorComponent
protected abstract java.awt.Component buildInlineEditorComponent()
Delegate the construction of the inline editor component.- Returns:
- the editors inline component
- See Also:
getInlineComponent()
-
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
protected java.awt.Component 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:
getDetailComponent()
-
getValue
public final ColumnConstraint<T> 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
public final void setValue(ColumnConstraint<T> value)
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
public void addChangeListener(javax.swing.event.ChangeListener l)
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
public void removeChangeListener(javax.swing.event.ChangeListener l)
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:
ColumnConstraintEditor.hasValidValue()
-
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
public final java.awt.Component 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
public final java.awt.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
protected static final java.lang.String formatStatus(java.lang.String message, boolean error)
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.
-
-