com.sciapp.editors
Class DateEditor

java.lang.Object
  extended by com.sciapp.editors.DateEditor
All Implemented Interfaces:
CellEditor, TableCellEditor

public class DateEditor
extends Object
implements TableCellEditor

An editor for table and tree cells that handles the editing of Date objects.


Field Summary
protected  ChangeEvent changeEvent
          The ChangeEvent fired when editing is stopped or canceled.
protected  Date currentDate
          the date selected
protected  JDateChooser dateChooser
          the date chooser component
protected  JDialog dialog
          the dialog component
protected  EventListenerList listenerList
          The listenerlist of CellEditorListeners.
 
Constructor Summary
DateEditor()
          Constructs a DateEditor object that uses a Dialog component to edit dates.
 
Method Summary
 void addCellEditorListener(CellEditorListener l)
          Adds a CellEditorListener to the listener list.
 void cancelCellEditing()
          Tells the editor to cancel editing and not accept any partially edited value.
protected  void fireEditingCanceled()
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireEditingStopped()
          Notifies all listeners that have registered interest for notification on this event type.
 Object getCellEditorValue()
          Returns the value contained in the editor.
 Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
          Implementation of the one method defined by javax.swing.table.TableCellEditor.
 boolean isCellEditable(EventObject e)
          Returns true.
 void removeCellEditorListener(CellEditorListener l)
          Removes a CellEditorListener from the listener list.
 boolean shouldSelectCell(EventObject anEvent)
          Returns true.
 boolean stopCellEditing()
          Calls fireEditingStopped and returns true.
 void updateUI()
          Updates the DateEditor's dialog UI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentDate

protected Date currentDate
the date selected


dialog

protected JDialog dialog
the dialog component


dateChooser

protected JDateChooser dateChooser
the date chooser component


listenerList

protected EventListenerList listenerList
The listenerlist of CellEditorListeners.


changeEvent

protected transient ChangeEvent changeEvent
The ChangeEvent fired when editing is stopped or canceled.

Constructor Detail

DateEditor

public DateEditor()
Constructs a DateEditor object that uses a Dialog component to edit dates.

Method Detail

addCellEditorListener

public void addCellEditorListener(CellEditorListener l)
Adds a CellEditorListener to the listener list.

Specified by:
addCellEditorListener in interface CellEditor
Parameters:
l - the new listener to be added

cancelCellEditing

public void cancelCellEditing()
Tells the editor to cancel editing and not accept any partially edited value.

Specified by:
cancelCellEditing in interface CellEditor

fireEditingCanceled

protected void fireEditingCanceled()
Notifies all listeners that have registered interest for notification on this event type.

See Also:
EventListenerList

fireEditingStopped

protected void fireEditingStopped()
Notifies all listeners that have registered interest for notification on this event type.

See Also:
EventListenerList

getCellEditorValue

public Object getCellEditorValue()
Returns the value contained in the editor. This value is a Date object.

Specified by:
getCellEditorValue in interface CellEditor
Returns:
the value contained in the editor.

getTableCellEditorComponent

public Component getTableCellEditorComponent(JTable table,
                                             Object value,
                                             boolean isSelected,
                                             int row,
                                             int column)
Implementation of the one method defined by javax.swing.table.TableCellEditor.

Specified by:
getTableCellEditorComponent in interface TableCellEditor
Parameters:
table - the JTable that is asking the editor to edit; can be null
value - the value of the cell to be edited; it is up to the specific editor to interpret and draw the value. For example, if value is the string "true", it could be rendered as a string or it could be rendered as a check box that is checked. null is a valid value
isSelected - true if the cell is to be rendered with highlighting
row - the row of the cell being edited
column - the column of the cell being edited
Returns:
the component for editing

isCellEditable

public boolean isCellEditable(EventObject e)
Returns true.

Specified by:
isCellEditable in interface CellEditor
Parameters:
e - an event object
Returns:
true
See Also:
CellEditor.shouldSelectCell(java.util.EventObject)

removeCellEditorListener

public void removeCellEditorListener(CellEditorListener l)
Removes a CellEditorListener from the listener list.

Specified by:
removeCellEditorListener in interface CellEditor
Parameters:
l - the listener to be removed

shouldSelectCell

public boolean shouldSelectCell(EventObject anEvent)
Returns true.

Specified by:
shouldSelectCell in interface CellEditor
Parameters:
anEvent - an event object
Returns:
true
See Also:
CellEditor.isCellEditable(java.util.EventObject)

stopCellEditing

public boolean stopCellEditing()
Calls fireEditingStopped and returns true.

Specified by:
stopCellEditing in interface CellEditor
Returns:
true

updateUI

public void updateUI()
Updates the DateEditor's dialog UI.