protected void generateAssociationDiagramInterchangeElements() { for (String associationId : generatedAssociationEdges.keySet()) { Object edge = generatedAssociationEdges.get(associationId); List<mxPoint> points = graph.getView().getState(edge).getAbsolutePoints(); createDiagramInterchangeInformation(handledArtifacts.get(associationId), optimizeEdgePoints(points)); } }
protected void handleSubProcess(FlowElement flowElement) { BpmnAutoLayout bpmnAutoLayout = new BpmnAutoLayout(bpmnModel); bpmnAutoLayout.layout((SubProcess) flowElement); double subProcessWidth = bpmnAutoLayout.getGraph().getView().getGraphBounds().getWidth(); double subProcessHeight = bpmnAutoLayout.getGraph().getView().getGraphBounds().getHeight(); Object subProcessVertex = graph.insertVertex(cellParent, flowElement.getId(), "", 0, 0, subProcessWidth + 2 * subProcessMargin, subProcessHeight + 2 * subProcessMargin); generatedVertices.put(flowElement.getId(), subProcessVertex); }
Object target = graph.getView().getVisibleTerminal(edge, invert); TreeNode tmp = dfs(target, parent, visited);
oldBounds = view.getGraphBounds(); oldStates = view.getStates(); oldScale = view.getScale(); view.setStates(new Hashtable<Object, mxCellState>()); view.setScale(scale); mxRectangle bounds = view.getBoundingBox(view.validateCellState(view.validateCell(cells[i]))); view.setGraphBounds(bbox);
mxCellState state = view.getState(edges[i]); Object src = (state != null) ? state.getVisibleTerminal(true) : view.getVisibleTerminal(edges[i], true); Object trg = (state != null) ? state.getVisibleTerminal(false) : view.getVisibleTerminal(edges[i], false);
|| (target == null && geo.getTerminalPoint(false) == null)) clear(state.getCell(), true, true); updateFixedTerminalPoints(state, source, target); updatePoints(state, geo.getPoints(), source, target); updateFloatingTerminalPoints(state, source, target); if (state.getCell() != getCurrentRoot() && (state.getAbsolutePointCount() < 2 || state.getAbsolutePoint(0) == null || state clear(state.getCell(), true, true); updateEdgeBounds(state); state.setAbsoluteOffset(getPoint(state, geo));
/** * */ public void zoom(double factor) { mxGraphView view = graph.getView(); double newScale = (double) ((int) (view.getScale() * 100 * factor)) / 100; if (newScale != view.getScale() && newScale > 0.04) { mxPoint translate = (pageVisible && centerPage) ? getPageTranslate(newScale) : new mxPoint(); graph.getView().scaleAndTranslate(newScale, translate.getX(), translate.getY()); if (keepSelectionVisibleOnZoom && !graph.isSelectionEmpty()) { getGraphControl().scrollRectToVisible( view.getBoundingBox(graph.getSelectionCells()) .getRectangle()); } else { maintainScrollBar(true, factor, centerZoom); maintainScrollBar(false, factor, centerZoom); } } }
view.setEventsEnabled(false); view.scaleAndTranslate(1, 0, 0); view.setEventsEnabled(true); view.clear(cc.getChild(), false, true); view.invalidate(cell); view.clear(cell, false, false); view.clear(cell, false, false); view.invalidate(cell); view.invalidate(cell);
/** * Refreshes the view for a cell. * * @param cell The cell. */ public void refreshCellView(mxICell cell) { if (layoutmanager != null) { mxIGraphLayout layout = layoutmanager.getLayout(cell); if (layout != null) { layout.execute(cell); } getView().clear(cell, true, false); getView().invalidate(cell); getView().validate(); refresh(); } }
/** * */ public void start(MouseEvent e) { if (isLivePreview()) { movePreview.start(e, graphComponent.getGraph().getView().getState(initialCell)); } else { mxGraph graph = graphComponent.getGraph(); // Constructs an array with cells that are indeed movable cells = getCells(initialCell); cellBounds = graph.getView().getBounds(cells); if (cellBounds != null) { // Updates the size of the graph handler that is in // charge of painting all other handlers bbox = graph.getView().getBoundingBox(cells); Rectangle bounds = cellBounds.getRectangle(); bounds.width += 1; bounds.height += 1; setPreviewBounds(bounds); } } first = e.getPoint(); }
/** * First validates all bounds and then validates all points recursively on * all visible cells. */ public void validate() { mxRectangle graphBounds = getBoundingBox(validateCellState(validateCell((currentRoot != null) ? currentRoot : graph.getModel().getRoot()))); setGraphBounds((graphBounds != null) ? graphBounds : new mxRectangle()); }
/** * Removes the state of the given cell and all descendants if the given cell * is not the current root. * * @param cell * @param force * @param recurse */ public void clear(Object cell, boolean force, boolean recurse) { removeState(cell); if (recurse && (force || cell != currentRoot)) { mxIGraphModel model = graph.getModel(); int childCount = model.getChildCount(cell); for (int i = 0; i < childCount; i++) { clear(model.getChildAt(cell, i), force, recurse); } } else { invalidate(cell); } }
public void stateChanged(ChangeEvent e) { if(currentcontainer != null) { currentcontainer.getGraph().getView().removeListener(zoomlistener); } currentcontainer = editorwindow.getSelectedModelContainer(); if (currentcontainer != null) { currentcontainer.getGraph().getView().addListener(mxEvent.SCALE, zoomlistener); setZoomText(currentcontainer.getGraph().getView().getScale()); } } });
@Override public void paint( final Graphics g ) { final double scale = graph.getView().getScale(); final double xcs = TrackScheme.X_COLUMN_SIZE * Math.min( 1d, scale ); final double ycs = TrackScheme.Y_COLUMN_SIZE * Math.min( 1d, scale ); g.setColor( BACKGROUND_COLOR_1 ); g.fillRect( 0, 0, ( int ) xcs, ( int ) ycs ); g.setColor( LINE_COLOR ); g.drawLine( 0, ( int ) ycs, ( int ) xcs, ( int ) ycs ); g.drawLine( ( int ) xcs, 0, ( int ) xcs, ( int ) ycs ); }
oldView.removeListener(updateHandler); newView.addListener(mxEvent.SCALE, updateHandler); newView.addListener(mxEvent.TRANSLATE, updateHandler); newView.addListener(mxEvent.SCALE_AND_TRANSLATE, updateHandler); newView.addListener(mxEvent.UP, updateHandler); newView.addListener(mxEvent.DOWN, updateHandler);
/** * Destroys the cell states and restores the state of the graph view. */ public void destroy() { view.setScale(oldScale); view.setStates(oldStates); view.setGraphBounds(oldBounds); }
/** * */ public void revalidate() { invalidate(); validate(); }
/** * Sets the view that contains the cell states. * * @param value View that contains the cell states */ public void setView(mxGraphView value) { if (view != null) { view.removeListener(fullRepaintHandler); view.removeListener(updateOriginHandler); } Object oldView = view; view = value; if (view != null) { view.revalidate(); } // Listens to changes in the view view.addListener(mxEvent.SCALE, fullRepaintHandler); view.addListener(mxEvent.SCALE, updateOriginHandler); view.addListener(mxEvent.TRANSLATE, fullRepaintHandler); view.addListener(mxEvent.SCALE_AND_TRANSLATE, fullRepaintHandler); view.addListener(mxEvent.SCALE_AND_TRANSLATE, updateOriginHandler); view.addListener(mxEvent.UP, fullRepaintHandler); view.addListener(mxEvent.DOWN, fullRepaintHandler); changeSupport.firePropertyChange("view", oldView, view); }
/** * */ public void revalidate(mxCellState state) { state.getView().invalidate(state.getCell()); state.getView().validateCellState(state.getCell()); }