001: /*
002: * Enhydra Java Application Server Project
003: *
004: * The contents of this file are subject to the Enhydra Public License
005: * Version 1.1 (the "License"); you may not use this file except in
006: * compliance with the License. You may obtain a copy of the License on
007: * the Enhydra web site (http://www.enhydra.org/).
008: *
009: * Software distributed under the License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011: * the License for the specific terms governing rights and limitations
012: * under the License.
013: *
014: * The Initial Developer of the Enhydra Application Server is Lutris
015: * Technologies, Inc. The Enhydra Application Server and portions created
016: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017: * All Rights Reserved.
018: *
019: * Contributor(s):
020: *
021: * $Id: CompConfig.java,v 1.1 2006-09-11 12:30:02 sinisa Exp $
022: */
023: package org.enhydra.barracuda.config;
024:
025: import java.io.*;
026: import java.util.*;
027: import javax.servlet.*;
028: import javax.servlet.http.*;
029:
030: import org.apache.log4j.*;
031:
032: import org.enhydra.barracuda.config.events.*;
033: import org.barracudamvc.core.comp.*;
034: import org.barracudamvc.core.comp.helper.*;
035: import org.barracudamvc.core.comp.renderer.*;
036: import org.barracudamvc.core.comp.renderer.html.*;
037: import org.barracudamvc.core.comp.renderer.xml.*;
038: import org.barracudamvc.core.event.*;
039: import org.barracudamvc.core.forms.*;
040: import org.barracudamvc.plankton.http.*;
041:
042: /**
043: * This class provides the methods needed to configure the component
044: * screens
045: */
046: public class CompConfig extends DefaultEventGateway {
047:
048: protected static final Logger logger = Logger
049: .getLogger(CompConfig.class.getName());
050:
051: //form id (must be unique)
052: public static final String FORM = CompConfig.class.getName()
053: + ".Form";
054:
055: //model name
056: public static final String MODEL_NAME = "Comp";
057:
058: //model elements (these are the data items supported)
059: //...components
060: public static final String ABSTRACT_BCOMPONENT_DL = "AbstractBComponent_DebugLevel";
061: public static final String BACTION_DL = "BAction_DebugLevel";
062: public static final String BINPUT_DL = "BInput_DebugLevel";
063: public static final String BLINK_DL = "BLink_DebugLevel";
064: public static final String BLIST_DL = "BList_DebugLevel";
065: public static final String BSELECT_DL = "BSelect_DebugLevel";
066: public static final String BTABLE_DL = "BTable_DebugLevel";
067: public static final String BTEMPLATE_DL = "BTemplate_DebugLevel";
068: public static final String BTEXT_DL = "BText_DebugLevel";
069: public static final String BTOGGLE_BUTTON_DL = "BToggleButton_DebugLevel";
070: public static final String COMPONENT_GATEWAY_DL = "ComponentGateway_DebugLevel";
071: //...models
072: public static final String DEFAULT_LIST_MODEL_DL = "DefaultListModel_DebugLevel";
073: public static final String DEFAULT_PROPERTIES_MODEL_DL = "DefaultPropertiesModel_DebugLevel";
074: //...views
075: // public static final String DEFAULT_LIST_VIEW_DL = "DefaultListView_DebugLevel";
076: public static final String DEFAULT_TABLE_VIEW_DL = "DefaultTableView_DebugLevel";
077: public static final String DEFAULT_TEMPLATE_VIEW_DL = "DefaultTemplateView_DebugLevel";
078: public static final String DEFAULT_VIEW_DL = "DefaultView_DebugLevel";
079: //...renderers
080: public static final String HTML_COMPONENT_RENDERER_DL = "HTMLComponentRenderer_DebugLevel";
081: public static final String HTML_ACTION_RENDERER_DL = "HTMLActionRenderer_DebugLevel";
082: public static final String HTML_INPUT_RENDERER_DL = "HTMLInputRenderer_DebugLevel";
083: public static final String HTML_LINK_RENDERER_DL = "HTMLLinkRenderer_DebugLevel";
084: public static final String HTML_LIST_RENDERER_DL = "HTMLListRenderer_DebugLevel";
085: public static final String HTML_SELECT_RENDERER_DL = "HTMLSelectRenderer_DebugLevel";
086: public static final String HTML_TABLE_RENDERER_DL = "HTMLTableRenderer_DebugLevel";
087: public static final String HTML_TOGGLE_RENDERER_DL = "HTMLToggleRenderer_DebugLevel";
088: public static final String HTML_TEMPLATE_RENDERER_DL = "HTMLTemplateRenderer_DebugLevel";
089: public static final String HTML_TEXT_RENDERER_DL = "HTMLTextRenderer_DebugLevel";
090: public static final String TEMPLATE_HELPER_DL = "TemplateHelper_DebugLevel";
091: public static final String XML_COMPONENT_RENDERER_DL = "XMLComponentRenderer_DebugLevel";
092: public static final String XML_TEMPLATE_RENDERER_DL = "XMLTemplateRenderer_DebugLevel";
093: public static final String XML_TEXT_RENDERER_DL = "XMLTextRenderer_DebugLevel";
094: //...buttons
095: public static final String ERROR_MESSAGE = "ErrorMessage";
096: public static final String SUCCESS_MESSAGE = "SuccessMessage";
097: public static final String UPDATE_BUTTON = "UpdateButton";
098:
099: //private vars
100: private ListenerFactory updateConfigFactory = new DefaultListenerFactory() {
101: public BaseEventListener getInstance() {
102: return new UpdateConfigHandler();
103: }
104:
105: public String getListenerID() {
106: return getID(UpdateConfigHandler.class);
107: }
108: };
109:
110: public CompConfig() {
111: //specify generic interest
112: specifyLocalEventInterests(updateConfigFactory);
113: }
114:
115: //------------------------------------------------------------
116: // Data Models
117: //------------------------------------------------------------
118: /**
119: * define the template model that backs this screen
120: */
121: class CompModel extends AbstractTemplateModel {
122:
123: //register the model by name
124: public String getName() {
125: return MODEL_NAME;
126: }
127:
128: //provide items by key
129: // public Object getItem(String key, ViewContext vc) {
130: public Object getItem(String key) {
131: ViewContext vc = getViewContext();
132:
133: if (logger.isDebugEnabled())
134: logger.debug("Asking for key:" + key);
135:
136: //Handle requests for data
137: //...components
138: if (key.equals(ABSTRACT_BCOMPONENT_DL)) {
139: return ScreenUtil.getDebugLevelComp2(vc, key,
140: AbstractBComponent.class);
141: } else if (key.equals(BACTION_DL)) {
142: return ScreenUtil.getDebugLevelComp2(vc, key,
143: BAction.class);
144: } else if (key.equals(BINPUT_DL)) {
145: return ScreenUtil.getDebugLevelComp2(vc, key,
146: BInput.class);
147: } else if (key.equals(BLINK_DL)) {
148: return ScreenUtil.getDebugLevelComp2(vc, key,
149: BLink.class);
150: } else if (key.equals(BLIST_DL)) {
151: return ScreenUtil.getDebugLevelComp2(vc, key,
152: BList.class);
153: } else if (key.equals(BSELECT_DL)) {
154: return ScreenUtil.getDebugLevelComp2(vc, key,
155: BSelect.class);
156: } else if (key.equals(BTABLE_DL)) {
157: return ScreenUtil.getDebugLevelComp2(vc, key,
158: BTable.class);
159: } else if (key.equals(BTEMPLATE_DL)) {
160: return ScreenUtil.getDebugLevelComp2(vc, key,
161: BTemplate.class);
162: } else if (key.equals(BTEXT_DL)) {
163: return ScreenUtil.getDebugLevelComp2(vc, key,
164: BText.class);
165: } else if (key.equals(BTOGGLE_BUTTON_DL)) {
166: return ScreenUtil.getDebugLevelComp2(vc, key,
167: BToggleButton.class);
168: } else if (key.equals(COMPONENT_GATEWAY_DL)) {
169: return ScreenUtil.getDebugLevelComp2(vc, key,
170: ComponentGateway.class);
171: //...models
172: } else if (key.equals(DEFAULT_LIST_MODEL_DL)) {
173: return ScreenUtil.getDebugLevelComp2(vc, key,
174: DefaultListModel.class);
175: } else if (key.equals(DEFAULT_PROPERTIES_MODEL_DL)) {
176: return ScreenUtil.getDebugLevelComp2(vc, key,
177: DefaultPropertiesModel.class);
178: //...views
179: } else if (key.equals(DEFAULT_TABLE_VIEW_DL)) {
180: return ScreenUtil.getDebugLevelComp2(vc, key,
181: DefaultTableView.class);
182: } else if (key.equals(DEFAULT_TEMPLATE_VIEW_DL)) {
183: return ScreenUtil.getDebugLevelComp2(vc, key,
184: DefaultTemplateView.class);
185: } else if (key.equals(DEFAULT_VIEW_DL)) {
186: return ScreenUtil.getDebugLevelComp2(vc, key,
187: DefaultView.class);
188: //...renderers
189: } else if (key.equals(HTML_COMPONENT_RENDERER_DL)) {
190: return ScreenUtil.getDebugLevelComp2(vc, key,
191: HTMLComponentRenderer.class);
192: } else if (key.equals(HTML_COMPONENT_RENDERER_DL)) {
193: return ScreenUtil.getDebugLevelComp2(vc, key,
194: HTMLComponentRenderer.class);
195: } else if (key.equals(HTML_ACTION_RENDERER_DL)) {
196: return ScreenUtil.getDebugLevelComp2(vc, key,
197: HTMLActionRenderer.class);
198: } else if (key.equals(HTML_INPUT_RENDERER_DL)) {
199: return ScreenUtil.getDebugLevelComp2(vc, key,
200: HTMLInputRenderer.class);
201: } else if (key.equals(HTML_LINK_RENDERER_DL)) {
202: return ScreenUtil.getDebugLevelComp2(vc, key,
203: HTMLLinkRenderer.class);
204: } else if (key.equals(HTML_LIST_RENDERER_DL)) {
205: return ScreenUtil.getDebugLevelComp2(vc, key,
206: HTMLListRenderer.class);
207: } else if (key.equals(HTML_SELECT_RENDERER_DL)) {
208: return ScreenUtil.getDebugLevelComp2(vc, key,
209: HTMLSelectRenderer.class);
210: } else if (key.equals(HTML_TABLE_RENDERER_DL)) {
211: return ScreenUtil.getDebugLevelComp2(vc, key,
212: HTMLTableRenderer.class);
213: } else if (key.equals(HTML_TOGGLE_RENDERER_DL)) {
214: return ScreenUtil.getDebugLevelComp2(vc, key,
215: HTMLToggleRenderer.class);
216: } else if (key.equals(HTML_TEMPLATE_RENDERER_DL)) {
217: return ScreenUtil.getDebugLevelComp2(vc, key,
218: HTMLTemplateRenderer.class);
219: } else if (key.equals(HTML_TEXT_RENDERER_DL)) {
220: return ScreenUtil.getDebugLevelComp2(vc, key,
221: HTMLTextRenderer.class);
222: } else if (key.equals(TEMPLATE_HELPER_DL)) {
223: return ScreenUtil.getDebugLevelComp2(vc, key,
224: TemplateHelper.class);
225: } else if (key.equals(XML_COMPONENT_RENDERER_DL)) {
226: return ScreenUtil.getDebugLevelComp2(vc, key,
227: XMLComponentRenderer.class);
228: } else if (key.equals(XML_TEMPLATE_RENDERER_DL)) {
229: return ScreenUtil.getDebugLevelComp2(vc, key,
230: XMLTemplateRenderer.class);
231: } else if (key.equals(XML_TEXT_RENDERER_DL)) {
232: return ScreenUtil.getDebugLevelComp2(vc, key,
233: XMLTextRenderer.class);
234: //...buttons
235: } else if (key.equals(ERROR_MESSAGE)) {
236: return ScreenUtil.getErrMsg(vc, FORM, ERROR_MESSAGE);
237: } else if (key.equals(SUCCESS_MESSAGE)) {
238: return ScreenUtil.getSuccessMsg(vc, FORM,
239: SUCCESS_MESSAGE);
240: } else if (key.equals(UPDATE_BUTTON)) {
241: return ScreenUtil.getUpdateButtonComp(vc,
242: updateConfigFactory);
243: // } else return super.getItem(key, vc);
244: } else
245: return super .getItem(key);
246:
247: }
248: }
249:
250: //------------------------------------------------------------
251: // Form Mappings, Validators
252: //------------------------------------------------------------
253: /**
254: * define the form map that backs the model
255: */
256: class CompForm extends DefaultFormMap {
257: public CompForm() {
258: //define the elements (note: these don't need any validators). Note
259: //also that we set the defaults to the current values. This allows
260: //us just to reset all current values down below without checking to
261: //see if the elements actually got passed in from the form.
262: if (logger.isDebugEnabled())
263: logger.debug("Defining form elements");
264: //...components
265: this .defineElement(new DefaultFormElement(
266: ABSTRACT_BCOMPONENT_DL, FormType.INTEGER,
267: new Integer(ScreenUtil
268: .cvtLevelToInt(AbstractBComponent.class)),
269: null, false));
270: this
271: .defineElement(new DefaultFormElement(BACTION_DL,
272: FormType.INTEGER, new Integer(ScreenUtil
273: .cvtLevelToInt(BAction.class)),
274: null, false));
275: this
276: .defineElement(new DefaultFormElement(BINPUT_DL,
277: FormType.INTEGER, new Integer(ScreenUtil
278: .cvtLevelToInt(BInput.class)),
279: null, false));
280: this .defineElement(new DefaultFormElement(BLINK_DL,
281: FormType.INTEGER, new Integer(ScreenUtil
282: .cvtLevelToInt(BLink.class)), null, false));
283: this .defineElement(new DefaultFormElement(BLIST_DL,
284: FormType.INTEGER, new Integer(ScreenUtil
285: .cvtLevelToInt(BList.class)), null, false));
286: this
287: .defineElement(new DefaultFormElement(BSELECT_DL,
288: FormType.INTEGER, new Integer(ScreenUtil
289: .cvtLevelToInt(BSelect.class)),
290: null, false));
291: this
292: .defineElement(new DefaultFormElement(BTABLE_DL,
293: FormType.INTEGER, new Integer(ScreenUtil
294: .cvtLevelToInt(BTable.class)),
295: null, false));
296: this .defineElement(new DefaultFormElement(BTEMPLATE_DL,
297: FormType.INTEGER, new Integer(ScreenUtil
298: .cvtLevelToInt(BTemplate.class)), null,
299: false));
300: this .defineElement(new DefaultFormElement(BTEXT_DL,
301: FormType.INTEGER, new Integer(ScreenUtil
302: .cvtLevelToInt(BText.class)), null, false));
303: this .defineElement(new DefaultFormElement(
304: BTOGGLE_BUTTON_DL, FormType.INTEGER,
305: new Integer(ScreenUtil
306: .cvtLevelToInt(BToggleButton.class)), null,
307: false));
308: this .defineElement(new DefaultFormElement(
309: COMPONENT_GATEWAY_DL, FormType.INTEGER,
310: new Integer(ScreenUtil
311: .cvtLevelToInt(ComponentGateway.class)),
312: null, false));
313: //...models
314: this .defineElement(new DefaultFormElement(
315: DEFAULT_LIST_MODEL_DL, FormType.INTEGER,
316: new Integer(ScreenUtil
317: .cvtLevelToInt(DefaultListModel.class)),
318: null, false));
319: this
320: .defineElement(new DefaultFormElement(
321: DEFAULT_PROPERTIES_MODEL_DL,
322: FormType.INTEGER,
323: new Integer(
324: ScreenUtil
325: .cvtLevelToInt(DefaultPropertiesModel.class)),
326: null, false));
327: //...views
328: this .defineElement(new DefaultFormElement(
329: DEFAULT_TABLE_VIEW_DL, FormType.INTEGER,
330: new Integer(ScreenUtil
331: .cvtLevelToInt(DefaultTableView.class)),
332: null, false));
333: this .defineElement(new DefaultFormElement(
334: DEFAULT_TEMPLATE_VIEW_DL, FormType.INTEGER,
335: new Integer(ScreenUtil
336: .cvtLevelToInt(DefaultTemplateView.class)),
337: null, false));
338: this .defineElement(new DefaultFormElement(DEFAULT_VIEW_DL,
339: FormType.INTEGER, new Integer(ScreenUtil
340: .cvtLevelToInt(DefaultView.class)), null,
341: false));
342: //...renderers
343: this
344: .defineElement(new DefaultFormElement(
345: HTML_COMPONENT_RENDERER_DL,
346: FormType.INTEGER,
347: new Integer(
348: ScreenUtil
349: .cvtLevelToInt(HTMLComponentRenderer.class)),
350: null, false));
351: this
352: .defineElement(new DefaultFormElement(
353: HTML_COMPONENT_RENDERER_DL,
354: FormType.INTEGER,
355: new Integer(
356: ScreenUtil
357: .cvtLevelToInt(HTMLComponentRenderer.class)),
358: null, false));
359: this .defineElement(new DefaultFormElement(
360: HTML_ACTION_RENDERER_DL, FormType.INTEGER,
361: new Integer(ScreenUtil
362: .cvtLevelToInt(HTMLActionRenderer.class)),
363: null, false));
364: this .defineElement(new DefaultFormElement(
365: HTML_INPUT_RENDERER_DL, FormType.INTEGER,
366: new Integer(ScreenUtil
367: .cvtLevelToInt(HTMLInputRenderer.class)),
368: null, false));
369: this .defineElement(new DefaultFormElement(
370: HTML_LINK_RENDERER_DL, FormType.INTEGER,
371: new Integer(ScreenUtil
372: .cvtLevelToInt(HTMLLinkRenderer.class)),
373: null, false));
374: this .defineElement(new DefaultFormElement(
375: HTML_LIST_RENDERER_DL, FormType.INTEGER,
376: new Integer(ScreenUtil
377: .cvtLevelToInt(HTMLListRenderer.class)),
378: null, false));
379: this .defineElement(new DefaultFormElement(
380: HTML_SELECT_RENDERER_DL, FormType.INTEGER,
381: new Integer(ScreenUtil
382: .cvtLevelToInt(HTMLSelectRenderer.class)),
383: null, false));
384: this .defineElement(new DefaultFormElement(
385: HTML_TABLE_RENDERER_DL, FormType.INTEGER,
386: new Integer(ScreenUtil
387: .cvtLevelToInt(HTMLTableRenderer.class)),
388: null, false));
389: this .defineElement(new DefaultFormElement(
390: HTML_TOGGLE_RENDERER_DL, FormType.INTEGER,
391: new Integer(ScreenUtil
392: .cvtLevelToInt(HTMLToggleRenderer.class)),
393: null, false));
394: this
395: .defineElement(new DefaultFormElement(
396: HTML_TEMPLATE_RENDERER_DL,
397: FormType.INTEGER,
398: new Integer(
399: ScreenUtil
400: .cvtLevelToInt(HTMLTemplateRenderer.class)),
401: null, false));
402: this .defineElement(new DefaultFormElement(
403: HTML_TEXT_RENDERER_DL, FormType.INTEGER,
404: new Integer(ScreenUtil
405: .cvtLevelToInt(HTMLTextRenderer.class)),
406: null, false));
407: this .defineElement(new DefaultFormElement(
408: TEMPLATE_HELPER_DL, FormType.INTEGER,
409: new Integer(ScreenUtil
410: .cvtLevelToInt(TemplateHelper.class)),
411: null, false));
412: this
413: .defineElement(new DefaultFormElement(
414: XML_COMPONENT_RENDERER_DL,
415: FormType.INTEGER,
416: new Integer(
417: ScreenUtil
418: .cvtLevelToInt(XMLComponentRenderer.class)),
419: null, false));
420: this .defineElement(new DefaultFormElement(
421: XML_TEMPLATE_RENDERER_DL, FormType.INTEGER,
422: new Integer(ScreenUtil
423: .cvtLevelToInt(XMLTemplateRenderer.class)),
424: null, false));
425: this .defineElement(new DefaultFormElement(
426: XML_TEXT_RENDERER_DL, FormType.INTEGER,
427: new Integer(ScreenUtil
428: .cvtLevelToInt(XMLTextRenderer.class)),
429: null, false));
430: }
431: }
432:
433: //------------------------------------------------------------
434: // Model 2 - Controller Event Handlers
435: //------------------------------------------------------------
436: /**
437: * UpdateConfigHandler - handle the request to update the config
438: * screen.
439: */
440: class UpdateConfigHandler extends DefaultBaseEventListener {
441: public void handleControlEvent(ControlEventContext context)
442: throws EventException, ServletException, IOException {
443: //figure out our target locale and get the appropriate screen
444: Locale locale = context.getViewCapabilities()
445: .getClientLocale();
446: MasterScreen screen = new MasterScreenFactory()
447: .getInstance(CompConfig.this , context, locale);
448: if (logger.isDebugEnabled())
449: ServletUtil.showParams(context.getRequest(), logger);
450:
451: //create the login form
452: ValidationException ve = null;
453: CompForm formMap = new CompForm();
454: try {
455: //map/validate the form
456: formMap.map(context.getRequest()).validate(true);
457:
458: //If there were no errors, update the data. Note that we just
459: //assume that all the data is here. The reason we can do this is
460: //because we prepopulated the form up above with the default values.
461: //The more proper way would be to check each value, see if it's set,
462: //and then only update it if the value has actually changed. Lot more
463: //code to do that though, and since we're just setting statics, the
464: //cost of doing it this way is minimal.
465: //...components
466: ScreenUtil.setLevel(AbstractBComponent.class,
467: ((Integer) formMap
468: .getVal(ABSTRACT_BCOMPONENT_DL))
469: .intValue());
470: ScreenUtil.setLevel(BAction.class, ((Integer) formMap
471: .getVal(BACTION_DL)).intValue());
472: ScreenUtil.setLevel(BInput.class, ((Integer) formMap
473: .getVal(BINPUT_DL)).intValue());
474: ScreenUtil.setLevel(BLink.class, ((Integer) formMap
475: .getVal(BLINK_DL)).intValue());
476: ScreenUtil
477: .setLevel(ScreenUtil.class, ((Integer) formMap
478: .getVal(BLIST_DL)).intValue());
479: ScreenUtil.setLevel(ScreenUtil.class,
480: ((Integer) formMap.getVal(BSELECT_DL))
481: .intValue());
482: ScreenUtil.setLevel(ScreenUtil.class,
483: ((Integer) formMap.getVal(BTABLE_DL))
484: .intValue());
485: ScreenUtil.setLevel(ScreenUtil.class,
486: ((Integer) formMap.getVal(BTEMPLATE_DL))
487: .intValue());
488: ScreenUtil.setLevel(BText.class, ((Integer) formMap
489: .getVal(BTEXT_DL)).intValue());
490: ScreenUtil.setLevel(BToggleButton.class,
491: ((Integer) formMap.getVal(BTOGGLE_BUTTON_DL))
492: .intValue());
493: ScreenUtil
494: .setLevel(ComponentGateway.class,
495: ((Integer) formMap
496: .getVal(COMPONENT_GATEWAY_DL))
497: .intValue());
498: //...models
499: ScreenUtil.setLevel(DefaultListModel.class,
500: ((Integer) formMap
501: .getVal(DEFAULT_LIST_MODEL_DL))
502: .intValue());
503: ScreenUtil.setLevel(DefaultPropertiesModel.class,
504: ((Integer) formMap
505: .getVal(DEFAULT_PROPERTIES_MODEL_DL))
506: .intValue());
507: //...views
508: ScreenUtil.setLevel(DefaultTableView.class,
509: ((Integer) formMap
510: .getVal(DEFAULT_TABLE_VIEW_DL))
511: .intValue());
512: ScreenUtil.setLevel(DefaultTemplateView.class,
513: ((Integer) formMap
514: .getVal(DEFAULT_TEMPLATE_VIEW_DL))
515: .intValue());
516: ScreenUtil.setLevel(DefaultView.class,
517: ((Integer) formMap.getVal(DEFAULT_VIEW_DL))
518: .intValue());
519: //...renderers
520: ScreenUtil.setLevel(HTMLComponentRenderer.class,
521: ((Integer) formMap
522: .getVal(HTML_COMPONENT_RENDERER_DL))
523: .intValue());
524: ScreenUtil.setLevel(HTMLComponentRenderer.class,
525: ((Integer) formMap
526: .getVal(HTML_COMPONENT_RENDERER_DL))
527: .intValue());
528: ScreenUtil.setLevel(HTMLActionRenderer.class,
529: ((Integer) formMap
530: .getVal(HTML_ACTION_RENDERER_DL))
531: .intValue());
532: ScreenUtil.setLevel(HTMLInputRenderer.class,
533: ((Integer) formMap
534: .getVal(HTML_INPUT_RENDERER_DL))
535: .intValue());
536: ScreenUtil.setLevel(HTMLLinkRenderer.class,
537: ((Integer) formMap
538: .getVal(HTML_LINK_RENDERER_DL))
539: .intValue());
540: ScreenUtil.setLevel(HTMLListRenderer.class,
541: ((Integer) formMap
542: .getVal(HTML_LIST_RENDERER_DL))
543: .intValue());
544: ScreenUtil.setLevel(HTMLSelectRenderer.class,
545: ((Integer) formMap
546: .getVal(HTML_SELECT_RENDERER_DL))
547: .intValue());
548: ScreenUtil.setLevel(HTMLTableRenderer.class,
549: ((Integer) formMap
550: .getVal(HTML_TABLE_RENDERER_DL))
551: .intValue());
552: ScreenUtil.setLevel(HTMLToggleRenderer.class,
553: ((Integer) formMap
554: .getVal(HTML_TOGGLE_RENDERER_DL))
555: .intValue());
556: ScreenUtil.setLevel(HTMLTemplateRenderer.class,
557: ((Integer) formMap
558: .getVal(HTML_TEMPLATE_RENDERER_DL))
559: .intValue());
560: ScreenUtil.setLevel(HTMLTextRenderer.class,
561: ((Integer) formMap
562: .getVal(HTML_TEXT_RENDERER_DL))
563: .intValue());
564: ScreenUtil.setLevel(TemplateHelper.class,
565: ((Integer) formMap.getVal(TEMPLATE_HELPER_DL))
566: .intValue());
567: ScreenUtil.setLevel(XMLComponentRenderer.class,
568: ((Integer) formMap
569: .getVal(XML_COMPONENT_RENDERER_DL))
570: .intValue());
571: ScreenUtil.setLevel(XMLTemplateRenderer.class,
572: ((Integer) formMap
573: .getVal(XML_TEMPLATE_RENDERER_DL))
574: .intValue());
575: ScreenUtil
576: .setLevel(XMLTextRenderer.class,
577: ((Integer) formMap
578: .getVal(XML_TEXT_RENDERER_DL))
579: .intValue());
580:
581: //remember our success
582: formMap.putState(SUCCESS_MESSAGE, new Boolean(true));
583:
584: } catch (ValidationException e) {
585: ve = e;
586: }
587:
588: //store the error message in the form and then put the form in the
589: //the event context
590: formMap.putState(ERROR_MESSAGE, ve);
591: context.putState(FORM, formMap);
592:
593: //fire an update so that the screen will redraw
594: ((CompModel) screen.compModel).fireModelChanged();
595:
596: //redirect to the get screen again
597: throw new ClientSideRedirectException(new GetBConfig());
598: }
599: }
600:
601: //------------------------------------------------------------
602: // Utility Methods
603: //------------------------------------------------------------
604: public TemplateModel getModel() {
605: return new CompModel();
606: }
607: }
|