protected void layout(FlowElementsContainer flowElementsContainer) { graph = new mxGraph(); cellParent = graph.getDefaultParent(); graph.getModel().beginUpdate();
public static mxGraph toMxGraph(Graph<?, ?> g, int displayWidth, int displayHeight, int xStartPos, int yStartPos) { mxGraph graph = new mxGraph(); setMxGraph(g, displayWidth, displayHeight, xStartPos, yStartPos, graph); return graph; }
mxGraph graph = new mxGraph(); Map<String, Object> style = graph.getStylesheet().getDefaultEdgeStyle(); style.put(mxConstants.STYLE_ROUNDED, true); style.put(mxConstants.STYLE_EDGE, mxConstants.EDGESTYLE_ENTITY_RELATION);
mxGraph graph = new mxGraph() { @Override public boolean isCellSelectable(Object cell) { if (cell != null) { if (cell instanceof mxCell) { mxCell myCell = (mxCell) cell; if (myCell.isEdge()) return false; } } return super.isCellSelectable(cell); } };
mxGraph graph = new mxGraph(); try { Document document = mxXmlUtils.parseXml(mxUtils.readFile(filePath)); mxCodec codec = new mxCodec(document); codec.decode(document.getDocumentElement(), graph.getModel()); } catch (Exception ex) { ex.printStackTrace(); }
Document doc = mxXmlUtils.parseXml(erXmlString); mxGraph graph = new mxGraph(); mxCodec codec = new mxCodec(doc); codec.decode(doc.getDocumentElement(), graph.getModel()); mxGraphComponent graphComponent = new mxGraphComponent(graph); BufferedImage image = mxCellRenderer.createBufferedImage(graphComponent.getGraph(), null, 1, Color.WHITE, graphComponent.isAntiAlias(), null, graphComponent.getCanvas()); mxPngEncodeParam param = mxPngEncodeParam.getDefaultEncodeParam(image); param.setCompressedText(new String[] { "mxGraphModel", erXmlString }); FileOutputStream outputStream = new FileOutputStream(new File(filename)); mxPngImageEncoder encoder = new mxPngImageEncoder(outputStream, param); if (image != null) { encoder.encode(image); return image; } outputStream.close(); return null; }
public class TelaPrincipalController { @FXML private SwingNode swingComponentWrapper ; public void initialize() { SwingUtilities.invokeLater(this::createMxGraph); } private void createMxGraph() { mxGraph grafo = new mxGraph(); Object parent = grafo.getDefaultParent(); Object v1 = grafo.insertVertex(parent, null, "Brazil", 100, 100, 50, 40); Object v2 = grafo.insertVertex(parent, null, "Soccer", 240, 150, 50, 40); Object a1 = grafo.insertEdge(parent, null, "loves", v1, v2); mxGraphComponent graphComponent = new mxGraphComponent(grafo); swingComponentWrapper.setContent(graphComponent); } @FXML private void selecionarNo() { // ... } // etc etc... }
mxGraph graph = new mxGraph()
private mxGraph getGraph() { if (graph == null) { mxGraphModel model = new mxGraphModel(); graph = new mxGraph(model); graph.setCellsDeletable(true); graph.getSelectionModel().setSingleSelection(false); graph.setHtmlLabels(true); graph.setAllowDanglingEdges(false); } return graph; }
super("Hello, World!"); mxGraph graph = new mxGraph(); Object parent = graph.getDefaultParent();
frame.getMaximumSize().height); final mxGraph graph = new mxGraph(); Object parent = graph.getDefaultParent(); graph.getModel().beginUpdate();
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); }
import javax.swing.JFrame; import com.mxgraph.swing.mxGraphComponent; import com.mxgraph.view.mxGraph; public class GraphFrame extends JFrame { public static void main(String[] args) { mxGraph graph = new mxGraph(); Object parent = graph.getDefaultParent(); graph.getModel().beginUpdate(); try { Object v1 = graph.insertVertex(parent, null, "Hello", 20, 20, 80, 30); Object v2 = graph.insertVertex(parent, null, "World!", 240, 150, 80, 30); graph.insertEdge(parent, null, "Edge", v1, v2); } finally { graph.getModel().endUpdate(); } mxGraphComponent graphComponent = new mxGraphComponent(graph); GraphFrame frame = new GraphFrame(); frame.add(graphComponent); frame.pack(); frame.setVisible(true); } }
public static mxGraph makeHelloWorldGraph() { mxGraph graph = new mxGraph(); Object parent = graph.getDefaultParent(); graph.getModel().beginUpdate(); try { Object v1 = graph.insertVertex(parent, null, "", 20, 20, 80, 30,"opacity=0"); Object v2 = graph.insertVertex(parent, null, "World!", 240, 150, 80, 30); graph.insertEdge(parent, null, "Edge", v1, v2); } finally { graph.getModel().endUpdate(); } return graph; }
protected void layout(FlowElementsContainer flowElementsContainer) { graph = new mxGraph(); cellParent = graph.getDefaultParent(); graph.getModel().beginUpdate();
private static mxGraph renderGraph(ProcessDefinition<?> definicao) { final mxGraph graph = new mxGraph(); final Object parent = graph.getDefaultParent(); style(graph); graph.getModel().beginUpdate(); graph.setAutoSizeCells(true); final FlowMap fluxo = definicao.getFlowMap(); final Map<String, Object> mapaVertice = new HashMap<>(); for (final MTask<?> task : fluxo.getTasks()) { final Object v = insertVertex(graph, task); mapaVertice.put(task.getAbbreviation(), v); } for (final MTaskEnd task : fluxo.getEndTasks()) { final Object v = insertVertex(graph, task); mapaVertice.put(task.getAbbreviation(), v); } addStartTransition(graph, fluxo.getStartTask(), mapaVertice); for (final MTask<?> task : fluxo.getTasks()) { for (final MTransition transicao : task.getTransitions()) { createTransition(graph, transicao, mapaVertice); } } final mxHierarchicalLayout layout = new mxHierarchicalLayout(graph); layout.setOrientation(SwingConstants.WEST); layout.execute(parent); graph.getModel().endUpdate(); return graph; }
private static mxGraph renderGraph(FlowDefinition<?> definition) { final mxGraph graph = new mxGraph(); final Object parent = graph.getDefaultParent();
Object[] cells = model.cloneCells(aGraph.getChildCells(graph.getDefaultParent(), true, true), true); mxGraphModel modelCopy = new mxGraphModel(); mxGraph graphCopy = new mxGraph(modelCopy); Object parentCopy = graphCopy.getDefaultParent(); graphCopy.addCells(cells);
mxGraph graphCopy = new mxGraph(modelCopy); graphCopy.addCells(cells); mxAnalysisGraph aGraphCopy = new mxAnalysisGraph();
mxGraph graphCopy = new mxGraph(modelCopy); graphCopy.addCells(cells); mxAnalysisGraph aGraphCopy = new mxAnalysisGraph();