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.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Add the classes to the tree view//from   ww  w  .jav a2  s  .c o m
 * 
 * @see #addIndividualsToTree(OntClass, DefaultMutableTreeNode,
 *      ProgressMonitor)
 * 
 * @param classesNode
 *          The classes parent node in the tree
 * @param maxIndividualsPerClass
 *          The maximum number of individuals to display in each class
 * @param messagePrefix
 *          Prefix for display messages
 */
private void addClassesToTree(DefaultMutableTreeNode classesNode, int maxIndividualsPerClass,
        String messagePrefix) {
    ProgressMonitor progress = null;
    DefaultMutableTreeNode oneClassNode;
    List<OntClass> ontClasses;
    ExtendedIterator<OntClass> classesIterator;
    int classNumber;
    try {
        classesIterator = ontModel.listClasses();

        setStatus(messagePrefix + "... obtaining the list of classes");

        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("List of classes built");
        }
        ontClasses = new ArrayList<OntClass>();
        while (classesIterator.hasNext()) {
            ontClasses.add(classesIterator.next());
        }
        progress = new ProgressMonitor(this, "Create the model tree view", "Setting up the class list", 0,
                ontClasses.size());
        Collections.sort(ontClasses, new OntClassComparator());
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("List of classes sorted. Num classes:" + ontClasses.size());
        }

        classNumber = 0;
        for (OntClass ontClass : ontClasses) {
            setStatus(messagePrefix + " for class " + ontClass);

            if (MemoryWarningSystem.hasLatestAvailableTenuredGenAfterCollectionChanged(this)
                    && MemoryWarningSystem
                            .getLatestAvailableTenuredGenAfterCollection() < MINIMUM_BYTES_REQUIRED_FOR_TREE_BUILD) {
                throw new IllegalStateException(
                        "Insufficient memory available to complete building the tree (class iteration)");
            }

            if (progress.isCanceled()) {
                throw new RuntimeException("Tree model creation canceled by user");
            }

            progress.setNote(ontClass.toString());
            progress.setProgress(++classNumber);

            // Check whether class is to be skipped
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace("Check if class to be skipped: " + ontClass.getURI());
                for (String skipClass : classesToSkipInTree.keySet()) {
                    LOGGER.trace("Class to skip: " + skipClass + "  equal? "
                            + (skipClass.equals(ontClass.getURI())));
                }
            }
            if (filterEnableFilters.isSelected() && classesToSkipInTree.get(ontClass.getURI()) != null) {
                LOGGER.debug("Class to be skipped: " + ontClass.getURI());
                continue;
            }

            if (ontClass.isAnon()) {
                // Show anonymous classes based on configuration
                if (filterShowAnonymousNodes.isSelected()) {
                    oneClassNode = new DefaultMutableTreeNode(
                            new WrapperClass(ontClass.getId().getLabelString(), "[Anonymous class]", true));
                } else {
                    LOGGER.debug("Skip anonymous class: " + ontClass.getId().getLabelString());
                    continue;
                }
            } else {
                oneClassNode = new DefaultMutableTreeNode(new WrapperClass(ontClass.getLocalName(),
                        ontClass.getURI(), showFqnInTree.isSelected()));
                LOGGER.debug("Add class node: " + ontClass.getLocalName() + " (" + ontClass.getURI() + ")");
            }
            classesNode.add(oneClassNode);

            addIndividualsToTree(ontClass, oneClassNode, maxIndividualsPerClass, progress);
        }

    } finally {
        if (progress != null) {
            progress.close();
        }
    }
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Add individuals of a class to the tree
 * //w w w.  j av  a2 s.co m
 * @see #addStatementsToTree(OntClass, Individual, DefaultMutableTreeNode,
 *      ProgressMonitor)
 * 
 * @param ontClass
 *          The class of individuals to be added
 * @param oneClassNode
 *          The class's node in the tree
 * @param maxIndividualsPerClass
 *          The maximum number of individuals to display in each class
 * @param progress
 *          A progress monitor to display progress to the user
 */
