Changeset 864 for vanHelsing


Ignore:
Timestamp:
Apr 16, 2010, 5:55:54 PM (14 years ago)
Author:
tobias
Message:

javadoc added

Location:
vanHelsing/trunk/gui
Files:
34 added
9 edited
1 moved

Legend:

Unmodified
Added
Removed
  • vanHelsing/trunk/gui/.metadata/WebContent/WEB-INF/faces-config.pageflow

    r830 r864  
    11<?xml version="1.0" encoding="UTF-8"?>
    2 <pageflow:Pageflow xmlns:pageflow="http://www.sybase.com/suade/pageflow" id="pf12676964616590" configfile="/vanHelsingGUI/WebContent/WEB-INF/faces-config.xml"/>
     2<pageflow:Pageflow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pageflow="http://www.sybase.com/suade/pageflow" id="pf12676964616590" configfile="/vanHelsingGUI/WebContent/WEB-INF/faces-config.xml">
     3  <nodes xsi:type="pageflow:PFPage" name="menu" id="pf12714196408465" referenceLink="//@navigationRule.0/@fromViewId|" outlinks="pf12714196408466 pf127142009894718 pf127142089972321" inlinks="pf127142009894718" path="/menu.jspx"/>
     4  <nodes xsi:type="pageflow:PFPage" name="client" id="pf12714196408467" referenceLink="//@navigationRule.0/@navigationCase.0/@toViewId|" inlinks="pf12714196408466" path="/client.jspx"/>
     5  <nodes xsi:type="pageflow:PFPage" name="&quot;/#{configurationBean.newResourceListener}.jspx&quot;" id="pf127142089972322" referenceLink="//@navigationRule.0/@navigationCase.1/@toViewId|" inlinks="pf127142089972321" path="&quot;/#{configurationBean.newResourceListener}.jspx&quot;"/>
     6  <links id="pf12714196408466" target="pf12714196408467" source="pf12714196408465" outcome="client"/>
     7  <links id="pf127142009894718" target="pf12714196408465" source="pf12714196408465" outcome="ok"/>
     8  <links id="pf127142089972321" target="pf127142089972322" source="pf12714196408465" outcome="#{configurationBean.newResourceListener}"/>
     9</pageflow:Pageflow>
  • vanHelsing/trunk/gui/WebContent/WEB-INF/faces-config.xml

    r856 r864  
    3838                <managed-bean-scope>request</managed-bean-scope>
    3939        </managed-bean>
     40       
     41        <navigation-rule>
     42                <display-name>menu</display-name>
     43                <from-view-id>/menu.jspx</from-view-id>
     44                <navigation-case>
     45                        <from-outcome>client</from-outcome>
     46                        <to-view-id>/client.jspx</to-view-id>
     47                </navigation-case>
     48                <navigation-case>
     49                        <from-outcome>#{configurationBean.newResourceListener}</from-outcome>
     50                        <to-view-id>"/#{configurationBean.newResourceListener}.jspx"</to-view-id>
     51                </navigation-case>
     52                <navigation-case>
     53                        <from-outcome>ok</from-outcome>
     54                        <to-view-id>/menu.jspx</to-view-id>
     55                </navigation-case>
     56        </navigation-rule>
    4057
    4158</faces-config>
  • vanHelsing/trunk/gui/WebContent/menu.jspx

    r862 r864  
    2424                                <ice:commandButton id="newRes"
    2525                                    value="create resource"
    26                                     actionListener="#{configurationBean.newResourceButtonListener}"/>
     26                                    actionListener="#{configurationBean.newResourceListener}"/>
    2727                                        <ice:commandButton id="reloadRes"
    2828                                                value="reload Tree"
     
    116116
    117117                        <ice:commandButton id="deleteNode"
    118                                 value="delete"
    119                                 actionListener="#{jobScheduleBean.deleteNodeListener}" />
    120                                
     118                                value="delete" actionListener="#{jobScheduleBean.deleteNodeListener}">
     119                                        <f:param name="userObject.resId" value="#{item.userObject.userObject.resId}"/>
     120                                        <f:param name="userObject.resName" value="#{item.userObject.userObject.resName}" />
     121                                </ice:commandButton>                           
    121122                        <ice:commandButton id="reloadTree"
    122123                                value="reloadTree"
     
    141142                                                                        <ice:commandLink actionListener="#{jobScheduleBean.selectNode}">
    142143                                                                        <f:param name="userObject.resId" value="#{item.userObject.userObject.resId}"/>
    143                                                                     <ice:outputText id="knoten" value="#{item.userObject.userObject.resName}"/>
    144                                                                                 </ice:commandLink>
     144                                                                        <f:param name="userObject.resName" value="#{item.userObject.userObject.resName}" />
     145                                                                    <ice:outputText id="knoten" value="#{item.userObject.userObject.resName}" />
     146                                                                        </ice:commandLink>
    145147                                                                </f:facet>
    146148                                                        </ice:treeNode>
  • vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/BeanUtil.java

    r862 r864  
    11package de.dass_it.vanhelsing.gui;
    2 
    3 
    42
    53import javax.faces.application.FacesMessage;
     
    97import java.util.ResourceBundle;
    108import java.util.Locale;
    11 
    12 
     9import java.util.HashMap;
    1310
    1411//import org.apache.log4j.Logger;
    1512
    16 /*
     13/**
    1714 * Helper class to encapsulate common bean methods.
    1815 * Managed beans will extend this class either directly or
     
    2017 */
    2118public class BeanUtil {
    22         //Logging
    23    
    24         //protected final Logger logger = Logger.getLogger(this.getClass());
    25    
    26         //Messagebundles
    27         public static String getProperty(String key){
     19        // Logging
     20
     21        // protected final Logger logger = Logger.getLogger(this.getClass());
     22
     23        // Messagebundles
     24        /**
     25         * getter method for a property value
     26         * @param key   key of the queried property, e.g. director.client.name.type
     27         * @return s    value of the property
     28         */
     29        public static String getProperty(String key) {
    2830                String s = PropertyBundle.getProperty(key);
    2931                return s;
    3032        }
    31        
    32         public static String[] getProperties(String key){
    33                 String[] suffix = {"ref", "type", "required", "def"};
     33        /**
     34         *
     35         * @param key   key contains the key value of the set of properties for a given attribute<br/>
     36         *                              except for the suffix which defines the content type of the property.
     37         * @return      bundle  contains all four properties of an attribute
     38         */
     39        public static String[] getProperties(String key) {
     40                String[] suffix = { "ref", "type", "required", "def" };
    3441                String[] bundle = new String[4];
    3542                for (int i = 0; i < 4; i++) {
    36                         bundle[i] = BeanUtil.getProperty(key+"."+suffix[i]);
     43                        bundle[i] = BeanUtil.getProperty(key + "." + suffix[i]);
    3744                }
    3845                return bundle;
    3946        }
    40         public static boolean getRequired(String type, String key){
     47        /**
     48         *
     49         * @param type  resource type of the attribute, like Client
     50         * @param key   attribute name of the resource, like Port
     51         * @return              true if the field is required or false
     52         */
     53        public static boolean getRequired(String type, String key) {
    4154                String s = getFieldProperty(type, key, 2);
    42                 if (s.equals("true") )return true;
     55                if (s.equals("true"))
     56                        return true;
    4357                return false;
    4458        }
    45         public static String getDataType(String type, String key){
     59        /**
     60         * returns the data type of a given attribute.
     61         * @param type  resource type of the attribute, like Client
     62         * @param key   attribute name of the resource, like Port
     63         * @return              data type of the attribute
     64         */
     65        public static String getDataType(String type, String key) {
    4666                return getFieldProperty(type, key, 1);
    4767        }
    48         //getRenderer returns rendererType based on properties
    49         public static String getRenderer(String type, String key){
     68
     69        // getRenderer returns rendererType based on properties
     70        /**
     71         * returns the renderer for a given attribute
     72         * @param type  resource type of the attribute, like Client
     73         * @param key   attribute name of the resource, like Port
     74         * @return              "inputText", "radioGroup" or "selectOneMenu"
     75         *                             
     76         */
     77        public static String getRenderer(String type, String key) {
    5078                return getFieldProperty(type, key, 0);
    5179        }
    52         public static String getFieldProperty(String type, String key, int i){
     80        /**
     81         * returns properties for a given attribute depending on the value of i.
     82         * One should use the getter method for the property.
     83         * @param type  resource type of the attribute, like Client
     84         * @param key   attribute name of the resource, like Port
     85         * @param i             i maybe between 0 and 3. The return value of the method is selected by the value of i
     86         * @return              one of the four properties as a String of a given attribute.
     87         */
     88        public static String getFieldProperty(String type, String key, int i) {
    5389                String daemon = "director";
    5490                String res = "inputText";
    55                 if (type.startsWith("SD")){
     91                if (type.startsWith("SD")) {
    5692                        daemon = "storagedaemon";
    5793                }
    58                 if (type.startsWith("FD")){
     94                if (type.startsWith("FD")) {
    5995                        daemon = "filedaemon";
    6096                }
     
    6298                key = key.toLowerCase();
    6399                key = key.replaceAll(" ", "");
    64                 String result[] = getProperties((daemon+"."+type+"."+key));
     100                String result[] = getProperties((daemon + "." + type + "." + key));
    65101                if (i == 0) {
    66                         if (result[1].equals("boolean")){
    67                                 return "radioGroup"; 
     102                        if (result[1].equals("boolean")) {
     103                                return "radioGroup";
    68104                        }
    69                         if (!(result[0].equals("0"))){
     105                        if (!(result[0].equals("0"))) {
    70106                                return "selectOneMenu";
    71                         }               
     107                        }
    72108                        return res;
    73109                }
    74                 if (i == 2) return result[2];
    75                 if (i == 1) return result[1];
    76                 if (i == 3) return result[3];
     110                if (i == 2)
     111                        return result[2];
     112                if (i == 1)
     113                        return result[1];
     114                if (i == 3)
     115                        return result[3];
    77116                return res;
    78117        }
    79        
    80     //Statusmeldungen an den Client
    81     public static void setInfoMessage(String client, String message){
    82         FacesContext.getCurrentInstance().addMessage(client, new FacesMessage(FacesMessage.SEVERITY_INFO, message, message));
    83     }
    84     public static void setErrorMessage(String client, String message){
    85         FacesContext.getCurrentInstance().addMessage(client, new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message));
    86     }
    87    
    88         //Linkout to Bacula documentation
    89         //ListItemsConfigView
    90         //ListItemsTopologyView
    91         //ListItemsJobSchedule
    92        
    93         //GetParameterFromContext
    94         public static String getRequestParameter(String name){
    95                 return (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(name);
     118
     119        // Statusmeldungen an den Client
     120        /**
     121         * sends an information type message to the message field at the bottom of the screen
     122         * @param client        could contain an identifier of a client. value can be set to null
     123         * @param message       the message to be displayed at the clients view
     124         */
     125        public static void setInfoMessage(String client, String message) {
     126                FacesContext.getCurrentInstance().addMessage(client,
     127                                new FacesMessage(FacesMessage.SEVERITY_INFO, message, message));
    96128        }
    97        
    98         public static String getAccessType(String type){
    99                 if (type.equals("jobdefs")) return "job";
     129        /**
     130         * sends an error type message to the message field at the bottom of the screen
     131         * @param client        could contain an identifier of a client. value can be set to null
     132         * @param message       the message to be displayed at the clients view
     133         */
     134        public static void setErrorMessage(String client, String message) {
     135                FacesContext.getCurrentInstance()
     136                                .addMessage(
     137                                                client,
     138                                                new FacesMessage(FacesMessage.SEVERITY_ERROR, message,
     139                                                                message));
     140        }
     141
     142        // Linkout to Bacula documentation
     143        // ListItemsConfigView
     144        // ListItemsTopologyView
     145        // ListItemsJobSchedule
     146
     147        // GetParameterFromContext
     148        /**
     149         * returns values of a given parameter of the FacesContext
     150         * @param name  name of the parameter e.g. the id of a parameter in the view.   
     151         * @return      value of a given parameter
     152         */
     153        public static String getRequestParameter(String name) {
     154                return (String) FacesContext.getCurrentInstance().getExternalContext()
     155                                .getRequestParameterMap().get(name);
     156        }
     157        /**
     158         * translation method for resource or object names.
     159         * @param type  untranslated name
     160         * @return              translated name if there is a translation. Otherwise type will be returned.
     161         */
     162        public static String getAccessType(String type) {
     163                String result = new String();
     164                HashMap<String, String> map = new HashMap<String, String>();
     165                map.put("jobdefs", "job");
     166                map.put("SDStorage", "Storage");
     167                map.put("Storage", "SDStorage");
     168                map.put("SDDevice", "Device");
     169                map.put("Device", "SDDevice");
     170                map.put("SDDevice", "Device");
     171                result = map.get(type);
     172                if (result != null)
     173                        return result;
    100174                return type;
    101175        }
    102        
     176
    103177}
  • vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/Client.java

    r862 r864  
    44import de.dass_it.www.vanhelsing.VanHelsingCallbackHandler.*;
    55import de.dass_it.www.vanhelsing.VanHelsingStub.*;
    6 
     6/**
     7 * Client wraps the access
     8 * @author tgoecke
     9 *
     10 */
    711public class Client {
    812        public ResourceInfo[] getListResources(String director, String resource){
     
    8892                return stub;
    8993        }       
    90         public static void main(String args[]){
    91                 Client c = new Client();
    92                 ListResourcesType lrt = new ListResourcesType();
    93                 lrt.setDirector("bacula-dir");
    94                 lrt.setResourceType("JobDefs");
    95                
    96                 ResourceInfo[] rinfo = c.getListResources(lrt);
    97        
    98                 System.err.println("!!!rinfo!!!");
    99                 for (int i = 0; i < rinfo.length && rinfo.length > 0; i++){
    100                         System.err.println(rinfo[i].getDirector());
    101                         System.err.println(rinfo[i].getResId());
    102                         System.err.println(rinfo[i].getResName());
    103                         System.err.println(rinfo[i].getResType());
    104                 }
    105                
    106                 GetResourceType grt = new GetResourceType();
    107                 grt.setDirector("bacula-dir");
    108                 grt.setResId(117);
    109                
    110                 SimpleResource sr = new SimpleResource();
    111                 sr = c.getSimpleResource(grt);
    112                
    113                 System.err.println("!!sr!!");
    114                 System.err.println(sr.getResourceInfo().getDirector());
    115                 System.err.println(sr.getResourceInfo().getResId());
    116                 System.err.println(sr.getResourceInfo().getResName());
    117                 System.err.println(sr.getResourceInfo().getResType());
    118 
    119                 for (int i = 0; i < sr.getResourceAttributeType().length; i++){
    120                         System.err.print("\nKey:   ");
    121                         System.err.print((sr.getResourceAttributeType())[i].getKey());
    122                         System.err.print("\nValue: ");
    123                         System.err.print((sr.getResourceAttributeType())[i].getValue());
    124                 }
    125                
    126         }
    127 
    12894}
  • vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/ConfigurationBean.java

    r862 r864  
    1414import de.dass_it.www.vanhelsing.VanHelsingStub.*;
    1515
    16 /*
    17  * List all Bacula configuration components by name
     16/**
     17 * List all Bacula configuration components by name.
    1818 */
    1919public class ConfigurationBean extends TreeNavigation {
     
    2626                init();
    2727        }
     28       
     29        /**
     30         * init() builds the data tree of the configuration view. The heading nodes are read from the properties file.
     31         * the web service will be queried for each heading node(e.g. client).
     32         */
    2833        private void init(){
    2934                DefaultMutableTreeNode root = new DefaultMutableTreeNode();
     
    3641                ResourceInfo[] ri;
    3742                SimpleResource sr;
    38                 // ((ClientItem)selectedObject).setName("ClientNameTest");
    3943
    4044                Client c = new Client();
    41                 /*String[] nodes = { "Director", "Storage", "Autochanger",
    42                                 "Client", "FileSet", "FDClient", "Schedule", "SDStorage",
    43                                 "Console", "Catalog", "SDDevice", "Job", "JobDefs", "Messages",
    44                                 "Pool" }; */
    45                 // String[] nodes = {"Client"};
    4645                setTree(super.createTree(root, BeanUtil.getProperty("nodes").split(","), "Configuration"));
    4746
    48                 // \forall header wird eine ResourceList[] angefragt
    4947               
    5048                for (int i = 0; i < tree.getChildCount(root); i++) {
     
    5957                                continue;
    6058                        for (int j = 0; j < ri.length; j++) {
    61                                 // myNode = null;
    6259                                myNode = addNode(header, type, ri[j]);
    63                                 // Node mit Daten befüllen
    6460                                grt = new GetResourceType();
    6561                                grt.setDirector(lrt.getDirector());
     
    7268                        }
    7369                }
    74                 /*
    75                  * for (int i = 0; i < tree.getChildCount(root); i++){ header =
    76                  * (DefaultMutableTreeNode)tree.getChild(root, i);
    77                  *
    78                  * for (int j = 0; j < tree.getChildCount(header); j++){ leaf =
    79                  * (DefaultMutableTreeNode)tree.getChild(header, j); type =
    80                  * ((UserObjectItemType
    81                  * )leaf.getUserObject()).getUserObject().getResType(); grt = new
    82                  * GetResourceType(); grt.setDirector("bacula-dir");
    83                  * grt.setResId(((ItemType
    84                  * )(((UserObjectItemType)leaf.getUserObject()).getUserObject
    85                  * ())).getResId()); sr = c.getSimpleResource(grt);
    86                  * sr.getResourceAttributeType(); myNode = addNode(leaf, type,
    87                  * sr.getResourceAttributeType()); if (myNode != null){
    88                  * leaf.add(myNode); }
    89                  *
    90                  * } }
    91                  */
    92 
    93         }
    94 
    95 
     70        }
     71
     72        /**
     73         * transfers the selected (by attribute resId) dataobject (resource) into an ArrayList of ViewItems.<br/>
     74         * Each ViewItem contain the key value pair and the rendering type. If the attribute is rendered as a
     75         * selectOneMenu, the values for the selectOneMenu will be read from the data tree.
     76         *
     77         * @param ae    ActionEvent which contains relevant information about the component tree. the variable is not used.
     78         */
    9679        public void userObjectItemNodeSelected(ActionEvent ae) {
    9780                DefaultMutableTreeNode node;
     
    11295                String classType = "de.dass_it.vanhelsing.gui.items." + type + "Item";
    11396                String accessType = BeanUtil.getAccessType(type.toLowerCase());
    114                 // Daten aus dem UserObjectItem extrahieren
    11597                try {
    11698                        UserObjectItem item = ((UserObjectItemType) (node.getUserObject()))
     
    163145                }
    164146        }
     147        /**
     148         * return an array of nodes of a given resource type
     149         *
     150         * @param tree2         copy of the data tree
     151         * @param key           name of the requested resource type
     152         * @return dmtn         array of nodes of a given resource type
     153         * @return null         null object there are no nodes of the requested type
     154         */
    165155        private DefaultMutableTreeNode[] getChildNodes(DefaultTreeModel tree2, String key) {
    166156                DefaultMutableTreeNode[] dmtn;
     
    179169                return null;
    180170        }
     171        /**
     172         *
     173         * @param ae
     174         */
    181175        public void newResourceButtonListener(ActionEvent ae){
    182176                DefaultMutableTreeNode node;
     
    215209                                                                si[i] = new SelectItem((String)o.invoke(nodeObject, (Object[])null),
    216210                                                                                (String)o.invoke(nodeObject, (Object[])null));
    217                                                                 //System.err.println("si[i]"+si[i].getLabel());
    218211                                                               
    219212                                                        }
     
    231224               
    232225        }
     226        /**
     227         * **EXPERIMENTAL** returns type of the selected resource.
     228         * The method is used for an evaluation about dynamic navigation.
     229         * @param ae    ActionEvent contains relevant information about the jsf component tree.
     230         * @return viewName     name of the resource type of the selected data tree node       
     231         */
     232        public String newResourceListener(ActionEvent ae){
     233                if (selectedObject != null && selectedObject.size() > 0){
     234                        String resType = selectedObject.get(0).getResType();
     235                        String viewName = BeanUtil.getAccessType(resType);
     236                        return viewName;
     237                }
     238                return "";
     239        }
     240       
    233241        public void userObjectItemOptionSelected(ValueChangeEvent vce){
    234242               
    235243        }
    236        
     244        /**
     245         * repeat the entire construction process of the data tree
     246         * @param ae
     247         */
    237248        public void reloadResourceButtonListener(ActionEvent ae){
    238249                init();
     
    241252                BeanUtil.setInfoMessage(null, "Diese Methode ist noch nicht implementiert.");
    242253        }
    243        
     254        /**
     255         * **EXPERIMENTAL** writes the selected resource to the data tree of the web service.
     256         *
     257         * @param ae    ActionEvent contains relevant information
     258         */
    244259        public void saveButtonListener(ActionEvent ae) {
    245260                if (selectedObject == null){
     
    280295                }
    281296        }
    282 
     297        /**
     298         * Setter method for the tree attribute
     299         * @param tree  tree contains the DefaultTreeModel for the data tree
     300         */
    283301        public void setTree(DefaultTreeModel tree) {
    284302                this.tree = tree;
    285303        }
    286 
     304        /**
     305         * getter method for the tree attribute
     306         * @return tree         tree contains the DefaultTreeModel for the data tree
     307         */
    287308        public DefaultTreeModel getTree() {
    288309                return tree;
    289310        }
    290 
     311       
     312        /**
     313         * gettter method for the selectedObject attribute
     314         * @return selectedObject       selectedObject contains the data object of the selected leaf node.
     315         */
    291316        public ArrayList<ViewItem> getSelectedObject() {
    292317                return selectedObject;
    293318        }
    294 
     319       
     320        /**
     321         * setter method for the selectedObject attribute
     322         * @param selectedObject        selectedObject contains the data object of the selected leaf node
     323         */
    295324        public void setSelectedObject(ArrayList<ViewItem> selectedObject) {
    296325                this.selectedObject = selectedObject;
    297326        }
     327       
     328        /**
     329         * getter method for the resId attribute of the selectedObject i.e. the selected leaf node of the data tree
     330         * @return id   resId attribute of the selected object
     331         */
    298332        public int getSelectedId(){
    299333                if (selectedObject != null){
  • vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/ConstraintViolationException.java

    r862 r864  
    11package de.dass_it.vanhelsing.gui;
    22
    3 public class constraintValidationException extends Exception {
     3public class ConstraintViolationException extends Exception {
    44
    55}
  • vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/DataTree.java

    r862 r864  
    22
    33import java.util.Enumeration;
    4 
    54import javax.swing.tree.DefaultMutableTreeNode;
    65import javax.swing.tree.DefaultTreeModel;
    7 
    86import de.dass_it.vanhelsing.gui.items.ConcreteUserObjectItem;
    9 import de.dass_it.vanhelsing.gui.items.ItemType;
    107import de.dass_it.vanhelsing.gui.items.UserObjectItem;
    118import de.dass_it.vanhelsing.gui.items.UserObjectItemType;
     
    1916        public void setTree(String name){
    2017                setRoot(new DefaultMutableTreeNode());
    21                 tree = new DefaultTreeModel(root);
    22                 UserObjectItemType userType = new UserObjectItemType(root);
     18                setTree(new DefaultTreeModel(getRoot()));
     19                UserObjectItemType userType = new UserObjectItemType(getRoot());
    2320                ConcreteUserObjectItem obj = new ConcreteUserObjectItem();
    24                 root.setUserObject(userType);
     21                getRoot().setUserObject(userType);
    2522                userType.setUserObject(obj);
    2623                userType.setLeaf(false);
     
    6663                return null;
    6764        }
    68         public DefaultMutableTreeNode deleteNode(DefaultMutableTreeNode node) throws constraintValidationException{
    69                 if (node.getChildCount()>0) throw new constraintValidationException();
     65        public DefaultMutableTreeNode deleteNode(DefaultMutableTreeNode node) throws ConstraintViolationException{
     66                if (node.getChildCount()>0) throw new ConstraintViolationException();
    7067                DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent();
    7168                parent.remove(node);
  • vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/JobScheduleBean.java

    r862 r864  
    66import de.dass_it.www.vanhelsing.VanHelsingStub.*;
    77import de.dass_it.vanhelsing.gui.items.ConcreteUserObjectItem;
     8import javax.faces.context.FacesContext;
    89
    910/*
    10  * JobSchedule will list all schedules and the jobs which are associated with a given schedule.
     11 * JobSchedule will list all schedules and the jobs which are associated
     12 * with a given schedule.
    1113 */
    1214public class JobScheduleBean  {
     
    1719                init();
    1820        }
     21       
    1922        private void init(){
    2023                Client c = new Client();
    2124                UserObjectItemFactory UOFactory = new UserObjectItemFactory();
    22                
    2325                ResourceInfo riSched[];
    2426                ResourceInfo riJobs[];
    2527                SimpleResource sr;
    2628                DefaultMutableTreeNode parent;
    27                
    2829                dataTree = new DataTree();
    2930                dataTree.setTree("JobSchedule");
    30 
    31                
    32                 //TODO: Director auslesen
    33                 riSched = c.getListResources("bacula-dir", "Schedule");
     31                riSched = c.getListResources(BeanUtil.getProperty("defaultdirector"), "Schedule");
    3432                for (ResourceInfo rinfo : riSched){
    3533                        parent = dataTree.createNode(dataTree.getRoot(),
    3634                                        UOFactory.createUserObjectItem(rinfo));
    37 
    3835                        riJobs = c.getListResources(rinfo.getDirector(), "Job");
    3936                        for (ResourceInfo rJobs : riJobs){
    40 
    4137                                sr = c.getSimpleResource(rJobs.getDirector(), rJobs.getResId());
    4238                                for (ResourceAttributeType rat : sr.getResourceAttributeType()){
     
    6460        }
    6561        public void deleteNodeListener(ActionEvent ae){
    66                 BeanUtil.setInfoMessage(null, "Die Methode ist noch nicht implementiert");
     62                DefaultMutableTreeNode node;
     63                ae.getComponent().getAttributes();
     64
     65                String idString = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("UserObject.resId");
     66                String name = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("UserObject.resName");
    6767               
     68                if (idString == null && name != null && !name.equals("")){
     69                        node = dataTree.getNodeByName(name);
     70                        try{
     71                                node = dataTree.deleteNode(node);
     72                        }catch (ConstraintViolationException ecv){
     73                                System.err.println(ecv.toString());
     74                        }
     75                } else if (idString != null) {
     76                        node = dataTree.getNodeById(new Integer(idString).intValue());
     77                        try {
     78                                node = dataTree.deleteNode(node);
     79                        } catch (ConstraintViolationException ecv) {
     80                                ecv.printStackTrace();
     81                        }
     82                } else {
     83                        BeanUtil.setInfoMessage(null, "Knoten kann nicht referenziert werden");
     84                }
     85                dataTree.getTree().reload();
    6886        }
    6987        public void reloadTreeListener(ActionEvent ae){
     
    7189        }
    7290        public void selectNode(ActionEvent ae){
    73                 BeanUtil.setInfoMessage(null, "Die Methode ist noch nicht implementiert");
     91                //BeanUtil.setInfoMessage(null, "Die Methode ist noch nicht implementiert");
     92               
    7493        }
    7594
  • vanHelsing/trunk/gui/src/de/dass_it/vanhelsing/gui/messages_en.properties

    r862 r864  
    1 director = bacula-dir
     1defaultdirector = bacula-dir
    22nodes = Director,Storage,Autochanger,Client,FileSet,FDClient,Schedule,SDStorage,Console,Catalog,SDDevice,Job,JobDefs,Messages,Pool
    33director.director.name.ref =  0
Note: See TracChangeset for help on using the changeset viewer.