Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.jface.viewers
Class CellEditor  view CellEditor download CellEditor.java

java.lang.Object
  extended byorg.eclipse.jface.viewers.CellEditor
Direct Known Subclasses:
CheckboxCellEditor, ComboBoxCellEditor, DialogCellEditor, TextCellEditor

public abstract class CellEditor
extends java.lang.Object

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:


Nested Class Summary
static class CellEditor.LayoutData
          Struct-like layout data for cell editors, with reasonable defaults for all fields.
 
Field Summary
private  org.eclipse.swt.widgets.Control control
          This cell editor's control, or null if not created yet.
static java.lang.String COPY
          Property name for the copy action
static java.lang.String CUT
          Property name for the cut action
private static int defaultStyle
          Default cell editor style
static java.lang.String DELETE
          Property name for the delete action
private  boolean dirty
          Indicates whether this cell editor has been changed recently.
private  java.lang.String errorMessage
          The error message string to display for invalid values; null if none (that is, the value is valid).
static java.lang.String FIND
          Property name for the find action
private  org.eclipse.jface.util.ListenerList listeners
          List of cell editor listeners (element type: ICellEditorListener).
static java.lang.String PASTE
          Property name for the paste action
private  org.eclipse.jface.util.ListenerList propertyChangeListeners
          List of cell editor property change listeners (element type: IPropertyChangeListener).
static java.lang.String REDO
          Property name for the redo action
static java.lang.String SELECT_ALL
          Property name for the select all action
private  int style
          This cell editor's style
static java.lang.String UNDO
          Property name for the undo action
private  boolean valid
          Indicates whether this cell editor's current value is valid.
private  ICellEditorValidator validator
          Optional cell editor validator; null if none.
 
Constructor Summary
protected CellEditor()
          Creates a new cell editor with no control The cell editor has no cell validator.
protected CellEditor(org.eclipse.swt.widgets.Composite parent)
          Creates a new cell editor under the given parent control.
protected CellEditor(org.eclipse.swt.widgets.Composite parent, int style)
          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(org.eclipse.jface.util.IPropertyChangeListener listener)
          Adds a property change listener to this cell editor.
 void create(org.eclipse.swt.widgets.Composite parent)
          Creates the control for this cell editor under the given parent control.