private void addIndividualsToTree(OntClass ontClass, DefaultMutableTreeNode oneClassNode,
        int maxIndividualsPerClass, ProgressMonitor progress) {
    DefaultMutableTreeNode oneIndividualNode;
    List<Individual> individuals;
    ExtendedIterator<Individual> individualsIterator;
    int nodeCount = 0;

    // Individuals
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Get list of individuals for " + ontClass.getURI());
    }
    individualsIterator = ontModel.listIndividuals(ontClass);
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("List of individuals built for " + ontClass.getURI()
                + " Is there at least one individual? " + individualsIterator.hasNext());
    }
    individuals = new ArrayList<Individual>();

    while (individualsIterator.hasNext()) {
        individuals.add(individualsIterator.next());
        ++nodeCount;
        if (maxIndividualsPerClass > 0 && nodeCount >= maxIndividualsPerClass) {
            break;
        }
    }

    Collections.sort(individuals, new IndividualComparator());
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("List of individuals sorted for " + ontClass.getURI());
    }

    for (Individual individual : individuals) {
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Next individual: " + individual.getLocalName());
        }

        if (MemoryWarningSystem.hasLatestAvailableTenuredGenAfterCollectionChanged(this) && MemoryWarningSystem
                .getLatestAvailableTenuredGenAfterCollection() < MINIMUM_BYTES_REQUIRED_FOR_TREE_BUILD) {
            throw new IllegalStateException(
                    "Insufficient memory available to complete building the tree (individual iteration)");
        }

        if (individual.isAnon()) {
            // Show anonymous individuals based on configuration
            if (filterShowAnonymousNodes.isSelected()) {
                if (individual.getId().getLabelString() != null) {
                    oneIndividualNode = new DefaultMutableTreeNode(new WrapperInstance(
                            individual.getId().getLabelString(), "[Anonymous individual]", true));
                } else {
                    oneIndividualNode = new DefaultMutableTreeNode(new WrapperInstance(individual.toString(),
                            "[null label - anonymous individual]", true));
                }
            } else {
                LOGGER.debug("Skip anonymous individual: " + individual.getId().getLabelString());
                continue;
            }
        } else if (individual.getLocalName() != null) {
            oneIndividualNode = new DefaultMutableTreeNode(new WrapperInstance(individual.getLocalName(),
                    individual.getURI(), showFqnInTree.isSelected()));
        } else {
            oneIndividualNode = new DefaultMutableTreeNode(
                    new WrapperInstance(individual.toString(), "[null name - non anonymous]", true));
        }
        oneClassNode.add(oneIndividualNode);

        addStatementsToTree(individual, oneIndividualNode, progress);
    }

}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Add statements to the tree (predicates and properties)
 * //from  w w w  .j a v a 2 s  .c o  m
 * @param individual
 *          The individual whose statements are to be added to the tree
 * @param oneIndividualNode
 *          The individual's node in the tree
 * @param progress
 *          A progress monitor to display progress to the user
 */
