- Timestamp:
- Apr 20, 2010, 5:21:42 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/DataTree.java
r864 r865 7 7 import de.dass_it.vanhelsing.gui.items.UserObjectItem; 8 8 import 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 */ 10 13 public class DataTree { 11 14 private DefaultTreeModel tree; … … 13 16 14 17 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 */ 16 22 public void setTree(String name){ 17 23 setRoot(new DefaultMutableTreeNode()); … … 24 30 obj.setResName(name); 25 31 } 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 */ 26 38 public DefaultMutableTreeNode createNode(DefaultMutableTreeNode parent, UserObjectItem userObject){ 27 39 DefaultMutableTreeNode node = new DefaultMutableTreeNode(); … … 33 45 return node; 34 46 } 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 */ 35 52 public void updateNode(DefaultMutableTreeNode node, UserObjectItem userObject){ 36 node.setUserObject(userObject);53 ((UserObjectItemType)node.getUserObject()).setUserObject(userObject); 37 54 } 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 */ 38 60 public DefaultMutableTreeNode getNodeById(int id){ 39 61 DefaultMutableTreeNode node; … … 50 72 return null; 51 73 } 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 */ 52 79 public DefaultMutableTreeNode getNodeByName(String name){ 53 80 DefaultMutableTreeNode node; … … 63 90 return null; 64 91 } 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 */ 65 98 public DefaultMutableTreeNode deleteNode(DefaultMutableTreeNode node) throws ConstraintViolationException{ 66 99 if (node.getChildCount()>0) throw new ConstraintViolationException(); … … 69 102 return node; 70 103 } 104 71 105 public DefaultMutableTreeNode getRoot(){ 72 106 return root;
Note:
See TracChangeset
for help on using the changeset viewer.