|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.ViewMode y.view.CellEditorMode
public class CellEditorMode
This ViewMode
is designed to use instances of NodeCellEditor
to
display a visual editor inline in the Graph2DView to edit a node's data.
This mode can be registered in EditMode
using
EditMode.setEditNodeMode(ViewMode)
or used as a stand-alone ViewMode
Field Summary |
---|
Fields inherited from class y.view.ViewMode |
---|
ACTIVE_PROPERTY, ACTIVE_VIEW_PROPERTY, CHILD_MODE_PROPERTY, EDITING_PROPERTY, GRAB_FOCUS_ENABLED_PROPERTY, lastClickEvent, lastDragEvent, lastMoveEvent, lastPressEvent, lastReleaseEvent, MODIFIER_MASK_PROPERTY, NAME_PROPERTY, originalX, originalY, PARENT_MODE_PROPERTY, view |
Constructor Summary | |
---|---|
CellEditorMode(DataProvider nodeCellEditorProvider,
DataMap userObjectMap)
Creates a new CellEditorMode ViewMode that is responsible for displaying
NodeCellEditor instances during editing. |
|
CellEditorMode(NodeCellEditor nodeCellEditor,
DataMap userObjectMap)
Creates a new CellEditorMode ViewMode that is responsible for displaying
NodeCellEditor instances during editing. |
Method Summary | |
---|---|
void |
cancelCellEditing()
Cancels the current edit process. |
protected void |
cellEditingCanceled()
Callback method that is called when the editor canceled the editing process. |
protected void |
cellEditingStopped()
Callback method that is being called when the editor stopped the editing process. |
boolean |
editNode(Node node,
java.util.EventObject e)
This method can be used to programmatically start editing a node. |
Node |
getEditingNode()
Returns the Node that is currently being edited or null . |
NodeCellEditor |
getEditor()
Returns the current NodeCellEditor in use. |
NodeCellEditor |
getNodeCellEditor(Node n)
Returns the NodeCellEditor instance that will be used for the editing of the given node. |
java.lang.Object |
getUserObject(Node node)
Callback method that determines the user object to pass to the NodeCellEditor . |
protected void |
installEditor(javax.swing.JComponent component,
NodeRealizer nr)
Installs the given editor JComponent for the given NodeRealizer. |
boolean |
isCellEditing()
Returns whether the mode is currently editing a cell. |
boolean |
isNodeEditable(Node node)
Determines whether a node is deemed editable. |
void |
mouseClicked(java.awt.event.MouseEvent e)
A mouse button get clicked |
void |
mouseDragged(java.awt.event.MouseEvent e)
The mouse gets dragged |
void |
mouseMoved(java.awt.event.MouseEvent e)
The Mouse gets moved. |
void |
mousePressed(java.awt.event.MouseEvent e)
A mouse button gets pressed. |
void |
mouseReleased(java.awt.event.MouseEvent e)
A mouse button get released |
protected void |
removeEditor()
This method removes the current editor instance from the canvas. |
void |
setUserObject(Node node,
java.lang.Object userObject)
Callback method that associates the user object with the node. |
protected boolean |
shouldStartCellEditing(java.awt.event.MouseEvent me)
Callback method that determines whether the mouse event should start the process of cell editing. |
void |
startCellEditing(NodeRealizer nr,
NodeCellEditor nce)
Initiates cell editing for a given NodeRealizer and NodeCellEditor. |
boolean |
stopCellEditing()
Tries to stop the current edit process. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CellEditorMode(NodeCellEditor nodeCellEditor, DataMap userObjectMap)
ViewMode
that is responsible for displaying
NodeCellEditor
instances during editing.
nodeCellEditor
- the single NodeCellEditor to use for all nodes.userObjectMap
- a map to obtain the editor values from and store the modified values topublic CellEditorMode(DataProvider nodeCellEditorProvider, DataMap userObjectMap)
ViewMode
that is responsible for displaying
NodeCellEditor
instances during editing.
nodeCellEditorProvider
- a DataProvider that will be queried for the NodeCellEditor
instances for each node to determine the instance to use for editing.userObjectMap
- a map to obtain the editor values from and store the modified values toMethod Detail |
---|
public boolean editNode(Node node, java.util.EventObject e)
stopCellEditing()
does not succeed, this method will
do nothing but return false
node
- the node to edite
- an optional event object that triggered the editing gesture
isNodeEditable(y.base.Node)
,
isCellEditing()
,
stopCellEditing()
public boolean isNodeEditable(Node node)
getNodeCellEditor(y.base.Node)
and
sees if the result is non-null;
node
- the node to check.
public java.lang.Object getUserObject(Node node)
NodeCellEditor
.
node
- the node to query the value from
setUserObject(y.base.Node, Object)
public void setUserObject(Node node, java.lang.Object userObject)
node
- the node to associate the value withuserObject
- the user objectgetUserObject(y.base.Node)
protected boolean shouldStartCellEditing(java.awt.event.MouseEvent me)
MouseEvent.MOUSE_CLICKED
event and the clickCount
is 2.
me
- the mouse event to inspect
public NodeCellEditor getNodeCellEditor(Node n)
n
- the node
null
if there is no such suitable editorpublic boolean isCellEditing()
public void startCellEditing(NodeRealizer nr, NodeCellEditor nce)
nr
- the NodeRealizer contextnce
- the NodeCellEditor to usepublic NodeCellEditor getEditor()
null
public Node getEditingNode()
null
.
null
public void cancelCellEditing()
public boolean stopCellEditing()
protected void cellEditingCanceled()
protected void cellEditingStopped()
public void mouseMoved(java.awt.event.MouseEvent e)
ViewMode
ViewMode.mouseMoved(double,double)
.
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseMoved
in class ViewMode
public void mouseReleased(java.awt.event.MouseEvent e)
ViewMode
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class ViewMode
public void mouseDragged(java.awt.event.MouseEvent e)
ViewMode
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
in class ViewMode
public void mousePressed(java.awt.event.MouseEvent e)
ViewMode
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class ViewMode
public void mouseClicked(java.awt.event.MouseEvent e)
ViewMode
mouseClicked
in interface java.awt.event.MouseListener
mouseClicked
in class ViewMode
protected void installEditor(javax.swing.JComponent component, NodeRealizer nr)
component
- the componentnr
- the NodeRealizer contextprotected void removeEditor()
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |