JIDE 3.5.15

com.jidesoft.grid
Class LegacyEnumCellEditor

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

public class LegacyEnumCellEditor
extends LegacyListComboBoxCellEditor

A cell editor that based on ListComboBoxCellEditor. It use EnumConverter. For example, in SwingConstants, the following values are defined.

 public static final int CENTER  = 0;
 public static final int TOP     = 1;
 public static final int LEFT    = 2;
 public static final int BOTTOM  = 3;
 public static final int RIGHT   = 4;
 
When you want user to choose one of the value above from a table's cell editor, you don't want to use 0, 1, 2, 3, 4 as the value in combobox as it doesn't mean anything from user point of view. You want user to be able to use meaningful names such as "Center", "Top", "Left", "Bottom", "Right". This is what EnumCellEditor can do it for you. First, you need to define a EnumConverter, then register it with ObjectConverterManager. Then define a EnumCellEditor and register with CellEditorManager. See code example below.
 EnumConverter locationConverter = new EnumConverter("Location", int.class,
       new Object[]{
           new Integer(SwingConstants.CENTER),
           new Integer(SwingConstants.TOP),
           new Integer(SwingConstants.LEFT),
           new Integer(SwingConstants.BOTTOM),
           new Integer(SwingConstants.RIGHT)
       },
       new String[]{
           "Center",
           "Top",
           "Left",
           "Bottom",
           "Right"
       }, new Integer(SwingConstants.HORIZONTAL));
 ObjectConverterManager.registerConverter(locationConverter.getType(), locationConverter,
 locationConverter.getContext());
 LegacyEnumCellRenderer locationCellRenderer = new LegacyEnumCellRenderer(locationConverter);
 CellRendererManager.registerRenderer(locationConverter.getType(), locationCellRenderer,
 locationCellRenderer.getContext());
 EnumCellEditor locationCellEditor = new LegacyEnumCellEditor(locationConverter);
 CellEditorManager.registerEditor(locationConverter.getType(), locationCellEditor, locationCellEditor.getContext());
 

See Also:
Serialized Form

Field Summary
 
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
LegacyEnumCellEditor(EnumConverter enumConverter)
           
 
Method Summary
 EditorContext getContext()
           
 
Methods inherited from class com.jidesoft.grid.LegacyListComboBoxCellEditor
createAbstractComboBox, createAbstractComboBox, createListComboBox, setConverterContext, setPossibleValues
 
Methods inherited from class com.jidesoft.grid.AbstractComboBoxCellEditor
actionPerformed, customizeAbstractComboBox, getCellEditorValue, getComboBox, getTableCellEditorComponent, isEditorStyleSupported, itemStateChanged, popupMenuCanceled, popupMenuWillBecomeInvisible, popupMenuWillBecomeVisible, setCellEditorValue, setConverter, stopCellEditing
 
Methods inherited from class com.jidesoft.grid.ContextSensitiveCellEditor
getConverter, getConverterContext, getEditorContext, getEditorStyle, getType, isUseConverterContext, setEditorContext, setEditorStyle, setType, setUseConverterContext
 
Methods inherited from class com.jidesoft.grid.AbstractJideCellEditor
addValidationListener, getClickCountToStart, getDefaultErrorBehavior, getValidationListeners, isAutoStopCellEditing, isCellEditable, isPassEnterKeyToTable, removeValidationListener, setAutoStopCellEditing, setClickCountToStart, setDefaultErrorBehavior, setPassEnterKeyToTable, validate
 
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
 

Constructor Detail

LegacyEnumCellEditor

public LegacyEnumCellEditor(EnumConverter enumConverter)
Method Detail

getContext

public EditorContext getContext()

JIDE 3.5.15