Example usage for javax.swing.tree DefaultMutableTreeNode getParent

List of usage examples for javax.swing.tree DefaultMutableTreeNode getParent

Introduction

In this page you can find the example usage for javax.swing.tree DefaultMutableTreeNode getParent.

Prototype

public TreeNode getParent() 

Source Link

Document

Returns this node's parent or null if this node has no parent.

Usage

From source file:edu.ku.brc.af.tasks.subpane.formeditor.ViewSetSelectorPanel.java

/**
 * Adds a new row in the right position (above).
 *//* ww w  .ja  v  a  2 s. com*/
protected void addRow() {
    DefaultTreeModel model = (DefaultTreeModel) tree.getModel();

    FormRow newRow = new FormRow();

    DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(newRow);
    newNode.setUserObject(newRow);

    DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree.getSelectionModel().getSelectionPath()
            .getLastPathComponent();
    DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) selectedNode.getParent();
    if (parentNode == null) {
        parentNode = (DefaultMutableTreeNode) model.getRoot();
        selectedNode = null;
    }

    int position;
    if (selectedRow == null || parentNode.getUserObject() instanceof String) {
        formViewDef.getRows().add(newRow);
        position = formViewDef.getRows().size() - 1;

    } else {
        position = formViewDef.getRows().indexOf(selectedRow);
        formViewDef.getRows().insertElementAt(newRow, (byte) position);
    }

    model.insertNodeInto(newNode, parentNode, position);

    renumberRows(formViewDef.getRows());
    updateTreeNodes((DefaultMutableTreeNode) model.getRoot(), model, false);

    Object[] newPath = new Object[2];
    newPath[0] = parentNode;
    newPath[1] = newNode;

    final TreePath newTreePath = new TreePath(newPath);
    SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            tree.setSelectionPath(newTreePath);
        }
    });

    previewPanel.rebuild(false);
}

From source file:edu.ku.brc.specify.ui.containers.ContainerTreePanel.java

/**
 * @param bottomNode/*from  ww  w . j a v  a 2s . c  om*/
 */
private void expandToNode(final DefaultMutableTreeNode bottomNode) {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            if (model != null && bottomNode != null && bottomNode.getParent() != null) {
                TreeNode[] path = model.getPathToRoot(bottomNode);
                if (path != null && path.length > 0) {
                    tree.expandPath(new TreePath(path));
                }
            }
        }
    });
}

From source file:gov.nih.nci.ncicb.cadsr.contexttree.service.impl.CDEBrowserTreeServiceImpl.java

/**
 * This method iterate all the classifications of a form and add
 * the corresponding branch of the cs tree to the root node
 *
 * @param currForm the Form that needs to be attached to the root node
 * @param currCSMap a Map to find a tree node given a cscsi id, this tree
 *          node is used as a master copy for each protocol to create its own
 *          cs tree//  w  w  w. j  a  v  a 2s  .c  om
 * @param treeNodeMap a Map used to avoid copy the orginal node more than one
 *        time.  For each given Webnode id, this Map returns the corresponding
 *        copy of that node that exist in the copy
 * @param newNode the form node to be added to the cs tree
 * @param rootNode the tree node for the branch to attach to
 * @param idGen the id genator used to get unique id when copy a node from
 * original tree
 */
