Refine search
protected void generateSequenceFlowDiagramInterchangeElements() { for (String sequenceFlowId : generatedSequenceFlowEdges.keySet()) { Object edge = generatedSequenceFlowEdges.get(sequenceFlowId); List<mxPoint> points = graph.getView().getState(edge).getAbsolutePoints(); mxPoint startPoint = points.get(0); Object gatewayVertex = generatedVertices.get(sourceElement.getId()); mxCellState gatewayState = graph.getView().getState(gatewayVertex); mxPoint northPoint = new mxPoint(gatewayState.getX() + (gatewayState.getWidth()) / 2, gatewayState.getY()); mxPoint southPoint = new mxPoint(gatewayState.getX() + (gatewayState.getWidth()) / 2, gatewayState.getY() + gatewayState.getHeight()); mxPoint eastPoint = new mxPoint(gatewayState.getX() + gatewayState.getWidth(), gatewayState.getY() + (gatewayState.getHeight()) / 2); mxPoint westPoint = new mxPoint(gatewayState.getX(), gatewayState.getY() + (gatewayState.getHeight()) / 2);
protected void generateActivityDiagramInterchangeElements() { for (String flowElementId : generatedVertices.keySet()) { Object vertex = generatedVertices.get(flowElementId); mxCellState cellState = graph.getView().getState(vertex); GraphicInfo subProcessGraphicInfo = createDiagramInterchangeInformation(handledFlowElements.get(flowElementId), (int) cellState.getX(), (int) cellState.getY(), (int) cellState.getWidth(), (int) cellState.getHeight()); // The DI for the elements of a subprocess are generated without // knowledge of the rest of the graph // So we must translate all it's elements with the x and y of the // subprocess itself if (handledFlowElements.get(flowElementId) instanceof SubProcess) { // Always expanded when auto layouting subProcessGraphicInfo.setExpanded(true); } } }
/** * * @return Returns the bounds of the preview. */ protected Rectangle getPreviewBounds() { Rectangle bounds = null; if (isLabel(index)) { bounds = state.getLabelBounds().getRectangle(); } else { bounds = new Rectangle(p[0]); for (int i = 0; i < p.length; i++) { bounds.add(p[i]); } bounds.height += 1; bounds.width += 1; } return bounds; }
/** * */ public Rectangle getFoldingIconBounds(mxCellState state, ImageIcon icon) { mxIGraphModel model = graph.getModel(); boolean isEdge = model.isEdge(state.getCell()); double scale = getGraph().getView().getScale(); int x = (int) Math.round(state.getX() + 4 * scale); int y = (int) Math.round(state.getY() + 4 * scale); int w = (int) Math.max(8, icon.getIconWidth() * scale); int h = (int) Math.max(8, icon.getIconHeight() * scale); if (isEdge) { mxPoint pt = graph.getView().getPoint(state); x = (int) pt.getX() - w / 2; y = (int) pt.getY() - h / 2; } return new Rectangle(x, y, w, h); }
/** * */ public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Stroke stroke = g2.getStroke(); g2.setStroke(getSelectionStroke()); g.setColor(getSelectionColor()); Point last = state.getAbsolutePoint(0).getPoint(); for (int i = 1; i < state.getAbsolutePointCount(); i++) { Point current = state.getAbsolutePoint(i).getPoint(); Line2D line = new Line2D.Float(last.x, last.y, current.x, current.y); Rectangle bounds = g2.getStroke().createStrokedShape(line) .getBounds(); if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height)) { g2.draw(line); } last = current; } g2.setStroke(stroke); super.paint(g); }
private final Rectangle getImageBounds( final mxCellState state ) { final Rectangle cellR = state.getRectangle(); final int arc = getArcSize( cellR.width, cellR.height ) / 2; final int minSize = Math.min( cellR.width - arc * 2, cellR.height - 4 ); final Rectangle imageBounds = new Rectangle( cellR.x + arc, cellR.y + 2, minSize, minSize ); return imageBounds; } }
/** * Returns the folding icon bounds. */ public Rectangle getFoldingIconBounds(mxCellState state, ImageIcon icon) { if (state.getCell() instanceof VSubProcess) { double scale = getGraph().getView().getScale(); int w = (int) Math.max(8, icon.getIconWidth() * scale); int h = (int) Math.max(8, icon.getIconHeight() * scale); int x = (int) Math.round(state.getX() + state.getWidth() * 0.5 - w * 0.5); int y = (int) Math.round(state.getY() + state.getHeight() - h * 1.25); return new Rectangle(x, y, w, h); } return super.getFoldingIconBounds(state, icon); }
public Object drawCell(mxCellState state) { Map<String, Object> style = state.getStyle(); mxIShape shape = getShape(style); if (g != null && shape != null) { // Creates a temporary graphics instance for drawing this shape float opacity = mxUtils.getFloat(style, mxConstants.STYLE_OPACITY, 100); Graphics2D previousGraphics = g; g = createTemporaryGraphics(style, opacity, state); // Paints the shape and restores the graphics object shape.paintShape(this, state); g.dispose(); g = previousGraphics; } return shape; }
/** * */ public void paint(Graphics g) { Rectangle bounds = getState().getRectangle(); if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height)) { Graphics2D g2 = (Graphics2D) g; Stroke stroke = g2.getStroke(); g2.setStroke(getSelectionStroke()); g.setColor(getSelectionColor()); g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height); g2.setStroke(stroke); } super.paint(g); }
public Object drawLabel(String text, mxCellState state, boolean html) { Map<String, Object> style = state.getStyle(); mxITextShape shape = getTextShape(style, html); if (g != null && shape != null && drawLabels && text != null && text.length() > 0) { // Creates a temporary graphics instance for drawing this shape float opacity = mxUtils.getFloat(style, mxConstants.STYLE_TEXT_OPACITY, 100); Graphics2D previousGraphics = g; g = createTemporaryGraphics(style, opacity, null); // Draws the label background and border Color bg = mxUtils.getColor(style, mxConstants.STYLE_LABEL_BACKGROUNDCOLOR); Color border = mxUtils.getColor(style, mxConstants.STYLE_LABEL_BORDERCOLOR); paintRectangle(state.getLabelBounds().getRectangle(), bg, border); // Paints the label and restores the graphics object shape.paintShape(this, text, state, style); g.dispose(); g = previousGraphics; } return shape; }
if (state.getAbsolutePointCount() > 1 && configureGraphics(canvas, state, false)) state.getAbsolutePoints()); Map<String, Object> style = state.getStyle(); canvas.getGraphics().setStroke(canvas.createStroke(style)); canvas.getGraphics().setStroke(canvas.createStroke(style)); paintPolyline(canvas, pts, state.getStyle());
/** * Paints the outline of the markedState with the currentColor. */ public void paint(Graphics g) { if (markedState != null && currentColor != null) { ((Graphics2D) g).setStroke(DEFAULT_STROKE); g.setColor(currentColor); if (markedState.getAbsolutePointCount() > 0) { Point last = markedState.getAbsolutePoint(0).getPoint(); for (int i = 1; i < markedState.getAbsolutePointCount(); i++) { Point current = markedState.getAbsolutePoint(i).getPoint(); g.drawLine(last.x - getX(), last.y - getY(), current.x - getX(), current.y - getY()); last = current; } } else { g.drawRect(1, 1, getWidth() - 3, getHeight() - 3); } } }
/** * Draws the preview using the graphics canvas. */ protected void paintPreview(mxGraphics2DCanvas canvas) { Composite previousComposite = canvas.getGraphics().getComposite(); // Paints the preview states Iterator<mxCellState> it = cellStates.iterator(); while (it.hasNext()) { mxCellState state = it.next(); canvas.getGraphics().setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getOpacityForCell(state.getCell()))); paintPreviewState(canvas, state); } canvas.getGraphics().setComposite(previousComposite); }
public mxPoint paintMarker(mxGraphics2DCanvas canvas, mxCellState state, String type, mxPoint pe, double nx, double ny, double size, boolean source) { double cx = pe.getX() - nx / 2; double cy = pe.getY() - ny / 2; double a = size / 2; Shape shape = new Ellipse2D.Double(cx - a, cy - a, size, size); if (mxUtils.isTrue(state.getStyle(), (source) ? "startFill" : "endFill", true)) { canvas.fillShape(shape); } canvas.getGraphics().draw(shape); return new mxPoint(-nx / 2, -ny / 2); } });
/** * * @param x * @param y * @return Returns the inde of the handle at the given location. */ public int getIndexAt(int x, int y) { int index = super.getIndexAt(x, y); // Makes the complete label a trigger for the label handle if (index < 0 && handles != null && handlesVisible && isLabelMovable() && state.getLabelBounds().getRectangle().contains(x, y)) { index = handles.length - 1; } return index; }
/** * */ public void paintShape(mxGraphics2DCanvas canvas, mxCellState state) { super.paintShape(canvas, state); int inset = (int) Math.round((mxUtils.getFloat(state.getStyle(), mxConstants.STYLE_STROKEWIDTH, 1) + 3) * canvas.getScale()); Rectangle rect = state.getRectangle(); int x = rect.x + inset; int y = rect.y + inset; int w = rect.width - 2 * inset; int h = rect.height - 2 * inset; canvas.getGraphics().drawRect(x, y, w, h); }
/** * */ public void paint(Graphics g) { if (currentState != null && first != null) { Rectangle rect = currentState.getRectangle(); double deg = currentAngle * mxConstants.DEG_PER_RAD; if (deg != 0) { ((Graphics2D) g).rotate(Math.toRadians(deg), currentState.getCenterX(), currentState.getCenterY()); } mxUtils.setAntiAlias((Graphics2D) g, true, false); g.drawRect(rect.x, rect.y, rect.width, rect.height); } }
/** * */ public void paintShape(mxGraphics2DCanvas canvas, mxCellState state) { super.paintShape(canvas, state); int inset = (int) Math.round((mxUtils.getFloat(state.getStyle(), mxConstants.STYLE_STROKEWIDTH, 1) + 3) * canvas.getScale()); Rectangle rect = state.getRectangle(); int x = rect.x + inset; int y = rect.y + inset; int w = rect.width - 2 * inset; int h = rect.height - 2 * inset; canvas.getGraphics().drawOval(x, y, w, h); }
/** * Refreshes the cell handler. */ public void refresh(mxCellState state) { this.state = state; handles = createHandles(); mxGraph graph = graphComponent.getGraph(); mxRectangle tmp = graph.getBoundingBox(state.getCell()); if (tmp != null) { bounds = tmp.getRectangle(); if (handles != null) { for (int i = 0; i < handles.length; i++) { if (isHandleVisible(i)) { bounds.add(handles[i]); } } } } }