Search in sources :

Example 51 with GraphWorkbench

use of edu.cmu.tetradapp.workbench.GraphWorkbench in project tetrad by cmu-phil.

the class BayesUpdaterEditor method createWorkbenchScroll.

private JScrollPane createWorkbenchScroll(UpdaterWrapper updaterWrapper) {
    workbench = new GraphWorkbench(updaterWrapper.getBayesUpdater().getManipulatedGraph());
    workbench.setAllowDoubleClickActions(false);
    JScrollPane workbenchScroll = new JScrollPane(getWorkbench());
    workbenchScroll.setPreferredSize(new Dimension(400, 400));
    return workbenchScroll;
}
Also used : GraphWorkbench(edu.cmu.tetradapp.workbench.GraphWorkbench)

Example 52 with GraphWorkbench

use of edu.cmu.tetradapp.workbench.GraphWorkbench in project tetrad by cmu-phil.

the class BayesUpdaterEditorObs method createWorkbenchScroll.

private JScrollPane createWorkbenchScroll(UpdaterWrapper updaterWrapper) {
    workbench = new GraphWorkbench(updaterWrapper.getBayesUpdater().getManipulatedGraph());
    workbench.setAllowDoubleClickActions(false);
    JScrollPane workbenchScroll = new JScrollPane(getWorkbench());
    workbenchScroll.setPreferredSize(new Dimension(400, 400));
    return workbenchScroll;
}
Also used : GraphWorkbench(edu.cmu.tetradapp.workbench.GraphWorkbench)

Example 53 with GraphWorkbench

use of edu.cmu.tetradapp.workbench.GraphWorkbench in project tetrad by cmu-phil.

the class BayesImEditorObs method init.

private void init(BayesIm bayesIm) {
    if (bayesIm == null) {
        throw new NullPointerException("Bayes IM must not be null.");
    }
    BayesPm bayesPm = bayesIm.getBayesPm();
    Graph graph = bayesPm.getDag();
    GraphWorkbench workbench = new GraphWorkbench(graph);
    JMenuBar menuBar = new JMenuBar();
    JMenu file = new JMenu("File");
    menuBar.add(file);
    // file.add(new SaveBayesImXmlAction(this));
    // file.add(new LoadBayesImXmlAction(wrapper, this));
    file.add(new SaveScreenshot(this, true, "Save Screenshot..."));
    file.add(new SaveComponentImage(workbench, "Save Graph Image..."));
    setLayout(new BorderLayout());
    add(menuBar, BorderLayout.NORTH);
    wizard = new BayesImEditorWizardObs(bayesIm, workbench);
    wizard.addPropertyChangeListener(new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            if ("editorValueChanged".equals(evt.getPropertyName())) {
                firePropertyChange("modelChanged", null, null);
            }
        }
    });
    JScrollPane workbenchScroll = new JScrollPane(workbench);
    JScrollPane wizardScroll = new JScrollPane(getWizard());
    workbenchScroll.setPreferredSize(new Dimension(450, 450));
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, workbenchScroll, wizardScroll);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(workbenchScroll.getPreferredSize().width);
    add(splitPane, BorderLayout.CENTER);
    setName("Bayes IM Obs Editor");
    getWizard().addPropertyChangeListener(new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            if ("editorClosing".equals(evt.getPropertyName())) {
                firePropertyChange("editorClosing", null, getName());
            }
            if ("closeFrame".equals(evt.getPropertyName())) {
                firePropertyChange("closeFrame", null, null);
                firePropertyChange("editorClosing", true, true);
            }
            if ("modelChanged".equals(evt.getPropertyName())) {
                firePropertyChange("modelChanged", evt.getOldValue(), evt.getNewValue());
            }
        }
    });
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) Graph(edu.cmu.tetrad.graph.Graph) GraphWorkbench(edu.cmu.tetradapp.workbench.GraphWorkbench) BayesPm(edu.cmu.tetrad.bayes.BayesPm)

Aggregations

GraphWorkbench (edu.cmu.tetradapp.workbench.GraphWorkbench)53 Graph (edu.cmu.tetrad.graph.Graph)24 EdgeListGraph (edu.cmu.tetrad.graph.EdgeListGraph)13 ActionEvent (java.awt.event.ActionEvent)11 ActionListener (java.awt.event.ActionListener)11 IKnowledge (edu.cmu.tetrad.data.IKnowledge)8 Knowledge2 (edu.cmu.tetrad.data.Knowledge2)8 WatchedProcess (edu.cmu.tetradapp.util.WatchedProcess)8 LayoutMenu (edu.cmu.tetradapp.workbench.LayoutMenu)7 MouseAdapter (java.awt.event.MouseAdapter)7 MouseEvent (java.awt.event.MouseEvent)7 PropertyChangeEvent (java.beans.PropertyChangeEvent)6 PropertyChangeListener (java.beans.PropertyChangeListener)6 TitledBorder (javax.swing.border.TitledBorder)6 DataModel (edu.cmu.tetrad.data.DataModel)4 PatternToDag (edu.cmu.tetrad.search.PatternToDag)3 CSH (javax.help.CSH)3 HelpBroker (javax.help.HelpBroker)3 EmptyBorder (javax.swing.border.EmptyBorder)3 MatteBorder (javax.swing.border.MatteBorder)3