|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgraph.graph.DefaultGraphCellEditor
public class DefaultGraphCellEditor
A GraphCellEditor. You need to supply an instance of DefaultGraphCellRenderer so that the icons can be obtained. You can optionaly supply a TreeCellEditor that will be layed out according to the icon in the DefaultTreeCellRenderer. If you do not supply a TreeCellEditor, a TextField will be used. Editing is started when the number of clicks specified in graph.getEditClickCount() is reached.
JTree
,
Serialized FormNested Class Summary | |
---|---|
class |
DefaultGraphCellEditor.DefaultTextField
TextField used when no editor is supplied. |
class |
DefaultGraphCellEditor.EditorContainer
Container responsible for placing the editingComponent. |
Field Summary | |
---|---|
protected Color |
borderSelectionColor
True if the border selection color should be drawn. |
protected boolean |
canEdit
Should isCellEditable return true? This is set in configure... |
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 JGraph |
graph
JTree instance listening too. |
protected Object |
lastCell
last path that was selected. |
protected int |
offsetX
Used in editing. |
protected int |
offsetY
|
protected GraphCellEditor |
realEditor
Editor handling the editing. |
Constructor Summary | |
---|---|
DefaultGraphCellEditor()
BOGUS CUT AND PASTE COMMENT |
|
DefaultGraphCellEditor(GraphCellEditor 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, this will start the editing session. |
void |
addCellEditorListener(CellEditorListener l)
Adds the CellEditorListener. |
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 GraphCellEditor |
createGraphCellEditor()
This is invoked if a TreeCellEditor is not supplied in the constructor. |
protected void |
determineOffset(JGraph graph,
Object value,
boolean isSelected)
|
Color |
getBorderSelectionColor()
Returns the color the border is drawn. |
Object |
getCellEditorValue()
Returns the value currently being edited. |
Font |
getFont()
Gets the font used for editing. |
Component |
getGraphCellEditorComponent(JGraph graph,
Object cell,
boolean isSelected)
Configures the editor. |
protected boolean |
inHitRegion(int x,
int y)
Should return 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 l)
Removes the previously added CellEditorListener l. |
void |
setBorderSelectionColor(Color newColor)
Sets the color to use for the border. |
void |
setFont(Font font)
Sets the font to edit with. |
protected void |
setGraph(JGraph newGraph)
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. |
boolean |
stopCellEditing()
If the realEditor will allow editing to stop, the realEditor is removed and true is returned, otherwise false is returned. |
void |
valueChanged(GraphSelectionEvent e)
Resets lastPath. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected GraphCellEditor realEditor
protected Container editingContainer
protected transient Component editingComponent
protected boolean canEdit
protected transient int offsetX
protected transient int offsetY
protected transient JGraph graph
protected transient Object lastCell
protected Color borderSelectionColor
protected transient Icon editingIcon
protected Font font
Constructor Detail |
---|
public DefaultGraphCellEditor()
public DefaultGraphCellEditor(GraphCellEditor editor)
editor
- a TreeCellEditor objectMethod Detail |
---|
public void setBorderSelectionColor(Color newColor)
public Color getBorderSelectionColor()
public void setFont(Font font)
font
- the editing FontgetFont()
public Font getFont()
setFont(java.awt.Font)
public Component getGraphCellEditorComponent(JGraph graph, Object cell, boolean isSelected)
getGraphCellEditorComponent
in interface GraphCellEditor
graph
- the JGraph that is asking the editor to edit
This parameter can be null.cell
- the value of the cell to be edited.isSelected
- true if the cell is to be rendered with
selection highlighting
public Object getCellEditorValue()
getCellEditorValue
in interface CellEditor
public boolean isCellEditable(EventObject event)
isCellEditable
in interface CellEditor
public boolean shouldSelectCell(EventObject event)
shouldSelectCell
in interface CellEditor
public boolean stopCellEditing()
stopCellEditing
in interface CellEditor
public void cancelCellEditing()
cancelCellEditing
in interface CellEditor
public void addCellEditorListener(CellEditorListener l)
addCellEditorListener
in interface CellEditor
public void removeCellEditorListener(CellEditorListener l)
removeCellEditorListener
in interface CellEditor
public void valueChanged(GraphSelectionEvent e)
valueChanged
in interface GraphSelectionListener
e
- the event that characterizes the change.public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
protected void setGraph(JGraph newGraph)
protected boolean shouldStartEditingTimer(EventObject event)
event
is a MouseEvent and the click
count is 1.
protected boolean canEditImmediately(EventObject event)
event
is null, or it is a MouseEvent
with a click count > 2 and inHitRegion returns true.
protected boolean inHitRegion(int x, int y)
x
is <= the width of the icon and icon gap displayed
by the renderer. In other words this returns true if the user
clicks over the text part displayed by the renderer, and false
otherwise.
protected void determineOffset(JGraph graph, Object value, boolean isSelected)
protected void prepareForEditing()
editingComponent
to the
editingContainer
.
protected Container createContainer()
protected GraphCellEditor createGraphCellEditor()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |