Ignore:
Timestamp:
Apr 20, 2010, 5:21:42 PM (14 years ago)
Author:
tobias
Message:

comments added
all methods of the wsdl file implemented

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/DataTree.java

    r864 r865  
    77import de.dass_it.vanhelsing.gui.items.UserObjectItem;
    88import de.dass_it.vanhelsing.gui.items.UserObjectItemType;
    9 
     9/**
     10 * DataTree contains the data tree of a navigation view and the method used by the view regarding the data tree
     11 * @author tgoecke
     12 */
    1013public class DataTree {
    1114        private DefaultTreeModel tree;
     
    1316       
    1417        public DataTree() {}
    15        
     18        /**
     19         * creates a new data tree and sets the name value of the root node to the value of argument name
     20         * @param name  label of the root node
     21         */
    1622        public void setTree(String name){
    1723                setRoot(new DefaultMutableTreeNode());
     
    2430                obj.setResName(name);
    2531        }
     32        /**
     33         * creates a tree node as a child to the parent node containing the given UserObectItem
     34         * @param parent        root node of the created tree node
     35         * @param userObject    a user object which implements the UserObjectItem interface, usually a resource type object
     36         * @return returns the created node object
     37         */
    2638        public DefaultMutableTreeNode createNode(DefaultMutableTreeNode parent, UserObjectItem userObject){
    2739                DefaultMutableTreeNode node = new DefaultMutableTreeNode();
     
    3345                return node;
    3446        }
     47        /**
     48         * replace a tree nodes UserObject
     49         * @param node  node object whose userObject will be updated
     50         * @param userObject    new UserObject to replace the nodes current UserObject
     51         */
    3552        public void updateNode(DefaultMutableTreeNode node, UserObjectItem userObject){
    36                 node.setUserObject(userObject);
     53                ((UserObjectItemType)node.getUserObject()).setUserObject(userObject);
    3754        }
     55        /**
     56         * retrieves a node by the value of the UserObjects resId
     57         * @param id    value to be matched by the returned object     
     58         * @return      first node whose UserObject attribute resId matches the argument id
     59         */
    3860        public DefaultMutableTreeNode getNodeById(int id){
    3961                DefaultMutableTreeNode node;
     
    5072                return null;
    5173        }
     74        /**
     75         * retrieves a node by the value of the UserObjects resName
     76         * @param name  string value to be matched by the returned object
     77         * @return      first node whose UserObject attribute matches the argument name
     78         */
    5279        public DefaultMutableTreeNode getNodeByName(String name){
    5380                DefaultMutableTreeNode node;
     
    6390                return null;
    6491        }
     92        /**
     93         * deletes the given node from the data tree
     94         * @param node  the node which is deleted by this operation
     95         * @return      node    the deleted node
     96         * @throws ConstraintViolationException         if the node has child nodes
     97         */
    6598        public DefaultMutableTreeNode deleteNode(DefaultMutableTreeNode node) throws ConstraintViolationException{
    6699                if (node.getChildCount()>0) throw new ConstraintViolationException();
     
    69102                return node;
    70103        }
     104       
    71105        public DefaultMutableTreeNode getRoot(){
    72106                return root;
Note: See TracChangeset for help on using the changeset viewer.