JIDE 3.5.15

com.jidesoft.grid
Class DateCellEditor

java.lang.Object
  extended by javax.swing.AbstractCellEditor
      extended by com.jidesoft.grid.AbstractJideCellEditor
          extended by com.jidesoft.grid.ContextSensitiveCellEditor
              extended by com.jidesoft.grid.ExComboBoxCellEditor
                  extended by com.jidesoft.grid.DateCellEditor
All Implemented Interfaces:
ConverterContextSupport, EditorContextSupport, EditorStyleSupport, JideCellEditor, ActionListener, Serializable, EventListener, CellEditor, PopupMenuListener, TableCellEditor

public class DateCellEditor
extends ExComboBoxCellEditor

CellEditor for Date or Calendar. It uses DateExComboBox to provide an editor for Date or Calendar. You can override createDateComboBox() method to provide your own DateExComboBox.

See Also:
Serialized Form

Field Summary
static EditorContext DATETIME_CONTEXT
           
static int TYPE_SQL_DATE
           
static int TYPE_SQL_TIME
           
static int TYPE_SQL_TIMESTAMP
           
static int TYPE_UTIL_CALENDAR
           
static int TYPE_UTIL_DATE
           
 
Fields inherited from class com.jidesoft.grid.ExComboBoxCellEditor
_comboBox
 
Fields inherited from class com.jidesoft.grid.ContextSensitiveCellEditor
DEFAULT_CELL_EDITOR_BORDER
 
Fields inherited from class com.jidesoft.grid.AbstractJideCellEditor
_clickCountToStart
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
DateCellEditor()
          Creates a DateCellEditor.
DateCellEditor(boolean useDate)
          Creates a DateCellEditor.
DateCellEditor(DateModel dateModel)
          Creates a DateCellEditor with a date model.
DateCellEditor(DateModel dateModel, boolean useDate)
          Creates a DateCellEditor with a date model.
 
Method Summary
protected  DateExComboBox createDateComboBox()
          Creates the DateExComboBox.
 ExComboBox createExComboBox()
          Creates the date combobox used by this cell editor.
 Object getCellEditorValue()
          Gets the value of the cell editor.
 int getDataType()
          Gets the date type.
 boolean isTimeDisplayed()
          Checks if the time is displayed.
 void setCellEditorValue(Object value)
          Sets the value to the combobox.
 void setDataType(int dataType)
          Sets the date type.
 void setTimeDisplayed(boolean timeDisplayed)
          Sets the timeDisplayed property.
 ValidationResult validate(Object oldValue, Object newValue)
          Validates date using DateModel.
 
Methods inherited from class com.jidesoft.grid.ExComboBoxCellEditor
actionPerformed, createExComboBox, customizeExComboBox, getComboBox, getTableCellEditorComponent, isEditorStyleSupported, popupMenuCanceled, popupMenuWillBecomeInvisible, popupMenuWillBecomeVisible, setConverter, setType, stopCellEditing
 
Methods inherited from class com.jidesoft.grid.ContextSensitiveCellEditor
getConverter, getConverterContext, getEditorContext, getEditorStyle, getType, isUseConverterContext, setConverterContext, setEditorContext, setEditorStyle, setUseConverterContext
 
Methods inherited from class com.jidesoft.grid.AbstractJideCellEditor
addValidationListener, getClickCountToStart, getDefaultErrorBehavior, getValidationListeners, isAutoStopCellEditing, isCellEditable, isPassEnterKeyToTable, removeValidationListener, setAutoStopCellEditing, setClickCountToStart, setDefaultErrorBehavior, setPassEnterKeyToTable
 
Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListener, shouldSelectCell
 
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, cancelCellEditing, isCellEditable, removeCellEditorListener, shouldSelectCell
 

Field Detail

DATETIME_CONTEXT

public static final EditorContext DATETIME_CONTEXT

TYPE_UTIL_CALENDAR

public static final int TYPE_UTIL_CALENDAR
See Also:
Constant Field Values

TYPE_UTIL_DATE

public static final int TYPE_UTIL_DATE
See Also:
Constant Field Values

TYPE_SQL_DATE

public static final int TYPE_SQL_DATE
See Also:
Constant Field Values

TYPE_SQL_TIME

public static final int TYPE_SQL_TIME
See Also:
Constant Field Values

TYPE_SQL_TIMESTAMP

public static final int TYPE_SQL_TIMESTAMP
See Also:
Constant Field Values
Constructor Detail

DateCellEditor

public DateCellEditor()
Creates a DateCellEditor.


DateCellEditor

public DateCellEditor(boolean useDate)
Creates a DateCellEditor.

Parameters:
useDate - true or false. If useDate is true, getCellEditorValue() will return an instance of Date. Otherwise it will return an instance of Calendar. Default is false.

DateCellEditor

public DateCellEditor(DateModel dateModel)
Creates a DateCellEditor with a date model.

Parameters:
dateModel - the new DateModel.

DateCellEditor

public DateCellEditor(DateModel dateModel,
                      boolean useDate)
Creates a DateCellEditor with a date model.

Parameters:
dateModel - the new DateModel.
useDate - true or false. If useDate is true, getCellEditorValue() will return an instance of Date. Otherwise it will return an instance of Calendar. Default is false.
Method Detail

createExComboBox

public ExComboBox createExComboBox()
Creates the date combobox used by this cell editor.

Specified by:
createExComboBox in class ExComboBoxCellEditor
Returns:
the date combobox.

createDateComboBox

protected DateExComboBox createDateComboBox()
Creates the DateExComboBox.

Returns:
the date combobox.

getDataType

public int getDataType()
Gets the date type. The type could be one of the followings: TYPE_UTIL_DATE, TYPE_UTIL_CALENDAR, TYPE_SQL_DATE, TYPE_SQL_TIME and TYPE_SQL_TIMESTAMP. They are corresponding to java.util.Date, java.util.Calendar, java.sql.Date and java.sql.Time respectively. The getCellEditorValue will return the data type as specified.

Returns:
the data type.

setDataType

public void setDataType(int dataType)
Sets the date type. The type could be one of the followings: TYPE_UTIL_DATE, TYPE_UTIL_CALENDAR, TYPE_SQL_DATE, TYPE_SQL_TIME and TYPE_SQL_TIMESTAMP. They are corresponding to java.util.Date, java.util.Calendar, java.sql.Date and java.sql.Time respectively. The getCellEditorValue will return the data type as specified.

Parameters:
dataType - the data type.

getCellEditorValue

public Object getCellEditorValue()
Gets the value of the cell editor.

Specified by:
getCellEditorValue in interface CellEditor
Overrides:
getCellEditorValue in class ExComboBoxCellEditor
Returns:
the value of the cell editor

setCellEditorValue

public void setCellEditorValue(Object value)
Description copied from class: ExComboBoxCellEditor
Sets the value to the combobox. By default, it will use setSelectedItem(value, false) to set the value.

Overrides:
setCellEditorValue in class ExComboBoxCellEditor
Parameters:
value - the new value.

validate

public ValidationResult validate(Object oldValue,
                                 Object newValue)
Validates date using DateModel.

Specified by:
validate in interface JideCellEditor
Overrides:
validate in class AbstractJideCellEditor
Parameters:
oldValue - the old value.
newValue - the new value.
Returns:
validation result.

isTimeDisplayed

public boolean isTimeDisplayed()
Checks if the time is displayed.

Returns:
true or false.

setTimeDisplayed

public void setTimeDisplayed(boolean timeDisplayed)
Sets the timeDisplayed property. If this property is true, the DateChooserPanel will show a time spinner so that user can change time.

Parameters:
timeDisplayed - true or false.

JIDE 3.5.15