public void beginUpdate() { updateLevel++; if (updateLevel == 1) { transEditAttrs = new Hashtable(); transEditCS = new ConnectionSet(); transEditPM = new ParentMap(); transAddedCells = new HashSet(); transRemovedCells = new HashSet(); } }
/** * Helper methods that connects the source of <code>edge</code> to * <code>port</code> in <code>model</model>. */ public static void setSourcePort(GraphModel model, Object edge, Object port) { model.edit(null, new ConnectionSet(edge, port, true), null, null); }
/** * Helper methods that connects the source of <code>edge</code> to * <code>port</code> in <code>model</model>. */ public static void setTargetPort(GraphModel model, Object edge, Object port) { model.edit(null, new ConnectionSet(edge, port, false), null, null); }
/** * Inserts the specified edge into the graph model. This method does in fact * nothing, it calls insert with a default connection set. * * @param edge * the edge to be inserted * @param source * the source port this edge is connected to * @param target * the target port this edge is connected to */ public void insertEdge(Object edge, Object source, Object target) { insert(new Object[] { edge }, new Hashtable(), new ConnectionSet(edge, source, target), new ParentMap()); }
public ConnectionSet connections(String[] roles, DefaultEdge[] edges, Port[] objects) { // Connections that will be inserted into the Model ConnectionSet cs = new ConnectionSet(); // Create connections between objects and this n-edge. for (int i = 0; i < objects.length; i++) { cs.connect(edges[i], this.getPort(roles[i]), objects[i]); } return cs; }
/** * Inserts the specified cells into the graph model. This method is a * general implementation of cell insertion. If the source and target port * are null, then no connection set is created. The method uses the * attributes from the specified edge and the egdge's children to construct * the insert call. This example shows how to insert an edge with a special * arrow between two known vertices: * * <pre> * Object source = graph.getDefaultPortForCell(sourceVertex).getCell(); * Object target = graph.getDefaultPortForCell(targetVertex).getCell(); * DefaultEdge edge = new DefaultEdge("Hello, world!"); * edge.setSource(source); * edge.setTarget(target); * Map attrs = edge.getAttributes(); * GraphConstants.setLineEnd(attrs, GraphConstants.ARROW_TECHNICAL); * graph.getGraphLayoutCache().insert(edge); * </pre> */ public void insert(Object[] cells) { insert(cells, new Hashtable(), new ConnectionSet(), new ParentMap()); }
Iterator insertedIterator = insertedList.iterator(); ConnectionSet cs = new ConnectionSet(); while (insertedIterator.hasNext())
public void run() { ConnectionSet cs = new ConnectionSet(); cs.connect(newEdge, otherextreme.getFirstChild(), vertex.getFirstChild()); Hashtable edgeprops = new Hashtable(); Hashtable elements = new Hashtable(); GraphConstants.setDashPattern(edgeprops, new float[] { 3, 3 }); elements.put(newEdge, edgeprops); glc.insert(new Object[] { newEdge }, elements, cs, null); // to conenct port with port } };
ConnectionSet cs = new ConnectionSet();
final ConnectionSet cs = new ConnectionSet();
/** * Creates a new connection set based on this connection set, where the * edges, and ports are mapped using <code>map</code>. If a port is not * found, the old port is used. If both, the edge and the port are not in * <code>map</code>, the entry is ignored. * <p> * <strong>Note: </strong> Consequently, unselected edges are only * reconnected at the first "paste" after a "cut", because in this case the * ConnectionSet is not cloned. */ public ConnectionSet clone(Map map) { ConnectionSet cs = new ConnectionSet(); Iterator it = connections(); while (it.hasNext()) { // Shortcut Vars Connection c = (Connection) it.next(); Object edge = map.get(c.getEdge()); Object port = c.getPort(); if (port != null) port = map.get(port); // New Port if (edge != null && port != null) cs.connect(edge, port, c.isSource()); // Old Port else if (edge != null) cs.connect(edge, c.getPort(), c.isSource()); } return cs; }
/** * Applies <code>connectionSet</code> to the model. Returns a connection * set that may be used to undo this change. */ protected ConnectionSet handleConnectionSet(ConnectionSet cs) { if (cs != null) { ConnectionSet csundo = new ConnectionSet(); Iterator it = cs.connections(); while (it.hasNext()) { ConnectionSet.Connection c = (ConnectionSet.Connection) it .next(); Object edge = c.getEdge(); if (c.isSource()) csundo.connect(edge, getSource(edge), true); else csundo.connect(edge, getTarget(edge), false); handleConnection(c, false); } // When removing edges it is possible that an edge is // removed in a later step which has been added in a // previous connection establishment (set semantic). // Therefore, we first need to remove all old connections // and then add all new connections in two steps. it = cs.connections(); while (it.hasNext()) handleConnection((ConnectionSet.Connection) it.next(), true); return csundo; } return null; }
ConnectionSet cs = new ConnectionSet();
/** * Returns a connection set that represents the connection or disconnection * of <code>cells</code> in <code>model</code> based on * <code>disconnect</code>. */ public static ConnectionSet create(GraphModel m, Object[] cells, boolean disconnect) { ConnectionSet cs = new ConnectionSet(); for (int i = 0; i < cells.length; i++) { Object cell = cells[i]; // Edge if (m.isEdge(cell)) { if (disconnect) cs.disconnect(cell); else cs.connect(cell, m.getSource(cell), m.getTarget(cell)); } // Port Iterator it = m.edges(cell); while (it.hasNext()) { // Edge At Port Object edge = it.next(); if (m.getSource(edge) == cell) connect(cs, edge, cell, true, disconnect); else if (m.getTarget(edge) == cell) connect(cs, edge, cell, false, disconnect); } } return cs; }
nested = new Hashtable(); if (cs == null) cs = new ConnectionSet(); if (pm == null) pm = new ParentMap();
ConnectionSet cs = new ConnectionSet(); Map attributes = new Hashtable();
protected ConnectionSet createConnectionSet(EdgeView view, boolean verbose) { Object edge = view.getCell(); GraphModel model = graph.getModel(); ConnectionSet cs = new ConnectionSet(); Object sourcePort = null, targetPort = null; if (view.getSource() != null) sourcePort = view.getSource().getCell(); else if (view.getSourceParentView() != null) sourcePort = model.getSource(edge); if (view.getTarget() != null) targetPort = view.getTarget().getCell(); else if (view.getTargetParentView() != null) targetPort = model.getTarget(edge); if (view.getTarget() != null) targetPort = view.getTarget().getCell(); if (verbose || (sourcePort != model.getSource(edge) && source)) cs.connect(edge, sourcePort, true); if (verbose || (targetPort != model.getTarget(edge) && target)) cs.connect(edge, targetPort, false); return cs; }
ConnectionSet cs = new ConnectionSet(); for (int i = 0; i < cells.length; i++) { if (cells[i] instanceof EdgeView) {