private void copyCSTree(Form currForm, Map currCSMap, Map treeNodeMap, DefaultMutableTreeNode newNode,
        DefaultMutableTreeNode rootNode, TreeIdGenerator idGen) {

    //if the cs map does not exist for any reason, simplely add the new to the root
    if (currCSMap == null)
        rootNode.add(newNode);
    else {
        Iterator csIter = currForm.getClassifications().iterator();

        while (csIter.hasNext()) {
            String cscsiId = ((ClassSchemeItem) csIter.next()).getCsCsiIdseq();

            DefaultMutableTreeNode origTreeNode = (DefaultMutableTreeNode) currCSMap.get(cscsiId);
            WebNode origWebNode = (WebNode) origTreeNode.getUserObject();

            DefaultMutableTreeNode treeNodeCopy = (DefaultMutableTreeNode) treeNodeMap.get(origWebNode.getId());

            if (treeNodeCopy == null) {
                treeNodeCopy = new DefaultMutableTreeNode(origWebNode.copy(idGen.getNewId()));

                treeNodeMap.put(origWebNode.getId(), treeNodeCopy);
            }

            treeNodeCopy.add(newNode);
            DefaultMutableTreeNode pTreeNode = origTreeNode;
            DefaultMutableTreeNode cTreeNode = treeNodeCopy;

            //copy this branch of the cs tree all the way until one parent node is
            //found in the new tree
            while (pTreeNode.getParent() != null) {
                DefaultMutableTreeNode parentTreeNode = (DefaultMutableTreeNode) pTreeNode.getParent();

                WebNode pWebNode = (WebNode) parentTreeNode.getUserObject();
                DefaultMutableTreeNode pNodeCopy = (DefaultMutableTreeNode) treeNodeMap.get(pWebNode.getId());

                if (pNodeCopy == null) {
                    pNodeCopy = new DefaultMutableTreeNode(pWebNode.copy(idGen.getNewId()));

                    treeNodeMap.put(pWebNode.getId(), pNodeCopy);
                    pNodeCopy.add(cTreeNode);
                    pTreeNode = parentTreeNode;
                    cTreeNode = pNodeCopy;
                } else {
                    // when one parent node is found in the new tree, attach the copy
                    pNodeCopy.add(cTreeNode);

                    return;
                }
            }

            rootNode.add(cTreeNode);
        }
    }
}

From source file:edu.ku.brc.af.tasks.subpane.formeditor.ViewSetSelectorPanel.java

/**
 * @param selectedControl//from  w w  w  .  j  av a  2s .c  o m
 * @param selectedCell
 */
protected void addControl(final ControlIFace selectedControl,
        @SuppressWarnings("hiding") final FormCell selectedCell) {
    int position = 0;
    if (selectedCell != null) {
        position = selectedRow.getCells().indexOf(selectedCell);
    }

    if (selectedControl instanceof RowControl) {
        addRow();
        return;
    }

    @SuppressWarnings("hiding")
    EditorPropPanel panel = new EditorPropPanel(controlHash, subcontrolHash, getAvailableFieldCells(), false,
            this);
    //panel.setFormViewDef(formViewDef);

    FormCell formCell = null;
    boolean skip = false;
    if (selectedControl instanceof Control) {
        Control control = (Control) selectedControl;

        if (control.getType().equals("label")) //$NON-NLS-1$
        {
            formCell = new FormCellLabel();
            formCell.setIdent(Integer.toString(getNextId()));
        }

        if (formCell != null) {
            formCell.setType(FormCellIFace.CellType.valueOf(control.getType()));

            //System.out.println(formCell.getType() + "  "+ formCell.getClass().getSimpleName());

            panel.loadView(formCell.getType().toString(), selectedViewDef.getClassName());
            panel.setDataIntoUI(formViewDef, formCell, (formViewDef.getRows().size() * 2) - 1,
                    formViewDef.getRowDefItem().getNumItems(), selectedRow.getRowNumber(),
                    (selectedRow.getCells().size() * 2) - 1, formViewDef.getColumnDefItem().getNumItems(),
                    position);
        }

    } else {
        SubControl subControl = (SubControl) selectedControl;

        FormCellField fcf = null;
        if (subControl.getType().equals("combobox")) //$NON-NLS-1$
        {
            fcf = new FormCellField(FormCell.CellType.field, Integer.toString(getNextId()), "", 1, 1); //$NON-NLS-1$
            fcf.setUiType(FormCellFieldIFace.FieldType.combobox);
            setDefaultDspUIType(fcf);
            formCell = fcf;
        }
        //System.out.println("* ["+fcf.getUiType().toString() + "]  "+ fcf.getClass().getSimpleName());
        //SubControl subcontrol = subcontrolHash.get(fcf.getUiType().toString());
        //System.out.println("SC: "+subcontrol);

        panel.loadView(fcf.getUiType().toString(), selectedViewDef.getClassName());
        panel.setDataIntoUI(formViewDef, fcf, (formViewDef.getRows().size() * 2) - 1,
                formViewDef.getRowDefItem().getNumItems(), selectedRow.getRowNumber(),
                (selectedRow.getCells().size() * 2) - 1, formViewDef.getColumnDefItem().getNumItems(),
                position);

    }

    if (!skip && formCell != null) {
        CustomDialog propDlg = new CustomDialog((Frame) UIRegistry.getTopWindow(),
                getResourceString("ViewSetSelectorPanel.CREATE"), true, panel); //$NON-NLS-1$
        propDlg.createUI();
        //panel.getViewDefMultiView().getCurrentView().getValidator().addEnableItem(propDlg.getOkBtn());
        propDlg.pack();
        Rectangle r = propDlg.getBounds();
        r.width += 60;
        r.height += 30;
        propDlg.setBounds(r);
        propDlg.setVisible(true);

        if (!propDlg.isCancelled()) {
            if (selectedControl instanceof Control) {
                panel.getDataFromUI(formCell);
            } else {
                panel.getDataFromUI((FormCellField) formCell);
            }

            DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(formCell);
            newNode.setUserObject(formCell);

            DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) tree.getSelectionModel()
                    .getSelectionPath().getLastPathComponent();
            if (!(parentNode.getUserObject() instanceof FormRow)) {
                parentNode = (DefaultMutableTreeNode) parentNode.getParent();
            }

            TreePath treePath = tree.getSelectionModel().getSelectionPath();
            Object[] path = treePath.getPath();

            Object[] newPath = new Object[path.length + (selectedCell == null ? 1 : 0)];
            for (int i = 0; i < path.length; i++) {
                newPath[i] = path[i];
            }
            newPath[newPath.length - 1] = newNode;

            if (selectedRow.getCells().size() == 0) {
                selectedRow.getCells().add(formCell);
                ((DefaultTreeModel) tree.getModel()).insertNodeInto(newNode, parentNode, 0);

            } else if (position == selectedRow.getCells().size() - 1) {
                //System.out.println("Adding New Cell at position["+(position+1)+"] number of nodes["+nodeParent.getChildCount()+"] rowCells "+selectedRow.getCells().size());
                selectedRow.getCells().add(formCell);
                ((DefaultTreeModel) tree.getModel()).insertNodeInto(newNode, parentNode, position + 1);

            } else {
                //System.out.println("Adding New Cell at position["+position+"] number of nodes["+nodeParent.getChildCount()+"] rowCells "+selectedRow.getCells().size());
                selectedRow.getCells().insertElementAt(formCell, position + 1);
                ((DefaultTreeModel) tree.getModel()).insertNodeInto(newNode, parentNode, position + 1);
            }

            //System.out.println("******* ADDING ["+formCell.getIdent()+"]"); //$NON-NLS-1$ //$NON-NLS-2$

            idHash.put(formCell.getIdent(), true);

            final TreePath newTreePath = new TreePath(newPath);
            SwingUtilities.invokeLater(new Runnable() {

                public void run() {
                    tree.setSelectionPath(newTreePath);
                }
            });

            previewPanel.rebuild(false);
        }
    }

}

