|
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.EditMode
public class EditMode
This view mode is the default edit mode for a Graph2DView. With this mode it is possible to
This complex mode makes use of other minor modes that have specialized responsibilities.
It is possible to exchange these minor modes by customized versions.
Optionally, this mode and its associated minor modes provide special support
for maintaining orthogonal edge paths.
See ORTHOGONAL_ROUTING_DPKEY
, isOrthogonalRouting(y.base.Edge)
,
and setOrthogonalEdgeRouting(boolean)
.
Field Summary | |
---|---|
protected ViewMode |
createEdgeMode
The minor create edge mode associated with this mode. |
protected ViewMode |
editNodeMode
The minor edit node mode associated with this mode. |
protected ViewMode |
hotSpotMode
Child mode HotSpotMode |
protected MouseInputMode |
mouseInputMode
The minor mouse input mode associated with this mode. |
protected ViewMode |
moveLabelMode
The minor move label mode associated with this mode. |
protected ViewMode |
moveNodePortMode
The minor move node port mode associated with this mode. |
protected ViewMode |
movePortMode
The minor move port mode associated with this mode. |
protected ViewMode |
moveSelectionMode
The minor move selection mode associated with this mode. |
protected ViewMode |
moveViewPortMode
The minor move viewport mode associated with this mode. |
static java.lang.Object |
ORTHOGONAL_ROUTING_DPKEY
A DataProvider that can be registered with the graph to determine whether an edge should be routed orthogonally. |
protected ViewMode |
popupMode
The minor popup mode associated with this mode |
protected Node |
pressedNode
Will be set when the mouse was pressed over a node. |
protected ViewMode |
selectionBoxMode
The minor selection box mode associated with this mode. |
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 | |
---|---|
EditMode()
Instantiates a new EditMode |
|
EditMode(ViewContainer vc)
Instantiates a new EditMode for a given ViewContainer |
Method Summary | |
---|---|
void |
activate(boolean activate)
Invoked when the Mode is activated/deactivated from the ViewControl or via the setChild() and reactivateParent operations This behaves like a bound property using ViewMode.ACTIVE_PROPERTY as the property name. |
void |
allowBendCreation(boolean b)
Allows or disallows bend creation. |
void |
allowEdgeCreation(boolean b)
Allows or disallows edge creation. |
void |
allowLabelSelection(boolean b)
Allows or disallows selecting labels by clicking on them. |
void |
allowMouseInput(boolean b)
Allows or disallows the delegation of events to a MouseInputMode . |
void |
allowMoveLabels(boolean b)
Allows or disallows moving around labels in the displayed graph. |
void |
allowMovePorts(boolean b)
Allows or disallows moving around ports in the displayed graph. |
void |
allowMoveSelection(boolean b)
Allows or disallows moving around the selected elements of the displayed graph. |
void |
allowMoving(boolean b)
Allows or disallows moving the viewport of the view via the right mouse button. |
void |
allowMovingWithPopup(boolean b)
Allows or disallows moving the viewport of the view via the right mouse button even if a popup menu is present. |
void |
allowNodeCreation(boolean b)
Allows or disallows node creation. |
void |
allowNodeEditing(boolean b)
Allows or disallows node editing. |
void |
allowResizeNodes(boolean b)
Allows or disallows resizing of nodes by dragging at the selection hotspots. |
void |
assignNodeLabel(boolean b)
Determines whether or not to assign a generic node label for newly created nodes. |
protected void |
beforeSelectionCycling(YCursor cyclicHits)
This method is called before cycling the selection. |
protected void |
bendClicked(Graph2D graph,
Bend bend,
boolean wasSelected,
double x,
double y,
boolean modifierSet)
Callback called by both mouseReleasedLeft(double,double) and
mouseShiftReleasedLeft(double,double) when a Bend has been
clicked. |
protected void |
bendCreated(Graph2D graph,
Edge edge,
Bend bend,
double x,
double y)
This method gets called after a new bend has been created by this mode. |
protected void |
bendDragged(Graph2D graph,
Bend bend,
boolean wasSelected,
double x,
double y,
boolean firstDrag)
Callback called by mouseDraggedLeft(double,double) when a
Bend is being dragged. |
void |
cancelEditing()
This can be used to cleanly exit an edit that is currently in progress. |
protected void |
configureNode(Graph2D graph,
Node node)
Callback called by createNode(Graph2D,double,double,y.base.Node)
right after a new node has been created (and prior to assigning the new
node a parent node). |
protected Bend |
createBend(Graph2D graph,
Edge edge,
double x,
double y)
Callback called by mouseDraggedLeft(double,double) when
a bend should be created. |
protected ViewMode |
createCreateEdgeMode()
Factory method, which creates the CreateEdgeMode. |
protected HitInfo |
createCyclicHitInfo(double x,
double y)
|
protected ViewMode |
createEditNodeMode()
Factory method, which can create the minor mode that is responsible for node editing. |
protected ViewMode |
createHotSpotMode()
Factory method, which creates the HotSpotMode. |
protected HitInfo |
createLabelHitInfo(double x,
double y)
Performs a hit test for a group node label at the specified location. |
protected MouseInputMode |
createMouseInputMode()
Factory method, which creates the MouseInputMode. |
protected ViewMode |
createMoveLabelMode()
Factory method, which creates the MoveLabelMode. |
protected ViewMode |
createMoveNodePortMode()
Factory method, which creates the MoveNodePortMode. |
protected ViewMode |
createMovePortMode()
Factory method, which creates the MovePortMode. |
protected ViewMode |
createMoveSelectionMode()
Factory method, which creates the MoveSelectionMode. |
protected ViewMode |
createMoveViewPortMode()
Factory method, which creates the MoveViewPortMode. |
protected Node |
createNode(Graph2D graph,
double x,
double y)
Callback called by paperClicked(Graph2D,double,double,boolean)
when a node should be created. |
protected Node |
createNode(Graph2D graph,
double x,
double y,
Node parent)
Callback called by groupNodeClicked(y.base.Node) when a node
should be created. |
protected ViewMode |
createOrthogonalMoveBendsMode()
Factory method that creates an OrthogonalMoveBendsMode. |
protected ViewMode |
createPopupMode()
Factory method, which can create the PopupMode. |
protected ViewMode |
createSelectionBoxMode()
Factory method, which creates the SelectionBoxMode. |
boolean |
doAllowBendCreation()
Returns true iff the creation of bends should be allowed. |
boolean |
doAllowEdgeCreation()
Returns true iff the creation of edges should be allowed. |
boolean |
doAllowLabelSelection()
Returns true iff the selection of labels via mouse clicks
should be allowed. |
boolean |
doAllowMouseInput()
Returns true iff events will be handled by a MouseInputMode first. |
boolean |
doAllowMoveLabels()
Returns true iff the moving of labels should be allowed. |
boolean |
doAllowMovePorts()
Returns true iff the moving of ports should be allowed. |
boolean |
doAllowMoveSelection()
Returns whether or not to allow moving around the selected elements of the displayed graph. |
boolean |
doAllowMoving()
Returns whether or not to allow moving the viewport of the view via right mouse drag action. |
boolean |
doAllowMovingWithPopup()
Returns whether or not to allow moving the viewport of the view via right mouse drag action in the presence of a popup menu. |
boolean |
doAllowNodeCreation()
Returns true iff the creation of nodes should be allowed. |
boolean |
doAllowNodeEditing()
Returns true iff the editing of nodes should be allowed. |
boolean |
doAllowResizeNodes()
Returns whether or not to allow resizing of nodes by dragging at the selection hotspots. |
boolean |
doAssignNodeLabel()
Returns true iff a generic node label is assigned for newly
created nodes. |
boolean |
doShowEdgeTips()
Returns true if this mode should display
tip text for an edge. |
boolean |
doShowNodeTips()
Returns true if this mode should display
tip text for a node. |
protected void |
edgeClicked(Graph2D graph,
Edge edge,
boolean wasSelected,
double x,
double y,
boolean modifierSet)
Callback called by both mouseReleasedLeft(double,double) and
mouseShiftReleasedLeft(double,double) when an Edge has been
clicked. |
protected void |
edgeDragged(Graph2D graph,
Edge edge,
boolean wasSelected,
double x,
double y,
boolean firstDrag)
Callback called by mouseDraggedLeft(double,double) when an
Edge is being dragged. |
protected boolean |
editNode(Node hitNode,
java.util.EventObject e)
Tries to start editing the given Node using the current editNodeMode . |
ViewMode |
getCreateEdgeMode()
Returns the minor create edge mode associated with this mode. |
int |
getCyclicSelectionModifierMask()
|
java.awt.Cursor |
getDefaultCursor()
Returns the default cursor displayed by this mode if no other cursor can be found. |
protected java.lang.String |
getEdgeTip(Edge e)
Returns the tip text displayed for the given edge. |
ViewMode |
getEditNodeMode()
Returns the minor mode for node editing associated with this mode |
int |
getGroupBorderWidth()
returns the width the active group node border. |
ViewMode |
getHotSpotMode()
Getter for child mode HotSpotMode. |
MouseInputMode |
getMouseInputMode()
Returns the minor mode for delegating mouse input, i.e., mouse events, to. |
ViewMode |
getMoveLabelMode()
Getter for child mode MoveLabelMode. |
ViewMode |
getMoveNodePortMode()
Getter for child mode MoveNodePortMode. |
ViewMode |
getMovePortMode()
Getter for child mode MovePortMode. |
ViewMode |
getMoveSelectionMode()
Returns the minor move selection mode associated with this mode. |
ViewMode |
getMoveViewPortMode()
Getter for child mode MoveViewPortMode . |
protected java.lang.String |
getNodeTip(Node v)
Returns the tip text displayed for the given node. |
ViewMode |
getOrthogonalMoveBendsMode()
Getter for child mode OrthogonalMoveBendsMode. |
ViewMode |
getPopupMode()
Returns the minor popup mode associated with this mode |
ViewMode |
getSelectionBoxMode()
Returns the minor selection box mode associated with this mode. |
protected void |
groupNodeClicked(Node v)
This method gets called after a left mouse click on a group node occurred. |
protected void |
hotSpotDragged(Graph2D graph,
double x,
double y,
boolean firstDrag)
Callback called by mouseDraggedLeft(double,double) when a
node hot spot is being dragged. |
boolean |
isAdjustScrollBarPolicy()
Returns true if the scroll bars in Graph2DView will be shown (if needed) when this mode is activated (default). |
boolean |
isChildNodeCreationEnabled()
Determines whether child nodes may be created when clicking on a group node. |
protected boolean |
isCreateEdgeGesture(java.awt.event.MouseEvent lastPress,
java.awt.event.MouseEvent lastDrag)
Determines whether the last press and drag initiates a create edge gesture. |
boolean |
isCreateEdgeOnGroupNodeLabelEnabled()
Returns whether or not a bend will be created when the mouse is released on the first label of a group node. |
boolean |
isCyclicSelectionEnabled()
|
protected boolean |
isCyclicSelectionModifierPressed()
|
protected boolean |
isEditNodeGesture(Node hitNode,
java.awt.event.MouseEvent lastPressEvent,
java.awt.event.MouseEvent lastReleaseEvent,
java.awt.event.MouseEvent lastClickEvent)
Determines if the given gesture is considered a gesture to start node editing. |
protected boolean |
isGroupNodeBorderHit(Graph2D graph,
Node node,
double x,
double y,
boolean considerGroupNodeLabel)
Determines whether the specified coordinates lie within the border area of a group node. |
boolean |
isMixedSelectionEnabled()
Determines whether or not this instance allows mixed selections of different kinds of graph elements (nodes/bends, edges, labels, node ports) to exist at the same time. |
boolean |
isOrthogonalEdgeRouting()
Returns whether or not special support for orthogonal edge paths is enabled for all edges. |
protected boolean |
isOrthogonalRouting(Edge edge)
Callback that determines whether an edge should be treated as an orthogonally routed edge. |
protected boolean |
isSelected(Graph2D graph,
Bend bend)
Returns true if the specified bend is currently selected;
false otherwise. |
protected boolean |
isSelected(Graph2D graph,
Edge edge)
Returns true if the specified edge is currently selected;
false otherwise. |
protected boolean |
isSelected(Graph2D graph,
Node node)
Returns true if the specified node is currently selected;
false otherwise. |
protected boolean |
isSelected(Graph2D graph,
NodePort port)
Returns true if the specified port is currently selected;
false otherwise. |
protected boolean |
isSelected(Graph2D graph,
YLabel label)
Returns true if the specified label is currently selected;
false otherwise. |
protected boolean |
isSelectionEmpty(Graph2D graph)
Returns true if there are no selected nodes, node labels,
node ports, edges, edge labels, and/or bends in the specified graph and
false otherwise. |
boolean |
isSelectOnGroupNodeLabelEnabled()
Determines whether clicking on a group node's default label should select the node instead of creating a child node when child node creation is enabled. |
protected void |
labelClicked(Graph2D graph,
YLabel label,
boolean wasSelected,
double x,
double y,
boolean modifierSet)
Callback called by both mouseReleasedLeft(double,double) and
mouseShiftReleasedLeft(double,double) when a YLabel has been
clicked. |
protected void |
labelClicked(YLabel label)
This method gets called after a left mouse click on a label occurred. |
protected void |
labelDragged(Graph2D graph,
EdgeLabel label,
boolean wasSelected,
double x,
double y,
boolean firstDrag)
Callback called by mouseDraggedLeft(double,double) when an
EdgeLabel is being dragged. |
protected void |
labelDragged(Graph2D graph,
NodeLabel label,
boolean wasSelected,
double x,
double y,
boolean firstDrag)
Callback called by mouseDraggedLeft(double,double) when a
NodeLabel is being dragged. |
void |
mouseClicked(double x,
double y)
Called when the mouse was clicked |
void |
mouseDraggedLeft(double x,
double y)
Activates a minor mode. |
void |
mouseDraggedRight(double x,
double y)
Called when the mouse was dragged with the right button down. |
void |
mouseEntered(java.awt.event.MouseEvent e)
The mouse enters the viewer component. |
void |
mouseMoved(double x,
double y)
When moving the mouse, the mouse cursor has to be adjusted. |
void |
mousePressed(java.awt.event.MouseEvent e)
A mouse button gets pressed. |
void |
mousePressedLeft(double x,
double y)
Takes the given coordinate and performs with it a hit test on all graph elements. |
void |
mousePressedRight(double x,
double y)
If a popup mode is associates with this mode then it will be activated. |
void |
mouseReleasedLeft(double x,
double y)
Depending on the history, actions are triggered, but only if Mouse was not moved since the button was pressed. |
void |
mouseReleasedRight(double x,
double y)
Called when the right mouse button was released |
void |
mouseShiftPressedLeft(double x,
double y)
Takes the given coordinate and performs with it a hit test on all graph elements. |
void |
mouseShiftReleasedLeft(double x,
double y)
Depending on the history, actions are triggered, but only if Mouse was not moved since the button was pressed. |
protected void |
nodeClicked(Graph2D graph,
Node node,
boolean wasSelected,
double x,
double y,
boolean modifierSet)
Callback called by both mouseReleasedLeft(double,double) and
mouseShiftReleasedLeft(double,double) when a Node has been
clicked. |
protected void |
nodeClicked(Node v)
This method gets called after a left mouse click on a node occurred. |
protected void |
nodeCreated(Node v)
This method gets called after a new node was completely created by this mode. |
protected void |
nodeDragged(Graph2D graph,
Node node,
boolean wasSelected,
double x,
double y,
boolean firstDrag)
Callback called by mouseDraggedLeft(double,double) when a
Node is being dragged. |
protected void |
nodePortClicked(Graph2D graph,
NodePort port,
boolean wasSelected,
double x,
double y,
boolean modifierSet)
Callback called by both mouseReleasedLeft(double,double) and
mouseShiftReleasedLeft(double,double) when a
NodePort has been clicked. |
protected void |
nodePortDragged(Graph2D graph,
NodePort port,
boolean wasSelected,
double x,
double y,
boolean firstDrag)
Callback called by mouseDraggedLeft(double,double) when a
NodePort is being dragged. |
protected void |
paperClicked(Graph2D graph,
double x,
double y,
boolean modifierSet)
Callback called by both mouseReleasedLeft(double,double) and
mouseShiftReleasedLeft(double,double) when the canvas has been
clicked. |
protected void |
paperDragged(Graph2D graph,
double x,
double y,
boolean firstDrag)
Callback called by mouseDraggedLeft(double,double) when a drag
operation is performed on the empty graph canvas. |
protected void |
portDragged(Graph2D graph,
Port port,
double x,
double y,
boolean firstDrag)
Callback called by mouseDraggedLeft(double,double) when a
Port is being dragged. |
protected void |
prepareView(Graph2DView view)
Callback called by activate(true) to initialize the view. |
void |
setAdjustScrollBarPolicy(boolean adjustScrollBarPolicy)
Whether the scroll bars will be shown (if needed) when this mode is activated. |
void |
setChild(ViewMode child,
java.awt.event.MouseEvent pressEvent,
java.awt.event.MouseEvent dragEvent,
java.awt.event.MouseEvent releaseEvent)
Sets a child mode for this mode. |
void |
setChildNodeCreationEnabled(boolean enabled)
Specifies whether child nodes may be created when clicking on a group node. |
void |
setCreateEdgeMode(ViewMode mode)
Sets the minor create edge mode associated with this mode. |
void |
setCreateEdgeOnGroupNodeLabelEnabled(boolean enabled)
Whether or not to connect an edge to a group node when the mouse is released on its first label. |
void |
setCyclicSelectionEnabled(boolean enabled)
If set to true this mode will cycle the selection through all hits at the
current position when the left mouse button is clicked while pressing the modifier(s)
specified in setCyclicSelectionModifierMask(int) . |
void |
setCyclicSelectionModifierMask(int modifierMask)
The given modifier mask is used for cyclic selection. |
void |
setDefaultCursor(java.awt.Cursor defaultCursor)
Sets the default cursor displayed by this mode if no other cursor is determined. |
void |
setEditNodeMode(ViewMode mode)
Sets the minor mode for node editing associated with this mode. |
void |
setGroupBorderWidth(int groupBorderWidth)
Sets the width of the active group node border. |
void |
setHotSpotMode(ViewMode hotSpotMode)
Setter for child mode HotSpotMode. |
void |
setMixedSelectionEnabled(boolean enable)
Allows or disallows mixed selections of different kinds of graph elements (nodes/bends, edges, labels, node ports) to exist at the same time. |
void |
setMouseInputMode(MouseInputMode mode)
Sets the minor mouse input mode associated with this mode. |
void |
setMoveLabelMode(ViewMode moveLabelMode)
Setter for child mode MoveLabelMode. |
void |
setMoveNodePortMode(ViewMode moveNodePortMode)
Setter for child mode MoveNodePortMode. |
void |
setMovePortMode(ViewMode movePortMode)
Setter for child mode MovePortMode. |
void |
setMoveSelectionMode(ViewMode mode)
Sets the minor move selection mode associated with this mode. |
void |
setMoveViewPortMode(ViewMode moveViewPortMode)
Setter for child mode MovePortMode. |
void |
setOrthogonalEdgeRouting(boolean enable)
Sets whether special support for orthogonal edge paths should be enabled for all edges. |
void |
setOrthogonalMoveBendsMode(ViewMode orthogonalMoveBendMode)
Setter for child mode OrthogonalMoveBendsMode. |
void |
setPopupMode(ViewMode mode)
Sets the minor popup mode associated with this mode. |
protected void |
setSelected(Graph2D graph,
Bend bend,
boolean state)
Sets the specified selection state for the specified bend. |
protected void |
setSelected(Graph2D graph,
Edge edge,
boolean state)
Sets the specified selection state for the specified edge. |
protected void |
setSelected(Graph2D graph,
Node node,
boolean state)
Sets the specified selection state for the specified node. |
protected void |
setSelected(Graph2D graph,
NodePort port,
boolean state)
Sets the specified selection state for the specified node port. |
protected void |
setSelected(Graph2D graph,
YLabel label,
boolean state)
Sets the specified selection state for the specified label. |
void |
setSelectionBoxMode(ViewMode mode)
Sets the minor selection box mode associated with this mode. |
void |
setSelectOnGroupNodeLabelEnabled(boolean enabled)
Specifies whether clicking on a group node's default label should select the node instead of creating a child node when child node creation is enabled. |
void |
setSnappingEnabled(boolean snapping)
Convenience method that tries to configure the various child modes of this mode to enable or disable snapping accordingly. |
void |
showEdgeTips(boolean b)
Specifies whether or not this mode will show a tool tip for edges. |
void |
showNodeTips(boolean b)
Specifies whether or not this mode will show a tool tip for nodes. |
boolean |
startEditor(MouseInputEditor editor)
Tries to start the given MouseInputEditor if mouse input is currently allowed and the corresponding MouseInputMode is available. |
protected void |
unselectAll(Graph2D graph)
Sets the selection state of all nodes, node labels, node ports, edges, edge labels, and bends to false . |
protected void |
unselectBends(Graph2D graph)
Sets the selection state of all bends in the specified graph to false . |
protected void |
unselectNodes(Graph2D graph)
Sets the selection state of all nodes in the specified graph to false . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Node pressedNode
protected ViewMode popupMode
protected ViewMode hotSpotMode
protected ViewMode selectionBoxMode
protected ViewMode createEdgeMode
protected ViewMode moveSelectionMode
protected ViewMode moveLabelMode
protected ViewMode movePortMode
protected ViewMode editNodeMode
protected ViewMode moveViewPortMode
protected MouseInputMode mouseInputMode
protected ViewMode moveNodePortMode
public static final java.lang.Object ORTHOGONAL_ROUTING_DPKEY
boolean
for each Edge object it is queried for.
Note that if no DataProvider is bound to the graph instance this mode will
automatically register one that delegates the request to isOrthogonalRouting(y.base.Edge)
.
isOrthogonalRouting(y.base.Edge)
Constructor Detail |
---|
public EditMode(ViewContainer vc)
public EditMode()
Method Detail |
---|
public boolean isAdjustScrollBarPolicy()
true
if the scroll bars in Graph2DView will be shown (if needed) when this mode is activated (default).
true
if the scroll bars in Graph2DView will be shown when this mode is activated (default).public void setAdjustScrollBarPolicy(boolean adjustScrollBarPolicy)
adjustScrollBarPolicy
- true
if the scroll bars in Graph2DView should be shown (if needed) when this mode is activated (default).public void setSnappingEnabled(boolean snapping)
MoveSelectionMode.setSnappingEnabled(boolean)
MoveSnapContext.setUsingOrthogonalMovementConstraints(boolean)
MoveSnapContext.setSnappingSegmentsToSnapLines(boolean)
OrthogonalMoveBendsMode.setSnappingEnabled(boolean)
CreateEdgeMode.setSnappingOrthogonalSegments(boolean)
CreateEdgeMode.setSnapToOrthogonalSegmentsDistance(double)
MovePortMode.setSegmentSnappingEnabled(boolean)
ViewMode
s that allow for customization of the snapping behavior, they should
be set one-by-one to appropriate values depending on the use case.
snapping
- Whether to enable snapping.protected ViewMode createHotSpotMode()
HotSpotMode
.protected MouseInputMode createMouseInputMode()
MouseInputMode
.protected ViewMode createMovePortMode()
MovePortMode
.protected ViewMode createMoveViewPortMode()
MoveViewPortMode
.protected ViewMode createMoveLabelMode()
MoveLabelMode
.protected ViewMode createMoveSelectionMode()
MoveSelectionMode
.protected ViewMode createCreateEdgeMode()
CreateEdgeMode
.protected ViewMode createSelectionBoxMode()
SelectionBoxMode
.protected ViewMode createPopupMode()
null
.protected ViewMode createEditNodeMode()
null
.protected ViewMode createMoveNodePortMode()
MoveNodePortMode
.public void activate(boolean activate)
ViewMode
ViewMode.ACTIVE_PROPERTY
as the property name.
activate
in class ViewMode
activate
- set true
when mode was activated
false
otherwisepublic void cancelEditing() throws java.lang.UnsupportedOperationException
setEditing(false)
if ViewMode.isEditing()
returns true
cancelEditing
in class ViewMode
java.lang.UnsupportedOperationException
- if the editing cannot be canceled for any reason.public void setChild(ViewMode child, java.awt.event.MouseEvent pressEvent, java.awt.event.MouseEvent dragEvent, java.awt.event.MouseEvent releaseEvent)
ViewMode
ViewMode.reactivateParent()
.
After the child mode is installed it will receive the
given press, drag and release events before any other mouse events.
Only non-null events will be delegated. active view
,
its new parent
, the last HitInfo
,
and will be activated
. null
is passed as the child or the child calls
its ViewMode.reactivateParent()
method,
the previously installed child will be deactivated
and have its parent
set to null
.
This behaves like a bound property using ViewMode.CHILD_MODE_PROPERTY
as the property name.
setChild
in class ViewMode
protected void prepareView(Graph2DView view)
activate(true)
to initialize the view.
This implementation sets the scrollbar policy and the cursor.
view
- the view to initialize.public void setMixedSelectionEnabled(boolean enable)
If disabled, this instance will clear the selection if the user selects
an item of another kind while holding the
modifier
.
The default is false
.
isMixedSelectionEnabled()
public boolean isMixedSelectionEnabled()
The default is false
.
setMixedSelectionEnabled(boolean)
public void setOrthogonalEdgeRouting(boolean enable)
false
.
See ORTHOGONAL_ROUTING_DPKEY
and isOrthogonalRouting(y.base.Edge)
for information on how to enable this special support for only a subset of
edges.
enable
- true
if all edges should be treated as being orthogonal.isOrthogonalEdgeRouting()
public boolean isOrthogonalEdgeRouting()
false
.
true
if special support for orthogonal edge paths is
enabled; false
otherwise.setOrthogonalEdgeRouting(boolean)
public void assignNodeLabel(boolean b)
true
.
doAssignNodeLabel()
public void allowNodeCreation(boolean b)
doAllowNodeCreation()
public void allowNodeEditing(boolean b)
doAllowNodeEditing()
public void allowEdgeCreation(boolean b)
doAllowEdgeCreation()
public void allowBendCreation(boolean b)
doAllowBendCreation()
public void allowMoveSelection(boolean b)
By default moving around selected elements is allowed.
doAllowMoveSelection()
public void allowMoveLabels(boolean b)
By default moving around labels is allowed.
doAllowMoveLabels()
public void allowMovePorts(boolean b)
By default moving around ports is allowed.
doAllowMovePorts()
public void allowLabelSelection(boolean b)
true
.
doAllowLabelSelection()
public void allowMoving(boolean b)
By default moving the viewport is allowed.
allowMovingWithPopup(boolean)
,
doAllowMoving()
public void allowMovingWithPopup(boolean b)
allowMoving(boolean)
, if it is set.
By default moving the viewport in the presence of a popup menu is not allowed.
b
- whether or not to allow moving with the right mouse button in the
presence of a popup menu.allowMoving(boolean)
,
doAllowMovingWithPopup()
public void allowResizeNodes(boolean b)
By default node resizing is allowed.
doAllowResizeNodes()
public void allowMouseInput(boolean b)
MouseInputMode
.
By default event delegation to MouseInputMode
is allowed.
doAllowMouseInput()
public boolean doAssignNodeLabel()
true
iff a generic node label is assigned for newly
created nodes.
This mode will act according to the return value of this method.
assignNodeLabel(boolean)
public boolean doAllowNodeCreation()
true
iff the creation of nodes should be allowed.
This mode will act according to the return value of this method.
allowNodeCreation(boolean)
public boolean doAllowNodeEditing()
true
iff the editing of nodes should be allowed.
This mode will act according to the return value of this method.
allowNodeEditing(boolean)
public boolean doAllowEdgeCreation()
true
iff the creation of edges should be allowed.
This mode will act according to the return value of this method.
allowEdgeCreation(boolean)
public boolean doAllowBendCreation()
true
iff the creation of bends should be allowed.
This mode will act according to the return value of this method.
allowBendCreation(boolean)
public boolean doAllowLabelSelection()
true
iff the selection of labels via mouse clicks
should be allowed.
This mode will act according to the return value of this method.
The default value is true
.
allowLabelSelection(boolean)
public boolean doAllowMoveLabels()
true
iff the moving of labels should be allowed.
This mode will act according to the return value of this method.
allowMoveLabels(boolean)
public boolean doAllowMovePorts()
true
iff the moving of ports should be allowed.
This mode will act according to the return value of this method.
allowMovePorts(boolean)
public boolean doAllowMouseInput()
true
iff events will be handled by a MouseInputMode first.
This mode will act according to the return value of this method.
allowMouseInput(boolean)
public boolean doAllowMoveSelection()
true
if selected elements may be moved around;
false
otherwise.allowMoveSelection(boolean)
public boolean doAllowMoving()
doAllowMovingWithPopup()
returns true
.
true
if the viewport may be moved; false
otherwise.doAllowMovingWithPopup()
,
allowMoving(boolean)
public boolean doAllowMovingWithPopup()
true
if the viewport may be moved in the presence of a
popup menu; false
otherwise.doAllowMoving()
,
allowMovingWithPopup(boolean)
public boolean doAllowResizeNodes()
true
if nodes may be resized by dragging at the
selection hotspots; false
otherwise.allowResizeNodes(boolean)
public void showNodeTips(boolean b)
getNodeTip(Node)
.
By default no node tips are displayed.
doShowNodeTips()
,
doShowEdgeTips()
,
showEdgeTips(boolean)
public boolean doShowNodeTips()
true
if this mode should display
tip text for a node.
showNodeTips(boolean)
,
doShowEdgeTips()
,
showEdgeTips(boolean)
public void showEdgeTips(boolean b)
getEdgeTip(Edge)
.
By default no edge tips are displayed.
doShowEdgeTips()
,
doShowNodeTips()
,
showNodeTips(boolean)
public boolean doShowEdgeTips()
true
if this mode should display
tip text for an edge.
showEdgeTips(boolean)
,
doShowNodeTips()
,
showNodeTips(boolean)
public void setCyclicSelectionEnabled(boolean enabled)
true
this mode will cycle the selection through all hits at the
current position when the left mouse button is clicked while pressing the modifier(s)
specified in setCyclicSelectionModifierMask(int)
.
enabled
- whether to activate this featureisCyclicSelectionEnabled()
public boolean isCyclicSelectionEnabled()
true
if this mode will cycle the selection through all hits at the
current position when the left mouse button is clicked while pressing the modifier(s)
specified in setCyclicSelectionModifierMask(int)
.setCyclicSelectionEnabled(boolean)
public void setCyclicSelectionModifierMask(int modifierMask)
modifierMask
- the modifier(s) for cyclic selectionsetCyclicSelectionEnabled(boolean)
,
getCyclicSelectionModifierMask()
public int getCyclicSelectionModifierMask()
setCyclicSelectionModifierMask(int)
,
isCyclicSelectionEnabled()
public ViewMode getEditNodeMode()
public void setEditNodeMode(ViewMode mode)
public ViewMode getPopupMode()
public void setPopupMode(ViewMode mode)
public ViewMode getMoveSelectionMode()
public void setMoveSelectionMode(ViewMode mode)
public MouseInputMode getMouseInputMode()
public void setMouseInputMode(MouseInputMode mode)
public ViewMode getCreateEdgeMode()
public void setCreateEdgeMode(ViewMode mode)
public ViewMode getSelectionBoxMode()
public void setSelectionBoxMode(ViewMode mode)
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.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 void labelClicked(Graph2D graph, YLabel label, boolean wasSelected, double x, double y, boolean modifierSet)
mouseReleasedLeft(double,double)
and
mouseShiftReleasedLeft(double,double)
when a YLabel
has been
clicked. This method implements the default operations of EditMode that
are performed when a label has been clicked.
graph
- the graph the label's associated node or edge resides in.label
- the label which has been clickedwasSelected
- whether the element is already selectedx
- the x coordinate where the mouse was clickedy
- the y coordinate where the mouse was clickedmodifierSet
- true
if the caller is mouseShiftReleasedLeft(double,double)
,
false
otherwiseprotected void labelClicked(YLabel label)
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.protected void nodePortClicked(Graph2D graph, NodePort port, boolean wasSelected, double x, double y, boolean modifierSet)
mouseReleasedLeft(double,double)
and
mouseShiftReleasedLeft(double,double)
when a
NodePort
has been clicked.
This method implements the default operations of EditMode that
are performed when a node port has been clicked.
graph
- the graph the specified port's associated node resides in.port
- the node port that has been clicked.wasSelected
- true
if the specified port is already
selected; false
otherwise.x
- the world coordinate that corresponds the mouse event's
x-coordinate.y
- the world coordinate that corresponds the mouse event's
y-coordinate.modifierSet
- true
if the caller is
mouseShiftReleasedLeft(double,double)
; false
otherwise.protected void nodeClicked(Graph2D graph, Node node, boolean wasSelected, double x, double y, boolean modifierSet)
mouseReleasedLeft(double,double)
and
mouseShiftReleasedLeft(double,double)
when a Node
has been
clicked. This method implements the default operations of EditMode that
are performed when a node has been clicked.
graph
- the graph the node resides innode
- the node which has been clickedwasSelected
- whether the element is already selectedx
- the x coordinate where the mouse was clickedy
- the y coordinate where the mouse was clickedmodifierSet
- true
if the caller is mouseShiftReleasedLeft(double,double)
,
false
otherwiseprotected void beforeSelectionCycling(YCursor cyclicHits)
cyclicHits
- the current list of elements for cyclic selectionprotected boolean isGroupNodeBorderHit(Graph2D graph, Node node, double x, double y, boolean considerGroupNodeLabel)
getGroupBorderWidth()
.
graph
- the graph to which the specified node belongs.node
- the node to be checked.x
- the x-coordinate of the hit event.y
- the y-coordinate of the hit event.considerGroupNodeLabel
- specifies whether the bounds of the default
label should be considered to be part of the border area.
true
if the specified node is a group node and the
specified coordinates lie within its border area; false
otherwise.protected void bendClicked(Graph2D graph, Bend bend, boolean wasSelected, double x, double y, boolean modifierSet)
mouseReleasedLeft(double,double)
and
mouseShiftReleasedLeft(double,double)
when a Bend
has been
clicked. This method implements the default operations of EditMode that
are performed when a bend has been clicked.
graph
- the graph the bend resides inbend
- the bend which has been clickedwasSelected
- whether the element is already selectedx
- the x coordinate where the mouse was clickedy
- the y coordinate where the mouse was clickedmodifierSet
- true
if the caller is mouseShiftReleasedLeft(double,double)
,
false
otherwiseprotected void edgeClicked(Graph2D graph, Edge edge, boolean wasSelected, double x, double y, boolean modifierSet)
mouseReleasedLeft(double,double)
and
mouseShiftReleasedLeft(double,double)
when an Edge
has been
clicked. This method implements the default operations of EditMode that
are performed when a edge has been clicked.
graph
- the graph the edge resides inedge
- the edge which has been clickedwasSelected
- whether the element is already selectedx
- the x coordinate where the mouse was clickedy
- the y coordinate where the mouse was clickedmodifierSet
- true
if the caller is mouseShiftReleasedLeft(double,double)
,
false
otherwiseprotected void paperClicked(Graph2D graph, double x, double y, boolean modifierSet)
mouseReleasedLeft(double,double)
and
mouseShiftReleasedLeft(double,double)
when the canvas has been
clicked. This method implements the default operations of EditMode that
are performed when nothing is clicked.
By default this method calls createNode(Graph2D,double,double)
when
node creation is allowed and nothing is currently selected.
graph
- the graph which resides in the canvasx
- the x coordinate where the mouse was clickedy
- the y coordinate where the mouse was clickedmodifierSet
- true
if the caller is mouseShiftReleasedLeft(double,double)
,
false
otherwisepublic void mousePressed(java.awt.event.MouseEvent e)
ViewMode
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class ViewMode
public 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.protected void bendDragged(Graph2D graph, Bend bend, boolean wasSelected, double x, double y, boolean firstDrag)
mouseDraggedLeft(double,double)
when a
Bend
is being dragged.
This method implements the default operations of EditMode
that
are performed when a bend is being dragged.
graph
- the graph the bend resides in.bend
- the bend which is being dragged.wasSelected
- whether the element is already selected.x
- the x coordinate of the current mouse drag event point.y
- the y coordinate of the current mouse drag event point.firstDrag
- true
if the previous mouse event captured by
this ViewMode
was not a drag event;
false
otherwise.protected void edgeDragged(Graph2D graph, Edge edge, boolean wasSelected, double x, double y, boolean firstDrag)
mouseDraggedLeft(double,double)
when an
Edge
is being dragged.
This method implements the default operations of EditMode
that
are performed when an edge is being dragged.
graph
- the graph the edge resides in.edge
- the edge which is being dragged.wasSelected
- whether the element is already selected.x
- the x coordinate of the current mouse drag event point.y
- the y coordinate of the current mouse drag event point.firstDrag
- true
if the previous mouse event captured by
this ViewMode
was not a drag event;
false
otherwise.protected void hotSpotDragged(Graph2D graph, double x, double y, boolean firstDrag)
mouseDraggedLeft(double,double)
when a
node hot spot is being dragged.
This method implements the default operations of EditMode
that
are performed when a hot spot is being dragged.
graph
- the graph for which the event occurred.x
- the x coordinate of the current mouse drag event point.y
- the y coordinate of the current mouse drag event point.firstDrag
- true
if the previous mouse event captured by
this ViewMode
was not a drag event;
false
otherwise.protected void labelDragged(Graph2D graph, EdgeLabel label, boolean wasSelected, double x, double y, boolean firstDrag)
mouseDraggedLeft(double,double)
when an
EdgeLabel
is being dragged.
This method implements the default operations of EditMode
that
are performed when an edge label is being dragged.
graph
- the graph the edge resides in.label
- the edge label which is being dragged.wasSelected
- whether the element is already selected.x
- the x coordinate of the current mouse drag event point.y
- the y coordinate of the current mouse drag event point.firstDrag
- true
if the previous mouse event captured by
this ViewMode
was not a drag event;
false
otherwise.protected void labelDragged(Graph2D graph, NodeLabel label, boolean wasSelected, double x, double y, boolean firstDrag)
mouseDraggedLeft(double,double)
when a
NodeLabel
is being dragged.
This method implements the default operations of EditMode
that
are performed when a node label is being dragged.
graph
- the graph the edge resides in.label
- the node label which is being dragged.wasSelected
- whether the element is already selected.x
- the x coordinate of the current mouse drag event point.y
- the y coordinate of the current mouse drag event point.firstDrag
- true
if the previous mouse event captured by
this ViewMode
was not a drag event;
false
otherwise.protected void nodeDragged(Graph2D graph, Node node, boolean wasSelected, double x, double y, boolean firstDrag)
mouseDraggedLeft(double,double)
when a
Node
is being dragged.
This method implements the default operations of EditMode
that
are performed when a node is being dragged.
graph
- the graph the node resides in.node
- the node which is being dragged.wasSelected
- whether the element is already selected.x
- the x coordinate of the current mouse drag event point.y
- the y coordinate of the current mouse drag event point.firstDrag
- true
if the previous mouse event captured by
this ViewMode
was not a drag event;
false
otherwise.protected void nodePortDragged(Graph2D graph, NodePort port, boolean wasSelected, double x, double y, boolean firstDrag)
mouseDraggedLeft(double,double)
when a
NodePort
is being dragged.
This method implements the default operations of EditMode
that
are performed when a node port is being dragged.
graph
- the graph the specified port's associated node resides in.port
- the node port which is being dragged.wasSelected
- true
if the specified port is already
selected; false
otherwise.x
- the world coordinate that corresponds the mouse drag event's
x-coordinate.y
- the world coordinate that corresponds the mouse drag event's
y-coordinate.firstDrag
- true
if the previous mouse event captured by
this ViewMode
was not a drag event;
false
otherwise.protected void paperDragged(Graph2D graph, double x, double y, boolean firstDrag)
mouseDraggedLeft(double,double)
when a drag
operation is performed on the empty graph canvas.
This method implements the default operations of EditMode
that
are performed when a drag operation is performed on the empty graph canvas.
graph
- the graph which resides in the canvasx
- the x coordinate where the mouse was clickedy
- the y coordinate where the mouse was clickedfirstDrag
- true
if the previous mouse event captured by
this ViewMode
was not a drag event;
false
otherwise.protected void portDragged(Graph2D graph, Port port, double x, double y, boolean firstDrag)
mouseDraggedLeft(double,double)
when a
Port
is being dragged.
This method implements the default operations of EditMode
that
are performed when a port is being dragged.
graph
- the graph the edge resides in.port
- the port which is being dragged.x
- the x coordinate of the current mouse drag event point.y
- the y coordinate of the current mouse drag event point.firstDrag
- true
if the previous mouse event captured by
this ViewMode
was not a drag event;
false
otherwise.protected void setSelected(Graph2D graph, NodePort port, boolean state)
graph
- the graph the specified port's associated node resides in.port
- the node port whose selection state has to be changed.state
- the new selection state for the specified node port.protected void setSelected(Graph2D graph, Node node, boolean state)
The default implementation sets the selection state of the specified node as well as the states of all bends in self loop edges incident to the specified node.
graph
- the graph the specified node resides in.node
- the node whose selection state has to be changed.state
- the new selection state for the specified node.protected void setSelected(Graph2D graph, YLabel label, boolean state)
graph
- the graph the specified label's associated node or edge resides
in.label
- the label whose selection state has to be changed.state
- the new selection state for the specified label.protected void setSelected(Graph2D graph, Edge edge, boolean state)
graph
- the graph the specified edge resides in.edge
- the edge whose selection state has to be changed.state
- the new selection state for the specified edge.protected void setSelected(Graph2D graph, Bend bend, boolean state)
graph
- the graph the specified bend's associated edge resides in.bend
- the bend whose selection state has to be changed.state
- the new selection state for the specified bend.protected void unselectNodes(Graph2D graph)
false
.
graph
- the graph whose nodes' selection states have to be changed.protected void unselectBends(Graph2D graph)
false
.
graph
- the graph whose bends' selection states have to be changed.protected void unselectAll(Graph2D graph)
false
.
graph
- the graph whose elements' selection states have to be changed.protected boolean isSelectionEmpty(Graph2D graph)
true
if there are no selected nodes, node labels,
node ports, edges, edge labels, and/or bends in the specified graph and
false
otherwise.
graph
- the graph whose elements' selection states are checked.
true
if there are no selected nodes, node labels,
node ports, edges, edge labels, and/or bends in the specified graph and
false
otherwise.protected boolean isSelected(Graph2D graph, Bend bend)
true
if the specified bend is currently selected;
false
otherwise.
graph
- the graph that holds the specified bend's associated edge.bend
- the bend whose selection state is checked.
true
if the specified bend is currently selected;
false
otherwise.protected boolean isSelected(Graph2D graph, Edge edge)
true
if the specified edge is currently selected;
false
otherwise.
graph
- the graph that holds the specified edge.edge
- the edge whose selection state is checked.
true
if the specified edge is currently selected;
false
otherwise.protected boolean isSelected(Graph2D graph, YLabel label)
true
if the specified label is currently selected;
false
otherwise.
graph
- the graph that holds the specified label's associated edge or
node.label
- the label whose selection state is checked.
true
if the specified label is currently selected;
false
otherwise.protected boolean isSelected(Graph2D graph, Node node)
true
if the specified node is currently selected;
false
otherwise.
graph
- the graph that holds the specified node.node
- the node whose selection state is checked.
true
if the specified node is currently selected;
false
otherwise.protected boolean isSelected(Graph2D graph, NodePort port)
true
if the specified port is currently selected;
false
otherwise.
graph
- the graph that holds the specified port's associated node.port
- the node port whose selection state is checked.
true
if the specified port is currently selected;
false
otherwise.protected boolean isOrthogonalRouting(Edge edge)
edge
- the edge to determine the attribute for
true
if the edge should be routed orthogonallyORTHOGONAL_ROUTING_DPKEY
,
OrthogonalMoveBendsMode
,
HotSpotMode.isOrthogonalRouting(y.base.Edge)
,
MoveSelectionMode.isOrthogonalRouting(y.base.Edge)
,
MovePortMode.isOrthogonalRouting(y.base.Edge)
,
CreateEdgeMode.setOrthogonalEdgeCreation(boolean)
protected Bend createBend(Graph2D graph, Edge edge, double x, double y)
mouseDraggedLeft(double,double)
when
a bend should be created. This method implements the default bend creation
code of EditMode: graph.getRealizer(edge).insertBend(x,y)
graph
- the graph which resided in the canvasedge
- the edge to create the bend onx
- the x coordinate where the mouse was draggedy
- the y coordinate where the mouse was dragged
null
if no bend should be createdprotected Node createNode(Graph2D graph, double x, double y)
paperClicked(Graph2D,double,double,boolean)
when a node should be created. Invoking this method is equivalent to:
createNode(graph, x, y, null);
graph
- the graph which resided in the canvasx
- the x coordinate where the mouse was clickedy
- the y coordinate where the mouse was clicked
null
if no node should be created.protected Node createNode(Graph2D graph, double x, double y, Node parent)
groupNodeClicked(y.base.Node)
when a node
should be created.
This method implements the default node creation code of EditMode.
graph
- the graph which resided in the canvasx
- the x coordinate where the mouse was clickedy
- the y coordinate where the mouse was clickedparent
- the parent group node for the newly created node.
If null
, the new node will be a top level node.
null
if no node should be created.protected void configureNode(Graph2D graph, Node node)
createNode(Graph2D,double,double,y.base.Node)
right after a new node has been created (and prior to assigning the new
node a parent node).
The default implementation sets an initial label text for the specified
node's default NodeLabel
if doAssignNodeLabel()
returns true
.
graph
- the graph which resided in the canvas.node
- the node for which the label is created.public void mousePressedRight(double x, double y)
mousePressedRight
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 mouseDraggedRight(double x, double y)
ViewMode
mouseDraggedRight
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 mouseReleasedRight(double x, double y)
ViewMode
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 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 mouseClicked(double x, double y)
ViewMode
mouseClicked
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 mouseEntered(java.awt.event.MouseEvent e)
ViewMode
mouseEntered
in interface java.awt.event.MouseListener
mouseEntered
in class ViewMode
public boolean startEditor(MouseInputEditor editor)
editor
- the editor to start
doAllowMouseInput()
,
setMouseInputMode(MouseInputMode)
protected boolean isCyclicSelectionModifierPressed()
protected HitInfo createCyclicHitInfo(double x, double y)
protected java.lang.String getNodeTip(Node v)
showNodeTips
.
By default the label text of the node will be returned.
Subclasses may want to overwrite this behavior.
protected java.lang.String getEdgeTip(Edge e)
showEdgeTips
.
By default the first label text of the edge will be returned.
Subclasses may want to overwrite this behavior.
protected void nodeCreated(Node v)
protected void bendCreated(Graph2D graph, Edge edge, Bend bend, double x, double y)
protected void nodeClicked(Node v)
groupNodeClicked(y.base.Node)
for group nodes and triggers no
action for all other nodes.
Subclasses that want to listen to node clicks can overwrite this method.
v
- the node that was clicked on.HierarchyManager.isGroupNode(y.base.Node)
protected void groupNodeClicked(Node v)
isGroupNodeBorderHit
.
Subclasses that want to listen to group node clicks can overwrite this
method.
v
- the group node that was clicked on.HierarchyManager.isGroupNode(y.base.Node)
,
isChildNodeCreationEnabled()
,
isGroupNodeBorderHit(Graph2D,y.base.Node,double,double,boolean)
,
isSelectOnGroupNodeLabelEnabled()
,
getGroupBorderWidth()
public ViewMode getMoveViewPortMode()
MoveViewPortMode
. This mode gets activated when the user
right-drags with the mouse if there is no popup mode
public ViewMode getMoveLabelMode()
public void setMoveViewPortMode(ViewMode moveViewPortMode)
MovePortMode
is set.
moveViewPortMode
- the new modepublic void setMoveLabelMode(ViewMode moveLabelMode)
MoveLabelMode
is set.
moveLabelMode
- New value of property moveLabelMode.public ViewMode getMovePortMode()
public void setMovePortMode(ViewMode movePortMode)
MovePortMode
is set.
movePortMode
- New value of property movePortMode.public ViewMode getHotSpotMode()
public void setHotSpotMode(ViewMode hotSpotMode)
HotSpotMode
is set.
public ViewMode getMoveNodePortMode()
public void setMoveNodePortMode(ViewMode moveNodePortMode)
MoveNodePortMode
is set.
moveNodePortMode
- the ViewMode
instance to handle
moving selected node ports.protected boolean isCreateEdgeGesture(java.awt.event.MouseEvent lastPress, java.awt.event.MouseEvent lastDrag)
getGroupBorderWidth()
. Activation
of the label hit acceptance is controlled by isCreateEdgeOnGroupNodeLabelEnabled()
.
lastPress
- the last press eventlastDrag
- the last drag event
protected boolean isEditNodeGesture(Node hitNode, java.awt.event.MouseEvent lastPressEvent, java.awt.event.MouseEvent lastReleaseEvent, java.awt.event.MouseEvent lastClickEvent)
true
if the clickCount
of lastClickEvent
is 2
.
hitNode
- the node that was hitlastPressEvent
- the last mouse pressed eventlastReleaseEvent
- the last mouse released eventlastClickEvent
- the last mouse clicked event
public java.awt.Cursor getDefaultCursor()
public void setDefaultCursor(java.awt.Cursor defaultCursor)
defaultCursor
- the cursor to use by defaultprotected boolean editNode(Node hitNode, java.util.EventObject e)
editNodeMode
.
If the current editNodeMode
is a CellEditorMode
, this method asks
the mode whether the node is editable
and
then invokes CellEditorMode.editNode(y.base.Node,java.util.EventObject)
.
hitNode
- the node that has been hit and should be editede
- the event object that can be used to trigger the editing, may be null
public ViewMode getOrthogonalMoveBendsMode()
setOrthogonalMoveBendsMode(ViewMode)
,
createOrthogonalMoveBendsMode()
public void setOrthogonalMoveBendsMode(ViewMode orthogonalMoveBendMode)
isOrthogonalRouting(y.base.Edge)
returns true
for the edge.
By default, this mode does not get activated.
orthogonalMoveBendMode
- The OrthogonalMoveBendsMode that should be used for moving edge segments and
maintaining an orthogonal edge path.getOrthogonalMoveBendsMode()
,
ORTHOGONAL_ROUTING_DPKEY
protected ViewMode createOrthogonalMoveBendsMode()
protected HitInfo createLabelHitInfo(double x, double y)
public void setGroupBorderWidth(int groupBorderWidth)
10
.
isCreateEdgeGesture(java.awt.event.MouseEvent,java.awt.event.MouseEvent)
public int getGroupBorderWidth()
setGroupBorderWidth(int)
public boolean isCreateEdgeOnGroupNodeLabelEnabled()
public void setCreateEdgeOnGroupNodeLabelEnabled(boolean enabled)
isCreateEdgeGesture(java.awt.event.MouseEvent,java.awt.event.MouseEvent)
public boolean isChildNodeCreationEnabled()
true
if a child node should be created when clicking
on a group node; false
otherwise.setChildNodeCreationEnabled(boolean)
,
groupNodeClicked(y.base.Node)
public void setChildNodeCreationEnabled(boolean enabled)
enabled
- true
if child node creation should be
enabled; false
otherwise.isChildNodeCreationEnabled()
,
groupNodeClicked(y.base.Node)
public boolean isSelectOnGroupNodeLabelEnabled()
true
if clicking on a group node's default label
should select the node instead of creating a child node; false
otherwise.setSelectOnGroupNodeLabelEnabled(boolean)
,
isChildNodeCreationEnabled()
public void setSelectOnGroupNodeLabelEnabled(boolean enabled)
enabled
- true
if label hits should select the node;
false
otherwise.isSelectOnGroupNodeLabelEnabled()
,
isChildNodeCreationEnabled()
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |