JIDE 3.5.15

com.jidesoft.grid
Class LegacyDateCellEditor

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.AbstractComboBoxCellEditor
                  extended by com.jidesoft.grid.LegacyDateCellEditor
All Implemented Interfaces:
ConverterContextSupport, EditorContextSupport, EditorStyleSupport, JideCellEditor, ActionListener, ItemListener, Serializable, EventListener, CellEditor, PopupMenuListener, TableCellEditor

public class LegacyDateCellEditor
extends AbstractComboBoxCellEditor

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

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.AbstractComboBoxCellEditor
_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
LegacyDateCellEditor()
          Creates a LegacyDateCellEditor.
LegacyDateCellEditor(boolean useDate)
          Creates a LegacyDateCellEditor.
LegacyDateCellEditor(DateModel dateModel)
          Creates a LegacyDateCellEditor with a date model.
LegacyDateCellEditor(DateModel dateModel, boolean useDate)
          Creates a LegacyDateCellEditor with a date model.
 
Method Summary
 AbstractComboBox createAbstractComboBox()
          Creates the date combobox used by this cell editor.
protected  DateComboBox createDateComboBox()
           
 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.AbstractComboBoxCellEditor
actionPerformed, createAbstractComboBox, customizeAbstractComboBox, getComboBox, getTableCellEditorComponent, isEditorStyleSupported, itemStateChanged, popupMenuCanceled, popupMenuWillBecomeInvisible, popupMenuWillBecomeVisible, setConverter, stopCellEditing
 
Methods inherited from class com.jidesoft.grid.ContextSensitiveCellEditor
getConverter, getConverterContext, getEditorContext, getEditorStyle, getType, isUseConverterContext, setConverterContext, setEditorContext, setEditorStyle, setType, 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

LegacyDateCellEditor

public LegacyDateCellEditor()
Creates a LegacyDateCellEditor.


LegacyDateCellEditor

public LegacyDateCellEditor(boolean useDate)
Creates a LegacyDateCellEditor.

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.

LegacyDateCellEditor

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

Parameters:
dateModel - the new DateModel.

LegacyDateCellEditor

public LegacyDateCellEditor(DateModel dateModel,
                            boolean useDate)
Creates a LegacyDateCellEditor 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

createAbstractComboBox

public AbstractComboBox createAbstractComboBox()
Creates the date combobox used by this cell editor.

Specified by:
createAbstractComboBox in class AbstractComboBoxCellEditor
Returns:
the date combobox.

createDateComboBox

protected DateComboBox createDateComboBox()

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 AbstractComboBoxCellEditor
Returns:
the value of the cell editor

setCellEditorValue

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

Overrides:
setCellEditorValue in class AbstractComboBoxCellEditor
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