KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mc > formgenerator > ggf > WebContextGGF


1 /*
2  * Created on 04 mai. 2004 by the Message Center Team
3  *
4  */

5 package mc.formgenerator.ggf;
6
7 //import org.chiba.xml.xforms.ui.BoundElement;
8
//import org.apache.log4j.Category;
9

10 import java.util.Map JavaDoc;
11 import java.util.HashMap JavaDoc;
12
13 /**
14  * Stores Servlet application specific properties.
15  * @author sempereb
16  */

17 public class WebContextGGF{
18     
19     //private static final Category LOGGER = Category.getInstance(ChibaContext.class);
20
public static final String JavaDoc REQUEST_PARAMETERS = "chiba.parameters";
21     private Map JavaDoc properties=null;
22     private GGF ggf = null;
23
24     public WebContextGGF(GGF ggf) {
25         this.ggf = ggf;
26         this.properties = new HashMap JavaDoc();
27     }
28
29     /**
30      * Stores a Servlet specific property in the context.
31      * @param key the property key
32      * @param value the property value
33      */

34     public void setProperty(String JavaDoc key, Object JavaDoc value) {
35         this.properties.put(key,value);
36     }
37
38     /**
39      * Reads a Servlet specific property from the context.
40      * @param key the key for the wanted object
41      * @return returns object from context
42      */

43     public Object JavaDoc getProperty(String JavaDoc key) {
44         return this.properties.get(key);
45     }
46
47     /**
48      * Return the properties Map
49      * @return All context properties in a Map object
50      */

51     public Map JavaDoc getProperties() {
52         return this.properties;
53     }
54
55     /**
56      * Returns an external name for a given bound control. This can be either a form control or
57      * another bound element like label, alert, filename, mediatype....
58      *
59      * Note: this solution is a bit of a hack. the method would feel better in ServletAdapter itself but
60      * this would make necessary another interface to access this method from inside the processor.
61      *
62      * @param control the bound control.
63      * @return an external name for a given bound control.
64      */

65     /*
66     public String getExternalName(BoundElement control) {
67         String name;
68
69         if (control instanceof org.chiba.xml.xforms.ui.Trigger) {
70             name = ggf.getUniqueParameterName(ggf.getTriggerPrefix());
71         } else {
72             name = ggf.getUniqueParameterName(ggf.getDataPrefix());
73         }
74
75         //if (LOGGER.isDebugEnabled()) {
76         // LOGGER.debug("mapped " + control + " to '" + name + "' ...");
77         //}
78
79         ((Map)getProperty(WebContextGGF.REQUEST_PARAMETERS)).put(name,control.getId());
80
81         return name;
82     }
83     */

84 }
Popular Tags