Changeset 848 for vanHelsing/trunk/gui/src/de
- Timestamp:
- Mar 22, 2010, 5:12:11 PM (15 years ago)
- Location:
- vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/BeanUtil.java
r832 r848 1 1 package de.dass_it.vanhelsing.gui; 2 3 import javax.faces.context.FacesContext; 2 4 3 5 … … 20 22 //ListItemsTopologyView 21 23 //ListItemsJobSchedule 24 25 //GetParameterFromContext 26 public static String getRequestParameter(String name){ 27 return (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(name); 28 } 22 29 } -
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/ConfigurationBean.java
r847 r848 1 1 package de.dass_it.vanhelsing.gui; 2 2 3 import java.lang.reflect.Method; 4 import java.util.ArrayList; 3 5 4 import java.lang.reflect.Method; 5 6 import javax.faces.event.ActionEvent; 6 7 import javax.swing.tree.DefaultMutableTreeNode; 7 8 import javax.swing.tree.DefaultTreeModel; … … 10 11 import de.dass_it.www.vanhelsing.VanHelsingCallbackHandler.*; 11 12 import de.dass_it.www.vanhelsing.VanHelsingStub.*; 13 12 14 /* 13 15 * List all Bacula configuration components by name … … 16 18 17 19 private DefaultTreeModel tree; 20 private ArrayList<ViewItem> selectedObject; 18 21 19 22 public ConfigurationBean(){ … … 27 30 ResourceInfo[] ri; 28 31 SimpleResource sr; 32 ((ClientItem)selectedObject).setName("ClientNameTest"); 29 33 30 34 Client c = new Client(); … … 61 65 sr = c.getSimpleResource(grt); 62 66 sr.getResourceAttributeType(); 63 for (ResourceAttributeType ra : sr.getResourceAttributeType()){ 64 myNode = addNode(leaf, type, ra); 65 if (myNode != null){ 66 leaf.add(myNode); 67 } 67 myNode = addNode(leaf, type, sr.getResourceAttributeType()); 68 if (myNode != null){ 69 leaf.add(myNode); 68 70 } 71 69 72 } 70 73 } 71 74 72 75 76 } 77 public void userObjectItemNodeSelected(ActionEvent ae){ 78 DefaultMutableTreeNode node; 79 UserObjectItem userObject; 80 String Id = BeanUtil.getRequestParameter("userObject.resId"); 81 node = getNode(Id, tree); 82 String type = ((UserObjectItem)((UserObjectItemType)node.getUserObject()).getUserObject()).getResType(); 83 73 84 } 74 85 … … 79 90 return tree; 80 91 } 92 public UserObjectItem getSelectedObject() { 93 return selectedObject; 94 } 95 public void setSelectedObject(UserObjectItem selectedObject) { 96 this.selectedObject = selectedObject; 97 } 81 98 82 99 -
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/TreeNavigation.java
r847 r848 3 3 //import org.apache.log4j.Logger; 4 4 import java.lang.reflect.Method; 5 import java.util.Enumeration; 5 6 6 7 import javax.swing.tree.DefaultTreeModel; … … 138 139 return null; 139 140 } 140 public DefaultMutableTreeNode addNode(DefaultMutableTreeNode parent, String type, ResourceAttributeType ra){141 public DefaultMutableTreeNode addNode(DefaultMutableTreeNode parent, String type, ResourceAttributeType[] ra){ 141 142 DefaultMutableTreeNode node = new DefaultMutableTreeNode(); 142 143 Class subClass; … … 163 164 } 164 165 }*/ 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 166 for(ResourceAttributeType rat : ra){ 167 for (Method n : rat.getClass().getDeclaredMethods()){ 168 if (n.getName().equals("getKey")) { 169 key = (String)(n.invoke(rat, (Object[])null)); 170 } 171 if (n.getName().equals("getValue")){ 172 value = (String)(n.invoke(rat, (Object[])null)); 173 174 } 175 176 } 177 if(!(key.isEmpty() && value.isEmpty())){ 178 key = key.replaceAll(" ", ""); 179 key = key.replaceFirst(new Character(key.charAt(0)).toString(), 180 new Character(Character.toUpperCase(key.charAt(0))).toString()); 181 m = myClass.getMethod(("set"+key), args); 182 m.invoke(item, value); 183 if(m.getName().equals("getName") || m.getName().equals("setName")){ 184 ((ItemType)o).setValue(key + ": " + value); 185 } 186 187 } 188 } 185 189 186 190 … … 206 210 207 211 return null; 208 } 212 } 213 public DefaultMutableTreeNode getNode(String id, DefaultTreeModel tree){ 214 DefaultMutableTreeNode root; 215 DefaultMutableTreeNode node; 216 int resId = new Integer(id); 217 root = (DefaultMutableTreeNode)tree.getRoot(); 218 Enumeration<DefaultMutableTreeNode> e = root.depthFirstEnumeration(); 219 220 while (e.hasMoreElements()){ 221 node = e.nextElement(); 222 if (resId ==((ItemType)(((UserObjectItemType)node.getUserObject()).getUserObject())).getResId()) { 223 return node; 224 } 225 } 226 return null; 227 } 228 public UserObjectItem getNodeObject(String id, DefaultTreeModel tree){ 229 DefaultMutableTreeNode node = getNode(id, tree); 230 return (UserObjectItem)((UserObjectItem)(node.getUserObject())); 231 } 209 232 } -
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/items/DirectorItem.java
r847 r848 1 1 package de.dass_it.vanhelsing.gui.items; 2 3 import de.dass_it.vanhelsing.gui.items.*;4 2 5 3 public class DirectorItem extends ItemType implements UserObjectItem{ -
vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/items/ItemType.java
r844 r848 1 1 package de.dass_it.vanhelsing.gui.items; 2 2 3 public abstract class ItemType 3 public abstract class ItemType implements UserObjectItem{ 4 4 private String ResType; 5 5 private int ResId; … … 9 9 10 10 public String getTypePage(){ 11 return ("/WEB-INF/" + ResType + ".jspx"); 11 /*"/WEB-INF/" +*/ 12 return (ResType + ".jspx"); 12 13 } 13 14
Note:
See TracChangeset
for help on using the changeset viewer.