com.metamatrix.toolbox.ui.widget.table
Class DefaultTableCellEditor

java.lang.Object
  extended by com.metamatrix.toolbox.ui.widget.table.DefaultTableCellEditor
All Implemented Interfaces:
javax.swing.CellEditor, javax.swing.SwingConstants, javax.swing.table.TableCellEditor

public class DefaultTableCellEditor
extends java.lang.Object
implements javax.swing.SwingConstants, javax.swing.table.TableCellEditor

This is the default cell editor for TableWidgets. It edits boolean values using CheckBoxes and numeric values using right- justified TextFields.

Since:
2.0
Version:
2.0
Author:
John P. A. Verhaeg

Nested Class Summary
protected  class DefaultTableCellEditor.Delegate
           
 
Field Summary
static java.lang.String CLICK_COUNT_TO_START_PROPERTY
           
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
DefaultTableCellEditor()
           
 
Method Summary
 void addCellEditorListener(javax.swing.event.CellEditorListener listener)
          Registers the specified listener to be notified of changes to the editor.
 void cancelCellEditing()
          Fires a ChangeEvent to all registered CellEditorListeners via the editingCanceled method.
 java.lang.Object getCellEditorValue()
           
protected  CheckBox getCheckBox()
           
 int getClickCountToStart()
           
 java.awt.Component getTableCellEditorComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, int rowIndex, int columnIndex)
           
protected  TextFieldWidget getTextField()
           
protected  void initializeComponent(java.awt.Component component, javax.swing.JTable table, java.lang.Object value, boolean isSelected, int rowIndex, int columnIndex)
           
 boolean isCellEditable(java.util.EventObject event)
           
 void removeCellEditorListener(javax.swing.event.CellEditorListener listener)
          Unregisters the specified listener.
 void setCellEditorValue(java.lang.Object value)
           
 void setClickCountToStart(int clickCountToStart)
          Sets the number of mouse clicks required before the cell begins editing.
protected  void setDelegate(DefaultTableCellEditor.Delegate delegate, java.lang.Object value)
          Sets the delegate property to the specified delegate and initializes its value to the specified value.
 boolean shouldSelectCell(java.util.EventObject event)
           
 boolean stopCellEditing()
          Fires a ChangeEvent to all registered CellEditorListeners via the editingStopped method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLICK_COUNT_TO_START_PROPERTY

public static final java.lang.String CLICK_COUNT_TO_START_PROPERTY
See Also:
Constant Field Values
Constructor Detail

DefaultTableCellEditor

public DefaultTableCellEditor()
Method Detail

addCellEditorListener

public void addCellEditorListener(javax.swing.event.CellEditorListener listener)
Registers the specified listener to be notified of changes to the editor.

Specified by:
addCellEditorListener in interface javax.swing.CellEditor
Parameters:
listener - A CellEditorListener
Since:
2.0

cancelCellEditing

public void cancelCellEditing()
Fires a ChangeEvent to all registered CellEditorListeners via the editingCanceled method.

Specified by:
cancelCellEditing in interface javax.swing.CellEditor
Since:
2.0

getCellEditorValue

public java.lang.Object getCellEditorValue()
Specified by:
getCellEditorValue in interface javax.swing.CellEditor
Returns:
The editor component's value
Since:
2.0

getCheckBox

protected CheckBox getCheckBox()
Since:
3.0

getClickCountToStart

public int getClickCountToStart()
Returns:
The number of mouse clicks required before the cell begins editing.
Since:
2.0

getTableCellEditorComponent

public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table,
                                                      java.lang.Object value,
                                                      boolean isSelected,
                                                      int rowIndex,
                                                      int columnIndex)
Specified by:
getTableCellEditorComponent in interface javax.swing.table.TableCellEditor
Since:
2.0

getTextField

protected TextFieldWidget getTextField()
Since:
3.0

initializeComponent

protected void initializeComponent(java.awt.Component component,
                                   javax.swing.JTable table,
                                   java.lang.Object value,
                                   boolean isSelected,
                                   int rowIndex,
                                   int columnIndex)
Since:
2.1

isCellEditable

public boolean isCellEditable(java.util.EventObject event)
Specified by:
isCellEditable in interface javax.swing.CellEditor
Parameters:
event - An event object (usually a MouseEvent)
Returns:
True if the cell should start editing
Since:
2.0

removeCellEditorListener

public void removeCellEditorListener(javax.swing.event.CellEditorListener listener)
Unregisters the specified listener.

Specified by:
removeCellEditorListener in interface javax.swing.CellEditor
Parameters:
listener - A CellEditorListener
Since:
2.0

setCellEditorValue

public void setCellEditorValue(java.lang.Object value)
Since:
3.0

setClickCountToStart

public void setClickCountToStart(int clickCountToStart)
Sets the number of mouse clicks required before the cell begins editing.

Parameters:
clickCountToStart - The number of mouse clicks
Since:
2.0

setDelegate

protected void setDelegate(DefaultTableCellEditor.Delegate delegate,
                           java.lang.Object value)
Sets the delegate property to the specified delegate and initializes its value to the specified value. The delegate is used by the getCellEditorValue method.

Since:
2.0

shouldSelectCell

public boolean shouldSelectCell(java.util.EventObject event)
Specified by:
shouldSelectCell in interface javax.swing.CellEditor
Parameters:
event - An event object (usually a MouseEvent)
Returns:
True
Since:
2.0

stopCellEditing

public boolean stopCellEditing()
Fires a ChangeEvent to all registered CellEditorListeners via the editingStopped method.

Specified by:
stopCellEditing in interface javax.swing.CellEditor
Returns:
True
Since:
2.0


Copyright © 2009. All Rights Reserved.