KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > verge > mvc > controller > form > config > FormConfig


1 /*
2  * Copyright (c) 2003, Inversoft
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.verge.mvc.controller.form.config;
8
9
10 import java.util.HashMap JavaDoc;
11 import java.util.Map JavaDoc;
12
13 import com.inversoft.verge.mvc.config.BaseFormConfig;
14 import com.inversoft.verge.mvc.controller.LongTxnSetup;
15
16
17 /**
18  * This class is a simple JavaBean that holds information
19  * about a form's configuration.
20  *
21  * @author Brian Pontarelli
22  */

23 public class FormConfig extends BaseFormConfig {
24
25     private Map JavaDoc actions;
26     private Map JavaDoc mappings;
27     private LongTxnSetup longTxnSetup;
28
29
30     public FormConfig(BaseFormConfig base) {
31         super(base);
32         actions = new HashMap JavaDoc();
33         mappings = new HashMap JavaDoc();
34     }
35
36
37     /**
38      * Adds a new action to the form with the name, bean (handle method) and optional
39      * handle method object
40      */

41     void addActionConfig(String JavaDoc name, ActionConfig action) {
42         actions.put(name, action);
43     }
44
45     /**
46      * Retrieves the Action with the given name.
47      */

48     public ActionConfig getActionConfig(String JavaDoc name) {
49         return (ActionConfig) actions.get(name);
50     }
51
52     /**
53      * Adds a new mapping to the form with the name, bean (handle method) and optional
54      * handle method object
55      */

56     void addMappingConfig(String JavaDoc name, MappingConfig mapping) {
57         mappings.put(name, mapping);
58     }
59
60     /**
61      * Retrieves the mapping with the given name.
62      */

63     public MappingConfig getMappingConfig(String JavaDoc name) {
64         return (MappingConfig) mappings.get(name);
65     }
66
67     /**
68      * Returns the LongTxnSetup to use to retrieve URLs if needed.
69      *
70      * @return The LongTxnSetup to use
71      */

72     public LongTxnSetup getLongTxnSetup() {
73         return longTxnSetup;
74     }
75
76     /**
77      * Sets the LongTxnSetup to use to retrieve URLs if needed.
78      *
79      * @param longTxnSetup The LongTxnSetup to use
80      */

81     void setLongTxnSetup(LongTxnSetup longTxnSetup) {
82         this.longTxnSetup = longTxnSetup;
83     }
84 }
Popular Tags