From source file:com.wwidesigner.gui.StudyView.java

@Override
protected void initializeComponents() {
    // create file tree
    tree = new JTree() {
        @Override//from  ww w .j a v a 2  s.  co  m
        public String getToolTipText(MouseEvent e) {
            String tip = null;
            TreePath path = tree.getPathForLocation(e.getX(), e.getY());
            if (path != null) {
                if (path.getPathCount() == 3) // it is a leaf
                {
                    DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
                    if (node instanceof TreeNodeWithToolTips) {
                        tip = ((TreeNodeWithToolTips) node).getToolTip();
                    }
                }
            }
            return tip == null ? getToolTipText() : tip;
        }
    };
    // Show tooltips for the Study view, and let them persist for 8 seconds.
    ToolTipManager.sharedInstance().registerComponent(tree);
    ToolTipManager.sharedInstance().setDismissDelay(8000);
    // If a Study view node doesn't fit in the pane, expand it when hovering
    // over it.
    ExpandedTipUtils.install(tree);
    tree.setRootVisible(false);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
    tree.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            TreePath path = tree.getPathForLocation(e.getX(), e.getY());
            if (path != null) {
                if (path.getPathCount() == 3) // it is a leaf
                {
                    DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
                    DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) node.getParent();
                    String category = (String) parentNode.getUserObject();
                    study.setCategorySelection(category, (String) node.getUserObject());
                    if (StudyModel.INSTRUMENT_CATEGORY_ID.equals(category)
                            || StudyModel.TUNING_CATEGORY_ID.equals(category)) {
                        try {
                            study.validHoleCount();
                        } catch (Exception ex) {
                            showException(ex);
                        }
                    }
                }
                updateView();
            }
        }
    });
    JScrollPane scrollPane = new JScrollPane(tree);
    scrollPane.setPreferredSize(new Dimension(225, 100));
    add(scrollPane);

    Preferences myPreferences = getApplication().getPreferences();
    String modelName = myPreferences.get(OptimizationPreferences.STUDY_MODEL_OPT,
            OptimizationPreferences.NAF_STUDY_NAME);
    setStudyModel(modelName);
    study.setPreferences(myPreferences);

    getApplication().getEventManager().subscribe(WIDesigner.FILE_OPENED_EVENT_ID, this);
    getApplication().getEventManager().subscribe(WIDesigner.FILE_CLOSED_EVENT_ID, this);
    getApplication().getEventManager().subscribe(WIDesigner.FILE_SAVED_EVENT_ID, this);
    getApplication().getEventManager().subscribe(WIDesigner.WINDOW_RENAMED_EVENT_ID, this);
}

