Index: vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/ConfigurationBean.java
===================================================================
--- vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/ConfigurationBean.java	(revision 857)
+++ vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/ConfigurationBean.java	(revision 858)
@@ -6,4 +6,5 @@
 import javax.faces.event.ActionEvent;
 import javax.faces.event.ValueChangeEvent;
+import javax.faces.model.SelectItem;
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
@@ -20,4 +21,5 @@
 	private DefaultTreeModel tree;
 	private ArrayList<ViewItem> selectedObject;
+	private String selectedId;
 
 	public ConfigurationBean() {
@@ -37,5 +39,5 @@
 
 		Client c = new Client();
-		String[] nodes = { "Director", "Storage", "Catalog", "Autochanger",
+		String[] nodes = { "Director", "Storage", "Autochanger",
 				"Client", "FileSet", "FDClient", "Schedule", "SDStorage",
 				"Console", "Catalog", "SDDevice", "Job", "JobDefs", "Messages",
@@ -44,5 +46,6 @@
 		setTree(super.createTree(root, nodes, "Configuration"));
 
-		// forall header wird eine ResourceList[] angefragt
+		// \forall header wird eine ResourceList[] angefragt
+		
 		for (int i = 0; i < tree.getChildCount(root); i++) {
 			header = (DefaultMutableTreeNode) tree.getChild(root, i);
@@ -68,5 +71,5 @@
 				}
 			}
-		}
+		} 
 		/*
 		 * for (int i = 0; i < tree.getChildCount(root); i++){ header =
@@ -96,5 +99,9 @@
 		selectedObject = new ArrayList<ViewItem>();
 		String Id = BeanUtil.getRequestParameter("userObject.resId");
+		String selected = BeanUtil.getRequestParameter("ice.event.shift");
 		node = getNode(Id, tree);
+		if (selected.equals("true")){
+			((UserObjectItemType)node.getUserObject()).switchSelected();
+		}
 		String type = ((UserObjectItem) ((UserObjectItemType) node
 				.getUserObject()).getUserObject()).getResType();
@@ -104,4 +111,5 @@
 				.getUserObject()).getUserObject())).getDirector();
 		String classType = "de.dass_it.vanhelsing.gui.items." + type + "Item";
+		String accessType = BeanUtil.getAccessType(type.toLowerCase());
 		// Daten aus dem UserObjectItem extrahieren
 		try {
@@ -127,8 +135,24 @@
 					vi.setResName(resName);
 					vi.setDirector(director);
-					vi.setRendererFlag(BeanUtil.getRenderer(type, key));
-					System.err.println(vi.getRenderer());
-					System.err.println(vi.getInputText());
-					System.err.println(vi.getSelectOneMenu()+"\n\n");
+					vi.setRendererFlag(BeanUtil.getRenderer(accessType, key));
+					vi.setRequired(BeanUtil.getRequired(accessType, key));
+					if (vi.getSelectOneMenu() != null){
+						DefaultMutableTreeNode[] dmtn = getChildNodes(tree, vi.getKey());
+						if (dmtn != null) {
+							SelectItem[] si = new SelectItem[dmtn.length];
+							String objectType;
+							for (int i = 0; i < dmtn.length; i++){
+								UserObjectItem nodeObject = ((UserObjectItemType)dmtn[i].getUserObject()).getUserObject();
+								objectType = "de.dass_it.vanhelsing.gui.items." + vi.getKey() +"Item";
+								Class subClass = Class.forName(objectType);
+								Class myClass = nodeObject.getClass().asSubclass(subClass);
+								Method o = myClass.getMethod("getName", (Class[])null);
+								si[i] = new SelectItem((String)o.invoke(nodeObject, (Object[])null),
+										(String)o.invoke(nodeObject, (Object[])null));
+								
+							}
+							vi.setKeyValueList(si);
+						}
+					}
 					selectedObject.add(vi);
 				}
@@ -139,5 +163,70 @@
 		}
 	}
+	private DefaultMutableTreeNode[] getChildNodes(DefaultTreeModel tree2, String key) {
+		DefaultMutableTreeNode[] dmtn;
+		DefaultMutableTreeNode root = (DefaultMutableTreeNode)tree2.getRoot();
+		DefaultMutableTreeNode node;
+		for (int i = 0; i< root.getChildCount(); i++){
+			node = (DefaultMutableTreeNode)root.getChildAt(i);
+			if (((UserObjectItemType)(node.getUserObject())).getUserObject().getResType().equals(key)){
+				dmtn = new DefaultMutableTreeNode[node.getChildCount()];
+				for (int j = 0; j < node.getChildCount(); j++){
+					dmtn[j] = (DefaultMutableTreeNode)node.getChildAt(j);
+				}
+				return dmtn;
+			}
+		}
+		return null;
+	}
 	public void newResourceButtonListener(ActionEvent ae){
+		DefaultMutableTreeNode node;
+		UserObjectItem userObject;
+		selectedObject = new ArrayList<ViewItem>();
+		String Id = BeanUtil.getRequestParameter("userObject.ResId");
+		String shift = BeanUtil.getRequestParameter("ice.event.shift");
+		System.err.println(shift);
+		if (Id == null){
+			return;
+		}
+		node = getNode(Id, tree);
+		String type = ((UserObjectItem) ((UserObjectItemType) node
+				.getUserObject()).getUserObject()).getResType();
+		ViewItem vi;
+		String[] val;
+		try{
+			String type2 = "de.dass_it.vanhelsing.gui.items." +  type + "Item";
+			Class newClass = Class.forName(type2);
+			for (Method m : newClass.getDeclaredMethods()){
+				if (m.getName().startsWith("get")) {
+					vi = new ViewItem();
+					vi.setKey(m.getName().substring(3));
+					vi.setRendererFlag(BeanUtil.getRenderer(type, vi.getKey()));
+					if (vi.getSelectOneMenu() != null){
+						DefaultMutableTreeNode[] dmtn = getChildNodes(tree, vi.getKey());
+						if (dmtn != null) {
+							SelectItem[] si = new SelectItem[dmtn.length];
+							String objectType;
+							for (int i = 0; i < dmtn.length; i++){
+								UserObjectItem nodeObject = ((UserObjectItemType)dmtn[i].getUserObject()).getUserObject();
+								objectType = "de.dass_it.vanhelsing.gui.items." + vi.getKey() +"Item";
+								Class subClass = Class.forName(objectType);
+								Class myClass = nodeObject.getClass().asSubclass(subClass);
+								Method o = myClass.getMethod("getName", (Class[])null);
+								si[i] = new SelectItem((String)o.invoke(nodeObject, (Object[])null),
+										(String)o.invoke(nodeObject, (Object[])null));
+								//System.err.println("si[i]"+si[i].getLabel());
+								
+							}
+							vi.setKeyValueList(si);
+						}
+					}
+					if (vi.getInputText() != null){
+						vi.setValue(BeanUtil.getProperty("director."+type+"."+vi.getKey()+".def"));
+					}
+				}
+			}
+		} catch (Exception e){
+			e.printStackTrace();
+		}
 		
 	}
@@ -146,36 +235,47 @@
 	}
 	
+	public void reloadResourceButtonListener(ActionEvent ae){
+		init();
+	}
+	public void deleteResourceButtonListener(ActionEvent ae){
+		BeanUtil.setInfoMessage(null, "Diese Methode ist noch nicht implementiert.");
+	}
+	
 	public void saveButtonListener(ActionEvent ae) {
-		Client c = new Client();
-		ResourceInfo ri = new ResourceInfo();
-		SetSimpleResourceResponse s2r2;
-		ri.setDirector( selectedObject.get(0).getDirector() );
-		ri.setResId( selectedObject.get(0).getResId() );
-		ri.setResName( selectedObject.get(0).getResName() );
-		ri.setResType( selectedObject.get(0).getResType() );
-		// ResourceAttribute
-		String key, value;
-		ResourceAttributeType[] ra = new ResourceAttributeType[selectedObject.size()];
-		for (int i = 0; i < selectedObject.size(); i++) {
-			key = selectedObject.get(i).getKey();
-			value = selectedObject.get(i).getKeyValue();
-			ra[i] = new ResourceAttributeType();
-			ra[i].setKey(key);
-			ra[i].setValue(value);
-		}
-		SetSimpleResource s2r = new SetSimpleResource();
-		s2r.setResAttribute(ra);
-		s2r.setResInfo(ri);
-		s2r2 = c.setSimpleResource(s2r);
-		System.err.println("Status setSimpleRes: "+s2r2.getStatus());
-		BeanUtil.setErrorMessage(null, "Status setSimpleRessource: "+s2r2.getStatus());
-		
-		/*String status = s2r2.getStatus();
-		if (selectedObject.get(0) != null){
-			selectedObject.get(0).setResId(s2r2.getResId());
-		}*/
-		// TODO: write ResId to selectedObject
-		// selectedObject.get(0).setResId(grt.getResId());
-		// valueChangeEffect.setFired(false);
+		if (selectedObject == null){
+			BeanUtil.setInfoMessage(null, "bitte eine Resource zum Ändern auswählen");
+		} else {
+			Client c = new Client();
+			ResourceInfo ri = new ResourceInfo();
+			SetSimpleResourceResponse s2r2;
+			ri.setDirector( selectedObject.get(0).getDirector() );
+			ri.setResId( selectedObject.get(0).getResId() );
+			ri.setResName( selectedObject.get(0).getResName() );
+			ri.setResType( selectedObject.get(0).getResType() );
+			// ResourceAttribute
+			String key, value;
+			ResourceAttributeType[] ra = new ResourceAttributeType[selectedObject.size()];
+			for (int i = 0; i < selectedObject.size(); i++) {
+				key = selectedObject.get(i).getKey();
+				value = selectedObject.get(i).getKeyValue();
+				ra[i] = new ResourceAttributeType();
+				ra[i].setKey(key);
+				ra[i].setValue(value);
+			}
+			SetSimpleResource s2r = new SetSimpleResource();
+			s2r.setResAttribute(ra);
+			s2r.setResInfo(ri);
+			s2r2 = c.setSimpleResource(s2r);
+			System.err.println("Status setSimpleRes: "+s2r2.getStatus());
+			BeanUtil.setErrorMessage(null, "Status setSimpleRessource: "+s2r2.getStatus());
+			
+			/*String status = s2r2.getStatus();
+			if (selectedObject.get(0) != null){
+				selectedObject.get(0).setResId(s2r2.getResId());
+			}*/
+			// TODO: write ResId to selectedObject
+			// selectedObject.get(0).setResId(grt.getResId());
+			// valueChangeEffect.setFired(false);
+		}
 	}
 
@@ -195,4 +295,12 @@
 		this.selectedObject = selectedObject;
 	}
+	public int getSelectedId(){
+		if (selectedObject != null){
+			if (selectedObject.size() > 0){
+				return selectedObject.get(0).getResId();
+			}
+		}
+		return -1;
+	}
 
 }
