Changeset 847 for vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui
- Timestamp:
- Mar 19, 2010, 5:51:31 PM (15 years ago)
- Location:
- vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/Client.java
r844 r847 42 42 43 43 } catch(Exception e){ 44 System.err.println("getS impleResource:" + e.toString());44 System.err.println("getSR:" + grt.getResId() + ":" + e.toString()); 45 45 } 46 46 return new SimpleResource(new ResourceInfo(), new ResourceAttributeType[0]); -
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/ConfigurationBean.java
r846 r847 20 20 DefaultMutableTreeNode root = new DefaultMutableTreeNode(); 21 21 DefaultMutableTreeNode header; 22 DefaultMutableTreeNode leaf; 22 23 String type; 23 24 ListResourcesType lrt; 25 GetResourceType grt; 24 26 DefaultMutableTreeNode myNode; 25 27 ResourceInfo[] ri; 28 SimpleResource sr; 29 26 30 Client c = new Client(); 27 String[] nodes = {"Director", "Storage", "Catalog", "Autochanger", "Client", "FileSet", "FDClient", "Schedule",28 "SDStorage", "Console", "Catalog", "SDDevice", "Job", "JobDefs", "Messages", "Pool"};31 //String[] nodes = {"Director", "Storage", "Catalog", "Autochanger", "Client", "FileSet", "FDClient", "Schedule", "SDStorage", "Console", "Catalog", "SDDevice", "Job", "JobDefs", "Messages", "Pool"}; 32 String[] nodes = {"Client"}; 29 33 setTree(super.createTree(root, nodes, "Configuration")); 30 34 … … 39 43 if (ri == null || ri.length == 0) continue; 40 44 for (int j = 0; j < ri.length; j++){ 41 myNode = null;45 //myNode = null; 42 46 myNode = addNode(header, type, ri[j]); 43 47 if (myNode != null){ … … 46 50 } 47 51 } 52 for (int i = 0; i < tree.getChildCount(root); i++){ 53 header = (DefaultMutableTreeNode)tree.getChild(root, i); 54 55 for (int j = 0; j < tree.getChildCount(header); j++){ 56 leaf = (DefaultMutableTreeNode)tree.getChild(header, j); 57 type = ((UserObjectItemType)leaf.getUserObject()).getUserObject().getResType(); 58 grt = new GetResourceType(); 59 grt.setDirector("bacula-dir"); 60 grt.setResId(((ItemType)(((UserObjectItemType)leaf.getUserObject()).getUserObject())).getResId()); 61 sr = c.getSimpleResource(grt); 62 sr.getResourceAttributeType(); 63 for (ResourceAttributeType ra : sr.getResourceAttributeType()){ 64 myNode = addNode(leaf, type, ra); 65 if (myNode != null){ 66 leaf.add(myNode); 67 } 68 } 69 } 70 } 71 72 48 73 } 49 74 -
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/TreeNavigation.java
r846 r847 75 75 System.err.println("Class " + type2 + " lacks a no-argument constructor"); 76 76 } catch (Exception e){ 77 System.err.println( e.toString());77 System.err.println("addHeader: " + e.toString()); 78 78 } 79 79 … … 133 133 System.err.println("Class " + type2 + " lacks a no-argument constructor"); 134 134 } catch (Exception e){ 135 System.err.println( e.toString());135 System.err.println("RI: " + e.toString()); 136 136 } 137 137 138 138 return null; 139 139 } 140 140 public DefaultMutableTreeNode addNode(DefaultMutableTreeNode parent, String type, ResourceAttributeType ra){ 141 DefaultMutableTreeNode node = new DefaultMutableTreeNode(); 142 Class subClass; 143 Class myClass; 144 Method[] raMethods; 145 Method[] methods; 146 Object o; 147 UserObjectItemType userObject = new UserObjectItemType(node); 148 String type2 = "de.dass_it.vanhelsing.gui.items." + type + "Item"; 149 String key = null, value = null; 150 try { 151 subClass = Class.forName(type2); 152 o = subClass.newInstance(); 153 UserObjectItem item = (UserObjectItem) o; 154 item.setResType(type); 155 myClass = item.getClass().asSubclass(subClass); 156 methods = myClass.getMethods(); 157 Method m; 158 Class[] args = new Class[1]; 159 args[0] = String.class; 160 /*for (Method m : methods){ 161 if(m.getName().contains("set" + p)){ 162 m.invoke(item, title); 163 } 164 }*/ 165 for (Method n : ra.getClass().getDeclaredMethods()){ 166 if (n.getName().equals("getKey")) { 167 key = (String)(n.invoke(ra, (Object[])null)); 168 } 169 if (n.getName().equals("getValue")){ 170 value = (String)(n.invoke(ra, (Object[])null)); 171 172 } 173 174 } 175 if(!(key.isEmpty() && value.isEmpty())){ 176 key = key.replaceAll(" ", ""); 177 key = key.replaceFirst(new Character(key.charAt(0)).toString(), 178 new Character(Character.toUpperCase(key.charAt(0))).toString()); 179 m = myClass.getMethod(("set"+key), args); 180 m.invoke(item, value); 181 ((ItemType)o).setValue(key + ": " + value); 182 183 } 184 185 186 187 188 189 //Value-Wert aus Key: Value zusammenbauen 190 191 //ItemObjekt erzeugen und an das UserObjekt referenzieren 192 userObject.setUserObjectItem((UserObjectItem)o); 193 //Eine Referenz auf das UserObjekt wird an das Nodeobjekt übergeben 194 node.setUserObject(userObject); 195 //System.out.println(((ItemType)((UserObjectItem)(node.getUserObject()))).getResId()); 196 return node; 197 } catch (ClassNotFoundException e1){ 198 System.err.println("Itemclass "+ type2 +" must be in the classpath"); 199 } catch (InstantiationException e2){ 200 System.err.println("Class "+type2+" must be a concrete class, not an interface or an abstract class"); 201 } catch (IllegalAccessException e3){ 202 System.err.println("Class " + type2 + " lacks a no-argument constructor"); 203 } catch (Exception e){ 204 System.err.println("Leaf: " + e.toString()); 205 } 206 207 return null; 208 } 141 209 } -
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/items/ClientItem.java
r844 r847 4 4 private String name; 5 5 private String address; 6 private String fdPort;6 private String FDPort; 7 7 private String catalog; 8 8 private String password; … … 31 31 } 32 32 33 public String getF dPort() {34 return fdPort;33 public String getFDPort() { 34 return FDPort; 35 35 } 36 36 37 public void setF dPort(String fdPort) {38 this. fdPort = fdPort;37 public void setFDPort(String fdPort) { 38 this.FDPort = fdPort; 39 39 } 40 40 -
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/items/DirectorItem.java
r832 r847 38 38 return name; 39 39 } 40 40 public String getDescription() { 41 41 return description; 42 42 } 43 43 44 44 public void setDescription(String description) { 45 45 this.description = description; 46 46 } 47 47 48 48 public String getPassword() { -
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/items/JobItem.java
r844 r847 3 3 private String name; 4 4 private String enabled; 5 private String description; 5 6 private String type; 6 7 private String level; … … 79 80 this.enabled = enabled; 80 81 } 82 public void setDescription(String description) { 83 this.description = description; 84 } 85 public String getDescription() { 86 return description; 87 } 81 88 public String getType() { 82 89 return type;
Note:
See TracChangeset
for help on using the changeset viewer.