com.mkdoc.query
Class AbstractResultRenderer

java.lang.Object
  |
  +--com.mkdoc.query.AbstractResultRenderer
All Implemented Interfaces:
ResultRenderer
Direct Known Subclasses:
RssResultRenderer, TextResultRenderer, XhtmlResultRenderer

public abstract class AbstractResultRenderer
extends java.lang.Object
implements ResultRenderer

A base class for result renderers.

Version:
0.8 2005-11-01
Author:
Philip Shaw

Field Summary
protected  Query query
          The query against which the results were returned.
 
Fields inherited from interface com.mkdoc.query.ResultRenderer
FULL, INSERT
 
Constructor Summary
AbstractResultRenderer()
           
 
Method Summary
protected  int getEndIndex(QueryResult queryResult)
          Get the end index for rendering results.
 Query getQuery()
          Get the query for the results.
protected abstract  java.lang.StringBuffer getQueryResult(QueryResult queryResult, int mode)
          Template method for rendering query results to a string buffer.
protected  int getStartIndex(QueryResult queryResult)
          Get the start index for rendering results.
 void renderQueryResult(javax.servlet.jsp.JspWriter jspWriter, QueryResult queryResult)
          Render a query result to a servlet output stream in FULL mode.
 void renderQueryResult(javax.servlet.jsp.JspWriter jspWriter, QueryResult queryResult, int mode)
          Render a query result to a JSP output stream.
 java.lang.String renderQueryResult(QueryResult queryResult, int mode)
          Render a query result to a string.
 void renderQueryResult(javax.servlet.ServletOutputStream outputStream, QueryResult queryResult)
          Render a query results table to a servlet output stream in FULL mode.
 void renderQueryResult(javax.servlet.ServletOutputStream outputStream, QueryResult queryResult, int mode)
          Render a query results table to a servlet output stream.
 void setQuery(Query query)
          Set the query for the results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.mkdoc.query.ResultRenderer
getContentType
 

Field Detail

query

protected Query query
The query against which the results were returned.

Since:
Version 0.4 2005-07-26
Constructor Detail

AbstractResultRenderer

public AbstractResultRenderer()
Method Detail

setQuery

public final void setQuery(Query query)
Set the query for the results.

Parameters:
query - The query from which the results were obtained.
Since:
Version 0.3 2005-07-25

getQuery

public final Query getQuery()
Get the query for the results.

Returns:
The query from which the results were obtained.
Since:
Version 0.3 2005-07-25

renderQueryResult

public final void renderQueryResult(javax.servlet.ServletOutputStream outputStream,
                                    QueryResult queryResult)
                             throws java.io.IOException
Render a query results table to a servlet output stream in FULL mode.

Specified by:
renderQueryResult in interface ResultRenderer
Parameters:
outputStream - The output stream to which to write the results.
queryResult - The query result to render.
Throws:
java.io.IOException - If there is a problem writing results to the output stream.
Since:
Version 0.6 2005-09-12

renderQueryResult

public final void renderQueryResult(javax.servlet.ServletOutputStream outputStream,
                                    QueryResult queryResult,
                                    int mode)
                             throws java.io.IOException
Render a query results table to a servlet output stream.

Specified by:
renderQueryResult in interface ResultRenderer
Parameters:
outputStream - The output stream to which to write the results.
queryResult - The query result to render.
mode - The output mode, either ResultRenderer.FULL or ResultRenderer.INSERT.
Throws:
java.io.IOException - If there is a problem writing results to the output stream.
Since:
Version 0.1 2005-07-14

renderQueryResult

public final void renderQueryResult(javax.servlet.jsp.JspWriter jspWriter,
                                    QueryResult queryResult)
                             throws java.io.IOException
Render a query result to a servlet output stream in FULL mode.

Implementations may render output according to a particular markup language or content type.

Specified by:
renderQueryResult in interface ResultRenderer
Parameters:
jspWriter - The output stream to which to write the results.
queryResult - The query result to render.
Throws:
java.io.IOException - If there is a problem writing results to the output stream.
Since:
Version 0.6 2005-09-12

renderQueryResult

public final void renderQueryResult(javax.servlet.jsp.JspWriter jspWriter,
                                    QueryResult queryResult,
                                    int mode)
                             throws java.io.IOException
Render a query result to a JSP output stream.

Specified by:
renderQueryResult in interface ResultRenderer
Parameters:
jspWriter - The JSP output stream to which to write the results.
queryResult - The query result to render.
mode - The output mode, either ResultRenderer.FULL or ResultRenderer.INSERT.
Throws:
java.io.IOException - If there is a problem writing results to the output stream.
Since:
Version 0.2 2005-07-19

renderQueryResult

public final java.lang.String renderQueryResult(QueryResult queryResult,
                                                int mode)
Render a query result to a string.

Specified by:
renderQueryResult in interface ResultRenderer
Parameters:
queryResult - The query results to render.
mode - The output mode, either ResultRenderer.FULL or ResultRenderer.INSERT.
Returns:
A text formatted tabular layout of the query result.
Since:
Version 0.1 2005-07-14

getQueryResult

protected abstract java.lang.StringBuffer getQueryResult(QueryResult queryResult,
                                                         int mode)
Template method for rendering query results to a string buffer.

Parameters:
queryResult - The query results to render.
mode - The output mode, either ResultRenderer.FULL or ResultRenderer.INSERT.
Returns:
A text formatted tabular layout of the query results.
Since:
Version 0.1 2005-01-26

getStartIndex

protected final int getStartIndex(QueryResult queryResult)
Get the start index for rendering results.

Parameters:
queryResult - The query result for which to get the start index.
Returns:
The first results item index to render.
Since:
Version 0.5 2005-08-02

getEndIndex

protected final int getEndIndex(QueryResult queryResult)
Get the end index for rendering results.

Parameters:
queryResult - The query result for which to get the end index.
Returns:
The last results item index to render.
Since:
Version 0.5 2005-08-02