Пример #1
0
  Graph getLatestWorkbenchGraph() {
    if (algorithmRunner.getParams() == null) {
      return null;
    }

    Graph graph = algorithmRunner.getParams().getSourceGraph();

    if (graph == null) {
      return algorithmRunner.getSourceGraph();
    }

    return graph;
  }
Пример #2
0
  JScrollPane workbenchScroll(String resultLabel) {
    Graph resultGraph = resultGraph();

    Graph sourceGraph = algorithmRunner.getSourceGraph();
    SearchParams searchParams = algorithmRunner.getParams();
    Graph latestWorkbenchGraph = null;

    if (searchParams != null) {
      latestWorkbenchGraph = searchParams.getSourceGraph();
    }

    if (latestWorkbenchGraph == null) {
      GraphUtils.arrangeBySourceGraph(resultGraph, sourceGraph);
    } else {
      GraphUtils.arrangeBySourceGraph(resultGraph, latestWorkbenchGraph);
    }

    //        boolean arrangedAll = DataGraphUtils.arrangeBySourceGraph(resultGraph,
    //                latestWorkbenchGraph);
    //
    //        if (!arrangedAll) {
    //            arrangedAll =
    //                    DataGraphUtils.arrangeBySourceGraph(resultGraph, sourceGraph);
    //        }

    //        if (!arrangedAll) {
    //            DataGraphUtils.circleLayout(resultGraph, 200, 200, 150);
    //        }

    this.workbench = new GraphWorkbench(resultGraph);

    graphHistory.clear();
    graphHistory.add(resultGraph);

    this.workbench.setAllowDoubleClickActions(false);
    this.workbench.setAllowNodeEdgeSelection(true);
    this.workbenchScroll = new JScrollPane(workbench);
    //        workbenchScroll.setPreferredSize(new Dimension(450, 450));
    //        workbenchScroll.setBorder(new TitledBorder(resultLabel));

    this.workbench.addMouseListener(
        new MouseAdapter() {
          public void mouseExited(MouseEvent e) {
            storeLatestWorkbenchGraph();
          }
        });

    return workbenchScroll;
  }