de.jaret.util.ui.table.editor
Class DateCellEditor

java.lang.Object
  extended by de.jaret.util.ui.table.editor.CellEditorBase
      extended by de.jaret.util.ui.table.editor.DateCellEditor
All Implemented Interfaces:
de.jaret.util.ui.datechooser.IDateChooserListener, ICellEditor, java.util.EventListener, org.eclipse.swt.events.FocusListener, org.eclipse.swt.internal.SWTEventListener

public class DateCellEditor
extends CellEditorBase
implements ICellEditor, de.jaret.util.ui.datechooser.IDateChooserListener, org.eclipse.swt.events.FocusListener

Cell editor for editing dates using the jaret datechooser. Supports java.util.date and JaretDate. The fieldidentifier used for the datechooser (see Javadoc there) is not locale dependant (Day/Month/year) have to be changed when used in another country (or removed!).

Key bindings: TAB and CR will leave the datechooser (positive). ESC will leave the chooser resetting the date to the value present when editing started.

Version:
$Id: DateCellEditor.java 602 2007-10-19 05:42:14Z olk $
Author:
Peter Kliem

Field Summary
protected  de.jaret.util.ui.datechooser.DateChooser _chooser
          chooser component.
protected  de.jaret.util.date.JaretDate _oldJaretDateVal
          old JaretDate value if present.
protected  java.util.Date _oldVal
          old java.util.Date val if present.
 
Fields inherited from class de.jaret.util.ui.table.editor.CellEditorBase
_column, _row, _table
 
Constructor Summary
DateCellEditor()
           
 
Method Summary
 void choosingCanceled()
           When the chooser tells us the user canceled the editing, restore the old date.
 void dateChosen(java.util.Date date)
           If the users choses a date, stop editing an store the chosen date.
 void dateIntermediateChange(java.util.Date date)
           No Action on intermediate changes in the chooser.
 void dispose()
          Dispose whatever resouces have been allocated.
 void focusGained(org.eclipse.swt.events.FocusEvent e)
           Do nothing on focus gained.
 void focusLost(org.eclipse.swt.events.FocusEvent e)
           When loosing focus, stop the editing and store the value.
 org.eclipse.swt.widgets.Control getEditorControl(JaretTable table, IRow row, IColumn column, char typedKey)
          Provide the Control for editing the value at row/column.
 void inputInvalid()
           nothing to do.
 void stopEditing(boolean storeInput)
          End editing.
 
Methods inherited from class de.jaret.util.ui.table.editor.CellEditorBase
getPreferredHeight, handleClick
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.jaret.util.ui.table.editor.ICellEditor
getPreferredHeight, handleClick
 

Field Detail

_chooser

protected de.jaret.util.ui.datechooser.DateChooser _chooser
chooser component.


_oldVal

protected java.util.Date _oldVal
old java.util.Date val if present.


_oldJaretDateVal

protected de.jaret.util.date.JaretDate _oldJaretDateVal
old JaretDate value if present.

Constructor Detail

DateCellEditor

public DateCellEditor()
Method Detail

getEditorControl

public org.eclipse.swt.widgets.Control getEditorControl(JaretTable table,
                                                        IRow row,
                                                        IColumn column,
                                                        char typedKey)
Provide the Control for editing the value at row/column. Important: make shure _not_ to create a new control with every call!

This method may return null indicating that the editor will not supply a control.

Base implementation storing the table and row/col information.

Specified by:
getEditorControl in interface ICellEditor
Overrides:
getEditorControl in class CellEditorBase
Parameters:
table - the table requesting the editor
row - row
column - column
typedKey - the character typed when invoking the editor (may be 0 if the editor was invoked without typing any key)
Returns:
configured Control (parent has to be the table)

stopEditing

public void stopEditing(boolean storeInput)
End editing.

Specified by:
stopEditing in interface ICellEditor
Parameters:
storeInput - if true the editor shall save the current input.

dispose

public void dispose()
Dispose whatever resouces have been allocated.

Specified by:
dispose in interface ICellEditor
Overrides:
dispose in class CellEditorBase

dateChosen

public void dateChosen(java.util.Date date)
If the users choses a date, stop editing an store the chosen date.

Specified by:
dateChosen in interface de.jaret.util.ui.datechooser.IDateChooserListener

dateIntermediateChange

public void dateIntermediateChange(java.util.Date date)
No Action on intermediate changes in the chooser.

Specified by:
dateIntermediateChange in interface de.jaret.util.ui.datechooser.IDateChooserListener

choosingCanceled

public void choosingCanceled()
When the chooser tells us the user canceled the editing, restore the old date.

Specified by:
choosingCanceled in interface de.jaret.util.ui.datechooser.IDateChooserListener

inputInvalid

public void inputInvalid()
nothing to do.

Specified by:
inputInvalid in interface de.jaret.util.ui.datechooser.IDateChooserListener

focusGained

public void focusGained(org.eclipse.swt.events.FocusEvent e)
Do nothing on focus gained.

Specified by:
focusGained in interface org.eclipse.swt.events.FocusListener

focusLost

public void focusLost(org.eclipse.swt.events.FocusEvent e)
When loosing focus, stop the editing and store the value.

Specified by:
focusLost in interface org.eclipse.swt.events.FocusListener


Copyright © 2012. All Rights Reserved.