Changeset 848 for vanHelsing/trunk/gui
- Timestamp:
- Mar 22, 2010, 5:12:11 PM (15 years ago)
- Location:
- vanHelsing/trunk/gui
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
vanHelsing/trunk/gui/WebContent/WEB-INF/faces-config.xml
r832 r848 24 24 <managed-bean-scope>session</managed-bean-scope> 25 25 </managed-bean> 26 <managed-bean> 27 <description>backend bean of the client item</description> 28 <managed-bean-name>client</managed-bean-name> 29 <managed-bean-class>de.dass_it.vanhelsing.gui.items.ClientItem</managed-bean-class> 30 <managed-bean-scope>request</managed-bean-scope> 31 </managed-bean> 26 32 27 33 </faces-config> -
vanHelsing/trunk/gui/WebContent/client.jspx
r832 r848 24 24 <ice:form> 25 25 <ice:outputLabel for="client.name" value="Name: " /> 26 <ice:inputText id="client.name" value="#{ baum.selectedNode.clientItem.name}" />26 <ice:inputText id="client.name" value="#{configurationBean.selectedNode.userObject.name}" /> 27 27 <ice:outputLabel for="client.address" value="Address: " /> 28 <ice:inputText id="client.address" value="#{ baum.selectedNode.clientItem.address}" />28 <ice:inputText id="client.address" value="#{configurationBean.selectedNode.userObject.address}" /> 29 29 <ice:outputLabel for="client.fdPort" value="FDPort: " /> 30 <ice:inputText id="client.fdPort" value="#{ baum.selectedNode.clientItem.fdPort}" />30 <ice:inputText id="client.fdPort" value="#{configurationBean.selectedNode.userObject.FDPort}" /> 31 31 <ice:outputLabel for="client.catalog" value="Catalog: " /> 32 <ice:inputText id="client.catalog" value="#{ baum.selectedNode.clientItem.catalog}" />32 <ice:inputText id="client.catalog" value="#{configurationBean.selectedNode.userObject.catalog}" /> 33 33 <ice:outputLabel for="client.password" value="Password: " /> 34 <ice:inputText id="client.password" value="#{ baum.selectedNode.clientItem.password}" />34 <ice:inputText id="client.password" value="#{configurationBean.selectedNode.userObject.password}" /> 35 35 <ice:outputLabel for="client.fileRetention" value="FileRetention: " /> 36 <ice:inputText id="client.fileRetention" value="#{ baum.selectedNode.clientItem.fileRetention}" />36 <ice:inputText id="client.fileRetention" value="#{configurationBean.selectedNode.userObject.fileRetention}" /> 37 37 <ice:outputLabel for="client.jobRetention" value="JobRetention: " /> 38 <ice:inputText id="client.jobRetention" value="#{ baum.selectedNode.clientItem.jobRetention}" />38 <ice:inputText id="client.jobRetention" value="#{configurationBean.selectedNode.userObject.jobRetention}" /> 39 39 <ice:outputLabel for="client.autoPrune" value="AutoPrune: " /> 40 <ice:inputText id="client.autoPrune" value="#{ baum.selectedNode.clientItem.autoPrune}" />40 <ice:inputText id="client.autoPrune" value="#{configurationBean.selectedNode.userObject.autoPrune}" /> 41 41 <ice:outputLabel for="client.maximumConcurrentJobs" value="MaximumConcurrentJobs: " /> 42 <ice:inputText id="client.maximumConcurrentJobs" value="#{ baum.selectedNode.clientItem.maximumConcurrentJobs}" />42 <ice:inputText id="client.maximumConcurrentJobs" value="#{configurationBean.selectedNode.userObject.maximumConcurrentJobs}" /> 43 43 <ice:outputLabel for="client.priority" value="Priority: " /> 44 <ice:inputText id="client.priority" value="#{ baum.selectedNode,clientItem.priority}" />44 <ice:inputText id="client.priority" value="#{configurationBean.selectedNode.userObject.priority}" /> 45 45 </ice:form> 46 46 </ice:panelGrid> -
vanHelsing/trunk/gui/WebContent/viewConfig.jspx
r844 r848 19 19 <body> 20 20 21 <ice:panelGroup style="float:left; width: 30%">21 <ice:panelGroup style="float:left; width:20%; background-color=blue"> 22 22 <ice:form> 23 23 <ice:tree id="baum" … … 28 28 29 29 <ice:treeNode id="knoten"> 30 <!--<f:facet name="icon">31 </f:facet> -->30 <f:facet name="icon"> 31 </f:facet> 32 32 <f:facet name="content"> 33 < !--<ice:commandLink actionListener="#{configurationBean.userObjectItemNodeSelected}">34 <f:param name=" configItemId" value="#{configurationBean.userObject.configItem.id}"/> -->33 <ice:commandLink actionListener="#{configurationBean.userObjectItemNodeSelected}"> 34 <f:param name="userObject.resId" value="#{item.userObject.userObject.resId}"/> 35 35 <ice:outputText id="knoten" value="#{item.userObject.userObject.value}"/> 36 < !--</ice:commandLink>-->36 </ice:commandLink> 37 37 </f:facet> 38 38 </ice:treeNode> … … 40 40 </ice:form> 41 41 </ice:panelGroup> 42 <!-- <ice:panelGroup> 43 <f:subview id="selectedNodeType"> 44 <jsp:include page="#{configurationBean.userObject.getTypePage}" /> 45 </f:subview> 46 </ice:panelGroup> --> 42 47 43 48 44 -
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.