|
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.CreateChildEdgeMode
public class CreateChildEdgeMode
This view mode is responsible for creating children in a tree like fashion.
A child is created with this mode in the following way:setCancelKeyCode(int)
).
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 | |
---|---|
CreateChildEdgeMode()
Instantiates a new CreateEdgeMode. |
|
CreateChildEdgeMode(ViewContainer view)
Instantiates a new CreateEdgeMode for a given ViewContainer |
Method Summary | |
---|---|
protected boolean |
acceptBend(Node start,
double x,
double y)
Whether or not to accept the creation of a bend. |
protected boolean |
acceptSourceNode(Node source,
double x,
double y)
This method gets called right before someone wants to start creating an edge at location (x,y)
starting from node source . |
void |
allowBendCreation(boolean b)
Allows or disallows bend creation. |
protected void |
cancelEdgeCreation()
Calling this method cancels edge creation properly. |
void |
cancelEditing()
This can be used to cleanly exit an edit that is currently in progress. |
protected void |
childCreated(Node child)
This method gets called after the new child node was completely created by this mode. |
protected NodeRealizer |
createChildNodeRealizer()
Factory method, which creates the NodeRealizer which is used for the new child node. |
protected EdgeRealizer |
createDummyEdgeRealizer()
Factory method, which creates the dummy EdgeRealizer which is used during the edge creation process. |
protected NodeRealizer |
createDummySourceNodeRealizer(NodeRealizer currentRealizer)
Creates a dummy node for the target node of the dummy edge By default, this method returns currentRealizer.createCopy(); |
protected NodeRealizer |
createDummyTargetNodeRealizer(double x,
double y)
Creates a dummy node for the other end of the edge. |
boolean |
doAllowBendCreation()
Returns true iff the creation of bends should be allowed. |
protected void |
edgeCreated(Edge edge)
This method gets called after a new edge was completely created by this mode. |
protected void |
edgeMoved(double x,
double y)
This method gets called whenever the dummy end point of the to be created edge has changed it's location. |
int |
getCancelKeyCode()
Sets the virtual key code as defined in KeyEvent
which cancels the edge creation. |
protected EdgeRealizer |
getDummyEdgeRealizer()
Returns the dummy EdgeRealizer which is currently in use. |
protected NodeRealizer |
getDummySourceNodeRealizer()
Returns the currently used dummy node realizer for the source node of the dummy edge. |
protected NodeRealizer |
getDummyTargetNodeRealizer()
Returns the currently used dummy node realizer for the target node of the dummy edge. |
void |
init()
This method is called in a child mode when it gets installed in another mode. |
void |
mouseDraggedLeft(double x,
double y)
Moves the dummy end of the edge while the actual target node is unknown. |
void |
mouseMoved(double x,
double y)
Moves the dummy end of the edge while the actual target node is unknown. |
void |
mousePressedLeft(double x,
double y)
Initiates the creation of an edge. |
void |
mouseReleasedLeft(double x,
double y)
If a node was hit at the given coordinates, that node will be used as target node for the newly created edge. |
void |
mouseReleasedRight(double x,
double y)
Removes a bend if possible. otherwise cancels edge creation. |
void |
mouseShiftPressedLeft(double x,
double y)
Initiates the creation of an edge. |
void |
mouseShiftReleasedLeft(double x,
double y)
If a node was hit at the given coordinates, that node will be used as target node for the newly created edge. |
void |
reactivateParent()
The parent of this ViewMode is reactivated and this ViewMode is deactivated. |
void |
setCancelKeyCode(int cancelKeyCode)
Sets the virtual key code as defined in KeyEvent
which cancels the edge creation. |
protected void |
sourceNodeDeclined(Node target,
double x,
double y)
This method gets called in case method acceptSourceNode(Node, double, double)
returns false. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CreateChildEdgeMode(ViewContainer view)
public CreateChildEdgeMode()
Method Detail |
---|
public void init()
ViewMode
init
in class ViewMode
ViewMode.setChild(ViewMode,MouseEvent,MouseEvent)
public void allowBendCreation(boolean b)
public boolean doAllowBendCreation()
true
iff the creation of bends should be allowed.
This mode will act according to the return value of this method.
public void mousePressedLeft(double x, double y)
mousePressedLeft
in class ViewMode
x
- the x-coordinate of the mouse event in world coordinates.y
- the y-coordinate of the mouse event in world coordinates.public void mouseShiftPressedLeft(double x, double y)
mouseShiftPressedLeft
in class ViewMode
x
- the x-coordinate of the mouse event in world coordinates.y
- the y-coordinate of the mouse event in world coordinates.protected NodeRealizer createChildNodeRealizer()
getGraph2D().getDefaultNodeRealizer().createCopy();
which is
labeled Integer.toString(getGraph2D().N() + 1)
.
protected EdgeRealizer createDummyEdgeRealizer()
getGraph2D().getDefaultEdgeRealizer().createCopy();
protected EdgeRealizer getDummyEdgeRealizer()
java.lang.IllegalStateException
- if the edge has not yet been createdprotected NodeRealizer createDummySourceNodeRealizer(NodeRealizer currentRealizer)
currentRealizer.createCopy();
protected NodeRealizer createDummyTargetNodeRealizer(double x, double y)
x
- the initial x coordinatey
- the initial y coordinate
protected NodeRealizer getDummyTargetNodeRealizer()
java.lang.IllegalStateException
- if the edge has not yet been createdprotected NodeRealizer getDummySourceNodeRealizer()
java.lang.IllegalStateException
- if the edge has not yet been createdpublic void mouseReleasedRight(double x, double y)
mouseReleasedRight
in class ViewMode
x
- the x-coordinate of the mouse event in world coordinates.y
- the y-coordinate of the mouse event in world coordinates.public void mouseShiftReleasedLeft(double x, double y)
mouseShiftReleasedLeft
in class ViewMode
x
- the x-coordinate of the mouse event in world coordinates.y
- the y-coordinate of the mouse event in world coordinates.public void mouseReleasedLeft(double x, double y)
mouseReleasedLeft
in class ViewMode
x
- the x-coordinate of the mouse event in world coordinates.y
- the y-coordinate of the mouse event in world coordinates.protected boolean acceptBend(Node start, double x, double y)
start
- the node from where edge creation startedx
- the x-coordinate of the current locationy
- the y-coordinate of the current locationpublic void mouseDraggedLeft(double x, double y)
mouseDraggedLeft
in class ViewMode
x
- the x-coordinate of the mouse event in world coordinates.y
- the y-coordinate of the mouse event in world coordinates.public void mouseMoved(double x, double y)
mouseMoved
in class ViewMode
x
- the x-coordinate of the mouse event in world coordinates.y
- the y-coordinate of the mouse event in world coordinates.public void reactivateParent()
ViewMode
reactivateParent
in class ViewMode
protected void edgeMoved(double x, double y)
x
- the x-coordinate of the end pointy
- the y-coordinate of the end pointprotected void edgeCreated(Edge edge)
protected void childCreated(Node child)
protected void cancelEdgeCreation()
protected boolean acceptSourceNode(Node source, double x, double y)
(x,y)
starting from node source
.
The return value of this method determines whether or not
creating an edge from that node will actually be initiated.
By default this method returns true
.
Subclasses may want to override this feature to forbid
edge creation starting from certain nodes.
protected void sourceNodeDeclined(Node target, double x, double y)
acceptSourceNode(Node, double, double)
returns false. This method is meant as a hook
to perform some post source declination code.
By default this method does nothing.
public int getCancelKeyCode()
KeyEvent
which cancels the edge creation. Negative values disable this feature.
Default is KeyEvent.VK_ESCAPE
.
public void setCancelKeyCode(int cancelKeyCode)
KeyEvent
which cancels the edge creation. Negative values disable this feature.
public void cancelEditing() throws java.lang.UnsupportedOperationException
ViewMode
setEditing(false)
if
ViewMode.isEditing()
returns true
cancelEditing
in class ViewMode
java.lang.UnsupportedOperationException
- if the editing cannot be canceled
for any reason.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |