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

Quick Search    Search Deep

javax.swing
Class DefaultCellEditor  view DefaultCellEditor download DefaultCellEditor.java

java.lang.Object
  extended byjavax.swing.AbstractCellEditor
      extended byjavax.swing.DefaultCellEditor
All Implemented Interfaces:
CellEditor, java.io.Serializable, javax.swing.table.TableCellEditor, javax.swing.tree.TreeCellEditor

public class DefaultCellEditor
extends AbstractCellEditor
implements javax.swing.table.TableCellEditor, javax.swing.tree.TreeCellEditor

The default implementation of javax.swing.table.TableCellEditor and javax.swing.tree.TreeCellEditor. It provides editor components for some standard object types.


Nested Class Summary
protected  class DefaultCellEditor.EditorDelegate
          This changeable module access the editor component in the component specific way.
private  class DefaultCellEditor.JCheckBoxDelegate
          Provides getter and setter methods to work with the check box.
private  class DefaultCellEditor.JComboBoxDelegate
          Provides getter and setter methods to work with the combo box.
private  class DefaultCellEditor.JTextFieldDelegate
          Provides getter and setter methods to work with the text component.
 
Field Summary
protected  int clickCountToStart
          The number of the mouse clicks, required to start the editing session.
protected  DefaultCellEditor.EditorDelegate delegate
          The editor delegate, responsible for listening the editorComponent 55 events and getting/setting its value.
protected  JComponent editorComponent
          The Swing JComponent, performing the editing session.
private static long serialVersionUID
           
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
DefaultCellEditor(JCheckBox checkbox)
          Constructor DefaultCellEditor that uses the checkbox (appropriate for boolean values)
DefaultCellEditor(JComboBox combobox)
          Constructor DefaultCellEditor that uses the combo box.
DefaultCellEditor(JTextField textfield)
          Create the DefaultCellEditor that uses the text field as its editor component (appropriate for the text content)
 
Method Summary
 void cancelCellEditing()
          Forwards call to the delegate 55 .
 java.lang.Object getCellEditorValue()
          Get the value, currently being displayed by the editor component.
 int getClickCountToStart()
          Get the number of mouse clicks, required to start the editing session.
 java.awt.Component getComponent()
          Get the component that performs the editing sessions.
 java.awt.Component getTableCellEditorComponent(JTable table, java.lang.Object value, boolean isSelected, int row, int column)
          Get the cell editor component that will perform the editing session.
 java.awt.Component getTreeCellEditorComponent(JTree tree, java.lang.Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
          Sets an initial value for the editor.
 boolean isCellEditable(java.util.EventObject event)
          Forwards call to the delegate 55 .
 void setClickCountToStart(int count)
          Set the number of mouse clicks, required to start the editing session.
 boolean shouldSelectCell(java.util.EventObject event)
          Forwards call to the delegate 55 .
 boolean stopCellEditing()
          Forwards call to the delegate 55 .
 
Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.CellEditor
addCellEditorListener, removeCellEditorListener
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

editorComponent

protected JComponent editorComponent
The Swing JComponent, performing the editing session.


delegate

protected DefaultCellEditor.EditorDelegate delegate
The editor delegate, responsible for listening the editorComponent 55 events and getting/setting its value.


clickCountToStart

protected int clickCountToStart
The number of the mouse clicks, required to start the editing session.

Constructor Detail

DefaultCellEditor

public DefaultCellEditor(JTextField textfield)
Create the DefaultCellEditor that uses the text field as its editor component (appropriate for the text content)


DefaultCellEditor

public DefaultCellEditor(JCheckBox checkbox)
Constructor DefaultCellEditor that uses the checkbox (appropriate for boolean values)


DefaultCellEditor

public DefaultCellEditor(JComboBox combobox)
Constructor DefaultCellEditor that uses the combo box.

Method Detail

getComponent

public java.awt.Component getComponent()
Get the component that performs the editing sessions. It is the same component that was passed in constructor.


getClickCountToStart

public int getClickCountToStart()
Get the number of mouse clicks, required to start the editing session.


setClickCountToStart

public void setClickCountToStart(int count)
Set the number of mouse clicks, required to start the editing session.


getCellEditorValue

public java.lang.Object getCellEditorValue()
Get the value, currently being displayed by the editor component. The call is forwarded to the delegate 55 .

Specified by:
getCellEditorValue in interface CellEditor

isCellEditable

public boolean isCellEditable(java.util.EventObject event)
Forwards call to the delegate 55 .

Specified by:
isCellEditable in interface CellEditor
Overrides:
isCellEditable in class AbstractCellEditor

shouldSelectCell

public boolean shouldSelectCell(java.util.EventObject event)
Forwards call to the delegate 55 .

Specified by:
shouldSelectCell in interface CellEditor
Overrides:
shouldSelectCell in class AbstractCellEditor

stopCellEditing

public boolean stopCellEditing()
Forwards call to the delegate 55 .

Specified by:
stopCellEditing in interface CellEditor
Overrides:
stopCellEditing in class AbstractCellEditor

cancelCellEditing

public void cancelCellEditing()
Forwards call to the delegate 55 .

Specified by:
cancelCellEditing in interface CellEditor
Overrides:
cancelCellEditing in class AbstractCellEditor

getTreeCellEditorComponent

public java.awt.Component getTreeCellEditorComponent(JTree tree,
                                                     java.lang.Object value,
                                                     boolean isSelected,
                                                     boolean expanded,
                                                     boolean leaf,
                                                     int row)
Sets an initial value for the editor. This will cause the editor to stopEditing and lose any partially edited value if the editor is editing when this method is called. Returns the component that should be added to the client's Component hierarchy. Once installed in the client's hierarchy this component will then be able to draw and receive user input.

Specified by:
getTreeCellEditorComponent in interface javax.swing.tree.TreeCellEditor

getTableCellEditorComponent

public java.awt.Component getTableCellEditorComponent(JTable table,
                                                      java.lang.Object value,
                                                      boolean isSelected,
                                                      int row,
                                                      int column)
Get the cell editor component that will perform the editing session. If returned once, the same component is also returned on the repetetive calls again (reused).

Specified by:
getTableCellEditorComponent in interface javax.swing.table.TableCellEditor