Search in sources :

Example 76 with DefaultMutableTreeNode

use of javax.swing.tree.DefaultMutableTreeNode in project ACS by ACS-Community.

the class ErrorTreeCellRenderer method getDocsTree.

/**
	 * This method initializes docsNode	
	 * 	
	 * @return javax.swing.JTree	
	 */
private JTree getDocsTree() {
    if (docsTree == null) {
        docsTree = new JTree(new DefaultMutableTreeNode("ROOT"));
        docsTree.setRootVisible(false);
        docsTree.setToggleClickCount(1);
        docsTree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {

            public void valueChanged(javax.swing.event.TreeSelectionEvent e) {
                docNodeSelected = (DefaultMutableTreeNode) docsTree.getLastSelectedPathComponent();
                if (docNodeSelected != null) {
                    docSelected = (EbeDocument) docNodeSelected.getUserObject();
                    locationField.setText(docSelected.getPath());
                } else {
                    locationField.setText("(none)");
                }
                complexNodeSelected = null;
                complexSelected = null;
                refreshNodesTree();
                refreshDocTable();
                try {
                    loadXmlView();
                } catch (IOException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }
            }
        });
    }
    ToolTipManager.sharedInstance().registerComponent(docsTree);
    return docsTree;
}
Also used : JTree(javax.swing.JTree) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) IOException(java.io.IOException)

Example 77 with DefaultMutableTreeNode

use of javax.swing.tree.DefaultMutableTreeNode in project ACS by ACS-Community.

the class ErrorTreeCellRenderer method isError.

protected boolean isError(Object value) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
    Object nodeInfo = (Object) (node.getUserObject());
    if (nodeInfo instanceof Error) {
        return true;
    }
    return false;
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ComplexObject(cl.utfsm.acs.types.ComplexObject)

Example 78 with DefaultMutableTreeNode

use of javax.swing.tree.DefaultMutableTreeNode in project ACS by ACS-Community.

the class ErrorTreeCellRenderer method refreshDocsTree.

public void refreshDocsTree() {
    TreeMap<String, EbeDocument> docs = manager.getDocuments();
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) docsTree.getModel().getRoot();
    root.removeAllChildren();
    for (EbeDocument doc : docs.values()) {
        root.add(new DefaultMutableTreeNode(doc));
    }
    ((DefaultTreeModel) docsTree.getModel()).reload();
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 79 with DefaultMutableTreeNode

use of javax.swing.tree.DefaultMutableTreeNode in project ACS by ACS-Community.

the class ErrorTreeCellRenderer method refreshNodesTree.

private void refreshNodesTree() {
    DefaultTreeModel model = (DefaultTreeModel) nodesTree.getModel();
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
    root.removeAllChildren();
    if (docSelected == null) {
        model.reload();
        return;
    }
    TreeMap<String, ComplexObject> nodes = docSelected.getNodes();
    for (ComplexObject node : nodes.values()) {
        root.add(new DefaultMutableTreeNode(node));
    }
    model.reload();
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ComplexObject(cl.utfsm.acs.types.ComplexObject) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 80 with DefaultMutableTreeNode

use of javax.swing.tree.DefaultMutableTreeNode in project ACS by ACS-Community.

the class ErrorTreeCellRenderer method isCompletion.

protected boolean isCompletion(Object value) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
    Object nodeInfo = (Object) (node.getUserObject());
    if (nodeInfo instanceof Completion) {
        return true;
    }
    return false;
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ComplexObject(cl.utfsm.acs.types.ComplexObject)

Aggregations

DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)692 TreePath (javax.swing.tree.TreePath)185 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)98 ArrayList (java.util.ArrayList)51 Nullable (org.jetbrains.annotations.Nullable)50 TreeNode (javax.swing.tree.TreeNode)42 Test (org.junit.Test)39 JTree (javax.swing.JTree)38 NotNull (org.jetbrains.annotations.NotNull)32 VirtualFile (com.intellij.openapi.vfs.VirtualFile)28 JScrollPane (javax.swing.JScrollPane)25 TreeSelectionEvent (javax.swing.event.TreeSelectionEvent)23 TreeSelectionListener (javax.swing.event.TreeSelectionListener)23 Module (com.intellij.openapi.module.Module)20 File (java.io.File)20 Tree (com.intellij.ui.treeStructure.Tree)19 Enumeration (java.util.Enumeration)19 MouseEvent (java.awt.event.MouseEvent)18 IOException (java.io.IOException)17 MProduct (org.compiere.model.MProduct)17