Search in sources :

Example 1 with TetradSerializable

use of edu.cmu.tetrad.util.TetradSerializable in project tetrad by cmu-phil.

the class GraphSelectionEditor method getSelectedModelComponents.

@Override
public List getSelectedModelComponents() {
    List<Component> selectedComponents = getWorkbench().getSelectedComponents();
    List<TetradSerializable> selectedModelComponents = new ArrayList<>();
    for (Component comp : selectedComponents) {
        if (comp instanceof DisplayNode) {
            selectedModelComponents.add(((DisplayNode) comp).getModelNode());
        } else if (comp instanceof DisplayEdge) {
            selectedModelComponents.add(((DisplayEdge) comp).getModelEdge());
        }
    }
    return selectedModelComponents;
}
Also used : DisplayNode(edu.cmu.tetradapp.workbench.DisplayNode) TetradSerializable(edu.cmu.tetrad.util.TetradSerializable) ArrayList(java.util.ArrayList) Component(java.awt.Component) JComponent(javax.swing.JComponent) DisplayEdge(edu.cmu.tetradapp.workbench.DisplayEdge)

Aggregations

TetradSerializable (edu.cmu.tetrad.util.TetradSerializable)1 DisplayEdge (edu.cmu.tetradapp.workbench.DisplayEdge)1 DisplayNode (edu.cmu.tetradapp.workbench.DisplayNode)1 Component (java.awt.Component)1 ArrayList (java.util.ArrayList)1 JComponent (javax.swing.JComponent)1