Example usage for javax.swing.tree DefaultMutableTreeNode DefaultMutableTreeNode

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

Introduction

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

Prototype

public DefaultMutableTreeNode(Object userObject) 

Source Link

Document

Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified user object.

Usage

From source file:com.pironet.tda.SunJDKParser.java

/**
 * check if any dead lock information is logged in the stream
 *
 * @param threadDump which tree node to add the histogram.
 *//*  w  ww  .  jav a 2 s.  c o m*/
private int checkForDeadlocks(DefaultMutableTreeNode threadDump) throws IOException {
    boolean finished = false;
    boolean found = false;
    int deadlocks = 0;
    int lineCounter = 0;
    StringBuffer dContent = new StringBuffer();
    TreeCategory deadlockCat = new TreeCategory("Deadlocks", IconFactory.DEADLOCKS);
    DefaultMutableTreeNode catDeadlocks = new DefaultMutableTreeNode(deadlockCat);
    boolean first = true;

    while (getBis().ready() && !finished) {
        String line = getNextLine();

        if (!found && !Strings.isNullOrEmpty(line)) {
            if (line.trim().startsWith("Found one Java-level deadlock")) {
                found = true;
                dContent.append("<body bgcolor=\"ffffff\"><font size=").append(TDA.getFontSizeModifier(-1))
                        .append("><b>");
                dContent.append("Found one Java-level deadlock");
                dContent.append("</b><hr></font><pre>\n");
            } else if (lineCounter >= getMaxCheckLines()) {
                finished = true;
            } else {
                lineCounter++;
            }
        } else if (found) {
            if (line.startsWith("Found one Java-level deadlock")) {
                if (dContent.length() > 0) {
                    deadlocks++;
                    addToCategory(catDeadlocks, "Deadlock No. " + (deadlocks), null, dContent.toString(), 0,
                            false);
                }
                dContent = new StringBuffer();
                dContent.append("</pre><b><font size=").append(TDA.getFontSizeModifier(-1)).append('>');
                dContent.append("Found one Java-level deadlock");
                dContent.append("</b><hr></font><pre>\n");
                first = true;
            } else if ((line.contains("Found"))
                    && (line.endsWith("deadlocks.") || line.endsWith("deadlock."))) {
                finished = true;
            } else if (line.startsWith("=======")) {
                // ignore this line
            } else if (line.contains(" monitor 0x")) {
                dContent.append(linkifyDeadlockInfo(line));
                dContent.append('\n');
            } else if (line.contains("Java stack information for the threads listed above")) {
                dContent.append("</pre><br><font size=").append(TDA.getFontSizeModifier(-1)).append("><b>");
                dContent.append("Java stack information for the threads listed above");
                dContent.append("</b><hr></font><pre>");
                first = true;
            } else if ((line.contains("- waiting on")) || (line.contains("- waiting to"))
                    || (line.contains("- locked")) || (line.contains("- parking to wait"))) {

                dContent.append(linkifyMonitor(line));
                dContent.append('\n');

            } else if (line.trim().startsWith("\"")) {
                dContent.append("</pre>");
                if (first) {
                    first = false;
                } else {
                    dContent.append("<br>");
                }
                dContent.append("<b><font size=").append(TDA.getFontSizeModifier(-1)).append("><code>");
                dContent.append(line);
                dContent.append("</font></code></b><pre>");
            } else {
                dContent.append(line);
                dContent.append('\n');
            }
        }
    }
    if (dContent.length() > 0) {
        deadlocks++;
        addToCategory(catDeadlocks, "Deadlock No. " + (deadlocks), null, dContent.toString(), 0, false);
    }

    if (deadlocks > 0) {
        threadDump.add(catDeadlocks);
        ((ThreadDumpInfo) threadDump.getUserObject()).setDeadlocks((TreeCategory) catDeadlocks.getUserObject());
        deadlockCat.setName("Deadlocks (" + deadlocks + (deadlocks == 1 ? " deadlock)" : " deadlocks)"));
    }

    return (deadlocks);
}

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

private DefaultMutableTreeNode getClassificationSchemeItemNode(String nodeId, ClassSchemeItem csi,
        TreeFunctions treeFunctions) throws Exception {
    return new DefaultMutableTreeNode(new WebNode(nodeId, csi.getClassSchemeItemName(),
            "javascript:" + treeFunctions.getJsFunctionName() + "('P_PARAM_TYPE=CSI&P_IDSEQ="
                    + csi.getCsCsiIdseq() + "&P_CONTE_IDSEQ=" + csi.getCsConteIdseq()
                    + treeFunctions.getExtraURLParameters() + "')",
            csi.getCsiDescription()));/*from www  .  j  ava  2  s. com*/
}