private void addStatementsToTree(Individual individual, DefaultMutableTreeNode oneIndividualNode,
        ProgressMonitor progress) {
    DefaultMutableTreeNode onePropertyNode;
    List<Statement> statements;
    Property property;
    RDFNode rdfNode;
    Literal literal;
    StmtIterator stmtIterator;

    // Properties (predicates) and Objects
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Get list of statements for " + individual.getURI());
    }
    stmtIterator = individual.listProperties();
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("List of statements built for " + individual.getURI());
    }
    statements = new ArrayList<Statement>();
    while (stmtIterator.hasNext()) {
        statements.add(stmtIterator.next());
    }
    Collections.sort(statements, new StatementComparator());
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("List of statements sorted for " + individual.getURI());
    }

    for (Statement statement : statements) {
        property = statement.getPredicate();

        // Check whether predicate is to be skipped
        if (filterEnableFilters.isSelected() && predicatesToSkipInTree.get(property.getURI()) != null) {
            continue;
        }

        rdfNode = statement.getObject();

        if (MemoryWarningSystem.hasLatestAvailableTenuredGenAfterCollectionChanged(this) && MemoryWarningSystem
                .getLatestAvailableTenuredGenAfterCollection() < MINIMUM_BYTES_REQUIRED_FOR_TREE_BUILD) {
            throw new IllegalStateException(
                    "Insufficient memory available to complete building the tree (statement iteration)");
        }

        if (property.isAnon()) {
            // Show anonymous properties based on configuration
            if (filterShowAnonymousNodes.isSelected()) {
                if (rdfNode.isLiteral()) {
                    onePropertyNode = new DefaultMutableTreeNode(new WrapperDataProperty(
                            property.getId().getLabelString(), "[Anonymous data property]", true));
                } else {
                    onePropertyNode = new DefaultMutableTreeNode(new WrapperObjectProperty(
                            property.getId().getLabelString(), "[Anonymous object property]", true));
                }
            } else {
                LOGGER.debug("Skip anonymous property: " + property.getId().getLabelString());
                continue;
            }
        } else if (rdfNode.isLiteral() || !statement.getResource().isAnon()
                || filterShowAnonymousNodes.isSelected()) {
            if (rdfNode.isLiteral()) {
                onePropertyNode = new DefaultMutableTreeNode(new WrapperDataProperty(property.getLocalName(),
                        property.getURI(), showFqnInTree.isSelected()));
            } else {
                onePropertyNode = new DefaultMutableTreeNode(new WrapperObjectProperty(property.getLocalName(),
                        property.getURI(), showFqnInTree.isSelected()));
            }
        } else {
            LOGGER.debug("Skip concrete property of an anonymous individual: " + property.getURI() + ", "
                    + statement.getResource().getId().getLabelString());
            continue;

        }
        oneIndividualNode.add(onePropertyNode);

        if (rdfNode.isLiteral()) {
            literal = statement.getLiteral();
            if (setupOutputDatatypesForLiterals.isSelected()) {
                onePropertyNode.add(new DefaultMutableTreeNode(new WrapperLiteral(
                        ValueFormatter.getInstance().applyFormat(literal.getString(), literal.getDatatypeURI())
                                + " [" + literal.getDatatypeURI() + "]")));

            } else {
                onePropertyNode.add(new DefaultMutableTreeNode(new WrapperLiteral(ValueFormatter.getInstance()
                        .applyFormat(literal.getString(), literal.getDatatypeURI()))));
            }
        } else {
            if (statement.getResource().isAnon()) {
                if (filterShowAnonymousNodes.isSelected()) {
                    onePropertyNode.add(new DefaultMutableTreeNode(new WrapperInstance(
                            statement.getResource().getId().getLabelString(), "[Anonymous individual]", true)));
                } else {
                    LOGGER.debug(
                            "Skip anonymous individual: " + statement.getResource().getId().getLabelString());
                    continue;
                }
            } else {
                onePropertyNode.add(
                        new DefaultMutableTreeNode(new WrapperInstance(statement.getResource().getLocalName(),
                                statement.getResource().getURI(), showFqnInTree.isSelected())));
            }
        }
    }
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenterTest.java

