org.sape.carbon.services.console
Class AttributeCellEditor

java.lang.Object
  |
  +--javax.swing.AbstractCellEditor
        |
        +--org.sape.carbon.services.console.AttributeCellEditor
All Implemented Interfaces:
CellEditor, Serializable

public class AttributeCellEditor
extends AbstractCellEditor

This implementation of CellEditor suports the editing of basic data types. It supports CarbonBase enums as a dropdown list, arrays as tabular data, booleans as checkboxes and text fields for everything else.

Copyright 2002 Sapient

Since:
carbon 1.0
Version:
$Revision: 1.4 $($Author: ghinkl $ / $Date: 2003/04/04 01:11:48 $)
Author:
Greg Hinkle, January 2002
See Also:
Serialized Form

Nested Class Summary
protected  class AttributeCellEditor.EditorDelegate
          The protected EditorDelegate class.
 
Field Summary
protected  int clickCountToStart
          An integer specifying the number of clicks needed to start editing.
protected  AttributeCellEditor.EditorDelegate delegate
          The delegate class which handles all methods sent from the CellEditor.
private  boolean editable
          true if the object may be altered
protected  JComponent editorComponent
          The Swing component being edited.
private  Class type
          The class type of the data being edited
private  Object value
          The object value of the data
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
AttributeCellEditor(Class type, Object value, boolean editable)
          Constructs a cell editor to handle the editing of values.
 
Method Summary
private  JComponent buildComponent(Class type, Object valuable, boolean editable)
           
 void cancelCellEditing()
          Forwards the message from the CellEditor to the delegate.
 Object getCellEditorValue()
          Forwards the message from the CellEditor to the delegate.
 int getClickCountToStart()
          Returns the number of clicks needed to start editing.
 Component getComponent()
          Returns a reference to the editor component.
 boolean isCellEditable(EventObject anEvent)
          Forwards the message from the CellEditor to the delegate.
 void setClickCountToStart(int count)
          Specifies the number of clicks needed to start editing.
 boolean shouldSelectCell(EventObject anEvent)
          Forwards the message from the CellEditor to the delegate.
 boolean stopCellEditing()
          Forwards the message from the CellEditor to the delegate.
 
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
 

Field Detail

editorComponent

protected JComponent editorComponent
The Swing component being edited.


delegate

protected AttributeCellEditor.EditorDelegate delegate
The delegate class which handles all methods sent from the CellEditor.


clickCountToStart

protected int clickCountToStart
An integer specifying the number of clicks needed to start editing. Even if clickCountToStart is defined as zero, it will not initiate until a click occurs.


type

private Class type
The class type of the data being edited


value

private Object value
The object value of the data


editable

private boolean editable
true if the object may be altered

Constructor Detail

AttributeCellEditor

public AttributeCellEditor(Class type,
                           Object value,
                           boolean editable)
Constructs a cell editor to handle the editing of values.

Parameters:
type - the class type of teh data being edited
value - the value object that is edited
editable - true if the value can be edited
Method Detail

getComponent

public Component getComponent()
Returns a reference to the editor component.

Returns:
the editor Component

buildComponent

private JComponent buildComponent(Class type,
                                  Object valuable,
                                  boolean editable)

setClickCountToStart

public void setClickCountToStart(int count)
Specifies the number of clicks needed to start editing.

Parameters:
count - an int specifying the number of clicks needed to start editing
See Also:
getClickCountToStart()

getClickCountToStart

public int getClickCountToStart()
Returns the number of clicks needed to start editing.


getCellEditorValue

public Object getCellEditorValue()
Forwards the message from the CellEditor to the delegate.

See Also:
AttributeCellEditor.EditorDelegate.getCellEditorValue()

isCellEditable

public boolean isCellEditable(EventObject anEvent)
Forwards the message from the CellEditor to the delegate.

Specified by:
isCellEditable in interface CellEditor
Overrides:
isCellEditable in class AbstractCellEditor
See Also:
AttributeCellEditor.EditorDelegate.isCellEditable(EventObject)

shouldSelectCell

public boolean shouldSelectCell(EventObject anEvent)
Forwards the message from the CellEditor to the delegate.

Specified by:
shouldSelectCell in interface CellEditor
Overrides:
shouldSelectCell in class AbstractCellEditor
See Also:
AttributeCellEditor.EditorDelegate.shouldSelectCell(EventObject)

stopCellEditing

public boolean stopCellEditing()
Forwards the message from the CellEditor to the delegate.

Specified by:
stopCellEditing in interface CellEditor
Overrides:
stopCellEditing in class AbstractCellEditor
See Also:
AttributeCellEditor.EditorDelegate.stopCellEditing()

cancelCellEditing

public void cancelCellEditing()
Forwards the message from the CellEditor to the delegate.

Specified by:
cancelCellEditing in interface CellEditor
Overrides:
cancelCellEditing in class AbstractCellEditor
See Also:
AttributeCellEditor.EditorDelegate.cancelCellEditing()


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.