wt.enterprise.tabularresults
Class TableFormatService

java.lang.Object
  extended bywt.enterprise.tabularresults.TableFormatService
Direct Known Subclasses:
StdTableFormatService

public abstract class TableFormatService
extends Object

This class provides the basic functionality for presenting a String of objects in a tabular form. This class will present a String of objects in a table with a header for each column and allows the user to specify HTML attributes of the table and the rows. The embedded Column objects allow the specification of the HTML presentation of the header and the data that is to appear in column of the table that the column defines. The table is created with a call to initTable and printed out with a call to printTable. The initialization of the table assumes that the user is sending a set of header names ( for example, a string can be generated by a call to an instance of a subclass of DataFormatService) . If the subclass of BasicQueryService does not specify a set of header names to be used, TableFormatService will look for an entry in wt.properties ( add example entry ). If there is NOT a string passed in from the subclass of BasicQueryService used and there is NOT an entry in wt.properties, then an exception is thrown and an error message is sent to the webpage. The default data service, StdDataFormatService, assumes that these names are derived attributes. Assuming that the initialization is done correctly, then customizing the table can be done. You can add columns, delete columns, set HTML format properties for the Table, Rows, Columns, and single Table cell entries. Should an invalid column ID be given during customization, an exception will be thrown and the table will not be printed and an exception will be thrown. One of the important aspects of using this TableFormatService is to specify the DataFormatService subclass that is to be used to generate the entries that are appear in the individual table cells. It will be this service that will provide the HTML output that appears inbetween the ... in each cell in each row.

Supported API: false

Extendable: false

See Also:

Field Summary
private static String CODEBASE
           
(package private)  Vector columns
           
private  DataFormatService currentDataFormatService
           
private  String defaultDataServiceName
           
private  Locale locale
           
private static String RESOURCE
           
protected  String[] ROW_ATTRIBUTES
          Defines the set of supported HTML row attributes
private  Properties rowProperties
          rowProperties holds the HTML specific properties of the rows of the table.
private static String TABLE_ALIGN_DEFAULT
           
protected  String[] TABLE_ATTRIBUTES
          Defines the set of supported HTML table attributes
private static String TABLE_BEGIN_DEFAULT
           
private static String TABLE_BGCOLOR_DEFAULT
           
private static String TABLE_BORDER_DEFAULT
           
private static String TABLE_END_DEFAULT
           
private static String TABLE_WIDTH_DEFAULT
           
private  String tableAlign
           
private  String tableBegin
           
private  String tableBGColor
           
private  String tableBorder
           
private  String tableEnd
           
private  Properties tableProperties
          tableProperties holds the HTML specific properties of table.
private  String tableWidth
           
private  String TR_Begin
           
private  String TR_End
           
private static boolean VERBOSE
           
 
Constructor Summary
TableFormatService()
          Supported API: false
 
Method Summary
 void addColumn(Column new_column, Properties properties)
          Supported API: false
 void addDefaultColumn(String column_ID, Properties column_properties, Object context_obj)
          Supported API: false
 void addToVector(Vector columns, Column new_column, Properties properties)
          Supported API: false
 void deleteColumn(String column_ID)
          Supported API: false
 DataFormatService getDataFormatService()
          Supported API: false
 String getDataServiceName()
          Supported API: false
 Locale getLocale()
          Supported API: false
 boolean hasColumn(String columnID)
          Supported API: false
 String[] initColumnNames(Object context_obj)
          Supported API: false
 void initTable(Object[] table_entries, Locale new_locale, String[] column_names)
          This method initializes the table by instantiating the objects that will keep track of the columns and the table properties and the row properties.
 Object loadClass(String className)
          Supported API: false
 void printCaption(PrintWriter out)
          Supported API: false
 void printHeadings(Object[] table_entries, PrintWriter out)
          Supported API: false
 void printRow(Object table_entry, PrintWriter out)
          Supported API: false
 void printTable(Object[] table_entries, PrintWriter out)
          Supported API: false
 void setAllColumnsProperties(Properties properties)
          Supported API: false
 void setAllHeadersProperties(Properties properties)
          Supported API: false
 void setColumnFormat()
          Supported API: false
 void setColumnProperties(String column_ID, Properties properties)
          Supported API: false
 void setDataFormatService(DataFormatService new_data_format_service)
          Supported API: false
 void setDataServiceName(String data_service_name)
          Supported API: false
 void setDefaultColumnProperties(String column_ID)
          Supported API: false
 void setDefaultColumns(Object[] context_objs, String[] column_names)
          This method is used to actually create the instances of the Column using the entries in column_names.
 void setDefaultRowProperties()
          Supported API: false
 void setDefaultTableProperties()
          Supported API: false
 void setHeader(String column_ID, String entry)
          Supported API: false
 void setHeaderProperties(String column_ID, Properties properties)
          Supported API: false
 void setLocale(Locale newLocale)
          Supported API: false
 void setRowFormat()
          Supported API: false
 void setRowProperties(Properties properties)
          Supported API: false
 void setTableFormat()
          Supported API: false
 void setTableProperties(Properties properties)
          Supported API: false
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CODEBASE

private static String CODEBASE

VERBOSE

private static boolean VERBOSE

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

TABLE_BEGIN_DEFAULT

private static String TABLE_BEGIN_DEFAULT

TABLE_END_DEFAULT

private static String TABLE_END_DEFAULT

TABLE_BGCOLOR_DEFAULT

private static String TABLE_BGCOLOR_DEFAULT

TABLE_ALIGN_DEFAULT

private static String TABLE_ALIGN_DEFAULT

TABLE_WIDTH_DEFAULT

