private static void setStyle(Object v, String style) { ((mxICell) v).setStyle(style); }
/** * Invoked after a cell has been removed from the model. This recursively * removes the cell from its terminals and removes the mapping from the Id * to the cell. * * @param cell Cell that has been removed. */ protected void cellRemoved(Object cell) { if (cell instanceof mxICell) { mxICell mxc = (mxICell) cell; int childCount = mxc.getChildCount(); for (int i = 0; i < childCount; i++) { cellRemoved(mxc.getChildAt(i)); } if (cells != null && mxc.getId() != null) { cells.remove(mxc.getId()); } } }
public static Set<mxICell> getTargetCells(mxICell input) { if(input == null) return Collections.emptySet(); int count = input.getEdgeCount(); Set<mxICell> result = new HashSet<mxICell>(count, 1); for(int i = 0; i < count; i++) { mxICell tmp = input.getEdgeAt(i); if(tmp instanceof mxCell && ((mxCell)tmp).getSource() == input) { result.add(tmp); } } return result; }
public mxICell removeEdge(mxICell edge, boolean isOutgoing) { if (edge != null) { if (edge.getTerminal(!isOutgoing) != this && edges != null) { edges.remove(edge); } edge.setTerminal(null, isOutgoing); } return edge; }
/** * Inserts the given cell into its parent and terminal cells. */ public void insertIntoGraph(mxICell cell) { mxICell parent = cell.getParent(); mxICell source = cell.getTerminal(true); mxICell target = cell.getTerminal(false); // Fixes possible inconsistencies during insert into graph cell.setTerminal(null, false); cell.setTerminal(null, true); cell.setParent(null); if (parent != null) { parent.insert(cell); } if (source != null) { source.insertEdge(cell, true); } if (target != null) { target.insertEdge(cell, false); } }
try int childCount = from.getChildCount(); mxICell cell = from.getChildAt(i); String id = cell.getId(); mxICell target = (mxICell) ((id != null && (!isEdge(cell) || !cloneAllEdges)) ? getCell(id) : null); mxCell clone = (mxCell) cell.clone(); clone.setId(id); target = to.insert(clone); cellAdded(target);
Object src = cell.getTerminal(true); Object trg = cell.getTerminal(false); ((mxICell) src).removeEdge(cell, true); ((mxICell) trg).removeEdge(cell, false); cell = SCreationController.createConnection((BpmnGraph) graph, mode, src, trg, ((BpmnConnectPreview) connectPreview).timestamp); List<mxPoint> points = null; if (cell != null && cell.getGeometry() != null) points = cell.getGeometry().getPoints(); result = graph.addCell(cell, ((mxICell) src).getParent(), null, src, trg); ((BpmnGraph) graph).refreshCellView(((VDataEdge) cell).getTarget().getParent()); cell.getGeometry().setPoints(points);
if (mxc.getId() == null && isCreateIds()) mxc.setId(createId(cell)); if (mxc.getId() != null) Object collision = getCell(mxc.getId()); mxc.setId(createId(cell)); collision = getCell(mxc.getId()); cells.put(mxc.getId(), cell); int id = Integer.parseInt(mxc.getId()); nextId = Math.max(nextId, id + 1); int childCount = mxc.getChildCount(); cellAdded(mxc.getChildAt(i));
protected VElement findElementById(mxICell startelement, String id) { if(startelement instanceof VElement && !(startelement instanceof VInParameter || startelement instanceof VOutParameter) && id.equals(((VElement)startelement).getBpmnElement().getId())) { return (VElement) startelement; } VElement ret = null; for (int i = 0; i < startelement.getChildCount() && ret == null; ++i) { ret = findElementById(startelement.getChildAt(i), id); } return ret; }
public Object getParent(Object child) { return (child instanceof mxICell) ? ((mxICell) child).getParent() : null; }
new Object[] { previewState.getCell() }); if (cell.getTerminal(false) != null) cell.getTerminal(false).removeEdge(cell, false); ((mxICell) targetState.getCell()).insertEdge(cell, false);
public String getStyle(Object cell) { return (cell instanceof mxICell) ? ((mxICell) cell).getStyle() : null; }
public mxICell insertEdge(mxICell edge, boolean isOutgoing) { if (edge != null) { edge.removeFromTerminal(isOutgoing); edge.setTerminal(this, isOutgoing); if (edges == null || edge.getTerminal(!isOutgoing) != this || !edges.contains(edge)) { if (edges == null) { edges = new ArrayList<Object>(); } edges.add(edge); } } return edge; }
mxPoint p = new mxPoint(vedge.getSource().getGeometry().getCenterX(), vedge.getSource().getGeometry().getCenterY()); mxICell pp = vedge.getSource(); if (pp instanceof VOutParameter) pp = pp.getParent(); p.setX(p.getX() + pp.getGeometry().getX()); p.setY(p.getY() + pp.getGeometry().getY()); p = new mxPoint(vedge.getTarget().getGeometry().getCenterX(), vedge.getTarget().getGeometry().getCenterY()); pp = vedge.getTarget(); if (pp instanceof VInParameter) pp = pp.getParent(); p.setX(p.getX() + pp.getGeometry().getX()); p.setY(p.getY() + pp.getGeometry().getY());
Object src = cell.getTerminal(true); Object trg = cell.getTerminal(false); ((mxICell) src).removeEdge(cell, true); ((mxICell) trg).removeEdge(cell, false);
public mxGeometry getGeometry(Object cell) { return (cell instanceof mxICell) ? ((mxICell) cell).getGeometry() : null; }
public Object getChildAt(Object parent, int index) { return (parent instanceof mxICell) ? ((mxICell) parent) .getChildAt(index) : null; }
/** * Inner helper method for cloning cells recursively. */ protected Object cloneCell(Object cell, Map<Object, Object> mapping, boolean includeChildren) throws CloneNotSupportedException { if (cell instanceof mxICell) { mxICell mxc = (mxICell) ((mxICell) cell).clone(); mapping.put(cell, mxc); if (includeChildren) { int childCount = getChildCount(cell); for (int i = 0; i < childCount; i++) { Object clone = cloneCell(getChildAt(cell, i), mapping, true); mxc.insert((mxICell) clone); } } return mxc; } return null; }