KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > table > TablePropertiesFormTag


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.wcf.table;
14
15 import java.net.MalformedURLException JavaDoc;
16 import java.net.URL JavaDoc;
17
18 import javax.servlet.jsp.JspException JavaDoc;
19
20 import org.apache.log4j.Logger;
21 import org.w3c.dom.Document JavaDoc;
22
23 import com.tonbeller.wcf.component.Component;
24 import com.tonbeller.wcf.component.ComponentTag;
25 import com.tonbeller.wcf.controller.RequestContext;
26 import com.tonbeller.wcf.form.FormDocument;
27 import com.tonbeller.wcf.utils.ResourceLocator;
28 import com.tonbeller.wcf.utils.XmlUtils;
29
30 /**
31  * creates a FormComponent
32  *
33  * @author av
34  */

35 public class TablePropertiesFormTag extends ComponentTag {
36
37   private String JavaDoc xmlUri;
38   private String JavaDoc table;
39   private boolean bookmarkable = false;
40   private boolean closable = true;
41
42   private static Logger logger = Logger.getLogger(TablePropertiesFormTag.class);
43
44   /**
45    * loads a form from an xml file and registeres it with the controller.
46    */

47   public Component createComponent(RequestContext context) throws JspException JavaDoc {
48     try {
49
50       URL JavaDoc url = ResourceLocator.getResource(context.getServletContext(), context.getLocale(), xmlUri);
51       Document JavaDoc doc = XmlUtils.parse(url);
52
53       //In replaceI18n(...) wird geprüft, ob "bundle"-Attribut vorhanden
54
FormDocument.replaceI18n(context, doc, null);
55
56       // find the bean model
57
TableComponent tc = (TableComponent) context.getModelReference(table);
58
59       // create the component
60
TablePropertiesFormComponent fc= new TablePropertiesFormComponent(id, null, doc, tc);
61       fc.setCloseable(closable);
62       fc.setBookmarkable(bookmarkable);
63       return fc;
64       
65     } catch (MalformedURLException JavaDoc e) {
66       logger.error("exception caught", e);
67       throw new JspException JavaDoc(e);
68     }
69   }
70
71   public void setBookmarkable(boolean b) {
72     bookmarkable = b;
73   }
74
75   public void setTable(String JavaDoc string) {
76     table = string;
77   }
78
79   public void setXmlUri(String JavaDoc string) {
80     xmlUri = string;
81   }
82
83   public void setClosable(boolean b) {
84     closable = b;
85   }
86
87 }
88
Popular Tags