layout.execute(graph.getDefaultParent()); graph.getModel().endUpdate();
model.endUpdate();
public void execute(Object parent) { Map<String, List<Object>> lookup = findParallels(parent); graph.getModel().beginUpdate(); try { Iterator<List<Object>> it = lookup.values().iterator(); while (it.hasNext()) { List<Object> parallels = it.next(); if (parallels.size() > 1) { layout(parallels); } } } finally { graph.getModel().endUpdate(); } }
/** * Sets the visible state of the specified cells. * * @param cells Array of cells whose visible state should be changed. * @param show Boolean that specifies the visible state to be assigned. */ public void cellsToggled(Object[] cells, boolean show) { if (cells != null && cells.length > 0) { model.beginUpdate(); try { for (int i = 0; i < cells.length; i++) { model.setVisible(cells[i], show); } } finally { model.endUpdate(); } } }
public void execute(Object parent) { Map<String, List<Object>> lookup = findParallels(parent); graph.getModel().beginUpdate(); try { Iterator<List<Object>> it = lookup.values().iterator(); while (it.hasNext()) { List<Object> parallels = it.next(); if (parallels.size() > 1) { layout(parallels); } } } finally { graph.getModel().endUpdate(); } }
/** * Draws a new vertex into the graph. * * @param vertex vertex to be added to the graph */ private void addJGraphTVertex(V vertex) { getModel().beginUpdate(); try { // create a new JGraphX vertex at position 0 mxICell cell = (mxICell) insertVertex(defaultParent, null, vertex, 0, 0, 0, 0); // update cell size so cell isn't "above" graph updateCellSize(cell); // Save reference between vertex and cell vertexToCellMap.put(vertex, cell); cellToVertexMap.put(cell, vertex); } finally { getModel().endUpdate(); } }
/** * Draws a new vertex into the graph. * * @param vertex vertex to be added to the graph */ private void addJGraphTVertex(V vertex) { getModel().beginUpdate(); try { // create a new JGraphX vertex at position 0 mxICell cell = (mxICell) insertVertex(defaultParent, null, vertex, 0, 0, 0, 0); // update cell size so cell isn't "above" graph updateCellSize(cell); // Save reference between vertex and cell vertexToCellMap.put(vertex, cell); cellToVertexMap.put(cell, vertex); } finally { getModel().endUpdate(); } }
/** * Sets the source and target of the given edge in a single atomic change. * * @param edge Cell that specifies the edge. * @param source Cell that specifies the new source terminal. * @param target Cell that specifies the new target terminal. */ public static void setTerminals(mxIGraphModel model, Object edge, Object source, Object target) { model.beginUpdate(); try { model.setTerminal(edge, source, true); model.setTerminal(edge, target, false); } finally { model.endUpdate(); } }
/** * Sets the source and target of the given edge in a single atomic change. * * @param edge Cell that specifies the edge. * @param source Cell that specifies the new source terminal. * @param target Cell that specifies the new target terminal. */ public static void setTerminals(mxIGraphModel model, Object edge, Object source, Object target) { model.beginUpdate(); try { model.setTerminal(edge, source, true); model.setTerminal(edge, target, false); } finally { model.endUpdate(); } }
/** * Updates the size of the given cell in the model using * getPreferredSizeForCell to get the new size. This function * fires mxEvent.UPDATE_CELL_SIZE. * * @param cell Cell for which the size should be changed. */ public Object updateCellSize(Object cell, boolean ignoreChildren) { model.beginUpdate(); try { cellSizeUpdated(cell, ignoreChildren); fireEvent(new mxEventObject(mxEvent.UPDATE_CELL_SIZE, "cell", cell, "ignoreChildren", ignoreChildren)); } finally { model.endUpdate(); } return cell; }
/** * Updates the size of the given cell in the model using * getPreferredSizeForCell to get the new size. This function * fires mxEvent.UPDATE_CELL_SIZE. * * @param cell Cell for which the size should be changed. */ public Object updateCellSize(Object cell, boolean ignoreChildren) { model.beginUpdate(); try { cellSizeUpdated(cell, ignoreChildren); fireEvent(new mxEventObject(mxEvent.UPDATE_CELL_SIZE, "cell", cell, "ignoreChildren", ignoreChildren)); } finally { model.endUpdate(); } return cell; }
/** * Sets the bounds of the given cells and fires a mxEvent.RESIZE_CELLS * event. while the transaction is in progress. Returns the cells which * have been passed to the function. * * @param cells Array of cells whose bounds should be changed. * @param bounds Array of rectangles that represents the new bounds. */ public Object[] resizeCells(Object[] cells, mxRectangle[] bounds) { model.beginUpdate(); try { cellsResized(cells, bounds); fireEvent(new mxEventObject(mxEvent.RESIZE_CELLS, "cells", cells, "bounds", bounds)); } finally { model.endUpdate(); } return cells; }
public void actionPerformed(ActionEvent e) { ModelContainer mc = editorwindow.getSelectedModelContainer(); BpmnGraph graph = mc.getGraph(); graph.getModel().beginUpdate(); graph.removeCells(); graph.getModel().endUpdate(); } });
/** * Removes the cell selected by the user in the GUI. */ public void removeSelectedCells() { graph.getModel().beginUpdate(); try { graph.removeCells( graph.getSelectionCells() ); // Will be caught by the graph listeners } finally { graph.getModel().endUpdate(); } }
/** * Removes the cell selected by the user in the GUI. */ public void removeSelectedCells() { graph.getModel().beginUpdate(); try { graph.removeCells( graph.getSelectionCells() ); // Will be caught by the graph listeners } finally { graph.getModel().endUpdate(); } }
public void actionPerformed(ActionEvent e1) { if (e1 != null) { EdgeDragContextMenu edcm = edcmc[0]; ((mxCell) connectPreview.getPreviewState().getCell()).setTarget(edcm.getTarget()); } reallycommit = true; EdgeController.super.mouseReleased(e); graphComponent.getGraph().getModel().endUpdate(); reallycommit = false; } };
private FileEntry createDockerCompositionSchema(CubeDockerConfiguration cubeDockerConfiguration, ReporterConfiguration reporterConfiguration) { final mxGraph graph = new mxGraph(); final Object parent = graph.getDefaultParent(); graph.setAutoSizeCells(true); graph.getModel().beginUpdate(); try { final DockerCompositions dockerContainersContent = cubeDockerConfiguration.getDockerContainersContent(); final Map<String, CubeContainer> containers = dockerContainersContent.getContainers(); final Map<String, Object> insertedVertex = new HashMap<>(); for (Map.Entry<String, CubeContainer> containerEntry : containers.entrySet()) { String containerId = containerEntry.getKey(); CubeContainer cubeContainer = containerEntry.getValue(); updateGraph(graph, parent, insertedVertex, containerId, cubeContainer); } } finally { graph.getModel().endUpdate(); } mxIGraphLayout layout = new mxHierarchicalLayout(graph, SwingConstants.WEST); layout.execute(graph.getDefaultParent()); return generateCompositionSchemaImage(graph, reporterConfiguration); }
public static void layout(mxGraphComponent graphComponent) { final mxGraph graph = graphComponent.getGraph(); final mxHierarchicalLayout layout = new mxHierarchicalLayout(graph); graph.getModel().beginUpdate(); try { layout.execute(graph.getDefaultParent()); } finally { graph.getModel().endUpdate(); } }
/** * Only insert spot and edges belonging to visible tracks. Any other spot or * edges will be ignored by the whole trackscheme framework, and if they are * needed, they will have to be imported "by hand". */ private void insertTrackCollection( final Model lTmm ) { model.beginUpdate(); try { for ( final Integer trackID : lTmm.getTrackModel().trackIDs( true ) ) { for ( final Spot vertex : lTmm.getTrackModel().trackSpots( trackID ) ) addJGraphTVertex( vertex ); for ( final DefaultWeightedEdge edge : lTmm.getTrackModel().trackEdges( trackID ) ) addJGraphTEdge( edge ); } } finally { model.endUpdate(); } }
/** * Only insert spot and edges belonging to visible tracks. Any other spot or * edges will be ignored by the whole trackscheme framework, and if they are * needed, they will have to be imported "by hand". */ private void insertTrackCollection( final Model lTmm ) { model.beginUpdate(); try { for ( final Integer trackID : lTmm.getTrackModel().trackIDs( true ) ) { for ( final Spot vertex : lTmm.getTrackModel().trackSpots( trackID ) ) addJGraphTVertex( vertex ); for ( final DefaultWeightedEdge edge : lTmm.getTrackModel().trackEdges( trackID ) ) addJGraphTEdge( edge ); } } finally { model.endUpdate(); } }