protected abstract  org.eclipse.swt.widgets.Control createControl(org.eclipse.swt.widgets.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  java.lang.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(java.lang.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(java.lang.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.
 org.eclipse.swt.widgets.Control getControl()
          Returns the control used to implement this cell editor.
 java.lang.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.
 java.lang.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(java.lang.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(org.eclipse.swt.events.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(org.eclipse.jface.util.IPropertyChangeListener listener)
          Removes the given property change listener from this cell editor.
protected  void setErrorMessage(java.lang.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(java.lang.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

listeners

private org.eclipse.jface.util.ListenerList listeners
List of cell editor listeners (element type: ICellEditorListener).


propertyChangeListeners

private org.eclipse.jface.util.ListenerList propertyChangeListeners
List of cell editor property change listeners (element type: IPropertyChangeListener).


valid

private boolean valid
Indicates whether this cell editor's current value is valid.


validator

private ICellEditorValidator validator
Optional cell editor validator; null if none.


errorMessage

private java.lang.String errorMessage
The error message string to display for invalid values; null if none (that is, the value is valid).


dirty

private boolean dirty
Indicates whether this cell editor has been changed recently.


control

private org.eclipse.swt.widgets.Control control
This cell editor's control, or null if not created yet.


defaultStyle

private static final int defaultStyle
Default cell editor style

See Also:
Constant Field Values

style

private int style
This cell editor's style


COPY

public static final java.lang.String COPY
Property name for the copy action

See Also:
Constant Field Values

CUT

public static final java.lang.String CUT
Property name for the cut action

See Also:
Constant Field Values

DELETE

public static final java.lang.String DELETE
Property name for the delete action

See Also:
Constant Field Values

FIND

public static final java.lang.String FIND
Property name for the find action

See Also:
Constant Field Values

PASTE

public static final java.lang.String PASTE
Property name for the paste action

See Also:
Constant Field Values

REDO

public static final java.lang.String REDO
Property name for the redo action

See Also:
Constant Field Values

SELECT_ALL

public static final java.lang.String SELECT_ALL
Property name for the select all action

See Also:
Constant Field Values

UNDO

public static final java.lang.String UNDO
Property name for the undo action

See Also:
Constant Field Values
Constructor Detail

CellEditor

protected CellEditor()
Creates a new cell editor with no control The cell editor has no cell validator.

Since:
2.1

CellEditor

protected CellEditor(org.eclipse.swt.widgets.Composite parent)
Creates a new cell editor under the given parent control. The cell editor has no cell validator.


CellEditor

protected CellEditor(org.eclipse.swt.widgets.Composite parent,
                     int style)
Creates a new cell editor under the given parent control. The cell editor has no cell validator.

Since:
2.1
Method Detail

activate

public void activate()
Activates this cell editor.

The default implementation of this framework method does nothing. Subclasses may reimplement.


addListener

public void addListener(ICellEditorListener listener)
Adds a listener to this cell editor. Has no effect if an identical listener is already registered.


addPropertyChangeListener

public void addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
Adds a property change listener to this cell editor. Has no effect if an identical property change listener is already registered.


createControl

protected abstract org.eclipse.swt.widgets.Control createControl(org.eclipse.swt.widgets.Composite parent)
Creates the control for this cell editor under the given parent control.

This framework method must be implemented by concrete subclasses.


create

public void create(org.eclipse.swt.widgets.Composite parent)
Creates the control for this cell editor under the given parent control.

Since:
2.1

deactivate

public void deactivate()
Hides this cell editor's control. Does nothing if this cell editor is not visible.


dispose

public void dispose()
Disposes of this cell editor and frees any associated SWT resources.


doGetValue

protected abstract java.lang.Object doGetValue()
Returns this cell editor's value.

This framework method must be implemented by concrete subclasses.


doSetFocus

protected abstract void doSetFocus()
Sets the focus to the cell editor's control.

This framework method must be implemented by concrete subclasses.


doSetValue

protected abstract void doSetValue(java.lang.Object value)
Sets this cell editor's value.

This framework method must be implemented by concrete subclasses.


fireApplyEditorValue

protected void fireApplyEditorValue()
Notifies all registered cell editor listeners of an apply event. Only listeners registered at the time this method is called are notified.


fireCancelEditor

protected void fireCancelEditor()
Notifies all registered cell editor listeners that editing has been canceled.


fireEditorValueChanged

protected void fireEditorValueChanged(boolean oldValidState,
                                      boolean newValidState)
Notifies all registered cell editor listeners of a value change.


fireEnablementChanged

protected void fireEnablementChanged(java.lang.String actionId)
Notifies all registered property listeners of an enablement change.


setStyle

public void setStyle(int style)
Sets the style bits for this cell editor.

Since:
2.1

getStyle

public int getStyle()
Returns the style bits for this cell editor.

Since:
2.1

getControl

public org.eclipse.swt.widgets.Control getControl()
Returns the control used to implement this cell editor.


getErrorMessage

public java.lang.String getErrorMessage()
Returns the current error message for this cell editor.


getLayoutData

public CellEditor.LayoutData getLayoutData()
Returns a layout data object for this cell editor. This is called each time the cell editor is activated and controls the layout of the SWT table editor.

The default implementation of this method sets the minimum width to the control's preferred width. Subclasses may extend or reimplement.


getValidator

public ICellEditorValidator getValidator()
Returns the input validator for this cell editor.


getValue

public final java.lang.Object getValue()
Returns this cell editor's value provided that it has a valid one.


isActivated

public boolean isActivated()
Returns whether this cell editor is activated.


isCopyEnabled

public boolean isCopyEnabled()
Returns true if this cell editor is able to perform the copy action.

This default implementation always returns false.

Subclasses may override


isCorrect

protected boolean isCorrect(java.lang.Object value)
Returns whether the given value is valid for this cell editor. This cell editor's validator (if any) makes the actual determination.


isCutEnabled

public boolean isCutEnabled()
Returns true if this cell editor is able to perform the cut action.

This default implementation always returns false.

Subclasses may override


isDeleteEnabled

public boolean isDeleteEnabled()
Returns true if this cell editor is able to perform the delete action.

This default implementation always returns false.

Subclasses may override


isDirty

public boolean isDirty()
Returns whether the value of this cell editor has changed since the last call to setValue.


markDirty

protected void markDirty()
Marks this cell editor as dirty.

Since:
2.1

isFindEnabled

public boolean isFindEnabled()
Returns true if this cell editor is able to perform the find action.

This default implementation always returns false.

Subclasses may override


isPasteEnabled

public boolean isPasteEnabled()
Returns true if this cell editor is able to perform the paste action.

This default implementation always returns false.

Subclasses may override


isRedoEnabled

public boolean isRedoEnabled()
Returns true if this cell editor is able to perform the redo action.

This default implementation always returns false.

Subclasses may override


isSelectAllEnabled

public boolean isSelectAllEnabled()
Returns true if this cell editor is able to perform the select all action.

This default implementation always returns false.

Subclasses may override


isUndoEnabled

public boolean isUndoEnabled()
Returns true if this cell editor is able to perform the undo action.

This default implementation always returns false.

Subclasses may override


isValueValid

public boolean isValueValid()
Returns whether this cell editor has a valid value. The default value is false.


keyReleaseOccured

protected void keyReleaseOccured(org.eclipse.swt.events.KeyEvent keyEvent)
Processes a key release event that occurred in this cell editor.

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.


focusLost

protected void focusLost()
Processes a focus lost event that occurred in this cell editor.

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.


performCopy

public void performCopy()
Performs the copy action. This default implementation does nothing.

Subclasses may override


performCut

public void performCut()
Performs the cut action. This default implementation does nothing.

Subclasses may override


performDelete

public void performDelete()
Performs the delete action. This default implementation does nothing.

Subclasses may override


performFind

public void performFind()
Performs the find action. This default implementation does nothing.

Subclasses may override


performPaste

public void performPaste()
Performs the paste action. This default implementation does nothing.

Subclasses may override


performRedo

public void performRedo()
Performs the redo action. This default implementation does nothing.

Subclasses may override


performSelectAll

public void performSelectAll()
Performs the select all action. This default implementation does nothing.

Subclasses may override


performUndo

public void performUndo()
Performs the undo action. This default implementation does nothing.

Subclasses may override


removeListener

public void removeListener(ICellEditorListener listener)
Removes the given listener from this cell editor. Has no affect if an identical listener is not registered.


removePropertyChangeListener

public void removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
Removes the given property change listener from this cell editor. Has no affect if an identical property change listener is not registered.


setErrorMessage

protected void setErrorMessage(java.lang.String message)
Sets or clears the current error message for this cell editor.


setFocus

public void setFocus()
Sets the focus to the cell editor's control.


setValidator

public void setValidator(ICellEditorValidator validator)
Sets the input validator for this cell editor.


setValue

public final void setValue(java.lang.Object value)
Sets this cell editor's value.


setValueValid

protected void setValueValid(boolean valid)
Sets the valid state of this cell editor. The default value is false. Subclasses should call this method on construction.


valueChanged

protected void valueChanged(boolean oldValidState,
                            boolean newValidState)
The value has changed. Updates the valid state flag, marks this cell editor as dirty, and notifies all registered cell editor listeners of a value change.