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
FieldsModifier and TypeFieldDescriptionprotected ColumnConstraint<T> protected static final ColorColor indicating a invalid value is defined by the editor widget(s)protected static final ColorColor indicating a valid value is defined by the editor widget(s) -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractColumnConstraintEditor(ColumnConstraint<T> constraint) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidRegister a callback handler for responding to changes made within the editorprotected ComponentDelegate the construction of the detail editor component.protected abstract ComponentDelegate the construction of the inline editor component.protected abstract booleanTemplate method that subclasses must implement.protected static final StringformatStatus(String message, boolean error) Uses HTML to format and color a string depending on if it is an error or not.final ComponentThe detail component resides in the configuration interface below the column and constraint selection widgets, and is afforded greater space.final ComponentThe 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 booleanDetermine if the graphical elements of the editor have been constructed.final booleanDetermine if the editor contains a valid value; do the UI widgets and state match, is the state sensible for the constraint.protected voidNotify all monitors that the configuration of the constraint has changed.voidRemove a callback handler that was responding changes made within the editorfinal voidsetValue(ColumnConstraint<T> value) Set the current value within the editorprotected abstract voidIndicates 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 voidNotification that the editors' value has changed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
ColumnConstraintEditorcontract.- Returns:
- the editors detail component; null in this implementation
- See Also:
-
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
Description copied from interface:ColumnConstraintEditorSet the current value within the editor- Specified by:
setValuein interfaceColumnConstraintEditor<T>- Parameters:
value- the new value to set
-
addChangeListener
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
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:
-
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
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
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
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.
-