From source file:org.jfree.chart.demo.SuperDemo.java

private MutableTreeNode createLineChartsNode() {
    DefaultMutableTreeNode defaultmutabletreenode = new DefaultMutableTreeNode("Line Charts");
    DefaultMutableTreeNode defaultmutabletreenode1 = new DefaultMutableTreeNode(
            new DemoDescription("AnnotationDemo1", "AnnotationDemo1.java"));
    DefaultMutableTreeNode defaultmutabletreenode2 = new DefaultMutableTreeNode(
            new DemoDescription("LineChartDemo1", "LineChartDemo1.java"));
    DefaultMutableTreeNode defaultmutabletreenode3 = new DefaultMutableTreeNode(
            new DemoDescription("LineChartDemo2", "LineChartDemo2.java"));
    DefaultMutableTreeNode defaultmutabletreenode4 = new DefaultMutableTreeNode(
            new DemoDescription("LineChartDemo3", "LineChartDemo3.java"));
    DefaultMutableTreeNode defaultmutabletreenode5 = new DefaultMutableTreeNode(
            new DemoDescription("LineChartDemo4", "LineChartDemo4.java"));
    DefaultMutableTreeNode defaultmutabletreenode6 = new DefaultMutableTreeNode(
            new DemoDescription("LineChartDemo5", "LineChartDemo5.java"));
    DefaultMutableTreeNode defaultmutabletreenode7 = new DefaultMutableTreeNode(
            new DemoDescription("LineChartDemo6", "LineChartDemo6.java"));
    DefaultMutableTreeNode defaultmutabletreenode8 = new DefaultMutableTreeNode(
            new DemoDescription("LineChartDemo7", "LineChartDemo7.java"));
    DefaultMutableTreeNode defaultmutabletreenode9 = new DefaultMutableTreeNode(
            new DemoDescription("LineChartDemo8", "LineChartDemo8.java"));
    DefaultMutableTreeNode defaultmutabletreenode10 = new DefaultMutableTreeNode(
            new DemoDescription("LineChart3DDemo1", "LineChart3DDemo1.java"));
    DefaultMutableTreeNode defaultmutabletreenode11 = new DefaultMutableTreeNode(
            new DemoDescription("StatisticalLineChartDemo1", "StatisticalLineChartDemo1.java"));
    DefaultMutableTreeNode defaultmutabletreenode12 = new DefaultMutableTreeNode(
            new DemoDescription("XYStepRendererDemo1", "XYStepRendererDemo1.java"));
    DefaultMutableTreeNode defaultmutabletreenode13 = new DefaultMutableTreeNode(
            new DemoDescription("XYStepRendererDemo2", "XYStepRendererDemo2.java"));
    defaultmutabletreenode.add(defaultmutabletreenode1);
    defaultmutabletreenode.add(defaultmutabletreenode2);
    defaultmutabletreenode.add(defaultmutabletreenode3);
    defaultmutabletreenode.add(defaultmutabletreenode4);
    defaultmutabletreenode.add(defaultmutabletreenode5);
    defaultmutabletreenode.add(defaultmutabletreenode6);
    defaultmutabletreenode.add(defaultmutabletreenode7);
    defaultmutabletreenode.add(defaultmutabletreenode8);
    defaultmutabletreenode.add(defaultmutabletreenode9);
    defaultmutabletreenode.add(defaultmutabletreenode10);
    defaultmutabletreenode.add(defaultmutabletreenode11);
    defaultmutabletreenode.add(defaultmutabletreenode12);
    defaultmutabletreenode.add(defaultmutabletreenode13);
    return defaultmutabletreenode;
}

From source file:edu.ucla.stat.SOCR.chart.ChartTree.java

