Index: vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/ConfigurationBean.java
===================================================================
--- vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/ConfigurationBean.java	(revision 867)
+++ vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/ConfigurationBean.java	(revision 868)
@@ -4,4 +4,5 @@
 import java.util.ArrayList;
 
+import javax.faces.context.FacesContext;
 import javax.faces.event.ActionEvent;
 import javax.faces.event.ValueChangeEvent;
@@ -17,11 +18,11 @@
  * List all Bacula configuration components by name.
  */
-public class ConfigurationBean extends TreeNavigation {
-
-	private DefaultTreeModel tree;
-	private ArrayList<ViewItem> selectedObject;
+public class ConfigurationBean implements ViewBean{
+	
+	
+	private DataTree dataTree;
+	private ConcreteUserObjectItem selectedObject;
+	private boolean createResource;
 	private String selectedId;
-	private String selectedName;
-	private boolean createResource = false;
 
 	public ConfigurationBean() {
@@ -34,42 +35,34 @@
 	 */
 	private void init(){
-		DefaultMutableTreeNode root = new DefaultMutableTreeNode();
-		DefaultMutableTreeNode header;
-		DefaultMutableTreeNode leaf;
-		String type;
-		ListResourcesType lrt;
-		GetResourceType grt;
-		DefaultMutableTreeNode myNode;
-		ResourceInfo[] ri;
+		DefaultMutableTreeNode parent;
+		ResourceInfo resItems[];
 		SimpleResource sr;
-
 		Client c = new Client();
-		setTree(super.createTree(root, BeanUtil.getProperty("nodes").split(","), "Configuration"));
-
-		
-		for (int i = 0; i < tree.getChildCount(root); i++) {
-			header = (DefaultMutableTreeNode) tree.getChild(root, i);
-			type = ((UserObjectItemType) header.getUserObject())
-					.getUserObject().getResType();
-			lrt = new ListResourcesType();
-			lrt.setDirector("bacula-dir");
-			lrt.setResourceType(type);
-			ri = c.getListResources(lrt);
-			if (ri == null || ri.length == 0)
-				continue;
-			for (int j = 0; j < ri.length; j++) {
-				myNode = addNode(header, type, ri[j]);
-				grt = new GetResourceType();
-				grt.setDirector(lrt.getDirector());
-				grt.setResId(ri[j].getResId());
-				sr = c.getSimpleResource(grt);
-				myNode = addNode(myNode, type, sr.getResourceAttributeType());
-				if (myNode != null) {
-					header.add(myNode);
+		UserObjectItemFactory UOFactory = new UserObjectItemFactory();
+		setDataTree(new DataTree());
+		dataTree.setTree("Configuration");
+		for (String name : BeanUtil.getProperty("nodes").split(",")){
+			parent = dataTree.createNode(dataTree.getRoot(), 
+					UOFactory.createUserObjectItem(
+							c.makeResourceInfo(BeanUtil.getProperty("defaultdirector"), -1, name, name)
+					)
+			);
+			resItems = c.getListResources(BeanUtil.getProperty("defaultdirector"), name);
+			if (resItems != null){
+				for (ResourceInfo rinfo : resItems){
+					sr = c.getSimpleResource(rinfo.getDirector(), rinfo.getResId());
+					if (sr != null){
+						//TODO: discard the SimpleResource ResInfo return value and work with the query object
+						dataTree.createNode(parent, 
+								UOFactory.createUserObjectItem(
+										sr.getResourceAttributeType(), rinfo));
+					}
 				}
 			}
-		} 
-	}
-
+		}
+		dataTree.createKeyValueLists();
+		dataTree.updateUserObjects();
+	}
+	
 	/**
 	 * transfers the selected (by attribute resId) dataobject (resource) into an ArrayList of ViewItems.<br/>
@@ -79,8 +72,21 @@
 	 * @param ae	ActionEvent which contains relevant information about the component tree. the variable is not used.
 	 */
-	public void userObjectItemNodeSelected(ActionEvent ae) {
+	public void renderResource(ActionEvent ae){
+		DefaultMutableTreeNode node;
+		String id = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("userObject.resId");
+		int numId = new Integer(id);
+		String name = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("userObject.resName");
+		if (numId > 0){
+			node = dataTree.getNodeById(numId);
+			selectedObject = (ConcreteUserObjectItem)((UserObjectItemType)(node.getUserObject())).getUserObject();
+		} else {
+			node = dataTree.getNodeByName(name);
+			selectedObject = (ConcreteUserObjectItem)((UserObjectItemType)(node.getUserObject())).getUserObject();
+		}
+	}
+	/*public void userObjectItemNodeSelected(ActionEvent ae) {
 		DefaultMutableTreeNode node;
 		UserObjectItem userObject;
-		selectedObject = new ArrayList<ViewItem>();
+		selectedObject.setViewItemList(viewItemList) = new ArrayList<ViewItem>();
 		String Id = BeanUtil.getRequestParameter("userObject.resId");
 		String name = BeanUtil.getRequestParameter("userObject.resName");
@@ -147,5 +153,5 @@
 			e.printStackTrace();
 		}
-	}
+	}*/
 	/**
 	 * return an array of nodes of a given resource type
@@ -156,5 +162,5 @@
 	 * @return null		null object there are no nodes of the requested type
 	 */
-	private DefaultMutableTreeNode[] getChildNodes(DefaultTreeModel tree2, String key) {
+	/*private DefaultMutableTreeNode[] getChildNodes(DefaultTreeModel tree2, String key) {
 		DefaultMutableTreeNode[] dmtn;
 		DefaultMutableTreeNode root = (DefaultMutableTreeNode)tree2.getRoot();
@@ -171,5 +177,5 @@
 		}
 		return null;
-	}
+	}*/
 	
 	/**
@@ -177,5 +183,5 @@
 	 * @param ae
 	 */
-	public void newClientButtonListener(ActionEvent ae){
+	/*public void newClientButtonListener(ActionEvent ae){
 		String type = "client";
 		ArrayList newResource = new ArrayList<ViewItem>();
@@ -211,7 +217,7 @@
 		
 		
-	}
-	
-	public void newResourceButtonListener(ActionEvent ae){
+	}*/
+	
+	/*public void newResourceButtonListener(ActionEvent ae){
 		DefaultMutableTreeNode node;
 		UserObjectItem userObject;
@@ -267,5 +273,5 @@
 		}
 		
-	}
+	}*/
 	/**
 	 * **EXPERIMENTAL** returns type of the selected resource.
@@ -274,5 +280,5 @@
 	 * @return viewName	name of the resource type of the selected data tree node	
 	 */
-	public String newResourceListener(ActionEvent ae){
+	/*public String newResourceListener(ActionEvent ae){
 		if (selectedObject != null && selectedObject.size() > 0){
 			String resType = selectedObject.get(0).getResType();
@@ -281,5 +287,5 @@
 		}
 		return "";
-	}
+	}*/
 	
 	public void userObjectItemOptionSelected(ValueChangeEvent vce){
@@ -296,5 +302,5 @@
 		BeanUtil.setInfoMessage(null, "Diese Methode ist noch nicht implementiert.");
 	}
-	public void saveClientButtonListener(ActionEvent ae){
+	/*public void saveClientButtonListener(ActionEvent ae){
 		Client c = new Client();
 		String name = "";
@@ -315,5 +321,5 @@
 				);
 		System.err.println(newResId);
-	}
+	}*/
 	/**
 	 * **EXPERIMENTAL** writes the selected resource to the data tree of the web service.
@@ -321,5 +327,5 @@
 	 * @param ae	ActionEvent contains relevant information 
 	 */
-	public void saveButtonListener(ActionEvent ae) {
+	/*public void saveButtonListener(ActionEvent ae) {
 		if (selectedObject == null){
 			BeanUtil.setInfoMessage(null, "bitte eine Resource zum Ändern auswählen");
@@ -353,16 +359,16 @@
 			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);
 		}
-	}
+	}*/
 	/**
 	 * Setter method for the tree attribute
 	 * @param tree	tree contains the DefaultTreeModel for the data tree
 	 */
-	public void setTree(DefaultTreeModel tree) {
-		this.tree = tree;
+	public void setDataTree(DataTree dataTree) {
+		this.dataTree = dataTree;
 	}
 	/**
@@ -370,6 +376,32 @@
 	 * @return tree		tree contains the DefaultTreeModel for the data tree
 	 */
-	public DefaultTreeModel getTree() {
-		return tree;
+	public DataTree getDataTree() {
+		return dataTree;
+	}
+
+	public void createNodeButtonListener(ActionEvent ae) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void deleteNodeButtonListener(ActionEvent ae) {
+		// TODO Auto-generated method stub
+		
+	}
+
+
+	public void readNodeButtonListener(ActionEvent ae) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void selectNode(ActionEvent ae) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void updateNodeButtonListener(ActionEvent ae) {
+		// TODO Auto-generated method stub
+		
 	}
 	
@@ -378,5 +410,5 @@
 	 * @return selectedObject	selectedObject contains the data object of the selected leaf node.
 	 */
-	public ArrayList<ViewItem> getSelectedObject() {
+	public ConcreteUserObjectItem getSelectedObject() {
 		return selectedObject;
 	}
@@ -386,5 +418,5 @@
 	 * @param selectedObject	selectedObject contains the data object of the selected leaf node
 	 */
-	public void setSelectedObject(ArrayList<ViewItem> selectedObject) {
+	public void setSelectedObject(ConcreteUserObjectItem selectedObject) {
 		this.selectedObject = selectedObject;
 	}
@@ -396,11 +428,9 @@
 	public int getSelectedId(){
 		if (selectedObject != null){
-			if (selectedObject.size() > 0){
-				return selectedObject.get(0).getResId();
-			}
-		}
+				return selectedObject.getResId();
+			}
 		return -1;
 	}
-	public String getSelectedName(){
+	/*public String getSelectedName(){
 		if (selectedObject != null){
 			if (selectedObject.size() > 0){
@@ -409,5 +439,5 @@
 		}
 		return "";
-	}
+	}*/
 	public void setCreateResource(boolean b){
 		this.createResource = b;
