|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.jface.viewers.CellEditor
Abstract base class for cell editors. Implements property change listener handling, and SWT window management.
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 dialog
Nested Class Summary | |
static class |
CellEditor.LayoutData
Struct-like layout data for cell editors, with reasonable defaults for all fields. |
Field Summary | |
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 |
Constructor Summary | |
protected |
CellEditor(Composite parent)
Creates a new cell editor under the given parent control. |
Method Summary | |
void |
activate()
Activates this cell editor. |
void |
addListener(ICellEditorListener listener)
Adds a listener to this cell editor. |
void |
addPropertyChangeListener(IPropertyChangeListener listener)
Adds a property change listener to this cell editor. |
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. |
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. |
Control |
getControl()
Returns the control used to implement this cell editor. |
String |
getErrorMessage()
Returns the current error message for this cell editor. |
CellEditor.LayoutData |
getLayoutData()
Returns a layout data object 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. |
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 |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
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
Constructor Detail |
protected CellEditor(Composite parent)
parent
- the parent controlMethod Detail |
public 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 control
null
if this cell editor has no 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 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 visible, and false
if not visiblepublic 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)
true
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 unchangedpublic 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 interprets the ESC key as canceling editing, and the RETURN key as applying the current value. Subclasses should call this method at appropriate times. Subclasses may also extend or reimplement.
keyEvent
- the key eventpublic 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)
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 valie 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)
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |