Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: info/crossbar/view/formatter/BaseFormatter.java


1   /*
2    *  @(#)BaseFormatter.java $Revision: 1.3 $ $Date: 2003/06/04 04:55:32 $
3    *
4    *  Copyright 2002 by Daniel Kehoe <kehoe@fortuity.com>
5    *  All Rights Reserved
6    *
7    *  Redistribution and use in source and binary forms, with or without
8    *  modification, are permitted provided that the following conditions
9    *  are met:
10   *  1. Redistributions of source code must retain the above copyright
11   *  notice, this list of conditions and the following disclaimer.
12   *  2. Redistributions in binary form must reproduce the above copyright
13   *  notice, this list of conditions and the following disclaimer in the
14   *  documentation and/or other materials provided with the distribution.
15   *
16   *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17   *  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18   *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19   *  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20   *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21   *  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22   *  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23   *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24   *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25   *  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26   *  SUCH DAMAGE.
27   */
28  package info.crossbar.view.formatter;
29  
30  import java.util.logging.Logger;
31  import java.io.*;
32  
33  import java.util.*;
34  
35  import java.text.*;
36  
37  import javax.servlet.http.HttpServletRequest;
38  import javax.servlet.http.HttpSession;
39  import javax.servlet.ServletException;
40  
41  import java.sql.SQLException;
42  
43  import sun.jdbc.rowset.*;
44  
45  import info.crossbar.view.formatter.FormatterAbstraction;
46  
47  
48  /**
49   * BaseFormatter class for use by <a href="http://www.crossbar.info/">Crossbar</a>
50   *
51   * @author     Daniel Kehoe, <a href="http://www.fortuity.com/">Fortuity Consulting</a>
52   * @created    February 5, 2002
53   * @version    <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/crossbar/crossbar-sitemap/src/java/info/crossbar/view/formatter/BaseFormatter.java">View source, revision history</a>
54   * $Revision: 1.3 $ $Date: 2003/06/04 04:55:32 $
55   * <p>
56   * DESCRIPTION:
57   * This is class implements the FormatterAbstraction interface. It is intended to
58   * parse a CachedRowSet of tabular data and markup the data for presentation on
59   * a JSP page by a custom tag. A custom tag can instatiate a Formatter for
60   * presenting the tabular data in different ways.
61   */
62  public class BaseFormatter implements FormatterAbstraction {
63  
64    /**
65     * Set up logging.
66     */
67    private static Logger log = Logger.getLogger(BaseFormatter.class.getName());
68  
69  
70    /**
71     * Given a CachedRowSet containing tabular data, iterate through each row
72     * and column, obtaining each field value and wrapping it with markup (for
73     * example, HTML tags) to be returned as a string to a custom tag for
74     * inclusion in a jsp page.
75     *
76     * @param  request               the HttpServletRequest for any needed parameters
77     * @param  table                 a CachedRowSet object
78     * @param  headerstyle           String that specifies a CSS table header style
79     * @param  bodystyle             String that specifies a CSS table body style
80     * @param  footerstyle           String that specifies a CSS table header style
81     * @return                       String suitable for output by a custom tag
82     * @exception  ServletException  thrown by any error
83     */
84    public String markup(HttpServletRequest request, CachedRowSet table, 
85      String headerstyle, String bodystyle, String footerstyle)
86      throws ServletException {
87      log.entering(BaseFormatter.class.getName(), "markup");
88      StringBuffer buffer = new StringBuffer("");
89      buffer.append("<!-- info.crossbar.view.formatter.BaseFormatter.markup() is not implemented -->");
90      log.exiting(BaseFormatter.class.getName(), "markup");
91      return buffer.toString();
92    }
93  
94    /**
95     * Obtain information on this class.
96     *
97     * @return    String describing this class.
98     */
99    public String getClassInfo() {
100     return "A Formatter class, intended to be dynamically loaded to mark up tabular data for presentation.";
101   }
102 }
103