|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.tree.DefaultTreeCellEditor
public class DefaultTreeCellEditor
Participates in the tree cell editing.
Nested Class Summary | |
---|---|
class |
DefaultTreeCellEditor.DefaultTextField
The default text field, used in the editing sessions. |
class |
DefaultTreeCellEditor.EditorContainer
This container that appears on the tree during editing session. |
Field Summary | |
---|---|
protected Color |
borderSelectionColor
True if the border selection color should be drawn. |
protected boolean |
canEdit
As of Java 2 platform v1.4 this field should no longer be used. |
protected Component |
editingComponent
Component used in editing, obtained from the editingContainer. |
protected Container |
editingContainer
Editing container, will contain the editorComponent. |
protected Icon |
editingIcon
Icon to use when editing. |
protected Font |
font
Font to paint with, null indicates font of renderer is to be used. |
protected TreePath |
lastPath
Last path that was selected. |
protected int |
lastRow
Row that was last passed into getTreeCellEditorComponent. |
protected int |
offset
Used in editing. |
protected TreeCellEditor |
realEditor
Editor handling the editing. |
protected DefaultTreeCellRenderer |
renderer
Renderer, used to get border and offsets from. |
protected Timer |
timer
Used before starting the editing session. |
protected JTree |
tree
JTree instance listening too. |
Constructor Summary | |
---|---|
DefaultTreeCellEditor(JTree tree,
DefaultTreeCellRenderer renderer)
Constructs a DefaultTreeCellEditor object for a JTree using the specified renderer and a default editor. |
|
DefaultTreeCellEditor(JTree tree,
DefaultTreeCellRenderer renderer,
TreeCellEditor editor)
Constructs a DefaultTreeCellEditor object for a JTree using the specified renderer and the specified editor. |
Method Summary | |
---|---|
void |
actionPerformed(ActionEvent e)
Messaged when the timer fires. |
void |
addCellEditorListener(CellEditorListener listener)
Adds a CellEditorListener object to this editor. |
void |
cancelCellEditing()
Messages cancelCellEditing to the realEditor and removes it from this instance. |
protected boolean |
canEditImmediately(EventObject event)
Returns true if event is null, or it is a MouseEvent with a click count > 2 and inHitRegion returns true. |
protected Container |
createContainer()
Creates the container to manage placement of editingComponent. |
protected TreeCellEditor |
createTreeCellEditor()
This is invoked if a TreeCellEditor is not supplied in the constructor. |
protected void |
determineOffset(JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row)
determineOffset |
Color |
getBorderSelectionColor()
Returns the color the border is drawn. |
CellEditorListener[] |
getCellEditorListeners()
Returns all added CellEditorListener objects to this editor. |
Object |
getCellEditorValue()
Returns the value currently being edited (requests it from the realEditor . |
Font |
getFont()
Gets the font used for editing. |
Component |
getTreeCellEditorComponent(JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row)
Configures the editor. |
protected boolean |
inHitRegion(int x,
int y)
Returns true if the passed in location is a valid mouse location to start editing from. |
boolean |
isCellEditable(EventObject event)
If the realEditor returns true to this message, prepareForEditing is messaged and true is returned. |
protected void |
prepareForEditing()
Invoked just before editing is to start. |
void |
removeCellEditorListener(CellEditorListener listener)
Removes a CellEditorListener object. |
void |
setBorderSelectionColor(Color newColor)
Sets the color to use for the border. |
void |
setFont(Font font)
Sets the font to edit with. null indicates the renderers font should be used. |
protected void |
setTree(JTree newTree)
Sets the tree currently editing for. |
boolean |
shouldSelectCell(EventObject event)
Messages the realEditor for the return value. |
protected boolean |
shouldStartEditingTimer(EventObject event)
Returns true if event is a MouseEvent and the click count is 1. |
protected void |
startEditingTimer()
Starts the editing timer (if one installed). |
boolean |
stopCellEditing()
If the realEditor will allow editing to stop, the realEditor is removed and true is returned, otherwise false is returned. |
void |
valueChanged(TreeSelectionEvent e)
Resets lastPath. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected TreeCellEditor realEditor
protected DefaultTreeCellRenderer renderer
protected Container editingContainer
protected transient Component editingComponent
protected boolean canEdit
protected transient int offset
protected transient JTree tree
protected transient TreePath lastPath
protected transient Timer timer
protected transient int lastRow
protected Color borderSelectionColor
protected transient Icon editingIcon
protected Font font
Constructor Detail |
---|
public DefaultTreeCellEditor(JTree tree, DefaultTreeCellRenderer renderer)
tree
- - a JTree objectrenderer
- - a DefaultTreeCellRenderer objectpublic DefaultTreeCellEditor(JTree tree, DefaultTreeCellRenderer renderer, TreeCellEditor editor)
tree
- - a JTree objectrenderer
- - a DefaultTreeCellRenderer objecteditor
- - a TreeCellEditor objectMethod Detail |
---|
public void setBorderSelectionColor(Color newColor)
newColor
- - the new border colorpublic Color getBorderSelectionColor()
public void setFont(Font font)
font
- - the editing Fontpublic Font getFont()
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
getTreeCellEditorComponent
in interface TreeCellEditor
tree
- - the JTree that is asking the editor to edit; this parameter can be nullvalue
- - the value of the cell to be editedisSelected
- - true is the cell is to be rendered with selection highlightingexpanded
- - true if the node is expandedleaf
- - true if the node is a leaf noderow
- - the row index of the node being edited
public Object getCellEditorValue()
realEditor
.
getCellEditorValue
in interface CellEditor
public boolean isCellEditable(EventObject event)
isCellEditable
in interface CellEditor
event
- - the event the editor should use to consider whether to
begin editing or not
public boolean shouldSelectCell(EventObject event)
shouldSelectCell
in interface CellEditor
event
- -
the event the editor should use to start editing
public boolean stopCellEditing()
stopCellEditing
in interface CellEditor
public void cancelCellEditing()
cancelCellEditing
in interface CellEditor
public void addCellEditorListener(CellEditorListener listener)
CellEditorListener
object to this editor.
addCellEditorListener
in interface CellEditor
listener
- the listener to addpublic void removeCellEditorListener(CellEditorListener listener)
CellEditorListener
object.
removeCellEditorListener
in interface CellEditor
listener
- the listener to removepublic CellEditorListener[] getCellEditorListeners()
CellEditorListener
objects to this editor.
public void valueChanged(TreeSelectionEvent e)
valueChanged
in interface TreeSelectionListener
e
- - the event that characterizes the change.public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
e
- the event that characterizes the action.protected void setTree(JTree newTree)
newTree
- -
the new tree to be editedprotected boolean shouldStartEditingTimer(EventObject event)
event
- - the event being studied
protected void startEditingTimer()
protected boolean canEditImmediately(EventObject event)
event
- - the event being studied
protected boolean inHitRegion(int x, int y)
x
- - the x-coordinate of the pointy
- - the y-coordinate of the point
protected void determineOffset(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
tree
- -value
- -isSelected
- -expanded
- -leaf
- -row
- -protected void prepareForEditing()
protected Container createContainer()
protected TreeCellEditor createTreeCellEditor()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |