Changeset 854 for vanHelsing/trunk/gui/src/de/dass_it/vanhelsing
- Timestamp:
- Mar 26, 2010, 6:01:33 PM (15 years ago)
- Location:
- vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/Client.java
r847 r854 46 46 return new SimpleResource(new ResourceInfo(), new ResourceAttributeType[0]); 47 47 } 48 48 49 public SetSimpleResourceResponse setSimpleResource(SetSimpleResource ssr){ 50 VanHelsingStub stub; 51 try { 52 stub = getStub(); 53 54 VanHelsingStub.SetSimpleResource req = new VanHelsingStub.SetSimpleResource(); 55 req.setResAttribute(ssr.getResAttribute()); 56 req.setResInfo(ssr.getResInfo()); 57 58 VanHelsingStub.SetSimpleResourceResponse res = stub.setSimpleResource(ssr); 59 60 return res; 61 } catch (Exception e) { 62 System.err.println(e.toString()); 63 } 64 return null; 65 } 66 49 67 private VanHelsingStub getStub() throws Exception { 50 68 String url = new String("http://localhost:8080/"); -
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/ConfigurationBean.java
r849 r854 20 20 private ArrayList<ViewItem> selectedObject; 21 21 22 public ConfigurationBean(){ 22 public ConfigurationBean() { 23 init(); 24 } 25 private void init(){ 23 26 DefaultMutableTreeNode root = new DefaultMutableTreeNode(); 24 27 DefaultMutableTreeNode header; … … 30 33 ResourceInfo[] ri; 31 34 SimpleResource sr; 32 // ((ClientItem)selectedObject).setName("ClientNameTest");33 35 // ((ClientItem)selectedObject).setName("ClientNameTest"); 36 34 37 Client c = new Client(); 35 String[] nodes = {"Director", "Storage", "Catalog", "Autochanger", "Client", "FileSet", "FDClient", "Schedule", "SDStorage", "Console", "Catalog", "SDDevice", "Job", "JobDefs", "Messages", "Pool"}; 36 //String[] nodes = {"Client"}; 38 String[] nodes = { "Director", "Storage", "Catalog", "Autochanger", 39 "Client", "FileSet", "FDClient", "Schedule", "SDStorage", 40 "Console", "Catalog", "SDDevice", "Job", "JobDefs", "Messages", 41 "Pool" }; 42 // String[] nodes = {"Client"}; 37 43 setTree(super.createTree(root, nodes, "Configuration")); 38 44 39 //forall header wird eine ResourceList[] angefragt 40 for(int i = 0; i < tree.getChildCount(root); i++){ 41 header = (DefaultMutableTreeNode)tree.getChild(root, i); 42 type = ((UserObjectItemType)header.getUserObject()).getUserObject().getResType(); 45 // forall header wird eine ResourceList[] angefragt 46 for (int i = 0; i < tree.getChildCount(root); i++) { 47 header = (DefaultMutableTreeNode) tree.getChild(root, i); 48 type = ((UserObjectItemType) header.getUserObject()) 49 .getUserObject().getResType(); 43 50 lrt = new ListResourcesType(); 44 51 lrt.setDirector("bacula-dir"); 45 52 lrt.setResourceType(type); 46 53 ri = c.getListResources(lrt); 47 if (ri == null || ri.length == 0) continue; 48 for (int j = 0; j < ri.length; j++){ 49 //myNode = null; 54 if (ri == null || ri.length == 0) 55 continue; 56 for (int j = 0; j < ri.length; j++) { 57 // myNode = null; 50 58 myNode = addNode(header, type, ri[j]); 51 // Node mit Daten befüllen59 // Node mit Daten befüllen 52 60 grt = new GetResourceType(); 53 61 grt.setDirector(lrt.getDirector()); … … 55 63 sr = c.getSimpleResource(grt); 56 64 myNode = addNode(myNode, type, sr.getResourceAttributeType()); 57 if (myNode != null) {65 if (myNode != null) { 58 66 header.add(myNode); 59 67 } 60 68 } 61 69 } 62 /*for (int i = 0; i < tree.getChildCount(root); i++){ 63 header = (DefaultMutableTreeNode)tree.getChild(root, i); 64 65 for (int j = 0; j < tree.getChildCount(header); j++){ 66 leaf = (DefaultMutableTreeNode)tree.getChild(header, j); 67 type = ((UserObjectItemType)leaf.getUserObject()).getUserObject().getResType(); 68 grt = new GetResourceType(); 69 grt.setDirector("bacula-dir"); 70 grt.setResId(((ItemType)(((UserObjectItemType)leaf.getUserObject()).getUserObject())).getResId()); 71 sr = c.getSimpleResource(grt); 72 sr.getResourceAttributeType(); 73 myNode = addNode(leaf, type, sr.getResourceAttributeType()); 74 if (myNode != null){ 75 leaf.add(myNode); 76 } 77 78 } 79 }*/ 80 70 /* 71 * for (int i = 0; i < tree.getChildCount(root); i++){ header = 72 * (DefaultMutableTreeNode)tree.getChild(root, i); 73 * 74 * for (int j = 0; j < tree.getChildCount(header); j++){ leaf = 75 * (DefaultMutableTreeNode)tree.getChild(header, j); type = 76 * ((UserObjectItemType 77 * )leaf.getUserObject()).getUserObject().getResType(); grt = new 78 * GetResourceType(); grt.setDirector("bacula-dir"); 79 * grt.setResId(((ItemType 80 * )(((UserObjectItemType)leaf.getUserObject()).getUserObject 81 * ())).getResId()); sr = c.getSimpleResource(grt); 82 * sr.getResourceAttributeType(); myNode = addNode(leaf, type, 83 * sr.getResourceAttributeType()); if (myNode != null){ 84 * leaf.add(myNode); } 85 * 86 * } } 87 */ 81 88 82 89 } 83 public void userObjectItemNodeSelected(ActionEvent ae){ 90 91 92 public void userObjectItemNodeSelected(ActionEvent ae) { 84 93 DefaultMutableTreeNode node; 85 94 UserObjectItem userObject; … … 87 96 String Id = BeanUtil.getRequestParameter("userObject.resId"); 88 97 node = getNode(Id, tree); 89 String type = ((UserObjectItem)((UserObjectItemType)node.getUserObject()).getUserObject()).getResType(); 90 String classType = "de.dass_it.vanhelsing.gui.items." + type + "Item"; 91 //Daten aus dem UserObjectItem extrahieren 98 String type = ((UserObjectItem) ((UserObjectItemType) node 99 .getUserObject()).getUserObject()).getResType(); 100 String resName = ((ItemType)((UserObjectItem) ((UserObjectItemType) node 101 .getUserObject()).getUserObject())).getResName(); 102 String director = ((ItemType)((UserObjectItem) ((UserObjectItemType) node 103 .getUserObject()).getUserObject())).getDirector(); 104 String classType = "de.dass_it.vanhelsing.gui.items." + type + "Item"; 105 // Daten aus dem UserObjectItem extrahieren 92 106 try { 93 94 UserObjectItem item = ((UserObjectItemType)(node.getUserObject())).getUserObject();107 UserObjectItem item = ((UserObjectItemType) (node.getUserObject())) 108 .getUserObject(); 95 109 96 Class c = ((UserObjectItemType)(node.getUserObject())).getUserObject().getClass(); 97 Method[] m = c.getDeclaredMethods(); 98 String keyValue; 99 String key; 100 ViewItem vi; 101 for (Method n : m) { 102 if(n.getName().startsWith("get")) { 103 keyValue = (String)n.invoke(item, (Object[])null); 104 if (keyValue == null) continue; 105 key = n.getName().substring(3); 106 vi = new ViewItem(); 107 vi.setKey(key); vi.setKeyValue(keyValue); vi.setResType(type); 108 selectedObject.add(vi); 110 Class c = ((UserObjectItemType) (node.getUserObject())) 111 .getUserObject().getClass(); 112 Method[] m = c.getDeclaredMethods(); 113 String keyValue; 114 String key; 115 ViewItem vi; 116 for (Method n : m) { 117 if (n.getName().startsWith("get")) { 118 keyValue = (String) n.invoke(item, (Object[]) null); 119 if (keyValue == null) 120 continue; 121 key = n.getName().substring(3); 122 vi = new ViewItem(); 123 vi.setResId(new Integer(Id)); 124 vi.setKey(key); 125 vi.setKeyValue(keyValue); 126 vi.setResType(type); 127 vi.setResName(resName); 128 vi.setDirector(director); 129 selectedObject.add(vi); 130 } 131 selectedObject.trimToSize(); 109 132 } 110 } 111 } catch(Exception e) { 133 } catch (Exception e) { 112 134 e.printStackTrace(); 113 135 } 114 136 } 137 public void newResourceButtonListener(ActionEvent ae){ 138 } 115 139 140 public void saveButtonListener(ActionEvent ae) { 141 Client c = new Client(); 142 ResourceInfo ri = new ResourceInfo(); 143 SetSimpleResourceResponse s2r2; 144 ri.setDirector( selectedObject.get(0).getDirector() ); 145 ri.setResId( selectedObject.get(0).getResId() ); 146 ri.setResName( selectedObject.get(0).getResName() ); 147 ri.setResType( selectedObject.get(0).getResType() ); 148 // ResourceAttribute 149 String key, value; 150 ResourceAttributeType[] ra = new ResourceAttributeType[selectedObject.size()]; 151 for (int i = 0; i < selectedObject.size(); i++) { 152 key = selectedObject.get(i).getKey(); 153 value = selectedObject.get(i).getKeyValue(); 154 ra[i] = new ResourceAttributeType(); 155 ra[i].setKey(key); 156 ra[i].setValue(value); 157 } 158 SetSimpleResource s2r = new SetSimpleResource(); 159 s2r.setResAttribute(ra); 160 s2r.setResInfo(ri); 161 s2r2 = c.setSimpleResource(s2r); 162 /*String status = s2r2.getStatus(); 163 if (selectedObject.get(0) != null){ 164 selectedObject.get(0).setResId(s2r2.getResId()); 165 }*/ 166 // TODO: write ResId to selectedObject 167 // selectedObject.get(0).setResId(grt.getResId()); 168 // valueChangeEffect.setFired(false); 169 } 170 116 171 public void setTree(DefaultTreeModel tree) { 117 172 this.tree = tree; 118 173 } 174 119 175 public DefaultTreeModel getTree() { 120 176 return tree; 121 177 } 178 122 179 public ArrayList<ViewItem> getSelectedObject() { 123 180 return selectedObject; 124 181 } 182 125 183 public void setSelectedObject(ArrayList<ViewItem> selectedObject) { 126 184 this.selectedObject = selectedObject; 127 185 } 128 129 186 130 187 } -
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/TreeNavigation.java
r849 r854 26 26 tree = new DefaultTreeModel(root); 27 27 UserObjectItemType item = new UserObjectItemType(root); 28 item.setLeaf(false); 28 29 UserObjectItem uoi = new TreeItem("Configuration"); 29 30 uoi.setResType("Tree"); … … 49 50 Object o; 50 51 UserObjectItemType userObject = new UserObjectItemType(node); 52 userObject.setLeaf(false); 51 53 String type2 = "de.dass_it.vanhelsing.gui.items." + type + "Item"; 52 54 -
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/items/UserObjectItemType.java
r831 r854 6 6 public class UserObjectItemType extends IceUserObject { 7 7 private UserObjectItem userObject; 8 9 8 public UserObjectItemType(DefaultMutableTreeNode defaultMutableTreeNode){ 10 9 super(defaultMutableTreeNode); 10 setBranchContractedIcon("tree_folder_closed.gif"); 11 setBranchExpandedIcon("tree_folder_open.gif"); 12 setLeafIcon("tree_document.gif"); 13 setLeaf(true); 14 setExpanded(false); 15 11 16 } 12 17 public UserObjectItem getUserObject(){ … … 16 21 this.userObject = userObject; 17 22 } 23 18 24 }
Note:
See TracChangeset
for help on using the changeset viewer.