/** Constructs a new GraphEditor for the given EdgeListGraph. */
  public TimeLagGraphEditor(TimeLagGraph graph) {
    setLayout(new BorderLayout());

    this.workbench = new TimeLagGraphWorkbench(graph);
    DagGraphToolbar toolbar = new DagGraphToolbar(getWorkbench());
    JMenuBar menuBar = createGraphMenuBar();
    JScrollPane scroll = new JScrollPane(getWorkbench());
    scroll.setPreferredSize(new Dimension(450, 450));

    add(scroll, BorderLayout.CENTER);
    add(toolbar, BorderLayout.WEST);
    add(menuBar, BorderLayout.NORTH);

    JLabel label = new JLabel("Double click variable to change name.");
    label.setFont(new Font("SansSerif", Font.PLAIN, 12));
    Box b = Box.createHorizontalBox();
    b.add(Box.createHorizontalStrut(2));
    b.add(label);
    b.add(Box.createHorizontalGlue());
    b.setBorder(new MatteBorder(0, 0, 1, 0, Color.GRAY));

    add(b, BorderLayout.SOUTH);

    this.getWorkbench()
        .addPropertyChangeListener(
            new PropertyChangeListener() {
              public void propertyChange(PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();

                if ("graph".equals(propertyName)) {
                  TimeLagGraph _graph = (TimeLagGraph) evt.getNewValue();

                  if (getWorkbench() != null) {
                    getGraphWrapper().setGraph(_graph);
                  }
                }
              }
            });
  }
Exemple #2
0
  private JPanel getParamsPanel() {
    JPanel paramsPanel = new JPanel();

    Box b2 = Box.createVerticalBox();

    JComponent indTestParamBox = getIndTestParamBox();
    if (indTestParamBox != null) {
      b2.add(indTestParamBox);
    }

    paramsPanel.add(b2);
    paramsPanel.setBorder(new TitledBorder("Parameters"));
    return paramsPanel;
  }
Exemple #3
0
  /** Construct the toolbar panel. */
  protected JPanel getToolbar() {
    JPanel toolbar = new JPanel();

    getExecuteButton().setText("Execute*");
    getExecuteButton()
        .addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                removeStatsTabs();
                execute();
              }
            });

    JButton statsButton = new JButton("Calc Stats");
    statsButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Window owner = (Window) getTopLevelAncestor();

            new WatchedProcess(owner) {
              public void watch() {
                calcStats();
              }
            };
          }
        });

    Box b1 = Box.createVerticalBox();
    b1.add(getParamsPanel());
    b1.add(Box.createVerticalStrut(10));

    Box b2 = Box.createHorizontalBox();
    b2.add(Box.createGlue());
    b2.add(getExecuteButton());
    b1.add(b2);
    b1.add(Box.createVerticalStrut(10));

    if (getAlgorithmRunner().getDataModel() instanceof DataSet) {
      Box b3 = Box.createHorizontalBox();
      b3.add(Box.createGlue());
      b3.add(statsButton);
      b1.add(b3);
    }

    //        if (getAlgorithmRunner().getParams() instanceof MeekSearchParams) {
    //            MeekSearchParams params = (MeekSearchParams) getAlgorithmRunner().getParams();
    //            JCheckBox preventCycles = new JCheckBox("Aggressively Prevent Cycles");
    //            preventCycles.setHorizontalTextPosition(AbstractButton.RIGHT);
    //            preventCycles.setSelected(params.isAggressivelyPreventCycles());
    //
    //            preventCycles.addActionListener(new ActionListener() {
    //                public void actionPerformed(ActionEvent e) {
    //                    JCheckBox box = (JCheckBox) e.getSource();
    //                    MeekSearchParams params = (MeekSearchParams)
    // getAlgorithmRunner().getParams();
    //                    params.setAggressivelyPreventCycles(box.isSelected());
    //                }
    //            });
    //
    //            b1.add(Box.createVerticalStrut(5));
    //            Box hBox = Box.createHorizontalBox();
    //            hBox.add(Box.createHorizontalGlue());
    //            hBox.add(preventCycles);
    //            b1.add(hBox);
    //            b1.add(Box.createVerticalStrut(5));
    //        }

    Box b4 = Box.createHorizontalBox();
    JLabel label =
        new JLabel(
            "<html>"
                + "*Please note that some"
                + "<br>searches may take a"
                + "<br>long time to complete."
                + "</html>");
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setVerticalAlignment(SwingConstants.CENTER);
    label.setBorder(new TitledBorder(""));
    b4.add(label);

    b1.add(Box.createVerticalStrut(10));
    b1.add(b4);

    toolbar.add(b1);
    return toolbar;
  }