Package org.dotuseful.ui.tree

Examples of org.dotuseful.ui.tree.AutomatedTreeNode


         * @param e
         *            Description of the Parameter
         */
        public void treeCollapsed(TreeExpansionEvent e) {
            TreePath path = e.getPath();
            AutomatedTreeNode node = (AutomatedTreeNode) path
                    .getLastPathComponent();

            if (node.getUserObject() instanceof BuddyGroup) {
                Settings.getInstance().setProperty(
                        "groupExpandStatus_"
                                + ((BuddyGroup) node.getUserObject())
                                        .getGroupName(), "collapsed");
            }
        }
View Full Code Here


         * @param e
         *            Description of the Parameter
         */
        public void treeExpanded(TreeExpansionEvent e) {
            TreePath path = e.getPath();
            AutomatedTreeNode node = (AutomatedTreeNode) path
                    .getLastPathComponent();

            if (node.getUserObject() instanceof BuddyGroup) {
                Settings.getInstance().remove(
                        "groupExpandStatus_"
                                + ((BuddyGroup) node.getUserObject())
                                        .getGroupName());
            }
        }
View Full Code Here

                        throw new ClassCastException();
                    }

                    tree.setSelectionPath(path);

                    AutomatedTreeNode node = (AutomatedTreeNode) path
                            .getLastPathComponent();
                    Object selectedUserObject = node.getUserObject();
                    if (selectedUserObject.getClass().equals(BuddyStatus.class)) {
                        buddy = (BuddyStatus) node.getUserObject();
                        buddyPopupMenu.showMenu(e.getComponent(), e.getX(), e
                                .getY(), buddy);
                    } else if (selectedUserObject.getClass().equals(
                            BuddyGroup.class)) {
                        // buddies that are not in any group are put in
                        // "Contacts" group by JBother
                        // if we need to send a message to them, we need to
                        // extract them from the tree
                        // because there is no way to do it from the roster
                        Enumeration iChildren = node.children();
                        String usersList = new String();
                        while (iChildren.hasMoreElements())
                        {
                            AutomatedTreeNode o = (AutomatedTreeNode) iChildren
                                    .nextElement();
                            BuddyStatus buddyStatus = (BuddyStatus) o
                                    .getUserObject();
                            usersList += buddyStatus.getUser() + MessagePanel.RECIPIENTS_DELIMITER + " ";
                        }
                        // get rid of 'unneeded delimiter + space' string at the end
                        usersList = usersList.substring(0, usersList.length() -
View Full Code Here

     *            the group to check
     * @return Description of the Return Value
     */
    public AutomatedTreeNode checkGroup(BuddyGroup group) {
        boolean check = false;
        AutomatedTreeNode node = new AutomatedTreeNode(group);

        Enumeration children = root.children();

        // find out if the group alread exists
        whileLoop: while (children.hasMoreElements()) {
            AutomatedTreeNode theNode = (AutomatedTreeNode) children
                    .nextElement();
            BuddyGroup g = (BuddyGroup) theNode.getUserObject();
            if (g.getGroupName().equals(group.getGroupName())) {
                node = theNode;
                check = true;
                break whileLoop;
            }
        }

        if (root.isNodeChild(node)) {
            return node;
        }

        final String tempGroup = group.getGroupName();
        final AutomatedTreeNode tempNode = node;

        if (!check) {
            int num = getGroupIndex(tempGroup);
            if (num >= 0) {
                root.insert(tempNode, num);
View Full Code Here

            return;

        gObj.addBuddy(buddy);

        if (add) {
            final AutomatedTreeNode node = checkGroup(gObj);
            node.setUserObject(gObj);

            // find the group that the buddy belongs to
            int index = getBuddyIndex(gObj.getGroupName(), buddy);

            if (!isInTree(buddy)) {
                node.insert(new AutomatedTreeNode(buddy), index);
            }

            TreePath parent = new TreePath(root);
            tree.expandPath(parent);
View Full Code Here

        // loop through all the groups until we find the group that this
        // buddy belongs to
        Enumeration children = root.children();
        while (children.hasMoreElements()) {
            AutomatedTreeNode node = (AutomatedTreeNode) children.nextElement();

            // once we find it's group, loop through all the buddies in that
            // group
            if (((BuddyGroup) node.getUserObject()).getGroupName()
                    .equals(group)) {
                Enumeration leafs = node.children();
                while (leafs.hasMoreElements()) {
                    AutomatedTreeNode leaf = (AutomatedTreeNode) leafs
                            .nextElement();
                    if (leaf.getUserObject() == buddy) {
                        return true;
                    }
                }
            }
        }
View Full Code Here

            final boolean removeFromGroup) {
        // loop through all the groups until we find the group that this
        // buddy belongs to
        Enumeration children = root.children();
        while (children.hasMoreElements()) {
            AutomatedTreeNode node = (AutomatedTreeNode) children.nextElement();

            // once we find it's group, loop through all the buddies in that
            // group
            if (((BuddyGroup) node.getUserObject()).getGroupName()
                    .equals(group)) {
                Enumeration leafs = node.children();
                while (leafs.hasMoreElements()) {
                    AutomatedTreeNode leaf = (AutomatedTreeNode) leafs
                            .nextElement();
                    Object check = leaf.getUserObject();
                    if (check instanceof BuddyStatus) {
                        BuddyStatus temp = (BuddyStatus) check;

                        if (temp.getUser().equals(buddy.getUser())) {
                            // once we find the buddy, remove it
View Full Code Here

            if (tree.getSelectionPath() == null) {
                return;
            }

            TreePath path = tree.getSelectionPath();
            AutomatedTreeNode node = (AutomatedTreeNode) path
                    .getLastPathComponent();
            if (model.isLeaf(node)) {
                try {
                    buddy = (BuddyStatus) node.getUserObject();
                } catch (ClassCastException ex) {
                    return;
                }
            }
        }
View Full Code Here

     * @see <code>javax.swing.DefaultTreeCellRenderer</code>
     */
    public Component getTreeCellRendererComponent(JTree tree,
            Object value, boolean isSelected, boolean expanded, boolean leaf,
            int row, boolean hasFocus) {
        AutomatedTreeNode node = (AutomatedTreeNode) value;
        String stringVal = node.getUserObject().toString();

        UIDefaults ui = UIManager.getDefaults();

        if (node.getUserObject() instanceof BuddyStatus) {
            // sets up the buddy information
            BuddyStatus buddy = (BuddyStatus) node.getUserObject();

            value = buddy.getUser();
            if (buddy.getName() != null) {
                value = buddy.getName();
            }
View Full Code Here

TOP

Related Classes of org.dotuseful.ui.tree.AutomatedTreeNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.