|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.AbstractCellEditor
javax.swing.DefaultCellEditor
com.antelmann.util.table.AbstractDialogCellEditor<T>
public abstract class AbstractDialogCellEditor<T>
provides an editor that always shows a dialog for editing the value.
To extend this class, the interfaces ValueRetriever and ValueSetter must be implemented.
The ValueRetriever is responsible to provide value after editing and the ValueSetter
is responsible to set the current value for the dialog component from the table before editing starts.
Note that any Exceptions that are thrown by the ValueSetter are simply wrapped as RuntimeExceptions and
then thrown.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.DefaultCellEditor |
|---|
DefaultCellEditor.EditorDelegate |
| Field Summary | |
|---|---|
protected int |
column
cached from the last call to the method that provides the component, so that it's available for the VaueSetter |
protected String |
columnName
|
protected JComponent |
dialogComponent
|
protected String |
dialogTitle
|
protected boolean |
expanded
cached from the last call to the method that provides the component, so that it's available for the VaueSetter |
protected boolean |
isSelected
cached from the last call to the method that provides the component, so that it's available for the VaueSetter |
protected boolean |
leaf
cached from the last call to the method that provides the component, so that it's available for the VaueSetter |
protected int |
row
cached from the last call to the method that provides the component, so that it's available for the VaueSetter |
protected JTable |
table
cached from the last call to the method that provides the component, so that it's available for the VaueSetter |
protected JTree |
tree
cached from the last call to the method that provides the component, so that it's available for the VaueSetter |
| Fields inherited from class javax.swing.DefaultCellEditor |
|---|
clickCountToStart, delegate, editorComponent |
| Fields inherited from class javax.swing.AbstractCellEditor |
|---|
changeEvent, listenerList |
| Constructor Summary | |
|---|---|
AbstractDialogCellEditor(JComponent dialogComponent)
|
|
AbstractDialogCellEditor(JComponent dialogComponent,
String dialogTitle)
|
|
AbstractDialogCellEditor(JComponent dialogComponent,
String dialogTitle,
boolean resizable)
initializes this instance with a component to be shown in the dialog and a title. |
|
| Method Summary | |
|---|---|
Object |
getCellEditorValue()
|
protected JComponent |
getDialogComponent()
override this to create a component on each call based on the cached member variables instead of simply returning the component provided in the constructor |
protected Component |
getRelevantComponent(Object value)
called by the methods providing the components for JTable and JTree to share the functionality |
Component |
getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
caches all parameters in member variables and then calls getRelevantComponent(Object) |
Component |
getTreeCellEditorComponent(JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row)
caches all parameters in member variables and then calls getRelevantComponent(Object) |
boolean |
isCellEditable(EventObject ev)
|
boolean |
isResizable()
|
void |
setResizable(boolean resizable)
|
protected int |
showDialog(JComponent parent)
shows the dialog and returns the value from the method JOptionPane.showConfirmDialog(Component, Object) |
protected void |
valueChanged()
|
| Methods inherited from class javax.swing.DefaultCellEditor |
|---|
cancelCellEditing, getClickCountToStart, getComponent, setClickCountToStart, shouldSelectCell, stopCellEditing |
| Methods inherited from class javax.swing.AbstractCellEditor |
|---|
addCellEditorListener, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.antelmann.util.ValueRetriever |
|---|
getRelevantValue |
| Methods inherited from interface com.antelmann.util.ValueSetter |
|---|
setRelevantValue |
| Methods inherited from interface javax.swing.CellEditor |
|---|
addCellEditorListener, removeCellEditorListener |
| Field Detail |
|---|
protected String dialogTitle
protected JComponent dialogComponent
protected String columnName
protected JTree tree
protected JTable table
protected int column
protected int row
protected boolean isSelected
protected boolean expanded
protected boolean leaf
| Constructor Detail |
|---|
public AbstractDialogCellEditor(JComponent dialogComponent)
AbstractDialogCellEditor(JComponent, String, boolean)
public AbstractDialogCellEditor(JComponent dialogComponent,
String dialogTitle)
AbstractDialogCellEditor(JComponent, String, boolean)
public AbstractDialogCellEditor(JComponent dialogComponent,
String dialogTitle,
boolean resizable)
AncestorListener will be added to the dialogComponent to ensure that
the component will receive the focus when the dialog is shown.
dialogComponent - the component to be shown in the dialogdialogTitle - if null, the column name is automatically used in when a JTable is used;
for JTree, this value really should be set, however!resizable - if true, the dialog shown is resizable| Method Detail |
|---|
public boolean isResizable()
public void setResizable(boolean resizable)
protected JComponent getDialogComponent()
protected int showDialog(JComponent parent)
JOptionPane.showConfirmDialog(Component, Object)
JOptionPane.showConfirmDialog(Component, Object)public Object getCellEditorValue()
getCellEditorValue in interface CellEditorgetCellEditorValue in class DefaultCellEditorpublic boolean isCellEditable(EventObject ev)
isCellEditable in interface CellEditorisCellEditable in class DefaultCellEditorprotected Component getRelevantComponent(Object value)
protected void valueChanged()
public Component getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
getRelevantComponent(Object)
getTableCellEditorComponent in interface TableCellEditorgetTableCellEditorComponent in class DefaultCellEditor
public Component getTreeCellEditorComponent(JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row)
getRelevantComponent(Object)
getTreeCellEditorComponent in interface TreeCellEditorgetTreeCellEditorComponent in class DefaultCellEditor
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||