protected boolean isBoundaryEvent(Object obj) { if (obj instanceof mxCell) { mxCell cell = (mxCell) obj; return cell.getId().startsWith("boundary-event-"); } return false; }
/** * Returns a boolean indicating if the given <em>mxCell</em> should be ignored as a vertex. This returns true if the cell has no connections. * * @param vertex * Object that represents the vertex to be tested. * @return Returns true if the vertex should be ignored. */ public boolean isVertexIgnored(Object vertex) { return super.isVertexIgnored(vertex) || graph.isSwimlane(vertex) || graph.getModel().getGeometry(vertex).isRelative() || graph.getConnections(vertex).length == 0; }
protected void handleBoundaryEvents() { for (BoundaryEvent boundaryEvent : boundaryEvents) { mxGeometry geometry = new mxGeometry(0.8, 1.0, eventSize, eventSize); geometry.setOffset(new mxPoint(-(eventSize / 2), -(eventSize / 2))); geometry.setRelative(true); mxCell boundaryPort = new mxCell(null, geometry, "shape=ellipse;perimter=ellipsePerimeter"); boundaryPort.setId("boundary-event-" + boundaryEvent.getId()); boundaryPort.setVertex(true); Object portParent = null; if (boundaryEvent.getAttachedToRefId() != null) { portParent = generatedVertices.get(boundaryEvent.getAttachedToRefId()); } else if (boundaryEvent.getAttachedToRef() != null) { portParent = generatedVertices.get(boundaryEvent.getAttachedToRef().getId()); } else { throw new RuntimeException("Could not generate DI: boundaryEvent '" + boundaryEvent.getId() + "' has no attachedToRef"); } graph.addCell(boundaryPort, portParent); generatedVertices.put(boundaryEvent.getId(), boundaryPort); } }
parent = model.getParent(root); parent = model.getParent(parent); model.beginUpdate(); mxGeometry g = model.getGeometry(root); if (g.isRelative()) { g = model.getGeometry(model.getParent(root)); x0 = g.getX(); y0 = g.getY(); mxGeometry g = model.getGeometry(parent); g = (mxGeometry) g.clone(); if (g.getWidth() > width) { dx += (g.getWidth() - width) / 2; } else { g.setWidth(width); if (g.getHeight() > height) { if (horizontal) { dy += (g.getHeight() - height) / 2; g.setHeight(height); model.setGeometry(parent, g);
protected void layout(FlowElementsContainer flowElementsContainer) { graph = new mxGraph(); cellParent = graph.getDefaultParent(); graph.getModel().beginUpdate(); layout.execute(graph.getDefaultParent()); graph.getModel().endUpdate();
public mxICell insert(mxICell child) { int index = getChildCount(); if (child.getParent() == this) { index--; } return insert(child, index); }
public Object setTerminal(Object edge, Object terminal, boolean isSource) { boolean terminalChanged = terminal != getTerminal(edge, isSource); execute(new mxTerminalChange(this, edge, terminal, isSource)); if (maintainEdgeParent && terminalChanged) { updateEdgeParent(edge, getRoot()); } return terminal; }
TreeNode tmp = dfs(target, parent, visited); if (tmp != null && model.getGeometry(target) != null) { if (prev == null) { node.child = tmp;
public Object remove(Object cell) { if (cell == root) { setRoot(null); } else if (getParent(cell) != null) { execute(new mxChildChange(this, null, cell)); } return cell; }
public boolean setVisible(Object cell, boolean visible) { if (visible != isVisible(cell)) { execute(new mxVisibleChange(this, cell, visible)); } return visible; }
public mxGeometry setGeometry(Object cell, mxGeometry geometry) { if (geometry != getGeometry(cell)) { execute(new mxGeometryChange(this, cell, geometry)); } return geometry; }
public boolean setCollapsed(Object cell, boolean collapsed) { if (collapsed != isCollapsed(cell)) { execute(new mxCollapseChange(this, cell, collapsed)); } return collapsed; }
/** * Inner callback to update the mxGeometry of the given mxCell using * mxCell.setGeometry and return the previous mxGeometry. */ protected mxGeometry geometryForCellChanged(Object cell, mxGeometry geometry) { mxGeometry previous = getGeometry(cell); ((mxICell) cell).setGeometry(geometry); return previous; }
public void removeFromTerminal(boolean isSource) { mxICell terminal = getTerminal(isSource); if (terminal != null) { terminal.removeEdge(this, isSource); } }
/** * Sets the visible state of the given mxCell using mxVisibleChange and * adds the change to the current transaction. */ protected boolean visibleStateForCellChanged(Object cell, boolean visible) { boolean previous = isVisible(cell); ((mxICell) cell).setVisible(visible); return previous; }
public Object setValue(Object cell, Object value) { execute(new mxValueChange(this, cell, value)); return value; }
public mxICell insert(mxICell child) { int index = getChildCount(); if (child.getParent() == this) { index--; } return insert(child, index); }
public Object setTerminal(Object edge, Object terminal, boolean isSource) { boolean terminalChanged = terminal != getTerminal(edge, isSource); execute(new mxTerminalChange(this, edge, terminal, isSource)); if (maintainEdgeParent && terminalChanged) { updateEdgeParent(edge, getRoot()); } return terminal; }
/** * */ protected mxRectangle apply(TreeNode node, mxRectangle bounds) { mxRectangle g = graph.getModel().getGeometry(node.cell); if (node.cell != null && g != null) { if (isVertexMovable(node.cell)) { g = setVertexLocation(node.cell, node.x, node.y); } if (bounds == null) { bounds = new mxRectangle(g.getX(), g.getY(), g.getWidth(), g.getHeight()); } else { bounds = new mxRectangle(Math.min(bounds.getX(), g.getX()), Math.min(bounds.getY(), g.getY()), Math.max(bounds.getX() + bounds.getWidth(), g.getX() + g.getWidth()), Math.max(bounds.getY() + bounds.getHeight(), g.getY() + g.getHeight())); } } return bounds; }