KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > jpivot > table > TableComponentTag


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.jpivot.table;
14
15 import java.net.URL JavaDoc;
16
17 import javax.servlet.jsp.JspException JavaDoc;
18
19 import com.tonbeller.jpivot.olap.model.OlapModel;
20 import com.tonbeller.wcf.component.Component;
21 import com.tonbeller.wcf.component.ComponentTag;
22 import com.tonbeller.wcf.controller.RequestContext;
23
24 /**
25  * creates a TableComponentImpl
26  * @author av
27  */

28 public class TableComponentTag extends ComponentTag {
29   String JavaDoc query;
30   String JavaDoc configXml = null;
31
32   /**
33    * creates a TableComponentImpl
34    */

35   public Component createComponent(RequestContext context) throws Exception JavaDoc {
36     // find the olap query
37
OlapModel olapModel = (OlapModel) context.getModelReference(query);
38     if (olapModel == null)
39       throw new JspException JavaDoc("query \"" + query + "\" not found");
40
41     // choose xml configuration
42
URL JavaDoc configUrl;
43     if (configXml != null)
44       configUrl = pageContext.getServletContext().getResource(configXml);
45     else
46       configUrl = getClass().getResource("config.xml");
47
48     return TableComponentFactory.instance(id, configUrl, olapModel);
49    
50   }
51
52   /**
53    * Returns the configXml.
54    * @return String
55    */

56   public String JavaDoc getConfigXml() {
57     return configXml;
58   }
59
60   /**
61    * Sets the configXml.
62    * @param configXml The configXml to set
63    */

64   public void setConfigXml(String JavaDoc configXml) {
65     this.configXml = configXml;
66   }
67
68   /**
69    * Returns the query.
70    * @return String
71    */

72   public String JavaDoc getQuery() {
73     return query;
74   }
75
76   /**
77    * Sets the query.
78    * @param query The query to set
79    */

80   public void setQuery(String JavaDoc query) {
81     this.query = query;
82   }
83
84 }
85
Popular Tags