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>currentConstraintprotected static java.awt.ColorINVALID_INPUT_COLORColor indicating a invalid value is defined by the editor widget(s)protected static java.awt.ColorVALID_INPUT_COLORColor indicating a valid value is defined by the editor widget(s)
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractColumnConstraintEditor(ColumnConstraint<T> constraint)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddChangeListener(javax.swing.event.ChangeListener l)Register a callback handler for responding to changes made within the editorprotected java.awt.ComponentbuildDetailEditorComponent()Delegate the construction of the detail editor component.protected abstract java.awt.ComponentbuildInlineEditorComponent()Delegate the construction of the inline editor component.protected abstract booleancheckEditorValueValidity()Template method that subclasses must implement.protected static java.lang.StringformatStatus(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.ComponentgetDetailComponent()The detail component resides in the configuration interface below the column and constraint selection widgets, and is afforded greater space.java.awt.ComponentgetInlineComponent()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 booleanhasEditorComponents()Determine if the graphical elements of the editor have been constructed.booleanhasValidValue()Determine if the editor contains a valid value; do the UI widgets and state match, is the state sensible for the constraint.protected voidnotifyConstraintChanged()Notify all monitors that the configuration of the constraint has changed.voidremoveChangeListener(javax.swing.event.ChangeListener l)Remove a callback handler that was responding changes made within the editorvoidsetValue(ColumnConstraint<T> value)Set the current value within the editorprotected abstract voidupdateEditorComponent()Indicates to subclasses that the constraint has changed, and the user interface needs to be updated to reflect the new state.protected abstract voidupdateInfoMessage(boolean isValid)protected voidvalueChanged()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:ColumnConstraintEditorGet the current value from the editor, in the form of a constraint.- Specified by:
getValuein interfaceColumnConstraintEditor<T>- Returns:
- the editors' current value
-
setValue
public final void setValue(ColumnConstraint<T> value)
Description copied from interface:ColumnConstraintEditorSet the current value within the editor- Specified by:
setValuein interfaceColumnConstraintEditor<T>- Parameters:
value- the new value to set
-
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener l)
Description copied from interface:ColumnConstraintEditorRegister a callback handler for responding to changes made within the editor- Specified by:
addChangeListenerin interfaceColumnConstraintEditor<T>- Parameters:
l- listener callback
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
Description copied from interface:ColumnConstraintEditorRemove a callback handler that was responding changes made within the editor- Specified by:
removeChangeListenerin 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:ColumnConstraintEditorDetermine if the editor contains a valid value; do the UI widgets and state match, is the state sensible for the constraint.- Specified by:
hasValidValuein 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:ColumnConstraintEditorThe 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:
getInlineComponentin interfaceColumnConstraintEditor<T>- Returns:
- the inline editor component
-
getDetailComponent
public final java.awt.Component getDetailComponent()
Description copied from interface:ColumnConstraintEditorThe 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:
getDetailComponentin 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.
-
-