Java Code Examples for org.jgrapht.ext.JGraphXAdapter#setCellsResizable()
The following examples show how to use
org.jgrapht.ext.JGraphXAdapter#setCellsResizable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ComputeInstanceSimilarityBlock.java From BART with MIT License | 5 votes |
private void saveGraph(UndirectedGraph<TupleWithTable, DefaultEdge> instancesGraph) { JGraphXAdapter<TupleWithTable, DefaultEdge> jgxAdapterContext = new JGraphXAdapter<TupleWithTable, DefaultEdge>(instancesGraph); jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_NOLABEL, "1"); jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_ENDARROW, "0"); jgxAdapterContext.setCellsEditable(false); jgxAdapterContext.setCellsMovable(false); jgxAdapterContext.setEdgeLabelsMovable(false); jgxAdapterContext.setCellsDeletable(false); jgxAdapterContext.setCellsDisconnectable(false); jgxAdapterContext.setCellsResizable(false); jgxAdapterContext.setCellsBendable(false); JFrame frame = new JFrame(); mxGraphComponent mxGraphComponent = new mxGraphComponent(jgxAdapterContext); frame.getContentPane().add(mxGraphComponent, BorderLayout.CENTER); mxHierarchicalLayout layout = new mxHierarchicalLayout(jgxAdapterContext); layout.execute(jgxAdapterContext.getDefaultParent()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Graph"); frame.pack(); frame.setLocationRelativeTo(null); // frame.setVisible(true); // try { // while (true) { // Thread.sleep(500); // } // } catch (InterruptedException ex) { // java.util.logging.Logger.getLogger(ComputeInstanceSimilarityBlock.class.getName()).log(Level.SEVERE, null, ex); // } try { BufferedImage image = mxCellRenderer.createBufferedImage(jgxAdapterContext, null, 1, Color.WHITE, true, null); File file = new File("/Users/Shared/Temp/bart/similarity/instances-graph.png"); file.getParentFile().mkdirs(); ImageIO.write(image, "PNG", file); } catch (IOException ex) { logger.error("Unable to save graph image: " + ex.getLocalizedMessage()); } }
Example 2
Source File: TTGDStratification.java From Llunatic with GNU General Public License v3.0 | 5 votes |
private void showTGDGraph(DirectedGraph<TGDStratum, DefaultEdge> strataGraph) { JGraphXAdapter<TGDStratum, DefaultEdge> jgxAdapterContext = new JGraphXAdapter<TGDStratum, DefaultEdge>(strataGraph); jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_NOLABEL, "1"); // jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_ENDARROW, "0"); jgxAdapterContext.setCellsEditable(false); jgxAdapterContext.setCellsMovable(false); jgxAdapterContext.setEdgeLabelsMovable(false); jgxAdapterContext.setCellsDeletable(false); jgxAdapterContext.setCellsDisconnectable(false); jgxAdapterContext.setCellsResizable(false); jgxAdapterContext.setCellsBendable(false); JFrame frame = new JFrame(); mxGraphComponent mxGraphComponent = new mxGraphComponent(jgxAdapterContext); frame.getContentPane().add(mxGraphComponent, BorderLayout.CENTER); mxHierarchicalLayout layout = new mxHierarchicalLayout(jgxAdapterContext); layout.execute(jgxAdapterContext.getDefaultParent()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Graph"); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); try { BufferedImage image = mxCellRenderer.createBufferedImage(jgxAdapterContext, null, 1, Color.WHITE, true, null); ImageIO.write(image, "PNG", new File("/Temp/llunatic/tgd-graph.png")); } catch (IOException ex) { logger.error("Unable to save graph image: " + ex.getLocalizedMessage()); } }
Example 3
Source File: TTGDStratification.java From Llunatic with GNU General Public License v3.0 | 5 votes |
private void showEGDGraph(DirectedGraph<EGDStratum, DefaultEdge> strataGraph) { JGraphXAdapter<EGDStratum, DefaultEdge> jgxAdapterContext = new JGraphXAdapter<EGDStratum, DefaultEdge>(strataGraph); jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_NOLABEL, "1"); // jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_ENDARROW, "0"); jgxAdapterContext.setCellsEditable(false); jgxAdapterContext.setCellsMovable(false); jgxAdapterContext.setEdgeLabelsMovable(false); jgxAdapterContext.setCellsDeletable(false); jgxAdapterContext.setCellsDisconnectable(false); jgxAdapterContext.setCellsResizable(false); jgxAdapterContext.setCellsBendable(false); JFrame frame = new JFrame(); mxGraphComponent mxGraphComponent = new mxGraphComponent(jgxAdapterContext); frame.getContentPane().add(mxGraphComponent, BorderLayout.CENTER); mxHierarchicalLayout layout = new mxHierarchicalLayout(jgxAdapterContext); layout.execute(jgxAdapterContext.getDefaultParent()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Graph"); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); try { BufferedImage image = mxCellRenderer.createBufferedImage(jgxAdapterContext, null, 1, Color.WHITE, true, null); ImageIO.write(image, "PNG", new File("/Temp/llunatic/egd-graph.png")); } catch (IOException ex) { logger.error("Unable to save graph image: " + ex.getLocalizedMessage()); } }