Class DataLoadingConstraintEditor<T>
- java.lang.Object
-
- docking.widgets.table.constrainteditor.AbstractColumnConstraintEditor<T>
-
- docking.widgets.table.constrainteditor.DataLoadingConstraintEditor<T>
-
- Type Parameters:
T
- the column type
- All Implemented Interfaces:
ColumnConstraintEditor<T>
,TaskListener
- Direct Known Subclasses:
AutocompletingStringConstraintEditor
public abstract class DataLoadingConstraintEditor<T> extends AbstractColumnConstraintEditor<T> implements TaskListener
Abstract base class for constraint editors that load all the data in a column in order to initialize themselves.
-
-
Field Summary
Fields Modifier and Type Field Description protected ColumnData<T>
columnDataSource
protected javax.swing.JLabel
statusLabel
-
Fields inherited from class docking.widgets.table.constrainteditor.AbstractColumnConstraintEditor
currentConstraint, INVALID_INPUT_COLOR, VALID_INPUT_COLOR
-
-
Constructor Summary
Constructors Constructor Description DataLoadingConstraintEditor(ColumnConstraint<T> delegateConstraint, ColumnData<T> columnDataSource)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.awt.Component
buildDelegateDetailEditor()
Get the delegates' detail componentprotected java.awt.Component
buildDelegateInlineEditor()
Get the delegates' inline editor componentprotected java.awt.Component
buildDetailEditorComponent()
Delegate the construction of the detail editor component.protected java.awt.Component
buildInlineEditorComponent()
Delegate the construction of the inline editor component.void
clearColumnData()
Request that any state maintained by the delegate editor pertaining to column data be cleared.void
columnDataLoadCancelled()
Notification that the column data-load was cancelled.void
columnDataLoadComplete()
Notification that the column data-load has been completed.protected abstract void
doUpdateEditorComponent()
Indicates the constraint has changed, and the user interface needs to be updated to reflect the new state.java.lang.String
getErrorMessage()
If the editor contains and invalid value, this message should indicate why the value is invalid.protected abstract ColumnConstraint<T>
getValueFromComponent()
Get the constraints' new value from the editor component.abstract void
handleColumnDataValue(T value)
A value has been read from the table (column); handle it in an editor-specific way.void
reset()
Reset the editor to a known-good state.protected abstract void
resetEditor()
Reset the delegate editor to a known statevoid
taskCancelled(Task task)
Notification that the task was canceled.void
taskCompleted(Task task)
Notification that the task completed.protected void
updateEditorComponent()
Indicates to subclasses that the constraint has changed, and the user interface needs to be updated to reflect the new state.-
Methods inherited from class docking.widgets.table.constrainteditor.AbstractColumnConstraintEditor
addChangeListener, checkEditorValueValidity, formatStatus, getDetailComponent, getInlineComponent, getValue, hasEditorComponents, hasValidValue, notifyConstraintChanged, removeChangeListener, setValue, updateInfoMessage, valueChanged
-
-
-
-
Field Detail
-
columnDataSource
protected final ColumnData<T> columnDataSource
-
statusLabel
protected javax.swing.JLabel statusLabel
-
-
Constructor Detail
-
DataLoadingConstraintEditor
public DataLoadingConstraintEditor(ColumnConstraint<T> delegateConstraint, ColumnData<T> columnDataSource)
Constructor.- Parameters:
delegateConstraint
- the constraint to feed column data to. Provides editors for manipulating constraint values.columnDataSource
- provides access to table data and. Must be non-null.
-
-
Method Detail
-
buildInlineEditorComponent
protected java.awt.Component buildInlineEditorComponent()
Delegate the construction of the inline editor component.This editor provides a panel containing a
TaskMonitorComponent
and the ability to reload the columns' data; if the delegate editor provides an inline editor, this wraps it, and switches between task view and the editor depending on the executing state of the data-load task.- Specified by:
buildInlineEditorComponent
in classAbstractColumnConstraintEditor<T>
- Returns:
- the editors inline component
- See Also:
buildDelegateInlineEditor()
-
buildDelegateInlineEditor
protected java.awt.Component buildDelegateInlineEditor()
Get the delegates' inline editor component- Returns:
- the inline editor for the delegate constraint
-
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.
- Overrides:
buildDetailEditorComponent
in classAbstractColumnConstraintEditor<T>
- Returns:
- the editors detail component; null in this implementation
- See Also:
buildDelegateDetailEditor()
-
buildDelegateDetailEditor
protected java.awt.Component buildDelegateDetailEditor()
Get the delegates' detail component- Returns:
- the detail editor for the delegate constraint
-
handleColumnDataValue
public abstract void handleColumnDataValue(T value)
A value has been read from the table (column); handle it in an editor-specific way.- Parameters:
value
- the value read from the table (column)
-
columnDataLoadComplete
public void columnDataLoadComplete()
Notification that the column data-load has been completed.
-
columnDataLoadCancelled
public void columnDataLoadCancelled()
Notification that the column data-load was cancelled.
-
clearColumnData
public void clearColumnData()
Request that any state maintained by the delegate editor pertaining to column data be cleared.
-
reset
public void reset()
Description copied from interface:ColumnConstraintEditor
Reset the editor to a known-good state.- Specified by:
reset
in interfaceColumnConstraintEditor<T>
-
resetEditor
protected abstract void resetEditor()
Reset the delegate editor to a known state- See Also:
reset()
-
getValueFromComponent
protected abstract ColumnConstraint<T> getValueFromComponent()
Description copied from class:AbstractColumnConstraintEditor
Get the constraints' new value from the editor component. This expects the UI to have been constructed.- Specified by:
getValueFromComponent
in classAbstractColumnConstraintEditor<T>
- Returns:
- See Also:
AbstractColumnConstraintEditor.getValue()
-
getErrorMessage
public java.lang.String getErrorMessage()
Description copied from interface:ColumnConstraintEditor
If the editor contains and invalid value, this message should indicate why the value is invalid. Only called if hasValidValue() returns false.- Specified by:
getErrorMessage
in interfaceColumnConstraintEditor<T>
- Returns:
- an error message, or an empty string if no error
-
updateEditorComponent
protected void updateEditorComponent()
Description copied from class:AbstractColumnConstraintEditor
Indicates to subclasses that the constraint has changed, and the user interface needs to be updated to reflect the new state.- Specified by:
updateEditorComponent
in classAbstractColumnConstraintEditor<T>
-
doUpdateEditorComponent
protected abstract void doUpdateEditorComponent()
Indicates the constraint has changed, and the user interface needs to be updated to reflect the new state.
-
taskCompleted
public void taskCompleted(Task task)
Description copied from interface:TaskListener
Notification that the task completed.- Specified by:
taskCompleted
in interfaceTaskListener
- Parameters:
task
- the task that was running and is now completed
-
taskCancelled
public void taskCancelled(Task task)
Description copied from interface:TaskListener
Notification that the task was canceled.- Specified by:
taskCancelled
in interfaceTaskListener
- Parameters:
task
- the task that was running and was canceled
-
-