Developed at the
ODRA – Object Database for Rapid Application development
Description and Programmer Manual
by Jacek Bekier, Mariusz Trzaska and the ODRA team
16. ODRA Web Components
ODRA Web Components is a library of user interface components parameterized by SBQL queries (see Fig.16-1). Currently the library provides five distinct components:
· Bar-Line Chart Component - bar/line chart.
· News Component - list of articles.
· Poll Component - poll/survey component.
· Table Component - table.
· Text Label Component - line of text.
Fig.16-2 presents a simplified Java class diagram of the implemented components. Notice that almost each of them is connected with appropriate style definition. Such a solution guarantees a separation between business logic and visual appearance of the data.
Beside abstract types (SBQL Web Component, SBQL Web Component Style), every item of the object model could be utilized as a tag inside JSP page. Table 16-1 show tags names for every item of the object model.
Each of the components is associated with at least one SBQL query. The SBQL queries are used to retrieve the data presented in the component, or to save the information entered by the user. The system is designed to be used in conjunction with Java Server PagesÔ technology.
The system is distributed as 3 Java archive files:
· sbqlweb.jar - contains the custom tag library.
· demo.war - a sample web application designed with SBQL Web Components.
· demoapp-installer.jar - a helper tool. Connects to an ODRA server and adds the modules required to run the sample application.
The following steps are required to run the sample application "demo.war":
· Deploy demo.war to a J2EE web application server, e.g. Apache Tomcat 5.5.17 (copy "demo.war" to TOMCAT\webapps).
· Run ODRA server.
· Run demoapp-installer.jar ("java -jar demoapp-installer.jar").
· The sample application should be available at http://HOSTNAME:PORT/demo.
The next subchapters describe each of the components with more details.
Every JSP page using ODRA Web Components needs SBQL Web Page item. The SBQL Web Page object corresponds to the sw:page tag. The functionality of the tag (tag handler class) is implemented in the odra.web.tags.PageTag class. The only parameter is „id”, which is a unique identifier of the page. Fig.16-3 shows sample utilization inside JSP page.
A definition of an SBQL Web Page could contains any number of SBQL Data Source objects responsible for a connection with an external instance of the ODRA server.
A counterpart of the SBQL Data Source object in the custom tags library is sw:dataSource, which functionality is implemented in odra.web.tags.DataSourceTag class. Table 16-2 presents the list of tag’s parameters.
Table 16-2. Tag sw:dataSource parameters
Fig.16-4 shows a sample utilization of the component.
The Bar-Line Chart component allows for embedding a bar-line chart inside a JSP page. The presented data is retrieved from an ODRA database using an SBQL query. Both line and a bars collection are optional. Thus it is possible to create a simple line chart or a simple bar chart. Implementation details are the following:
· tag handler class: odra.web.tags.components.ChartTag
· Tag’s name: chart.
Table 16-3 describes component’s parameters.
Table 16-3. Chart component parameters
Figures from 16-6 to 16-9 present sample utilizations of charts together with the results.
The News component allowing creating lists of articles or news. The current version is able to publish following information:
· Title of the news/article
· Creation date
· Content of the article or news
· tag handler class: odra.web.tags.components.NewsTag
· Tag’s name: news.
Table 16-4 describes component’s parameters.
Table 16-4. News component parameters
Fig.16-10 and Fig.16-11 show a sample code and a corresponding www result page.
The Poll component supports creating polls or surveys. There are two modes of working:
· Question; The question and possible answers are presented.
· Answer: The mode is activated after a user’s answer and show the current results of the poll.
The poll component is the only one from the library which utilizes SBQL queries to send information from a client to a server. Query defined in parameter „submitVoteQuery” is used in case of Whiting user’s answer in a database.
· tag handler class: odra.web.tags.components.PollTag
· Tag’s name: poll.
Table 16-5 describes component’s parameters.
Table 16-5. Poll component parameters
Figures 16-12, 16-13 and 16-14 show a sample code and a corresponding www result page.
The Table component shows a data in a table form. The source of the data is a SBQL query. The number and column’s name are configured using special parameter. Implementation details:
· tag handler class: odra.web.tags.components.TableTag
· Tag’s name: table.
Table 16-6 describes component’s parameters.
Fig.16-15 and Fig.16-16 show a sample code and a corresponding www result page.
Text label component shows single value read from a database, i.e. a text or a number. On contrary to others component, visual properties of the Text Label object are not defined using separate style tag. The way of presenting information depends only on the location inside other HTML items, which describes visual format.
· tag handler class: odra.web.tags.components.TextLabelTag
· Tag’s name: textLabel.
Table 16-7 describes component’s parameters.
Table 16-7. Text Label component parameters
Fig.16-17 and Fig.16-18 show a sample code and the corresponding www result page.
ODRA Web API Specification, including the Java documentation, is presented as a MS Word document.
Last modified: July 9, 2008