private static String TABLE_WIDTH_DEFAULT

TABLE_BORDER_DEFAULT

private static String TABLE_BORDER_DEFAULT

tableBegin

private String tableBegin

tableEnd

private String tableEnd

tableBGColor

private String tableBGColor

tableAlign

private String tableAlign

tableWidth

private String tableWidth

tableBorder

private String tableBorder

tableProperties

private Properties tableProperties
tableProperties holds the HTML specific properties of table. There is an internal list of supported HTML tags for a Table that are used as keys to get any valid table tags in tableProperties out. If the developer or customizer enters an invalid table tag into the tableProperties Properties object, it is simply ignored when building the table


columns

Vector columns

TR_Begin

private String TR_Begin

TR_End

private String TR_End

rowProperties

private Properties rowProperties
rowProperties holds the HTML specific properties of the rows of the table. There is an internal list of supported HTML tags for a Table Row that are used as keys to get any valid row tags in rowProperties out. If the developer or customizer enters an invalid row tag into the rowProperties Properties object, it is simply ignored when building the row.


TABLE_ATTRIBUTES

protected String[] TABLE_ATTRIBUTES
Defines the set of supported HTML table attributes


ROW_ATTRIBUTES

protected String[] ROW_ATTRIBUTES
Defines the set of supported HTML row attributes


defaultDataServiceName

private String defaultDataServiceName

currentDataFormatService

private DataFormatService currentDataFormatService

locale

private Locale locale
Constructor Detail

TableFormatService

public TableFormatService()
Supported API: false

Method Detail

setLocale

public void setLocale(Locale newLocale)
Supported API: false


getLocale

public Locale getLocale()
Supported API: false


initTable

public void initTable(Object[] table_entries,
                      Locale new_locale,
                      String[] column_names)
               throws WTException
This method initializes the table by instantiating the objects that will keep track of the columns and the table properties and the row properties. If table_entries == null or table_entries.length == 0, then an exception is thrown. If column_names == null, then initTable tries to get the table names from an entry in wt.properties based on the type of objects in table_entries. If this attempt to get column names fails, then an exception is thrown. Currently, the columns names are used to initialize the column's ID and header, with the headers determined by a call to the instance of the subclass of DataFormatService being used.

Supported API: false

Parameters:
table_entries - The string of objects that are going to be used to create the table. Currently, each entry in the array presents a row in the table
new_locale - The locale that should be used to localize output
column_names - The list of column names. Context depends on the DataFormatService that is used. The default DataFormatService assumes that these are derived attributes of the objects in table_entries
Throws:
WTException

setDataServiceName

public void setDataServiceName(String data_service_name)
Supported API: false


getDataServiceName

public String getDataServiceName()
Supported API: false


setDataFormatService

public void setDataFormatService(DataFormatService new_data_format_service)
Supported API: false


getDataFormatService

public DataFormatService getDataFormatService()
Supported API: false


hasColumn

public boolean hasColumn(String columnID)
Supported API: false


setDefaultColumns

public void setDefaultColumns(Object[] context_objs,
                              String[] column_names)
                       throws WTException
This method is used to actually create the instances of the Column using the entries in column_names. The array column_names is looped over and DataFormatService is called to get an HTML string to present to Column header using context_obj as the context object for the HTML string generation.

Supported API: false

Parameters:
column_names - The names of the columns to add
Throws:
WTException

addDefaultColumn

public void addDefaultColumn(String column_ID,
                             Properties column_properties,
                             Object context_obj)
                      throws WTException
Supported API: false

Throws:
WTException

addColumn

public void addColumn(Column new_column,
                      Properties properties)
Supported API: false


deleteColumn

public void deleteColumn(String column_ID)
                  throws WTException
Supported API: false

Throws:
WTException

setTableProperties

public void setTableProperties(Properties properties)
Supported API: false


setColumnProperties

public void setColumnProperties(String column_ID,
                                Properties properties)
                         throws WTException
Supported API: false

Throws:
WTException

setAllColumnsProperties

public void setAllColumnsProperties(Properties properties)
Supported API: false


setHeaderProperties

public void setHeaderProperties(String column_ID,
                                Properties properties)
                         throws WTException
Supported API: false

Throws:
WTException

setAllHeadersProperties

public void setAllHeadersProperties(Properties properties)
Supported API: false


setHeader

public void setHeader(String column_ID,
                      String entry)
               throws WTException
Supported API: false

Throws:
WTException

setDefaultTableProperties

public void setDefaultTableProperties()
Supported API: false


setRowProperties

public void setRowProperties(Properties properties)
Supported API: false


setDefaultRowProperties

public void setDefaultRowProperties()
Supported API: false


setDefaultColumnProperties

public void setDefaultColumnProperties(String column_ID)
Supported API: false


printTable

public void printTable(Object[] table_entries,
                       PrintWriter out)
Supported API: false


printHeadings

public void printHeadings(Object[] table_entries,
                          PrintWriter out)
Supported API: false


setRowFormat

public void setRowFormat()
Supported API: false


setTableFormat

public void setTableFormat()
Supported API: false


setColumnFormat

public void setColumnFormat()
Supported API: false


printCaption

public void printCaption(PrintWriter out)
Supported API: false


printRow

public void printRow(Object table_entry,
                     PrintWriter out)
Supported API: false


initColumnNames

public String[] initColumnNames(Object context_obj)
                         throws WTException
Supported API: false

Throws:
WTException

addToVector

public void addToVector(Vector columns,
                        Column new_column,
                        Properties properties)
Supported API: false


loadClass

public Object loadClass(String className)
Supported API: false