public abstract class CellEditor extends Object
Subclasses implement particular kinds of cell editors. This package contains various specialized cell editors:
TextCellEditor
- for simple text stringsColorCellEditor
- for colorsComboBoxCellEditor
- value selected from drop-down combo
boxCheckboxCellEditor
- boolean valued checkboxDialogCellEditor
- value from arbitrary dialogModifier and Type | Class and Description |
---|---|
static class |
CellEditor.LayoutData
Struct-like layout data for cell editors, with reasonable defaults for
all fields.
|
Modifier and Type | Field and Description |
---|---|
static String |
COPY
Property name for the copy action
|
static String |
CUT
Property name for the cut action
|
static String |
DELETE
Property name for the delete action
|
static String |
FIND
Property name for the find action
|
static String |
PASTE
Property name for the paste action
|
static String |
REDO
Property name for the redo action
|
static String |
SELECT_ALL
Property name for the select all action
|
static String |
UNDO
Property name for the undo action
|
Modifier | Constructor and Description |
---|---|
protected |
CellEditor()
Creates a new cell editor with no control The cell editor has no cell
validator.
|
protected |
CellEditor(Composite parent)
Creates a new cell editor under the given parent control.
|
protected |
CellEditor(Composite parent,
int style)
Creates a new cell editor under the given parent control.
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activates this cell editor.
|
void |
activate(ColumnViewerEditorActivationEvent activationEvent)
Activate the editor but also inform the editor which event triggered its
activation.
|
void |
addListener(ICellEditorListener listener)
Adds a listener to this cell editor.
|
void |
addPropertyChangeListener(IPropertyChangeListener listener)
Adds a property change listener to this cell editor.
|
void |
create(Composite parent)
Creates the control for this cell editor under the given parent control.
|
protected abstract Control |
createControl(Composite parent)
Creates the control for this cell editor under the given parent control.
|
void |
deactivate()
Hides this cell editor's control.
|
protected void |
deactivate(ColumnViewerEditorDeactivationEvent event) |
protected boolean |
dependsOnExternalFocusListener()
The default implementation of this method returns true.
|
void |
dispose()
Disposes of this cell editor and frees any associated SWT resources.
|
protected abstract Object |
doGetValue()
Returns this cell editor's value.
|
protected abstract void |
doSetFocus()
Sets the focus to the cell editor's control.
|
protected abstract void |
doSetValue(Object value)
Sets this cell editor's value.
|
protected void |
fireApplyEditorValue()
Notifies all registered cell editor listeners of an apply event.
|
protected void |
fireCancelEditor()
Notifies all registered cell editor listeners that editing has been
canceled.
|
protected void |
fireEditorValueChanged(boolean oldValidState,
boolean newValidState)
Notifies all registered cell editor listeners of a value change.
|
protected void |
fireEnablementChanged(String actionId)
Notifies all registered property listeners of an enablement change.
|
protected void |
focusLost()
Processes a focus lost event that occurred in this cell editor.
|
Control |
getControl()
Returns the control used to implement this cell editor.
|
protected int |
getDoubleClickTimeout()
Returns the duration, in milliseconds, between the mouse button click
that activates the cell editor and a subsequent mouse button click that
will be considered a double click on the underlying control.
|
String |
getErrorMessage()
Returns the current error message for this cell editor.
|
CellEditor.LayoutData |
getLayoutData()
Returns a layout data object for this cell editor.
|
int |
getStyle()
Returns the style bits for this cell editor.
|
ICellEditorValidator |
getValidator()
Returns the input validator for this cell editor.
|
Object |
getValue()
Returns this cell editor's value provided that it has a valid one.
|
boolean |
isActivated()
Returns whether this cell editor is activated.
|
boolean |
isCopyEnabled()
Returns
true if this cell editor is able to perform the
copy action. |
protected boolean |
isCorrect(Object value)
Returns whether the given value is valid for this cell editor.
|
boolean |
isCutEnabled()
Returns
true if this cell editor is able to perform the
cut action. |
boolean |
isDeleteEnabled()
Returns
true if this cell editor is able to perform the
delete action. |
boolean |
isDirty()
Returns whether the value of this cell editor has changed since the last
call to
setValue . |
boolean |
isFindEnabled()
Returns
true if this cell editor is able to perform the
find action. |
boolean |
isPasteEnabled()
Returns
true if this cell editor is able to perform the
paste action. |
boolean |
isRedoEnabled()
Returns
true if this cell editor is able to perform the
redo action. |
boolean |
isSelectAllEnabled()
Returns
true if this cell editor is able to perform the
select all action. |
boolean |
isUndoEnabled()
Returns
true if this cell editor is able to perform the
undo action. |
boolean |
isValueValid()
Returns whether this cell editor has a valid value.
|
protected void |
keyReleaseOccured(KeyEvent keyEvent)
Processes a key release event that occurred in this cell editor.
|
protected void |
markDirty()
Marks this cell editor as dirty.
|
void |
performCopy()
Performs the copy action.
|
void |
performCut()
Performs the cut action.
|
void |
performDelete()
Performs the delete action.
|
void |
performFind()
Performs the find action.
|
void |
performPaste()
Performs the paste action.
|
void |
performRedo()
Performs the redo action.
|
void |
performSelectAll()
Performs the select all action.
|
void |
performUndo()
Performs the undo action.
|
void |
removeListener(ICellEditorListener listener)
Removes the given listener from this cell editor.
|
void |
removePropertyChangeListener(IPropertyChangeListener listener)
Removes the given property change listener from this cell editor.
|
protected void |
setErrorMessage(String message)
Sets or clears the current error message for this cell editor.
|
void |
setFocus()
Sets the focus to the cell editor's control.
|
void |
setStyle(int style)
Sets the style bits for this cell editor.
|
void |
setValidator(ICellEditorValidator validator)
Sets the input validator for this cell editor.
|
void |
setValue(Object value)
Sets this cell editor's value.
|
protected void |
setValueValid(boolean valid)
Sets the valid state of this cell editor.
|
protected void |
valueChanged(boolean oldValidState,
boolean newValidState)
The value has changed.
|
public static final String COPY
public static final String CUT
public static final String DELETE
public static final String FIND
public static final String PASTE
public static final String REDO
public static final String SELECT_ALL
public static final String UNDO
protected CellEditor()
protected CellEditor(Composite parent)
parent
- the parent controlprotected CellEditor(Composite parent, int style)
parent
- the parent controlstyle
- the style bitspublic void activate()
The default implementation of this framework method does nothing. Subclasses may reimplement.
public void addListener(ICellEditorListener listener)
listener
- a cell editor listenerpublic void addPropertyChangeListener(IPropertyChangeListener listener)
listener
- a property change listenerprotected abstract Control createControl(Composite parent)
This framework method must be implemented by concrete subclasses.
parent
- the parent controlnull
if this cell editor has
no controlpublic void create(Composite parent)
parent
- the parent controlpublic void deactivate()
public void dispose()
protected abstract Object doGetValue()
This framework method must be implemented by concrete subclasses.
getValue()
protected abstract void doSetFocus()
This framework method must be implemented by concrete subclasses.
setFocus()
protected abstract void doSetValue(Object value)
This framework method must be implemented by concrete subclasses.
value
- the value of this cell editorsetValue(java.lang.Object)
protected void fireApplyEditorValue()
ICellEditorListener.applyEditorValue()
protected void fireCancelEditor()
ICellEditorListener.cancelEditor()
protected void fireEditorValueChanged(boolean oldValidState, boolean newValidState)
oldValidState
- the valid state before the end user changed the valuenewValidState
- the current valid stateICellEditorListener.editorValueChanged(boolean, boolean)
protected void fireEnablementChanged(String actionId)
actionId
- the id indicating what action's enablement has changed.public void setStyle(int style)
style
- the SWT style bits for this cell editorpublic int getStyle()
public Control getControl()
null
if this cell editor has no
controlpublic String getErrorMessage()
null
if the cell editor is validpublic CellEditor.LayoutData getLayoutData()
The default implementation of this method sets the minimum width to the control's preferred width. Subclasses may extend or reimplement.
public ICellEditorValidator getValidator()
null
if nonepublic final Object getValue()
null
if the cell
editor does not contain a valid valuepublic boolean isActivated()
true
if this cell editor's control is currently
activated, and false
if not activatedpublic boolean isCopyEnabled()
true
if this cell editor is able to perform the
copy action.
This default implementation always returns false
.
Subclasses may override
true
if copy is possible, false
otherwiseprotected boolean isCorrect(Object value)
value
- the value to check fortrue
if the value is valid, and false
if invalidpublic boolean isCutEnabled()
true
if this cell editor is able to perform the
cut action.
This default implementation always returns false
.
Subclasses may override
true
if cut is possible, false
otherwisepublic boolean isDeleteEnabled()
true
if this cell editor is able to perform the
delete action.
This default implementation always returns false
.
Subclasses may override
true
if delete is possible, false
otherwisepublic boolean isDirty()
setValue
.true
if the value has changed, and
false
if unchangedprotected void markDirty()
public boolean isFindEnabled()
true
if this cell editor is able to perform the
find action.
This default implementation always returns false
.
Subclasses may override
true
if find is possible, false
otherwisepublic boolean isPasteEnabled()
true
if this cell editor is able to perform the
paste action.
This default implementation always returns false
.
Subclasses may override
true
if paste is possible, false
otherwisepublic boolean isRedoEnabled()
true
if this cell editor is able to perform the
redo action.
This default implementation always returns false
.
Subclasses may override
true
if redo is possible, false
otherwisepublic boolean isSelectAllEnabled()
true
if this cell editor is able to perform the
select all action.
This default implementation always returns false
.
Subclasses may override
true
if select all is possible, false
otherwisepublic boolean isUndoEnabled()
true
if this cell editor is able to perform the
undo action.
This default implementation always returns false
.
Subclasses may override
true
if undo is possible, false
otherwisepublic boolean isValueValid()
true
if the value is valid, and false
if invalidsetValueValid(boolean)
protected void keyReleaseOccured(KeyEvent keyEvent)
The default implementation of this framework method cancels editing when the ESC key is pressed. When the RETURN key is pressed the current value is applied and the cell editor deactivates. Subclasses should call this method at appropriate times. Subclasses may also extend or reimplement.
keyEvent
- the key eventprotected void focusLost()
The default implementation of this framework method applies the current value and deactivates the cell editor. Subclasses should call this method at appropriate times. Subclasses may also extend or reimplement.
public void performCopy()
Subclasses may override
public void performCut()
Subclasses may override
public void performDelete()
Subclasses may override
public void performFind()
Subclasses may override
public void performPaste()
Subclasses may override
public void performRedo()
Subclasses may override
public void performSelectAll()
Subclasses may override
public void performUndo()
Subclasses may override
public void removeListener(ICellEditorListener listener)
listener
- a cell editor listenerpublic void removePropertyChangeListener(IPropertyChangeListener listener)
listener
- a property change listenerprotected void setErrorMessage(String message)
No formatting is done here, the message to be set is expected to be fully formatted before being passed in.
message
- the error message, or null
to clearpublic void setFocus()
public void setValidator(ICellEditorValidator validator)
validator
- the input validator, or null
if nonepublic final void setValue(Object value)
value
- the value of this cell editorprotected void setValueValid(boolean valid)
valid
- true
if the current value is valid, and
false
if invalidisValueValid()
protected void valueChanged(boolean oldValidState, boolean newValidState)
oldValidState
- the valid state before the end user changed the valuenewValidState
- the current valid stateICellEditorListener.editorValueChanged(boolean, boolean)
public void activate(ColumnViewerEditorActivationEvent activationEvent)
activate()
activationEvent
- the editor activation eventprotected boolean dependsOnExternalFocusListener()
true
to indicate that a focus listener has to be
attachedprotected void deactivate(ColumnViewerEditorDeactivationEvent event)
event
- deactivation eventprotected int getDoubleClickTimeout()
0
Copyright (c) 2000, 2017 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.