private MutableTreeNode createCrosshairChartsNode() {
    DefaultMutableTreeNode root = new DefaultMutableTreeNode("Crosshairs");

    DefaultMutableTreeNode n1 = new DefaultMutableTreeNode(
            new DemoDescription("edu.ucla.stat.SOCR.chart.demo.CrosshairDemo1", "CrosshairDemo1"));
    DefaultMutableTreeNode n2 = new DefaultMutableTreeNode(
            new DemoDescription("edu.ucla.stat.SOCR.chart.demo.CrosshairDemo2", "CrosshairDemo2"));
    DefaultMutableTreeNode n3 = new DefaultMutableTreeNode(
            new DemoDescription("edu.ucla.stat.SOCR.chart.demo.CrosshairDemo3", "CrosshairDemo3"));
    DefaultMutableTreeNode n4 = new DefaultMutableTreeNode(
            new DemoDescription("edu.ucla.stat.SOCR.chart.demo.CrosshairDemo4", "CrosshairDemo4"));

    root.add(n1);//from www .  ja v  a2 s .com
    //        root.add(n2);
    root.add(n3);
    root.add(n4);

    return root;
}

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

private void updateTableTreeNode(Model aModel, Table aTable, DefaultMutableTreeNode aTableNode) {

    aTableNode.removeAllChildren();// w w w  .ja v a2  s . c  o  m

    aTable.getAttributes().stream().filter(theAttribute -> isVisible(theAttribute)).forEach(theAttribute -> {
        DefaultMutableTreeNode theAttributeNode = new DefaultMutableTreeNode(theAttribute);
        aTableNode.add(theAttributeNode);

        registerUserObject(theAttribute, theAttributeNode);
    });

    aTable.getIndexes().stream().filter(theIndex -> isVisible(theIndex)).forEach(theIndex -> {
        createIndexTreeNode(aTableNode, theIndex);
    });

    aModel.getRelations().getForeignKeysFor(aTable).stream().filter(theRelation -> isVisible(theRelation))
            .forEach(theRelation -> {
                createRelationTreeNode(aTableNode, theRelation);
            });

    Set<Table> theAlreadyKnown = new HashSet<>();
    aModel.getRelations().getExportedKeysFor(aTable).stream().filter(
            theRelation -> isVisible(theRelation) && !theAlreadyKnown.contains(theRelation.getImportingTable()))
            .forEach(theRelation -> {
                UsedBy theUsedBy = new UsedBy();
                theUsedBy.ref = theRelation.getImportingTable();
                DefaultMutableTreeNode theUsedByNode = new DefaultMutableTreeNode(theUsedBy);
                aTableNode.add(theUsedByNode);

                theAlreadyKnown.add(theRelation.getImportingTable());
            });
}

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

private DefaultMutableTreeNode getRegStatusCSINode(String nodeId, ClassSchemeItem csi, String regStatus,
        TreeFunctions treeFunctions) throws Exception {
    return new DefaultMutableTreeNode(new WebNode(nodeId, csi.getClassSchemeItemName(),
            "javascript:" + treeFunctions.getJsFunctionName() + "('P_PARAM_TYPE=REGCSI&P_IDSEQ="
                    + csi.getCsCsiIdseq() + "&P_CONTE_IDSEQ=" + csi.getCsConteIdseq() + "&P_REGSTATUS="
                    + regStatus + treeFunctions.getExtraURLParameters() + "')",
            csi.getCsiDescription()));/*from w w w  .  j ava  2  s.  co  m*/
}

From source file:edu.ucla.stat.SOCR.chart.ChartTree.java

private MutableTreeNode createItemLabelsNode() {
    DefaultMutableTreeNode root = new DefaultMutableTreeNode("Item Labels");

    DefaultMutableTreeNode n1 = new DefaultMutableTreeNode(
            new DemoDescription("edu.ucla.stat.SOCR.chart.demo.ItemLabelDemo1", "ItemLabelDemo1"));
    DefaultMutableTreeNode n2 = new DefaultMutableTreeNode(
            new DemoDescription("edu.ucla.stat.SOCR.chart.demo.ItemLabelDemo2", "ItemLabelDemo2"));
    DefaultMutableTreeNode n3 = new DefaultMutableTreeNode(
            new DemoDescription("edu.ucla.stat.SOCR.chart.demo.ItemLabelDemo3", "ItemLabelDemo3"));

    root.add(n1);// ww  w. j a  va2s  .  c om
    root.add(n2);
    root.add(n3);

    return root;
}

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

private DefaultMutableTreeNode getContextNode(String nodeId, Context context, TreeFunctions treeFunctions)
        throws Exception {
    String currContextId = context.getConteIdseq();

    String name = context.getName();
    String desc = context.getDescription();

    DefaultMutableTreeNode contextNode = new DefaultMutableTreeNode(
            new WebNode(nodeId, name + " (" + desc + ")",
                    "javascript:" + treeFunctions.getJsFunctionName() + "('P_PARAM_TYPE=CONTEXT&P_IDSEQ="
                            + currContextId + "&P_CONTE_IDSEQ=" + currContextId
                            + treeFunctions.getExtraURLParameters() + "')",
                    desc + " (" + name + ")"));
    return contextNode;
}

