Exemple #1
0
  /** Used to instantiate and configure the {@link JGraphXAdapter} that will be used for display. */
  private JGraphXAdapter createGraph() {

    gui.logger.setStatus("Creating graph adapter.");

    final JGraphXAdapter graph = new JGraphXAdapter(model);
    graph.setAllowLoops(false);
    graph.setAllowDanglingEdges(false);
    graph.setCellsCloneable(false);
    graph.setCellsSelectable(true);
    graph.setCellsDisconnectable(false);
    graph.setCellsMovable(true);
    graph.setGridEnabled(false);
    graph.setLabelsVisible(true);
    graph.setDropEnabled(false);

    // Cells removed from JGraphX
    graph.addListener(mxEvent.CELLS_REMOVED, new CellRemovalListener());

    // Cell selection change
    graph.getSelectionModel().addListener(mxEvent.CHANGE, new SelectionChangeListener());

    // Return graph
    return graph;
  }