KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > jpivot > chart > ChartComponentTag


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 package com.tonbeller.jpivot.chart;
12
13 import javax.servlet.jsp.JspException JavaDoc;
14
15 import com.tonbeller.jpivot.olap.model.OlapModel;
16 import com.tonbeller.wcf.component.Component;
17 import com.tonbeller.wcf.component.ComponentTag;
18 import com.tonbeller.wcf.controller.RequestContext;
19
20
21 /**
22  * creates a ChartComponent
23  * @author Robin Bagot
24  */

25 public class ChartComponentTag extends ComponentTag {
26     String JavaDoc query;
27     String JavaDoc baseDisplayURL;
28     String JavaDoc controllerURL;
29
30   /**
31    * creates a ChartComponent
32    */

33   public Component createComponent(RequestContext context) throws Exception JavaDoc {
34     // find the Olap Model
35
OlapModel model = (OlapModel) context.getModelReference(getQuery());
36     // check model exists
37
if (model == null)
38       throw new JspException JavaDoc("component \"" + getQuery() + "\" not found");
39 /*
40     // choose xml configuration
41     URL configUrl;
42     if (configXml != null)
43       configUrl = pageContext.getServletContext().getResource(configXml);
44     else
45       configUrl = getClass().getResource("config.xml");
46     return TableComponentFactory.instance(id, configUrl, olapModel);
47 */

48     return new ChartComponent(id, null, query, baseDisplayURL, controllerURL, context);
49   }
50
51   /**
52    * Returns the query attribute (actually a reference to an Olap Model)
53    * @return String
54    */

55   public String JavaDoc getQuery() {
56     return query;
57   }
58
59   /**
60    * Sets the query attribute (actually a reference to an Olap Model)
61    * @param ref The ref to set
62    */

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

71   public String JavaDoc getBaseDisplayURL() {
72     return baseDisplayURL;
73   }
74
75   /**
76    * Sets the baseDisplayURL
77    * @param baseDisplayURL The baseDisplayURL to set
78    */

79   public void setBaseDisplayURL(String JavaDoc baseDisplayURL) {
80     this.baseDisplayURL = baseDisplayURL;
81   }
82
83 public String JavaDoc getControllerURL() {
84     return controllerURL;
85 }
86
87 public void setControllerURL(String JavaDoc controllerURL) {
88     this.controllerURL = controllerURL;
89 }
90   
91 }
92
Popular Tags