@Test
public final void testGetFileSystemMenu() {
    // Includes a test for setting the root entity

    DefaultMutableTreeNode node = new DefaultMutableTreeNode("Nothing");
    JPopupMenu menu = depositPresenter.getFileSystemMenu(node);
    // menu should be null if the user object isn't a FileSystemObject
    assertTrue(menu == null);//from   w  w  w  .  j  av  a 2 s  .  c  om

    File theFile = new File(RESOURCES_INPUT_SOUND);
    String description = "ManualDeposit";
    FileSystemObject root = new FileSystemObject(description, theFile, null);
    node = new DefaultMutableTreeNode(root);
    AppProperties props = depositPresenter.getAppProperties();
    UserGroupData userGroupData = null;
    try {
        userGroupData = props.getUserData().getUser(props.getLoggedOnUser()).getUserGroupData();
    } catch (Exception ex) {
        fail();
    }
    userGroupData.setIncludeMultiEntityMenuItem(false);
    menu = depositPresenter.getFileSystemMenu(node);
    assertTrue(menu != null);
    int menuCount = menu.getComponentCount();
    assertTrue(menuCount >= 1);
    try {
        depositPresenter.setupScreen();
    } catch (Exception ex) {
        fail();
    }
    userGroupData.setIncludeMultiEntityMenuItem(true);
    menu = depositPresenter.getFileSystemMenu(node);
    assertTrue(menu != null && menu.getComponentCount() == menuCount + 2);

    try {
        depositPresenter.setupScreen();
    } catch (Exception ex) {
        fail();
    }
    theFile = new File(RESOURCES_INPUT_SOUND + "/Preservation Copy/OHC-0000_s_1.wav");
    description = "OHC-0000_s_1.wav";
    FileSystemObject newRoot = new FileSystemObject(description, theFile, null);
    DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(newRoot);
    node.add(childNode);
    userGroupData.setIncludeMultiEntityMenuItem(false);
    menu = depositPresenter.getFileSystemMenu(childNode);
    assertTrue(menu != null);
    menuCount = menu.getComponentCount();
    assertTrue(menuCount >= 1);
    try {
        depositPresenter.setupScreen();
    } catch (Exception ex) {
        fail();
    }
    userGroupData.setIncludeMultiEntityMenuItem(true);
    menu = depositPresenter.getFileSystemMenu(childNode);
    assertTrue(menu != null && menu.getComponentCount() == menuCount);

    root = setRoot();
    // assertTrue(_presenter _theFrame._rootNode.equals(root));
    assertFalse(theFrame.cursorIsWaiting);
    // node = new DefaultMutableTreeNode(root);
    // menu = _presenter.getFileSystemMenu(node);
    // menu should have at least one item
    // When the menu is fixed, implement this check
    // assertTrue(menu != null && menu.getComponentCount() >= 1);
    assertFalse(theFrame.cursorIsWaiting);
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenterTest.java

@Test
public final void testGetEntityMenu() {
    String entityName = "Nothing";
    DefaultMutableTreeNode node = new DefaultMutableTreeNode(entityName);
    JPopupMenu menu = depositPresenter.getEntityMenu(node);
    // menu should be null if the entity root hasn't been set
    assertTrue(menu == null);/*from  w  w w  .ja  v  a2  s  . c o m*/

    FileSystemObject root = setRoot();
    FileGroupCollection groups = new FileGroupCollection(entityName, root.getFullPath());
    FileGroup group = FileGroup.create(entityName, "", RepresentationTypes.DigitalOriginal, root.getChildren());
    // FileGroup group = new FileGroup(entityName,
    // RepresentationTypes.DigitalOriginal, root.getChildren());
    try {
        groups.add(group);
    } catch (Exception ex) {
        fail();
    }
    try {
        Thread.sleep(500);
    } catch (InterruptedException e) {
    }
    node = new DefaultMutableTreeNode(groups);
    menu = depositPresenter.getEntityMenu(node);
    // Should have at least two items - "Rename Intellectual Entity" &
    // "Add Entity"
    // Text may change so only check that they're there
    assertTrue(menu != null && menu.getComponentCount() > 1);

    FileGroup entity = FileGroup.create("Test Entity", "", RepresentationTypes.DigitalOriginal,
            root.getChildren());
    // FileGroup entity = new FileGroup("Test Entity",
    // RepresentationTypes.DigitalOriginal, root.getChildren());
    try {
        depositPresenter.getEntities().get(0).add(entity);
    } catch (Exception ex) {
        fail();
    }
    node = new DefaultMutableTreeNode(entity);
    menu = depositPresenter.getEntityMenu(node);
    // Should have at one item - "Delete Entity"
    // "Rename Entity" has been deleted
    // Text may change so only check that they're there
    // assertTrue(menu != null && menu.getComponentCount() > 1);
    assertTrue(menu != null && menu.getComponentCount() == 1);

    FileSystemObject fso = root.getChildren().get(0);
    node = new DefaultMutableTreeNode(fso);
    menu = depositPresenter.getEntityMenu(node);
    try {
        Thread.sleep(500);
    } catch (InterruptedException e) {
    }
    // Should have at least two items - "Delete" & "Rename"
    // Applies to both file & directory, though the text is different for
    // each
    assertTrue(menu != null && menu.getComponentCount() > 1);
    assertFalse(theFrame.cursorIsWaiting);
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenterTest.java

@Test
public final void testGetStructMapMenu() {
    DefaultMutableTreeNode node = new DefaultMutableTreeNode("Nothing");
    JPopupMenu menu = depositPresenter.getStructMapMenu(node);
    // menu should be null if the entity root hasn't been set
    assertTrue(menu == null);/*from  w  w  w  .jav a2s .  co m*/

    FileSystemObject root = setRoot();
    try {
        Thread.sleep(500);
    } catch (InterruptedException e) {
    }
    menu = depositPresenter.getStructMapMenu(node);
    // Should have at one item - "Add Structure Item"
    // Text may change so only check that it's there
    assertTrue(menu != null && menu.getComponentCount() == 1);

    StructMap map = new StructMap("Test Entity", null, root.getChildren(), 0);
    // _theFrame.getStructures().add(map);
    node = new DefaultMutableTreeNode(map);
    menu = depositPresenter.getStructMapMenu(node);
    // Should have at least 3 items - "Delete" & "Rename" & "Add"
    // Text may change so only check that they're there
    assertTrue(menu != null && menu.getComponentCount() > 2);

    FileSystemObject fso = root.getChildren().get(0);
    node = new DefaultMutableTreeNode(fso);
    menu = depositPresenter.getStructMapMenu(node);
    try {
        Thread.sleep(500);
    } catch (InterruptedException e) {
    }
    // Should have one item - "Delete"
    // Text may change so only check that it's there
    assertTrue(menu != null && menu.getComponentCount() == 1);
    assertFalse(theFrame.cursorIsWaiting);
}

From source file:op.care.med.structure.PnlMed.java

private DefaultMutableTreeNode getRoot() {
    DefaultMutableTreeNode root;//from   w  w  w  .ja va2s. c o m
    root = new DefaultMutableTreeNode(product);
    SYSTools.addAllNodes(root, getTradeForms());
    return root;
}

From source file:op.care.med.structure.PnlMed.java

private java.util.List<TradeForm> getTradeForms() {
    java.util.List result = new ArrayList();

    EntityManager em = OPDE.createEM();// w  w w.  java2 s .  com
    Query query = em.createQuery(
            "SELECT m FROM TradeForm m WHERE m.medProduct = :medProdukt ORDER BY m.dosageForm.preparation");
    query.setParameter("medProdukt", product);

    java.util.List<TradeForm> listDAF = query.getResultList();
    em.close();

    for (TradeForm daf : listDAF) {
        DefaultMutableTreeNode nodeDAF = new DefaultMutableTreeNode(daf);
        SYSTools.addAllNodes(nodeDAF, getPackung(daf));
        result.add(nodeDAF);
    }

    return result;
}

From source file:op.care.med.structure.PnlMed.java

private java.util.List getPackung(TradeForm darreichung) {
    java.util.List result = new ArrayList();
    for (MedPackage aPackage : darreichung.getPackages()) {
        result.add(new DefaultMutableTreeNode(aPackage));
    }/*  w  ww  .  ja v a 2 s  .c o  m*/

    return result;
}

From source file:org.alfresco.repo.jive.impl.MockJiveService.java

private final TreeModel buildMockData1() {
    TreeModel result = null;//from   www .  ja v  a 2  s  .  c om

    /*
     * Build up a tree that looks like this:
     * 
     * root
     *   Child 1
     *     Child 1.1
     *       Child 1.1.1
     *       Child 1.1.2
     *       Child 1.1.3
     *         Child 1.1.3.1
     *           Child 1.1.3.1.1
     *             Child 1.1.3.1.1.1
     *               Child 1.1.3.1.1.1.1
     *                 Child 1.1.3.1.1.1.1.1
     *     Child 1.2
     *       Child 1.2.1
     *       Child 1.2.2
     *     Child 1.3
     *   Child 2
     *     Child 2.1
     *     Child 2.2
     *     Child 2.3
     *     Child 2.4
     *     ... 45 other children omitted for brevity ...
     *     Child 2.50
     *   Child 3
     *   Child 4 which has some punctuation characters: '";/?\[]{}
     *   Child 5 which has an extremely long name that is intended to test out how it'll appear in the Share UI
     *   Child 6 which has some Unicode characters: ?
     */

    // First up we create all the nodes
    DefaultMutableTreeNode root = new DefaultMutableTreeNode(new JiveCommunity(0, "root"));
    DefaultMutableTreeNode child1 = new DefaultMutableTreeNode(new JiveCommunity(1, "Child 1"));
    DefaultMutableTreeNode child11 = new DefaultMutableTreeNode(new JiveCommunity(11, "Child 1.1"));
    DefaultMutableTreeNode child111 = new DefaultMutableTreeNode(new JiveCommunity(111, "Child 1.1.1"));
    DefaultMutableTreeNode child112 = new DefaultMutableTreeNode(new JiveCommunity(112, "Child 1.1.2"));
    DefaultMutableTreeNode child113 = new DefaultMutableTreeNode(new JiveCommunity(113, "Child 1.1.3"));
    DefaultMutableTreeNode child1131 = new DefaultMutableTreeNode(new JiveCommunity(1131, "Child 1.1.3.1"));
    DefaultMutableTreeNode child11311 = new DefaultMutableTreeNode(new JiveCommunity(11311, "Child 1.1.3.1.1"));
    DefaultMutableTreeNode child113111 = new DefaultMutableTreeNode(
            new JiveCommunity(113111, "Child 1.1.3.1.1.1"));
    DefaultMutableTreeNode child1131111 = new DefaultMutableTreeNode(
            new JiveCommunity(1131111, "Child 1.1.3.1.1.1.1"));
    DefaultMutableTreeNode child11311111 = new DefaultMutableTreeNode(
            new JiveCommunity(11311111, "Child 1.1.3.1.1.1.1.1"));
    DefaultMutableTreeNode child12 = new DefaultMutableTreeNode(new JiveCommunity(12, "Child 1.2"));
    DefaultMutableTreeNode child121 = new DefaultMutableTreeNode(new JiveCommunity(121, "Child 1.2.1"));
    DefaultMutableTreeNode child122 = new DefaultMutableTreeNode(new JiveCommunity(122, "Child 1.2.2"));
    DefaultMutableTreeNode child13 = new DefaultMutableTreeNode(new JiveCommunity(13, "Child 1.3"));
    DefaultMutableTreeNode child2 = new DefaultMutableTreeNode(new JiveCommunity(2, "Child 2"));
    DefaultMutableTreeNode child21 = new DefaultMutableTreeNode(new JiveCommunity(21, "Child 2.1"));
    DefaultMutableTreeNode child22 = new DefaultMutableTreeNode(new JiveCommunity(22, "Child 2.2"));
    DefaultMutableTreeNode child23 = new DefaultMutableTreeNode(new JiveCommunity(23, "Child 2.3"));
    DefaultMutableTreeNode child24 = new DefaultMutableTreeNode(new JiveCommunity(24, "Child 2.4"));
    DefaultMutableTreeNode child25 = new DefaultMutableTreeNode(new JiveCommunity(25, "Child 2.5"));
    DefaultMutableTreeNode child26 = new DefaultMutableTreeNode(new JiveCommunity(26, "Child 2.6"));
    DefaultMutableTreeNode child27 = new DefaultMutableTreeNode(new JiveCommunity(27, "Child 2.7"));
    DefaultMutableTreeNode child28 = new DefaultMutableTreeNode(new JiveCommunity(28, "Child 2.8"));
    DefaultMutableTreeNode child29 = new DefaultMutableTreeNode(new JiveCommunity(29, "Child 2.9"));
    DefaultMutableTreeNode child210 = new DefaultMutableTreeNode(new JiveCommunity(210, "Child 2.10"));
    DefaultMutableTreeNode child211 = new DefaultMutableTreeNode(new JiveCommunity(211, "Child 2.11"));
    DefaultMutableTreeNode child212 = new DefaultMutableTreeNode(new JiveCommunity(212, "Child 2.12"));
    DefaultMutableTreeNode child213 = new DefaultMutableTreeNode(new JiveCommunity(213, "Child 2.13"));
    DefaultMutableTreeNode child214 = new DefaultMutableTreeNode(new JiveCommunity(214, "Child 2.14"));
    DefaultMutableTreeNode child215 = new DefaultMutableTreeNode(new JiveCommunity(215, "Child 2.15"));
    DefaultMutableTreeNode child216 = new DefaultMutableTreeNode(new JiveCommunity(216, "Child 2.16"));
    DefaultMutableTreeNode child217 = new DefaultMutableTreeNode(new JiveCommunity(217, "Child 2.17"));
    DefaultMutableTreeNode child218 = new DefaultMutableTreeNode(new JiveCommunity(218, "Child 2.18"));
    DefaultMutableTreeNode child219 = new DefaultMutableTreeNode(new JiveCommunity(219, "Child 2.19"));
    DefaultMutableTreeNode child220 = new DefaultMutableTreeNode(new JiveCommunity(220, "Child 2.20"));
    DefaultMutableTreeNode child221 = new DefaultMutableTreeNode(new JiveCommunity(221, "Child 2.21"));
    DefaultMutableTreeNode child222 = new DefaultMutableTreeNode(new JiveCommunity(222, "Child 2.22"));
    DefaultMutableTreeNode child223 = new DefaultMutableTreeNode(new JiveCommunity(223, "Child 2.23"));
    DefaultMutableTreeNode child224 = new DefaultMutableTreeNode(new JiveCommunity(224, "Child 2.24"));
    DefaultMutableTreeNode child225 = new DefaultMutableTreeNode(new JiveCommunity(225, "Child 2.25"));
    DefaultMutableTreeNode child226 = new DefaultMutableTreeNode(new JiveCommunity(226, "Child 2.26"));
    DefaultMutableTreeNode child227 = new DefaultMutableTreeNode(new JiveCommunity(227, "Child 2.27"));
    DefaultMutableTreeNode child228 = new DefaultMutableTreeNode(new JiveCommunity(228, "Child 2.28"));
    DefaultMutableTreeNode child229 = new DefaultMutableTreeNode(new JiveCommunity(229, "Child 2.29"));
    DefaultMutableTreeNode child230 = new DefaultMutableTreeNode(new JiveCommunity(230, "Child 2.30"));
    DefaultMutableTreeNode child231 = new DefaultMutableTreeNode(new JiveCommunity(231, "Child 2.31"));
    DefaultMutableTreeNode child232 = new DefaultMutableTreeNode(new JiveCommunity(232, "Child 2.32"));
    DefaultMutableTreeNode child233 = new DefaultMutableTreeNode(new JiveCommunity(233, "Child 2.33"));
    DefaultMutableTreeNode child234 = new DefaultMutableTreeNode(new JiveCommunity(234, "Child 2.34"));
    DefaultMutableTreeNode child235 = new DefaultMutableTreeNode(new JiveCommunity(235, "Child 2.35"));
    DefaultMutableTreeNode child236 = new DefaultMutableTreeNode(new JiveCommunity(236, "Child 2.36"));
    DefaultMutableTreeNode child237 = new DefaultMutableTreeNode(new JiveCommunity(237, "Child 2.37"));
    DefaultMutableTreeNode child238 = new DefaultMutableTreeNode(new JiveCommunity(238, "Child 2.38"));
    DefaultMutableTreeNode child239 = new DefaultMutableTreeNode(new JiveCommunity(239, "Child 2.39"));
    DefaultMutableTreeNode child240 = new DefaultMutableTreeNode(new JiveCommunity(240, "Child 2.40"));
    DefaultMutableTreeNode child241 = new DefaultMutableTreeNode(new JiveCommunity(241, "Child 2.41"));
    DefaultMutableTreeNode child242 = new DefaultMutableTreeNode(new JiveCommunity(242, "Child 2.42"));
    DefaultMutableTreeNode child243 = new DefaultMutableTreeNode(new JiveCommunity(243, "Child 2.43"));
    DefaultMutableTreeNode child244 = new DefaultMutableTreeNode(new JiveCommunity(244, "Child 2.44"));
    DefaultMutableTreeNode child245 = new DefaultMutableTreeNode(new JiveCommunity(245, "Child 2.45"));
    DefaultMutableTreeNode child246 = new DefaultMutableTreeNode(new JiveCommunity(246, "Child 2.46"));
    DefaultMutableTreeNode child247 = new DefaultMutableTreeNode(new JiveCommunity(247, "Child 2.47"));
    DefaultMutableTreeNode child248 = new DefaultMutableTreeNode(new JiveCommunity(248, "Child 2.48"));
    DefaultMutableTreeNode child249 = new DefaultMutableTreeNode(new JiveCommunity(249, "Child 2.49"));
    DefaultMutableTreeNode child250 = new DefaultMutableTreeNode(new JiveCommunity(250, "Child 2.50"));
    DefaultMutableTreeNode child3 = new DefaultMutableTreeNode(new JiveCommunity(3, "Child 3"));
    DefaultMutableTreeNode child4 = new DefaultMutableTreeNode(
            new JiveCommunity(4, "Child 4 which has some punctuation characters: '\";/?\\[]{}"));
    DefaultMutableTreeNode child5 = new DefaultMutableTreeNode(new JiveCommunity(5,
            "Child 5 which has an extremely long name that is intended to test out how it'll appear in the Share UI"));
    DefaultMutableTreeNode child6 = new DefaultMutableTreeNode(new JiveCommunity(6,
            "Child 6 which has some Unicode characters: ?"));

    // Now link all of the nodes together to create the tree structure
    root.add(child1);
    root.add(child2);
    root.add(child3);
    root.add(child4);
    root.add(child5);
    root.add(child6);

    child1.add(child11);
    child1.add(child12);
    child1.add(child13);

    child11.add(child111);
    child11.add(child112);
    child11.add(child113);

    child113.add(child1131);
    child1131.add(child11311);
    child11311.add(child113111);
    child113111.add(child1131111);
    child1131111.add(child11311111);

    child12.add(child121);
    child12.add(child122);

    child2.add(child21);
    child2.add(child22);
    child2.add(child23);
    child2.add(child24);
    child2.add(child25);
    child2.add(child26);
    child2.add(child27);
    child2.add(child28);
    child2.add(child29);
    child2.add(child210);
    child2.add(child211);
    child2.add(child212);
    child2.add(child213);
    child2.add(child214);
    child2.add(child215);
    child2.add(child216);
    child2.add(child217);
    child2.add(child218);
    child2.add(child219);
    child2.add(child220);
    child2.add(child221);
    child2.add(child222);
    child2.add(child223);
    child2.add(child224);
    child2.add(child225);
    child2.add(child226);
    child2.add(child227);
    child2.add(child228);
    child2.add(child229);
    child2.add(child230);
    child2.add(child231);
    child2.add(child232);
    child2.add(child233);
    child2.add(child234);
    child2.add(child235);
    child2.add(child236);
    child2.add(child237);
    child2.add(child238);
    child2.add(child239);
    child2.add(child240);
    child2.add(child241);
    child2.add(child242);
    child2.add(child243);
    child2.add(child244);
    child2.add(child245);
    child2.add(child246);
    child2.add(child247);
    child2.add(child248);
    child2.add(child249);
    child2.add(child250);

    result = new DefaultTreeModel(root);
    return (result);
}