From source file:com.emental.mindraider.ui.outline.OutlineJPanel.java

public void conceptRefactor() {
    String sourceOutlineUri;/*  w  ww .  j ava2 s . c o  m*/
    String sourceConceptUri;

    if (MindRaider.profile.getActiveOutlineUri() == null) {
        JOptionPane.showMessageDialog(OutlineJPanel.this,
                Messages.getString("NotebookOutlineJPanel.toRefactorConceptTheNotebookMustBeOpened"),
                Messages.getString("NotebookOutlineJPanel.refactoringError"), JOptionPane.ERROR_MESSAGE);
        return;
    }

    DefaultMutableTreeNode node = getSelectedTreeNode();
    if (node != null) {
        if (node.isLeaf()) {
            try {
                if (JOptionPane.showConfirmDialog(MindRaider.mainJFrame,
                        Messages.getString("NotebookOutlineJPanel.doYouWantToRefactorConcept", node.toString()),
                        Messages.getString("NotebookOutlineJPanel.refactorConcept"),
                        JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
                    return;
                }

                DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent();
                sourceOutlineUri = MindRaider.outlineCustodian.getActiveOutlineResource().resource.getMetadata()
                        .getUri().toString();
                sourceConceptUri = ((OutlineNode) node).getUri();
                MindRaider.noteCustodian.discard(sourceOutlineUri, ((OutlineNode) parent).getUri(),
                        sourceConceptUri);
                ConceptResource conceptResource = MindRaider.noteCustodian.get(sourceOutlineUri,
                        sourceConceptUri);

                // choose target outline and create new concept into this notebook
                new OpenOutlineJDialog(Messages.getString("NotebookOutlineJPanel.refactorConcept"),
                        Messages.getString("NotebookOutlineJPanel.selectTargetNotebook"),
                        Messages.getString("NotebookOutlineJPanel.refactor"), false);

                // create that concept in the target notebook (put it to the root)
                String targetConceptUri = conceptResource.resource.getMetadata().getUri().toString();
                while (MindRaiderConstants.EXISTS.equals(
                        MindRaider.noteCustodian.create(MindRaider.outlineCustodian.getActiveOutlineResource(),
                                null, conceptResource.getLabel(), targetConceptUri,
                                conceptResource.getAnnotation(), false))) {
                    targetConceptUri += "_";
                }
                // refactor also attachments
                AttachmentProperty[] attachments = conceptResource.getAttachments();
                if (!ArrayUtils.isEmpty(attachments)) {
                    ConceptResource newConceptResource = MindRaider.noteCustodian
                            .get(MindRaider.outlineCustodian.getActiveOutlineResource().resource.getMetadata()
                                    .getUri().toString(), targetConceptUri);
                    for (AttachmentProperty attachment : attachments) {
                        newConceptResource.addAttachment(attachment.getDescription(), attachment.getUrl());
                    }
                    newConceptResource.save();
                }

                // delete discarded concept in the source outline
                MindRaider.noteCustodian.deleteConcept(sourceOutlineUri, sourceConceptUri);

                refresh();
                MindRaider.spidersGraph.selectNodeByUri(sourceOutlineUri);
                MindRaider.spidersGraph.renderModel();
            } catch (Exception e1) {
                logger.debug(Messages.getString("NotebookOutlineJPanel.unableToRefactorConcept"), e1);
                StatusBar.show(Messages.getString("NotebookOutlineJPanel.unableToRefactorConcept"));
            }
        } else {
            StatusBar.show(Messages.getString("NotebookOutlineJPanel.discardingingOnlyLeafConcepts"));
            JOptionPane.showMessageDialog(OutlineJPanel.this,
                    Messages.getString("NotebookOutlineJPanel.refactoringOnlyLeafConcepts"),
                    Messages.getString("NotebookOutlineJPanel.refactoringError"), JOptionPane.ERROR_MESSAGE);
            return;
        }
    } else {
        logger.debug(Messages.getString("NotebookOutlineJPanel.noNodeSelected"));
    }

}

From source file:de.erdesignerng.visual.common.OutlineComponent.java

/**
 * Create the PopupMenu actions correlating to a specific tree node.
 *
 * @param aNode     - the node/*  w w w.  j  av a2  s  . c  om*/
 * @param aMenu     - the menu to add the actions to
 * @param aRecursive - recursive
 */
private void initializeActionsFor(final DefaultMutableTreeNode aNode, JPopupMenu aMenu, boolean aRecursive) {

    Object theUserObject = aNode.getUserObject();

    if (!aRecursive) {
        JMenuItem theExpandAllItem = new JMenuItem();
        theExpandAllItem.setText(getResourceHelper().getFormattedText(ERDesignerBundle.EXPANDALL));
        theExpandAllItem
                .addActionListener(e -> expandOrCollapseAllChildrenOfNode(new TreePath(aNode.getPath()), true));
        aMenu.add(theExpandAllItem);

        JMenuItem theCollapseAllItem = new JMenuItem();
        theCollapseAllItem.setText(getResourceHelper().getFormattedText(ERDesignerBundle.COLLAPSEALL));
        theCollapseAllItem.addActionListener(
                e -> expandOrCollapseAllChildrenOfNode(new TreePath(aNode.getPath()), false));

        aMenu.add(theCollapseAllItem);
        aMenu.addSeparator();
    }

    List<ModelItem> theItemList = new ArrayList<>();
    if (theUserObject instanceof ModelItem) {
        theItemList.add((ModelItem) theUserObject);
        ContextMenuFactory.addActionsToMenu(ERDesignerComponent.getDefault().getEditor(), aMenu, theItemList);
    }

    if (aNode.getParent() != null) {
        initializeActionsFor((DefaultMutableTreeNode) aNode.getParent(), aMenu, true);
    }
}

From source file:edu.ku.brc.af.tasks.subpane.formeditor.ViewSetSelectorPanel.java

/**
 * //from   w  ww.j  a va2  s  . c  o m
 */
protected void treeSelected() {
    TreePath treePath = tree.getSelectionModel().getSelectionPath();
    if (treePath == null) {
        selectedRow = null;
        selectedCell = null;
        return;
    }

    DefaultMutableTreeNode node = (DefaultMutableTreeNode) treePath.getLastPathComponent();
    Object nodeObj = node.getUserObject();

    if (nodeObj instanceof FormRow) {
        if (nodeObj == selectedRow) {
            return;
        }
        selectedRow = (FormRow) nodeObj;
        selectedCell = null;

    } else if (nodeObj instanceof FormCell) {
        if (nodeObj == selectedCell) {
            return;
        }
        selectedCell = (FormCell) nodeObj;
        DefaultMutableTreeNode rowNode = (DefaultMutableTreeNode) node.getParent();
        selectedRow = (FormRow) rowNode.getUserObject();

    } else {
        selectedRow = null;
        selectedCell = null;
    }

    if (treePath != null) {
        updateUIControls();

        if (treePath.getPathCount() == 1) {
            panel.loadView("ViewDefProps", null); //$NON-NLS-1$
            panel.setData(selectedViewDef);

            return;
        }

        if (selectedCell != null) {
            int col = 0;
            for (FormCellIFace fc : selectedRow.getCells()) {
                if (fc == nodeObj) {
                    break;
                }
                col++;
            }
            showPropertiesPanel((FormCell) nodeObj, formViewDef.getClassName(),
                    (formViewDef.getRows().size() * 2) - 1, formViewDef.getRowDefItem().getNumItems(),
                    selectedRow.getRowNumber(), (selectedRow.getCells().size() * 2) - 1,
                    formViewDef.getColumnDefItem().getNumItems(), col);
        }
    }
}

From source file:StAXStreamTreeViewer.java

private void parseRestOfDocument(XMLStreamReader reader, DefaultMutableTreeNode current)
        throws XMLStreamException {

    while (reader.hasNext()) {
        int type = reader.next();
        switch (type) {
        case XMLStreamConstants.START_ELEMENT:

            DefaultMutableTreeNode element = new DefaultMutableTreeNode(reader.getLocalName());
            current.add(element);//from ww  w  .  j a  va 2 s .  c o m
            current = element;

            if (reader.getNamespaceURI() != null) {
                String prefix = reader.getPrefix();
                if (prefix == null) {
                    prefix = "[None]";
                }
                DefaultMutableTreeNode namespace = new DefaultMutableTreeNode(
                        "prefix = '" + prefix + "', URI = '" + reader.getNamespaceURI() + "'");
                current.add(namespace);
            }

            if (reader.getAttributeCount() > 0) {
                for (int i = 0; i < reader.getAttributeCount(); i++) {
                    DefaultMutableTreeNode attribute = new DefaultMutableTreeNode(
                            "Attribute (name = '" + reader.getAttributeLocalName(i) + "', value = '"
                                    + reader.getAttributeValue(i) + "')");
                    String attURI = reader.getAttributeNamespace(i);
                    if (attURI != null) {
                        String attPrefix = reader.getAttributePrefix(i);
                        if (attPrefix == null || attPrefix.equals("")) {
                            attPrefix = "[None]";
                        }
                        DefaultMutableTreeNode attNamespace = new DefaultMutableTreeNode(
                                "prefix=" + attPrefix + ",URI=" + attURI);
                        attribute.add(attNamespace);
                    }
                    current.add(attribute);
                }
            }

            break;
        case XMLStreamConstants.END_ELEMENT:
            current = (DefaultMutableTreeNode) current.getParent();
            break;
        case XMLStreamConstants.CHARACTERS:
            if (!reader.isWhiteSpace()) {
                DefaultMutableTreeNode data = new DefaultMutableTreeNode("CD:" + reader.getText());
                current.add(data);
            }
            break;
        case XMLStreamConstants.DTD:
            DefaultMutableTreeNode dtd = new DefaultMutableTreeNode("DTD:" + reader.getText());
            current.add(dtd);
            break;
        case XMLStreamConstants.SPACE:
            break;
        case XMLStreamConstants.COMMENT:
            DefaultMutableTreeNode comment = new DefaultMutableTreeNode(reader.getText());
            current.add(comment);
            break;
        default:
            System.out.println(type);
        }
    }
}

From source file:com.ibm.soatf.gui.SOATestingFrameworkGUI.java

private FlowExecutor buildFlowExecutor() throws FrameworkConfigurationException {
    String interfaceId = jlInterfaces.getSelectedValue().getWrappedObject().getName();
    logger.info("Interface ID : " + interfaceId);
    String envName = cbEnvironment.getSelectedItem().toString();
    //boolean ignoreFailures = chkBoxIgnoreFailures.isSelected();
    FlowExecutor flowExecutor = new FlowExecutor(envName, interfaceId);
    TreePath selectionPath = jtInterfaceDetails.getSelectionPath();
    if (selectionPath == null) {
        return flowExecutor;
    }//from  w w  w .  j  ava  2s. com

    DefaultMutableTreeNode node = (DefaultMutableTreeNode) selectionPath.getLastPathComponent();
    while (node != null) {
        Object userObject = node.getUserObject();
        if (userObject instanceof GUIObjects.Project) {
            boolean inboundOnly = "INBOUND"
                    .equalsIgnoreCase(((GUIObjects.Project) userObject).getWrappedObject().getDirection());
            flowExecutor = new FlowExecutor(inboundOnly, envName, interfaceId);
            break;
        } else if (userObject instanceof GUIObjects.Operation) {
            flowExecutor.setOperation(((GUIObjects.Operation) userObject).getWrappedObject());
        } else if (userObject instanceof GUIObjects.InterfaceExecutionBlock) {
            flowExecutor.setIfaceExecutionBlock(
                    ((GUIObjects.InterfaceExecutionBlock) userObject).getWrappedObject());
        } else if (userObject instanceof GUIObjects.InterfaceTestScenario) {
            flowExecutor
                    .setIfaceTestScenario(((GUIObjects.InterfaceTestScenario) userObject).getWrappedObject());
        } else if (userObject instanceof GUIObjects.IfaceFlowPattern) {
            flowExecutor.setIfaceFlowPattern(((GUIObjects.IfaceFlowPattern) userObject).getWrappedObject());
        }
        node = (DefaultMutableTreeNode) node.getParent();
    }

    return flowExecutor;
}