From source file:com.lp.client.frame.component.PanelDokumentenablage.java

private void setDocNodesOnTree(DefaultMutableTreeNode top, List<DocNodeBase> docNodes, DocPath docPath)
        throws ExceptionLP, RepositoryException, Throwable {
    treeModel.reload(top);/*from  ww w . ja va  2 s  .c o m*/
    DefaultMutableTreeNode treeNode = null;
    if (docNodes != null) {
        for (DocNodeBase docNode : docNodes) {
            treeNode = new DefaultMutableTreeNode(docNode);
            boolean bDarfDocSehen = true;
            JCRDocDto jcrDocDto = null;
            if (docNode.getNodeType() == DocNodeBase.FILE)
                jcrDocDto = ((DocNodeFile) docNode).getJcrDocDto();
            if (jcrDocDto != null) {
                int iSicherheitsstufe = (int) jcrDocDto.getlSicherheitsstufe();
                bDarfDocSehen = false;
                switch (iSicherheitsstufe) {
                case (int) JCRDocFac.SECURITY_NONE:
                    if (bHatStufe0) {
                        bDarfDocSehen = true;
                    }
                    break;
                case (int) JCRDocFac.SECURITY_LOW:
                    if (bHatStufe1) {
                        bDarfDocSehen = true;
                    }
                    break;
                case (int) JCRDocFac.SECURITY_MEDIUM:
                    if (bHatStufe2) {
                        bDarfDocSehen = true;
                    }
                    break;
                case (int) JCRDocFac.SECURITY_HIGH:
                    if (bHatStufe3) {
                        bDarfDocSehen = true;
                    }
                    break;
                case (int) JCRDocFac.SECURITY_ARCHIV:
                    if (bHatStufe99) {
                        bDarfDocSehen = true;
                    }
                    break;
                }
            }

            if (bDarfDocSehen) {
                if (jcrDocDto != null) {
                    ArrayList<DocNodeVersion> versions = DelegateFactory.getInstance().getJCRDocDelegate()
                            .getAllDocumentVersions(jcrDocDto);
                    if (versions.size() > 0) {
                        boolean alleVersteckt = true;
                        for (DocNodeVersion version : versions) {
                            if (!version.getJCRDocDto().getbVersteckt()) {
                                alleVersteckt = false;
                                break;
                            }
                        }
                        if (bVersteckteAnzeigen || !alleVersteckt) {
                            treeModel.insertNodeInto(treeNode, top, top.getChildCount());
                        }
                        for (DocNodeVersion version : versions) {
                            if (bVersteckteAnzeigen || !version.getJCRDocDto().getbVersteckt()) {
                                treeModel.insertNodeInto(new DefaultMutableTreeNode(version), treeNode,
                                        treeNode.getChildCount());
                            }
                        }
                    } else if (bVersteckteAnzeigen || !jcrDocDto.getbVersteckt()) {
                        treeModel.insertNodeInto(treeNode, top, top.getChildCount());
                    }
                }
                if (jcrDocDto == null) {
                    if (docNode.getNodeType() == DocNodeBase.SYMBOLIC_LINK) {
                        DocPath path = ((DocNodeSymbolicLink) docNode).getViewPath().getDeepCopy();
                        path.asDocNodeList().remove(path.getLastDocNode());
                        path.add(docNode);
                        addNotExistingNodes(path, top);
                    } else {
                        treeModel.insertNodeInto(treeNode, top, top.getChildCount());
                        treeModel.insertNodeInto(new DefaultMutableTreeNode(MUST_LOAD_CHILDREN), treeNode, 0);
                    }
                }
            }
        }
    }
}

From source file:edu.ucla.stat.SOCR.chart.ChartTree.java

private MutableTreeNode createLegendNode() {
    DefaultMutableTreeNode root = new DefaultMutableTreeNode("Legends");

    DefaultMutableTreeNode n1 = new DefaultMutableTreeNode(
            new DemoDescription("edu.ucla.stat.SOCR.chart.demo.LegendWrapperDemo1", "LegendWrapperDemo1"));

    root.add(n1);/*from w w w.  j a  v a  2  s. c om*/

    return root;
}