com.jidesoft.grid
Class TristateCheckBoxCellEditor
java.lang.Object
javax.swing.AbstractCellEditor
com.jidesoft.grid.AbstractJideCellEditor
com.jidesoft.grid.ContextSensitiveCellEditor
com.jidesoft.grid.TristateCheckBoxCellEditor
- All Implemented Interfaces:
- ConverterContextSupport, EditorContextSupport, EditorStyleSupport, JideCellEditor, ActionListener, Serializable, EventListener, CellEditor, TableCellEditor
public class TristateCheckBoxCellEditor
- extends ContextSensitiveCellEditor
- implements TableCellEditor, ActionListener
CellEditor based on TristateCheckBox. It uses int or Integer as the data type. 0 means not selected, 1 means selected
and 2 means partially selected. If you want to use some other data types or change the meaning of integers, you need
to override both setCellEditorValue(Object)
and getCellEditorValue()
.
The check box is center aligned by default. If you want to make it left aligned, you can use the code below to change
it.
CellEditorManager.initDefaultEditor();
CellEditorFactory editorFactory = new CellEditorFactory() {
public CellEditor create() {
return new TristateCheckBoxCellEditor() {
protected void configureCheckBox() {
super.configureCheckBox();
_checkBox.setHorizontalAlignment(SwingConstants.LEFT);
}
};
}
};
CellEditorManager.registerEditor(int.class, editorFactory, TristateCheckBoxCellEditor.CONTEXT);
CellEditorManager.registerEditor(Integer.class, editorFactory, TristateCheckBoxCellEditor.CONTEXT);
- See Also:
- Serialized Form
Constructor Summary |
TristateCheckBoxCellEditor()
Creates a ListComboBoxCellEditor that contains the elements in the specified array. |
Methods inherited from class com.jidesoft.grid.ContextSensitiveCellEditor |
getConverter, getConverterContext, getEditorContext, getEditorStyle, getType, isEditorStyleSupported, isUseConverterContext, setConverter, 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, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CONTEXT
public static EditorContext CONTEXT
_checkBox
protected TristateCheckBox _checkBox
TristateCheckBoxCellEditor
public TristateCheckBoxCellEditor()
- Creates a
ListComboBoxCellEditor
that contains the elements in the specified array. By default the
first item in the array (and therefore the data model) becomes selected.
createCheckBox
protected TristateCheckBox createCheckBox()
- Creates the check box.
- Returns:
- the check box.
configureCheckBox
protected void configureCheckBox()
- Configures the check box. The default implementation will set horizontal alignment to center and set border to
empty border.
getCellEditorValue
public Object getCellEditorValue()
- Specified by:
getCellEditorValue
in interface CellEditor
setCellEditorValue
public void setCellEditorValue(Object value)
getTableCellEditorComponent
public Component getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
- Specified by:
getTableCellEditorComponent
in interface TableCellEditor
customizeCheckBox
protected void customizeCheckBox()
actionPerformed
public void actionPerformed(ActionEvent evt)
- Specified by:
actionPerformed
in interface ActionListener