|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.AbstractAction y.view.Graph2DViewActions.DuplicateAction
public static class Graph2DViewActions.DuplicateAction
Action that allows to duplicate nodes or edges. The nodes and edges to
duplicate are determined by the cursors returned by Graph2D.selectedNodes()
and Graph2D.selectedEdges()
, respectively. If there is at least one
selected node, the selected edges are ignored and the edges to duplicate
are induced by the selected nodes instead.
createDuplicates(Graph2D, y.base.NodeList, y.base.EdgeList, java.util.Map, java.util.Map)
,
Serialized FormField Summary |
---|
Fields inherited from class javax.swing.AbstractAction |
---|
changeSupport, enabled |
Fields inherited from interface javax.swing.Action |
---|
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON |
Constructor Summary | |
---|---|
Graph2DViewActions.DuplicateAction(Graph2DView view)
Creates a new instance of DuplicateAction . |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Invokes duplicate(Graph2DView) for the view returned by
getView(e) . |
protected void |
createDuplicates(Graph2D graph,
NodeList newNodes,
EdgeList newEdges,
java.util.Map mappedNodes,
java.util.Map mappedEdges)
Duplicates nodes or edges. |
protected void |
createLabelDuplicates(Graph2D graph,
java.util.List newNodeLabels,
java.util.List newEdgeLabels,
java.util.Map mappedNodeLabels,
java.util.Map mappedEdgeLabels)
Duplicates node or edge labels. |
void |
duplicate(Graph2DView view)
Duplicates selected nodes or selected edges of the specified view. |
protected java.util.List |
getEdgeLabelsToDuplicate(Graph2D graph)
Determines the edge labels to duplicate. |
protected EdgeList |
getEdgesToDuplicate(Graph2D graph)
Determines the edges to duplicate. |
protected java.util.List |
getNodeLabelsToDuplicate(Graph2D graph)
Determines the node labels to duplicate. |
protected NodeList |
getNodesToDuplicate(Graph2D graph)
Determines the nodes to duplicate. |
protected Graph2DView |
getView(java.awt.event.ActionEvent e)
Determines the view in which to duplicate graph elements. |
protected void |
layoutDuplicates(Graph2D graph,
NodeList newNodes,
EdgeList newEdges,
java.util.Map mappedNodes,
java.util.Map mappedEdges)
Lays out the nodes and/or edges created by createDuplicates . |
protected void |
placeLabelDuplicates(Graph2D graph,
java.util.List newNodeLabels,
java.util.List newEdgeLabels,
java.util.Map mappedNodeLabels,
java.util.Map mappedEdgeLabels)
Places the node and/or edge labels created by createLabelDuplicates . |
protected void |
selectDuplicates(Graph2D graph,
NodeList newNodes,
EdgeList newEdges,
java.util.Map mappedNodes,
java.util.Map mappedEdges)
Selects the nodes and/or edges created by createDuplicates . |
protected void |
selectLabelDuplicates(Graph2D graph,
java.util.List newNodeLabels,
java.util.List newEdgeLabels,
java.util.Map mappedNodeLabels,
java.util.Map mappedEdgeLabels)
Selects the node and/or edge labels created by createLabelDuplicates . |
Methods inherited from class javax.swing.AbstractAction |
---|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Graph2DViewActions.DuplicateAction(Graph2DView view)
DuplicateAction
.
view
- the default view that is used if the actual view cannot be
determined from the information provided by an ActionEvent
.Method Detail |
---|
public void actionPerformed(java.awt.event.ActionEvent e)
duplicate(Graph2DView)
for the view returned by
getView(e)
.
e
- the ActionEvent
that triggers the duplication of
graph elements.public void duplicate(Graph2DView view)
view
- the related Graph2DView.createDuplicates(Graph2D, y.base.NodeList, y.base.EdgeList, java.util.Map, java.util.Map)
protected void createDuplicates(Graph2D graph, NodeList newNodes, EdgeList newEdges, java.util.Map mappedNodes, java.util.Map mappedEdges)
getNodesToDuplicate(Graph2D)
and getEdgesToDuplicate(Graph2D)
, respectively. If there is at
least one selected node, the selected edges are ignored and the edges to
duplicate are induced by the selected nodes instead.
For each selected node, a new (duplicate) node is created and connected
to the same non-selected neighbors as the original one. Additionally,
each duplicate is connected to the duplicates of the selected neighbors
of its original node.
If there is no selected node, for each selected edge a new edge is
created with the same source and target node.
graph
- the related graph.newNodes
- the created nodes are stored in this list.newEdges
- the created edges are stored in this list.mappedNodes
- for each new node, the mapping to its original node
is stored in this map.mappedEdges
- for each new edge, the mapping to its original edge
is stored in this map.protected NodeList getNodesToDuplicate(Graph2D graph)
graph
- the related graph.
createDuplicates(Graph2D, y.base.NodeList, y.base.EdgeList, java.util.Map, java.util.Map)
protected EdgeList getEdgesToDuplicate(Graph2D graph)
graph
- the related graph.
createDuplicates(Graph2D, y.base.NodeList, y.base.EdgeList, java.util.Map, java.util.Map)
protected void layoutDuplicates(Graph2D graph, NodeList newNodes, EdgeList newEdges, java.util.Map mappedNodes, java.util.Map mappedEdges)
createDuplicates
.
graph
- the related graph.newNodes
- the newly created nodes.newEdges
- the newly created edges.mappedNodes
- mappings from new nodes to original nodes (i.e.
nodes that were duplicated).mappedEdges
- mappings from new edges to original edges (i.e.
edges that were duplicated).createDuplicates(Graph2D, y.base.NodeList, y.base.EdgeList, java.util.Map, java.util.Map)
protected void selectDuplicates(Graph2D graph, NodeList newNodes, EdgeList newEdges, java.util.Map mappedNodes, java.util.Map mappedEdges)
createDuplicates
.
graph
- the related graph.newNodes
- the newly created nodes.newEdges
- the newly created edges.mappedNodes
- mappings from new nodes to original nodes (i.e.
nodes that were duplicated).mappedEdges
- mappings from new edges to original edges (i.e.
edges that were duplicated).createDuplicates(Graph2D, y.base.NodeList, y.base.EdgeList, java.util.Map, java.util.Map)
protected void createLabelDuplicates(Graph2D graph, java.util.List newNodeLabels, java.util.List newEdgeLabels, java.util.Map mappedNodeLabels, java.util.Map mappedEdgeLabels)
getNodeLabelsToDuplicate(Graph2D)
or getEdgeLabelsToDuplicate(Graph2D)
, respectively.
For each selected label, a new (duplicate) label is created and connected to the same non-selected node or edge as
the original one.
graph
- the related graph.newNodeLabels
- the created node labels are stored in this list.newEdgeLabels
- the created edge labels are stored in this list.mappedNodeLabels
- for each new node label, the mapping to its original node label is stored in this map.mappedEdgeLabels
- for each new edge label, the mapping to its original edge label is stored in this map.protected java.util.List getNodeLabelsToDuplicate(Graph2D graph)
graph
- the related graph.
createLabelDuplicates(Graph2D, java.util.List, java.util.List, java.util.Map, java.util.Map)
protected java.util.List getEdgeLabelsToDuplicate(Graph2D graph)
graph
- the related graph.
createLabelDuplicates(Graph2D, java.util.List, java.util.List, java.util.Map, java.util.Map)
protected void placeLabelDuplicates(Graph2D graph, java.util.List newNodeLabels, java.util.List newEdgeLabels, java.util.Map mappedNodeLabels, java.util.Map mappedEdgeLabels)
createLabelDuplicates
. Node and edge labels are set to one of the remaining label positions a discrete label model offers. If all positions are in use, the label is placed over its original. In case the label has a free label model, the label is placed below its original.
graph
- the related graph.newNodeLabels
- the newly created node labels.newEdgeLabels
- the newly created edge labels.mappedNodeLabels
- mappings from new node labels to original node labels (i.e. labels that were duplicated).mappedEdgeLabels
- mappings from new edge labels to original edge labels (i.e. labels that were duplicated).createLabelDuplicates(Graph2D, java.util.List, java.util.List, java.util.Map, java.util.Map)
protected void selectLabelDuplicates(Graph2D graph, java.util.List newNodeLabels, java.util.List newEdgeLabels, java.util.Map mappedNodeLabels, java.util.Map mappedEdgeLabels)
createLabelDuplicates
.
graph
- the related graph.newNodeLabels
- the newly created node labels.newEdgeLabels
- the newly created edge labels.mappedNodeLabels
- mappings from new node labels to original node labels (i.e. labels that were
duplicated).mappedEdgeLabels
- mappings from new edge labels to original edge labels (i.e. labels that were
duplicated).createDuplicates(Graph2D, y.base.NodeList, y.base.EdgeList, java.util.Map, java.util.Map)
protected Graph2DView getView(java.awt.event.ActionEvent e)
e
- the ActionEvent
that triggers the duplication of graph elements.
actionPerformed(java.awt.event.ActionEvent)
,
Graph2DViewActions.DuplicateAction(y.view.Graph2DView)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |