KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > barracuda > config > CompConfig


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site (http://www.enhydra.org/).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: CompConfig.java,v 1.1 2004/05/28 19:39:27 slobodan Exp $
22  */

23 package org.enhydra.barracuda.config;
24
25 import java.io.*;
26 import java.util.*;
27 import javax.servlet.*;
28 import javax.servlet.http.*;
29
30 import org.apache.log4j.*;
31
32 import org.enhydra.barracuda.config.events.*;
33 import org.enhydra.barracuda.core.comp.*;
34 import org.enhydra.barracuda.core.comp.helper.*;
35 import org.enhydra.barracuda.core.comp.renderer.*;
36 import org.enhydra.barracuda.core.comp.renderer.html.*;
37 import org.enhydra.barracuda.core.comp.renderer.xml.*;
38 import org.enhydra.barracuda.core.event.*;
39 import org.enhydra.barracuda.core.forms.*;
40 import org.enhydra.barracuda.plankton.http.*;
41
42
43 /**
44  * This class provides the methods needed to configure the component
45  * screens
46  */

47 public class CompConfig extends DefaultEventGateway {
48
49     protected static final Logger logger = Logger.getLogger(CompConfig.class.getName());
50
51     //form id (must be unique)
52
public static final String JavaDoc FORM = CompConfig.class.getName()+".Form";
53
54     //model name
55
public static final String JavaDoc MODEL_NAME = "Comp";
56
57     //model elements (these are the data items supported)
58
//...components
59
public static final String JavaDoc ABSTRACT_BCOMPONENT_DL = "AbstractBComponent_DebugLevel";
60     public static final String JavaDoc BACTION_DL = "BAction_DebugLevel";
61     public static final String JavaDoc BINPUT_DL = "BInput_DebugLevel";
62     public static final String JavaDoc BLINK_DL = "BLink_DebugLevel";
63     public static final String JavaDoc BLIST_DL = "BList_DebugLevel";
64     public static final String JavaDoc BSELECT_DL = "BSelect_DebugLevel";
65     public static final String JavaDoc BTABLE_DL = "BTable_DebugLevel";
66     public static final String JavaDoc BTEMPLATE_DL = "BTemplate_DebugLevel";
67     public static final String JavaDoc BTEXT_DL = "BText_DebugLevel";
68     public static final String JavaDoc BTOGGLE_BUTTON_DL = "BToggleButton_DebugLevel";
69     public static final String JavaDoc COMPONENT_GATEWAY_DL = "ComponentGateway_DebugLevel";
70     //...models
71
public static final String JavaDoc DEFAULT_LIST_MODEL_DL = "DefaultListModel_DebugLevel";
72     public static final String JavaDoc DEFAULT_PROPERTIES_MODEL_DL = "DefaultPropertiesModel_DebugLevel";
73     //...views
74
// public static final String DEFAULT_LIST_VIEW_DL = "DefaultListView_DebugLevel";
75
public static final String JavaDoc DEFAULT_TABLE_VIEW_DL = "DefaultTableView_DebugLevel";
76     public static final String JavaDoc DEFAULT_TEMPLATE_VIEW_DL = "DefaultTemplateView_DebugLevel";
77     public static final String JavaDoc DEFAULT_VIEW_DL = "DefaultView_DebugLevel";
78     //...renderers
79
public static final String JavaDoc HTML_COMPONENT_RENDERER_DL = "HTMLComponentRenderer_DebugLevel";
80     public static final String JavaDoc HTML_ACTION_RENDERER_DL = "HTMLActionRenderer_DebugLevel";
81     public static final String JavaDoc HTML_INPUT_RENDERER_DL = "HTMLInputRenderer_DebugLevel";
82     public static final String JavaDoc HTML_LINK_RENDERER_DL = "HTMLLinkRenderer_DebugLevel";
83     public static final String JavaDoc HTML_LIST_RENDERER_DL = "HTMLListRenderer_DebugLevel";
84     public static final String JavaDoc HTML_SELECT_RENDERER_DL = "HTMLSelectRenderer_DebugLevel";
85     public static final String JavaDoc HTML_TABLE_RENDERER_DL = "HTMLTableRenderer_DebugLevel";
86     public static final String JavaDoc HTML_TOGGLE_RENDERER_DL = "HTMLToggleRenderer_DebugLevel";
87     public static final String JavaDoc HTML_TEMPLATE_RENDERER_DL = "HTMLTemplateRenderer_DebugLevel";
88     public static final String JavaDoc HTML_TEXT_RENDERER_DL = "HTMLTextRenderer_DebugLevel";
89     public static final String JavaDoc TEMPLATE_HELPER_DL = "TemplateHelper_DebugLevel";
90     public static final String JavaDoc XML_COMPONENT_RENDERER_DL = "XMLComponentRenderer_DebugLevel";
91     public static final String JavaDoc XML_TEMPLATE_RENDERER_DL = "XMLTemplateRenderer_DebugLevel";
92     public static final String JavaDoc XML_TEXT_RENDERER_DL = "XMLTextRenderer_DebugLevel";
93     //...buttons
94
public static final String JavaDoc ERROR_MESSAGE = "ErrorMessage";
95     public static final String JavaDoc SUCCESS_MESSAGE = "SuccessMessage";
96     public static final String JavaDoc UPDATE_BUTTON = "UpdateButton";
97
98     //private vars
99
private ListenerFactory updateConfigFactory = new DefaultListenerFactory() {public BaseEventListener getInstance() {return new UpdateConfigHandler();} public String JavaDoc getListenerID() {return getID(UpdateConfigHandler.class);}};
100
101     public CompConfig() {
102         //specify generic interest
103
specifyLocalEventInterests(updateConfigFactory);
104     }
105
106     //------------------------------------------------------------
107
// Data Models
108
//------------------------------------------------------------
109
/**
110      * define the template model that backs this screen
111      */

112     class CompModel extends AbstractTemplateModel {
113
114         //register the model by name
115
public String JavaDoc getName() {return MODEL_NAME;}
116         
117         //provide items by key
118
// public Object getItem(String key, ViewContext vc) {
119
public Object JavaDoc getItem(String JavaDoc key) {
120             ViewContext vc = getViewContext();
121
122             if (logger.isDebugEnabled()) logger.debug("Asking for key:"+key);
123             
124             //Handle requests for data
125
//...components
126
if (key.equals(ABSTRACT_BCOMPONENT_DL)) {
127                 return ScreenUtil.getDebugLevelComp2(vc, key, AbstractBComponent.class);
128             } else if (key.equals(BACTION_DL)) {
129                 return ScreenUtil.getDebugLevelComp2(vc, key, BAction.class);
130             } else if (key.equals(BINPUT_DL)) {
131                 return ScreenUtil.getDebugLevelComp2(vc, key, BInput.class);
132             } else if (key.equals(BLINK_DL)) {
133                 return ScreenUtil.getDebugLevelComp2(vc, key, BLink.class);
134             } else if (key.equals(BLIST_DL)) {
135                 return ScreenUtil.getDebugLevelComp2(vc, key, BList.class);
136             } else if (key.equals(BSELECT_DL)) {
137                 return ScreenUtil.getDebugLevelComp2(vc, key, BSelect.class);
138             } else if (key.equals(BTABLE_DL)) {
139                 return ScreenUtil.getDebugLevelComp2(vc, key, BTable.class);
140             } else if (key.equals(BTEMPLATE_DL)) {
141                 return ScreenUtil.getDebugLevelComp2(vc, key, BTemplate.class);
142             } else if (key.equals(BTEXT_DL)) {
143                 return ScreenUtil.getDebugLevelComp2(vc, key, BText.class);
144             } else if (key.equals(BTOGGLE_BUTTON_DL)) {
145                 return ScreenUtil.getDebugLevelComp2(vc, key, BToggleButton.class);
146             } else if (key.equals(COMPONENT_GATEWAY_DL)) {
147                 return ScreenUtil.getDebugLevelComp2(vc, key, ComponentGateway.class);
148             //...models
149
} else if (key.equals(DEFAULT_LIST_MODEL_DL)) {
150                 return ScreenUtil.getDebugLevelComp2(vc, key, DefaultListModel.class);
151             } else if (key.equals(DEFAULT_PROPERTIES_MODEL_DL)) {
152                 return ScreenUtil.getDebugLevelComp2(vc, key, DefaultPropertiesModel.class);
153             //...views
154
} else if (key.equals(DEFAULT_TABLE_VIEW_DL)) {
155                 return ScreenUtil.getDebugLevelComp2(vc, key, DefaultTableView.class);
156             } else if (key.equals(DEFAULT_TEMPLATE_VIEW_DL)) {
157                 return ScreenUtil.getDebugLevelComp2(vc, key, DefaultTemplateView.class);
158             } else if (key.equals(DEFAULT_VIEW_DL)) {
159                 return ScreenUtil.getDebugLevelComp2(vc, key, DefaultView.class);
160             //...renderers
161
} else if (key.equals(HTML_COMPONENT_RENDERER_DL)) {
162                 return ScreenUtil.getDebugLevelComp2(vc, key, HTMLComponentRenderer.class);
163             } else if (key.equals(HTML_COMPONENT_RENDERER_DL)) {
164                 return ScreenUtil.getDebugLevelComp2(vc, key, HTMLComponentRenderer.class);
165             } else if (key.equals(HTML_ACTION_RENDERER_DL)) {
166                 return ScreenUtil.getDebugLevelComp2(vc, key, HTMLActionRenderer.class);
167             } else if (key.equals(HTML_INPUT_RENDERER_DL)) {
168                 return ScreenUtil.getDebugLevelComp2(vc, key, HTMLInputRenderer.class);
169             } else if (key.equals(HTML_LINK_RENDERER_DL)) {
170                 return ScreenUtil.getDebugLevelComp2(vc, key, HTMLLinkRenderer.class);
171             } else if (key.equals(HTML_LIST_RENDERER_DL)) {
172                 return ScreenUtil.getDebugLevelComp2(vc, key, HTMLListRenderer.class);
173             } else if (key.equals(HTML_SELECT_RENDERER_DL)) {
174                 return ScreenUtil.getDebugLevelComp2(vc, key, HTMLSelectRenderer.class);
175             } else if (key.equals(HTML_TABLE_RENDERER_DL)) {
176                 return ScreenUtil.getDebugLevelComp2(vc, key, HTMLTableRenderer.class);
177             } else if (key.equals(HTML_TOGGLE_RENDERER_DL)) {
178                 return ScreenUtil.getDebugLevelComp2(vc, key, HTMLToggleRenderer.class);
179             } else if (key.equals(HTML_TEMPLATE_RENDERER_DL)) {
180                 return ScreenUtil.getDebugLevelComp2(vc, key, HTMLTemplateRenderer.class);
181             } else if (key.equals(HTML_TEXT_RENDERER_DL)) {
182                 return ScreenUtil.getDebugLevelComp2(vc, key, HTMLTextRenderer.class);
183             } else if (key.equals(TEMPLATE_HELPER_DL)) {
184                 return ScreenUtil.getDebugLevelComp2(vc, key, TemplateHelper.class);
185             } else if (key.equals(XML_COMPONENT_RENDERER_DL)) {
186                 return ScreenUtil.getDebugLevelComp2(vc, key, XMLComponentRenderer.class);
187             } else if (key.equals(XML_TEMPLATE_RENDERER_DL)) {
188                 return ScreenUtil.getDebugLevelComp2(vc, key, XMLTemplateRenderer.class);
189             } else if (key.equals(XML_TEXT_RENDERER_DL)) {
190                 return ScreenUtil.getDebugLevelComp2(vc, key, XMLTextRenderer.class);
191             //...buttons
192
} else if (key.equals(ERROR_MESSAGE)) {
193                 return ScreenUtil.getErrMsg(vc, FORM, ERROR_MESSAGE);
194             } else if (key.equals(SUCCESS_MESSAGE)) {
195                 return ScreenUtil.getSuccessMsg(vc, FORM, SUCCESS_MESSAGE);
196             } else if (key.equals(UPDATE_BUTTON)) {
197                 return ScreenUtil.getUpdateButtonComp(vc, updateConfigFactory);
198 // } else return super.getItem(key, vc);
199
} else return super.getItem(key);
200             
201         }
202     }
203
204     //------------------------------------------------------------
205
// Form Mappings, Validators
206
//------------------------------------------------------------
207
/**
208      * define the form map that backs the model
209      */

210     class CompForm extends DefaultFormMap {
211         public CompForm() {
212             //define the elements (note: these don't need any validators). Note
213
//also that we set the defaults to the current values. This allows
214
//us just to reset all current values down below without checking to
215
//see if the elements actually got passed in from the form.
216
if (logger.isDebugEnabled()) logger.debug("Defining form elements");
217             //...components
218
this.defineElement(new DefaultFormElement(ABSTRACT_BCOMPONENT_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(AbstractBComponent.class)), null, false));
219             this.defineElement(new DefaultFormElement(BACTION_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(BAction.class)), null, false));
220             this.defineElement(new DefaultFormElement(BINPUT_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(BInput.class)), null, false));
221             this.defineElement(new DefaultFormElement(BLINK_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(BLink.class)), null, false));
222             this.defineElement(new DefaultFormElement(BLIST_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(BList.class)), null, false));
223             this.defineElement(new DefaultFormElement(BSELECT_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(BSelect.class)), null, false));
224             this.defineElement(new DefaultFormElement(BTABLE_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(BTable.class)), null, false));
225             this.defineElement(new DefaultFormElement(BTEMPLATE_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(BTemplate.class)), null, false));
226             this.defineElement(new DefaultFormElement(BTEXT_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(BText.class)), null, false));
227             this.defineElement(new DefaultFormElement(BTOGGLE_BUTTON_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(BToggleButton.class)), null, false));
228             this.defineElement(new DefaultFormElement(COMPONENT_GATEWAY_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(ComponentGateway.class)), null, false));
229             //...models
230
this.defineElement(new DefaultFormElement(DEFAULT_LIST_MODEL_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(DefaultListModel.class)), null, false));
231             this.defineElement(new DefaultFormElement(DEFAULT_PROPERTIES_MODEL_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(DefaultPropertiesModel.class)), null, false));
232             //...views
233
this.defineElement(new DefaultFormElement(DEFAULT_TABLE_VIEW_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(DefaultTableView.class)), null, false));
234             this.defineElement(new DefaultFormElement(DEFAULT_TEMPLATE_VIEW_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(DefaultTemplateView.class)), null, false));
235             this.defineElement(new DefaultFormElement(DEFAULT_VIEW_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(DefaultView.class)), null, false));
236             //...renderers
237
this.defineElement(new DefaultFormElement(HTML_COMPONENT_RENDERER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(HTMLComponentRenderer.class)), null, false));
238             this.defineElement(new DefaultFormElement(HTML_COMPONENT_RENDERER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(HTMLComponentRenderer.class)), null, false));
239             this.defineElement(new DefaultFormElement(HTML_ACTION_RENDERER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(HTMLActionRenderer.class)), null, false));
240             this.defineElement(new DefaultFormElement(HTML_INPUT_RENDERER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(HTMLInputRenderer.class)), null, false));
241             this.defineElement(new DefaultFormElement(HTML_LINK_RENDERER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(HTMLLinkRenderer.class)), null, false));
242             this.defineElement(new DefaultFormElement(HTML_LIST_RENDERER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(HTMLListRenderer.class)), null, false));
243             this.defineElement(new DefaultFormElement(HTML_SELECT_RENDERER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(HTMLSelectRenderer.class)), null, false));
244             this.defineElement(new DefaultFormElement(HTML_TABLE_RENDERER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(HTMLTableRenderer.class)), null, false));
245             this.defineElement(new DefaultFormElement(HTML_TOGGLE_RENDERER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(HTMLToggleRenderer.class)), null, false));
246             this.defineElement(new DefaultFormElement(HTML_TEMPLATE_RENDERER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(HTMLTemplateRenderer.class)), null, false));
247             this.defineElement(new DefaultFormElement(HTML_TEXT_RENDERER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(HTMLTextRenderer.class)), null, false));
248             this.defineElement(new DefaultFormElement(TEMPLATE_HELPER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(TemplateHelper.class)), null, false));
249             this.defineElement(new DefaultFormElement(XML_COMPONENT_RENDERER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(XMLComponentRenderer.class)), null, false));
250             this.defineElement(new DefaultFormElement(XML_TEMPLATE_RENDERER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(XMLTemplateRenderer.class)), null, false));
251             this.defineElement(new DefaultFormElement(XML_TEXT_RENDERER_DL, FormType.INTEGER, new Integer JavaDoc(ScreenUtil.cvtLevelToInt(XMLTextRenderer.class)), null, false));
252         }
253     }
254
255     //------------------------------------------------------------
256
// Model 2 - Controller Event Handlers
257
//------------------------------------------------------------
258
/**
259      * UpdateConfigHandler - handle the request to update the config
260      * screen.
261      */

262     class UpdateConfigHandler extends DefaultBaseEventListener {
263         public void handleControlEvent(ControlEventContext context) throws EventException, ServletException, IOException {
264             //figure out our target locale and get the appropriate screen
265
Locale locale = context.getViewCapabilities().getClientLocale();
266             MasterScreen screen = new MasterScreenFactory().getInstance(CompConfig.this, context, locale);
267             if (logger.isDebugEnabled()) ServletUtil.showParams(context.getRequest(), logger);
268             
269             //create the login form
270
ValidationException ve = null;
271             CompForm formMap = new CompForm();
272             try {
273                 //map/validate the form
274
formMap.map(context.getRequest()).validate(true);
275                 
276                 //If there were no errors, update the data. Note that we just
277
//assume that all the data is here. The reason we can do this is
278
//because we prepopulated the form up above with the default values.
279
//The more proper way would be to check each value, see if it's set,
280
//and then only update it if the value has actually changed. Lot more
281
//code to do that though, and since we're just setting statics, the
282
//cost of doing it this way is minimal.
283
//...components
284
ScreenUtil.setLevel(AbstractBComponent.class, formMap.getIntegerVal(ABSTRACT_BCOMPONENT_DL).intValue());
285                 ScreenUtil.setLevel(BAction.class, formMap.getIntegerVal(BACTION_DL).intValue());
286                 ScreenUtil.setLevel(BInput.class, formMap.getIntegerVal(BINPUT_DL).intValue());
287                 ScreenUtil.setLevel(BLink.class, formMap.getIntegerVal(BLINK_DL).intValue());
288                 ScreenUtil.setLevel(ScreenUtil.class, formMap.getIntegerVal(BLIST_DL).intValue());
289                 ScreenUtil.setLevel(ScreenUtil.class, formMap.getIntegerVal(BSELECT_DL).intValue());
290                 ScreenUtil.setLevel(ScreenUtil.class, formMap.getIntegerVal(BTABLE_DL).intValue());
291                 ScreenUtil.setLevel(ScreenUtil.class, formMap.getIntegerVal(BTEMPLATE_DL).intValue());
292                 ScreenUtil.setLevel(BText.class, formMap.getIntegerVal(BTEXT_DL).intValue());
293                 ScreenUtil.setLevel(BToggleButton.class, formMap.getIntegerVal(BTOGGLE_BUTTON_DL).intValue());
294                 ScreenUtil.setLevel(ComponentGateway.class, formMap.getIntegerVal(COMPONENT_GATEWAY_DL).intValue());
295                 //...models
296
ScreenUtil.setLevel(DefaultListModel.class, formMap.getIntegerVal(DEFAULT_LIST_MODEL_DL).intValue());
297                 ScreenUtil.setLevel(DefaultPropertiesModel.class, formMap.getIntegerVal(DEFAULT_PROPERTIES_MODEL_DL).intValue());
298                 //...views
299
ScreenUtil.setLevel(DefaultTableView.class, formMap.getIntegerVal(DEFAULT_TABLE_VIEW_DL).intValue());
300                 ScreenUtil.setLevel(DefaultTemplateView.class, formMap.getIntegerVal(DEFAULT_TEMPLATE_VIEW_DL).intValue());
301                 ScreenUtil.setLevel(DefaultView.class, formMap.getIntegerVal(DEFAULT_VIEW_DL).intValue());
302                 //...renderers
303
ScreenUtil.setLevel(HTMLComponentRenderer.class, formMap.getIntegerVal(HTML_COMPONENT_RENDERER_DL).intValue());
304                 ScreenUtil.setLevel(HTMLComponentRenderer.class, formMap.getIntegerVal(HTML_COMPONENT_RENDERER_DL).intValue());
305                 ScreenUtil.setLevel(HTMLActionRenderer.class, formMap.getIntegerVal(HTML_ACTION_RENDERER_DL).intValue());
306                 ScreenUtil.setLevel(HTMLInputRenderer.class, formMap.getIntegerVal(HTML_INPUT_RENDERER_DL).intValue());
307                 ScreenUtil.setLevel(HTMLLinkRenderer.class, formMap.getIntegerVal(HTML_LINK_RENDERER_DL).intValue());
308                 ScreenUtil.setLevel(HTMLListRenderer.class, formMap.getIntegerVal(HTML_LIST_RENDERER_DL).intValue());
309                 ScreenUtil.setLevel(HTMLSelectRenderer.class, formMap.getIntegerVal(HTML_SELECT_RENDERER_DL).intValue());
310                 ScreenUtil.setLevel(HTMLTableRenderer.class, formMap.getIntegerVal(HTML_TABLE_RENDERER_DL).intValue());
311                 ScreenUtil.setLevel(HTMLToggleRenderer.class, formMap.getIntegerVal(HTML_TOGGLE_RENDERER_DL).intValue());
312                 ScreenUtil.setLevel(HTMLTemplateRenderer.class, formMap.getIntegerVal(HTML_TEMPLATE_RENDERER_DL).intValue());
313                 ScreenUtil.setLevel(HTMLTextRenderer.class, formMap.getIntegerVal(HTML_TEXT_RENDERER_DL).intValue());
314                 ScreenUtil.setLevel(TemplateHelper.class, formMap.getIntegerVal(TEMPLATE_HELPER_DL).intValue());
315                 ScreenUtil.setLevel(XMLComponentRenderer.class, formMap.getIntegerVal(XML_COMPONENT_RENDERER_DL).intValue());
316                 ScreenUtil.setLevel(XMLTemplateRenderer.class, formMap.getIntegerVal(XML_TEMPLATE_RENDERER_DL).intValue());
317                 ScreenUtil.setLevel(XMLTextRenderer.class, formMap.getIntegerVal(XML_TEXT_RENDERER_DL).intValue());
318
319                 //remember our success
320
formMap.putState(SUCCESS_MESSAGE, new Boolean JavaDoc(true));
321
322             } catch (ValidationException e) {
323                 ve = e;
324             }
325
326             //store the error message in the form and then put the form in the
327
//the event context
328
formMap.putState(ERROR_MESSAGE, ve);
329             context.putState(FORM, formMap);
330
331             //fire an update so that the screen will redraw
332
((CompModel) screen.compModel).fireModelChanged();
333
334             //redirect to the get screen again
335
throw new ClientSideRedirectException(new GetBConfig());
336         }
337     }
338
339     //------------------------------------------------------------
340
// Utility Methods
341
//------------------------------------------------------------
342
public TemplateModel getModel() {
343         return new CompModel();
344     }
345 }
346
347
Popular Tags