com.fdsapi
Class FormattedDataSet

java.lang.Object
  |
  +--com.fdsapi.FormattedDataSet
All Implemented Interfaces:
java.io.Serializable

public class FormattedDataSet
extends java.lang.Object
implements java.io.Serializable

Using templates and tabular data The FormattedDataSet generates dynamic text such as HTML, XML and more. The FormattedDataSet makes a clean separation of data and presentation. The data can be any TabularData such as a ResultSet or a 2 dimensional array. The formatting is kept in templates and can be reused with any TabularData.

There are many methods that are overloaded in the FormattedDataSet. For example there are 12 different "getFormattedDataSet(...)" method calls. The main differences in the methods are the type of TabularData they take as input. For example a query can be passed in directly, or a query with a DataSourceName, a ResultSetConverter or any other form of TabularData. Also some of the methods can take a Map which contains miscellaneous data referenced in the Template with ## variable syntax (i.e. ##mapKey). Finally there are alternative signatures that take a Template name, or the Template object itself. Despite the large number of signatures remember that conceptually all the "getFormattedDataSet(...)" methods do the same thing.

The same principle applies to the multiple signatures of "getDropDownListBox(...)", "getListBox(...)", "getMultiSelectListBox(...)", "getRadioButton(...)", and "getSortedText(...)"

Note that the methods for "getDropDownListBox(...)", "getListBox(...)", "getMultiSelectListBox(...)", and "getRadioButton(...)" all take the same format of the TabularData which is dataValue, displayValue (for example "select dataValue, displayValue from table"). These correspond to the html data and display values. Many of these methods have sample code and output in the javadocs.

Note template names are case-insensitive ("mytemplate" is the same as "MYTEMPLATE").

Sample Output From Many of the Methods mentioned above follow:

1) getFormattedDataSet(...) methods (using the "BasicHtmlTable" template):
lastNameValuelastNameDisplay
SouzaValueSouzaDisplay
BeckValueBeckDisplay
ReidValueReidDisplay
HibbertValueHibbertDisplay
RichardsValueRichardsDisplay

2) getFormattedDataSet(...) methods (using the "HtmlTable" template):

3) getFormattedDataSet(...) methods (using the "xml1" template):

 <rollingstones>
  <row rowID='1'>
   <First Name>Keith</First Name>
   <Last Name>Richards</Last Name>
  </row>
  <row rowID='2'>
   <First Name>Mick</First Name>
   <Last Name>Jagger</Last Name>
  </row>
  <row rowID='3'>
   <First Name>Bill</First Name>
   <Last Name>Wyman</Last Name>
  </row>
  <row rowID='4'>
   <First Name>Ron</First Name>
   <Last Name>Wood</Last Name>
  </row>
  <row rowID='5'>
   <First Name>Charlie</First Name>
   <Last Name>Watts</Last Name>
  </row>
  </rollingstones>

 

4) getSortedText(...) methods (using the "sortedHTMLTable" template):

5) getDropDownListBox(...) methods:

6) getListBox(...) methods:

7) getMultiSelectListBox(...) methods:

8) getRadioButton(...) methods:
SouzaDisplay BeckDisplay ReidDisplay HibbertDisplay RichardsDisplay



View Code

See Also:
Serialized Form

Constructor Summary
FormattedDataSet()
          FormattedDataSet may either be created with a constructor or the createInstance() method
 
Method Summary
static FormattedDataSet createInstance()
          Returns a singleton version of the FormattedDataSet.
protected  java.lang.String formatList(java.lang.String listBox, java.lang.String selectedItem)
          Select/hightlight an item in an html list box
protected  java.lang.String formatRadioButton(java.lang.String radioButton, java.lang.String selectedItem)
          Select/highlight an item in an html radio button list box
 ArrayConverter getArrayConverter()
          Get the ArrayConverter that is set for any arrays.
 DataAccess getDataAccess()
          Return the underlying DataAccess object.
 boolean getDebug()
          Enable/Disable debugging.
 java.lang.String getDropDownListBox(java.lang.Object header, java.lang.Object body, java.util.Map miscData, java.lang.String selectedItem)
          Using the specified data (which has to either implement TabularData or have been checked into the TabularData factory) display an html drop down listbox.
 java.lang.String getDropDownListBox(java.lang.Object header, java.lang.Object body, java.lang.String selectedItem)
          Using the specified data (which has to either implement TabularData or have been checked into the TabularData factory) display an html drop down listbox.
 java.lang.String getDropDownListBox(ResultSetConverter rsc, java.util.Map miscData, java.lang.String selectedItem)
          Using a ResultSetConverter display an html drop down listbox.
 java.lang.String getDropDownListBox(ResultSetConverter rsc, java.lang.String selectedItem)
          Using a ResultSetConverter display an html drop down listbox.
 java.lang.String getDropDownListBox(java.lang.String query, java.util.Map miscData, java.lang.String selectedItem)
          Using the specified query and default DataSource display an html drop down listbox (extra info can be passed in via a Map).
 java.lang.String getDropDownListBox(java.lang.String query, java.lang.String selectedItem)
          Using the specified query and the default DataSource display an html drop down listbox.
 java.lang.String getDropDownListBox(java.lang.String dataSource, java.lang.String query, java.util.Map miscData, java.lang.String selectedItem)
          Using the specified query and DataSource display an html drop down listbox (extra info can be passed in via a Map).
 java.lang.String getDropDownListBox(java.lang.String dataSource, java.lang.String query, java.lang.String selectedItem)
          Using the specified query and DataSource display an html drop down listbox.
 java.lang.String getFormattedDataSet(java.lang.Object header, java.lang.Object body, java.util.Map miscData, java.lang.String templateName)
          Format the passed data using the passed template and pass in dynamic template variables.
 java.lang.String getFormattedDataSet(java.lang.Object header, java.lang.Object body, java.util.Map miscData, Template template)
          Format the passed data using the passed template object and pass in dynamic template variables.
 java.lang.String getFormattedDataSet(java.lang.Object header, java.lang.Object body, java.lang.String templateName)
          Format the passed data using the passed template.
 java.lang.String getFormattedDataSet(ResultSetConverter rsConverter, java.util.Map miscData, java.lang.String templateName)
          Format the ResultSetConverter using the passed template and pass in dynamic template variables.
 java.lang.String getFormattedDataSet(ResultSetConverter rsConverter, java.util.Map miscData, Template template)
          Format the ResultSetConverter using the passed template object and pass in dynamic template variables.
 java.lang.String getFormattedDataSet(ResultSetConverter rsConverter, java.lang.String templateName)
          Format the ResultSetConverter using the passed template.
 java.lang.String getFormattedDataSet(java.lang.String query, java.util.Map miscData, java.lang.String templateName)
          Execute a query against the default DataSource (jdbc/DataSource) and format the results by using the specified template, also accepting a Map which can be used to specify dynamic template variables.
 java.lang.String getFormattedDataSet(java.lang.String query, java.lang.String templateName)
          Execute a query against the default datasource (named jdbc/DataSource) and format the results by using the specified template.
 java.lang.String getFormattedDataSet(java.lang.String dataSource, java.lang.String query, java.util.Map miscData, java.lang.String templateName)
          Execute a query against the named datasource (named jdbc/MyDataSource) and format the results by using the specified template.
 java.lang.String getFormattedDataSet(java.lang.String dataSource, java.lang.String query, java.util.Map miscData, Template template)
          Execute a query against the named datasource (named jdbc/MyDataSource) and format the results by using the specified Template object.
 java.lang.String getFormattedDataSet(java.lang.String dataSource, java.lang.String query, java.lang.String templateName)
          Execute a query against the named datasource (named jdbc/MyDataSource) and format the results by using the specified template.
 java.lang.String getFormattedDataSet(java.lang.String query, Template template)
          Execute a query against the default datasource (named jdbc/DataSource) and format the results by using the specified template.
 java.lang.String getListBox(java.lang.Object header, java.lang.Object body, java.util.Map miscData, java.lang.String selectedItem, int size)
          Using the specified data (which can either be a TabularData interface or an Object that can implement this interface) display an html listbox (extra info may be passed in to the template via a Map).
 java.lang.String getListBox(java.lang.Object header, java.lang.Object body, java.lang.String selectedItem, int size)
          Using the specified data (which can either be a TabularData interface or an Object that can implement this interface) display an html listbox.
 java.lang.String getListBox(ResultSetConverter rsc, java.util.Map miscData, java.lang.String selectedItem, int size)
          Using a ResultSetConverter display an html listbox (extra info may be passed in to the template via a Map).
 java.lang.String getListBox(ResultSetConverter rsc, java.lang.String selectedItem, int size)
          Using a ResultSetConverter display an html listbox (extra info may be passed in to the template via a Map).
 java.lang.String getListBox(java.lang.String query, java.util.Map miscData, java.lang.String selectedItem, int size)
          Using the specified query and default DataSource display an html listbox (extra info can be passed in via a Map).
 java.lang.String getListBox(java.lang.String query, java.lang.String selectedItem, int size)
          Using the specified query and default DataSource display an html listbox.
 java.lang.String getListBox(java.lang.String dataSource, java.lang.String query, java.util.Map miscData, java.lang.String selectedItem, int size)
          Using the specified query and a named DataSource display an html listbox (extra info can be passed in via a Map).
 java.lang.String getListBox(java.lang.String dataSource, java.lang.String query, java.lang.String selectedItem, int size)
          Using the specified query and DataSource display an html listbox.
 java.lang.String getMultiSelectListBox(java.lang.Object header, java.lang.Object body, java.util.Map miscData, java.lang.String[] selectedItems, int size)
          Use the specified header and body to display an html multi-select listbox (which must either be an implementation of the TabularData interface or the Objects must be in the TabularData factory.
 java.lang.String getMultiSelectListBox(java.lang.Object header, java.lang.Object body, java.lang.String[] selectedItems, int size)
          Use the specified header and body to display an html multi-select lisbox (which must either be an implementation of the TabularData interface or the Objects must be in the TabularData factory).
 java.lang.String getMultiSelectListBox(ResultSetConverter rsc, java.util.Map miscData, java.lang.String[] selectedItems, int size)
          Using a ResultSetConverter display an html multi-select listbox (extra info may be passed into the template via a Map).
 java.lang.String getMultiSelectListBox(ResultSetConverter rsc, java.lang.String[] selectedItems, int size)
          Using a ResultSetConverter display an html multi-select listbox.
 java.lang.String getMultiSelectListBox(java.lang.String query, java.util.Map miscData, java.lang.String[] selectedItems, int size)
          Using the specified query and the default DataSource display an html multi-select listbox (extra info can be passed in via a Map).
 java.lang.String getMultiSelectListBox(java.lang.String query, java.lang.String[] selectedItems, int size)
          Using the specified query and the default DataSource display an html multi-select listbox.
 java.lang.String getMultiSelectListBox(java.lang.String dataSource, java.lang.String query, java.util.Map miscData, java.lang.String[] selectedItems, int size)
          Using the specified query and a named DataSource display an html multi-select listbox (extra info can be passed in via a Map).
 java.lang.String getMultiSelectListBox(java.lang.String dataSource, java.lang.String query, java.lang.String[] selectedItems, int size)
          Using the specified query and a named DataSource display an html multi-select listbox.
 java.lang.String getRadioButton(java.lang.Object header, java.lang.Object body, java.util.Map miscData, java.lang.String selectedItem)
          Use the specified data (Either the TabularData interface or an object that has been placed in the TabularData factory) to display an html radio button listbox (extra info may be passed in via a Map).
 java.lang.String getRadioButton(java.lang.Object header, java.lang.Object body, java.lang.String selectedItem)
          Use the specified data (Either the TabularData interface or an object that has been placed in the TabularData factory.) to display an html radio button listbox.
 java.lang.String getRadioButton(ResultSetConverter rsc, java.util.Map miscData, java.lang.String selectedItem)
          Use a ResultSetConverter to display an html radio button listbox (extra info accessible in the template can be passed in via a Map).
 java.lang.String getRadioButton(ResultSetConverter rsc, java.lang.String selectedItem)
          Use a ResultSetConverter to display an html radio button listbox.
 java.lang.String getRadioButton(java.lang.String query, java.lang.String selectedItem)
          Using the specified query and the default DataSource display an HTML radio-button listbox.
 java.lang.String getRadioButton(java.lang.String dataSource, java.lang.String query, java.util.Map miscData, java.lang.String selectedItem)
          Use the specified query and DataSource to display an HTML radio-button listbox.
 java.lang.String getRadioButton(java.lang.String dataSource, java.lang.String query, java.lang.String selectedItem)
          Using the specified query and DataSource display an HTML radio-button listbox.
 ResultSetConverter getResultSetConverter(java.lang.String query)
          Execute the query against the default DataSource (jdbc/DataSource) and return a ResultSetConverter object.
 ResultSetConverter getResultSetConverter(java.lang.String dataSource, java.lang.String query)
          Execute the query against the named DataSource, and return a ResultSetConverter object.
 java.lang.String getSortedText(java.lang.Object[] header, java.lang.Object[][] body, java.util.Map miscData, int sortCol, java.lang.String sortOrder, java.lang.String templateName)
          Sort and format the input on the specified sort column and order (ascending, or descending).
 java.lang.String getSortedText(java.lang.Object[] header, java.lang.Object[][] body, java.util.Map miscData, int sortCol, java.lang.String sortOrder, Template template)
          Sort and format the input on the specified sort column and order (ascending, or descending).
 java.lang.String getSortedText(ResultSetConverter rsConverter, java.util.Map miscData, int sortCol, java.lang.String sortOrder, java.lang.String templateName)
          Sort and format the ResultSetConverter on the specified sort column and order (ascending, or descending).
 java.lang.String getSortedText(java.lang.String query, java.util.Map miscData, int sortCol, java.lang.String sortOrder, java.lang.String templateName)
          Sort and format the query on the specified sort column and order (ascending, or descending).
 java.lang.String getSortedText(java.lang.String dataSource, java.lang.String query, java.util.Map miscData, int sortCol, java.lang.String sortOrder, java.lang.String templateName)
          Sort and format the query on the specified sort column and order (ascending, or descending).
 Template getTemplate(java.lang.String templateName)
          Returns a Template object which can be manipulated programmatically.
 Templates getTemplates()
          Returns the templates that belong to the FormattedDataSet.
protected  java.lang.String highLightMultiSelect(java.lang.String listBox, java.lang.String[] selectedItems)
          Method that can be used to highlight selected entries in a multi-select listbox
 void initialize(java.lang.Object[][] templateFiles)
          Pass in an array of template names and files to be parsed into Template objects contained in the FormattedDataSet instance.
static void main(java.lang.String[] args)
          Test code for the FormattedDataSet
 void putTemplate(java.lang.String templateName, Template template)
          Check in a template object to be used in subsequent calls to FormattedDataSet.
 void setArrayConverter(ArrayConverter arrayConverter)
          Set the ArrayConverter that is used to Format any passed in data to the getSortedText routines
 void setDataAccessFactory(DataAccess dataAccessFactory)
          This method sets the DataAccess interface that will be called by the FormattedDataSet when Database interaction is required.
 void setDebug(boolean debug)
          Enable/Disable debugging.
protected  java.lang.String sizeList(java.lang.String listBox, int size)
          Change the size of an html listbox passed in as a String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormattedDataSet

public FormattedDataSet()
FormattedDataSet may either be created with a constructor or the createInstance() method

Method Detail

createInstance

public static FormattedDataSet createInstance()

Returns a singleton version of the FormattedDataSet. It is the equivalent of calling the public constructor except this method returns a singleton. Each FormattedDataSet instance is thread safe no matter how it is created.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 String html=fds.getFormattedDataSet("select * from table", "htmlTable");
 


initialize

public void initialize(java.lang.Object[][] templateFiles)

Pass in an array of template names and files to be parsed into Template objects contained in the FormattedDataSet instance. The array takes a logical template name and a file. The logical template name can then be referenced in calls to getFormattedDataSet. Note although this routine takes an Object[][] it will typically be passed a String[][]. An Object[][] was taken so the ResultSetConverter.getResultSet() method can be passed directly.

Note in the example below the template name "line_item_template" is parsed using 2 files. Order is important. The first file in the array is parsed first and then the second. If there any conflicting template tags then the second files values will overwrite the first.

Sample call: If the sample code was put in a jsp within a WAR then the template files referenced would be found in the WAR subdirectory called "/templates" off of the root.

 <%!
 FormattedDataSet fds=FormattedDataSet.createInstance();

 public void jspInit() {
 String path=getServletContext().getRealPath("/");
 String s[][] = { 
   {"line_item_template", path+"templates/sorted_table_template.html"},
   {"line_item_template", path+"templates/line_item_template.html"},
   {"myXMLtemplate", path+"templates/xml.html"},
 };

 fds.initialize(s);
 } %>


Sample call of a template from the jsp follows:

<%= fds.getFormattedDataSet("select * from table", "myXMLTemplate") %>


getTemplates

public Templates getTemplates()
Returns the templates that belong to the FormattedDataSet. Individual Template objects can be manipulated from the Templates object.

See Also:
Templates

getTemplate

public Template getTemplate(java.lang.String templateName)
Returns a Template object which can be manipulated programmatically.

Sample call:

  FormattedDataSet fds=new FormattedDataSet();
  Template template=fds.getTemplate("xml");
  

See Also:
Template

putTemplate

public void putTemplate(java.lang.String templateName,
                        Template template)
Check in a template object to be used in subsequent calls to FormattedDataSet.

Sample call:

  FormattedDataSet fds=new FormattedDataSet();
  fds.putTemplate("myxml", new Template());
  


setDataAccessFactory

public void setDataAccessFactory(DataAccess dataAccessFactory)

This method sets the DataAccess interface that will be called by the FormattedDataSet when Database interaction is required. For example there will be a different DataAccess class used for a J2EE application than a stand alone Java app.

Sample Call:

  FormattedDataSet fds=FormattedDataSet.createInstance();
  DataAccess dataAccessFactory=new DataAccessJ2EE(new InitialContext(), "MyDataSource");
  fds.setDataAccessFactory(dataAccessFactory);
  

See Also:

getDataAccess

public DataAccess getDataAccess()
                         throws java.sql.SQLException
Return the underlying DataAccess object. This allows developers to execute direct SQL with the FormattedDataSet's DataAccess object.

java.sql.SQLException

getFormattedDataSet

public java.lang.String getFormattedDataSet(java.lang.String query,
                                            java.lang.String templateName)
                                     throws java.sql.SQLException
Execute a query against the default datasource (named jdbc/DataSource) and format the results by using the specified template. This method will execute the query using the FormattedDataSet's DataAccess interface. Note the FormattedDataSet can handle all JDBC calls.

Sample Call: The following sample will execute the query and format the results as an HTML table.

 FormattedDataSet fds=new FormattedDataSet();
 String html=fds.getFormattedDataSet("select * from table", "htmlTable");
 

java.sql.SQLException

getFormattedDataSet

public java.lang.String getFormattedDataSet(java.lang.String query,
                                            Template template)
                                     throws java.sql.SQLException
Execute a query against the default datasource (named jdbc/DataSource) and format the results by using the specified template. This method will execute the query using the FormattedDataSet's DataAccess interface. Note FormattedDataSet handles all JDBC calls.

Sample Call: The following sample will execute the query and format the results as an HTML table.

 FormattedDataSet fds=new FormattedDataSet();
 String html=fds.getFormattedDataSet("select * from table", fds.getTemplate("htmlTable").copy());
 

java.sql.SQLException

getFormattedDataSet

public java.lang.String getFormattedDataSet(java.lang.String query,
                                            java.util.Map miscData,
                                            java.lang.String templateName)
                                     throws java.sql.SQLException
Execute a query against the default DataSource (jdbc/DataSource) and format the results by using the specified template, also accepting a Map which can be used to specify dynamic template variables. This method will execute the query using the FormattedDataSet's DataAccess interface. Note FormattedDataSet handles all JDBC calls.

Sample Call:The following sample will execute the query and format the results as an HTML table.

 FormattedDataSet fds=new FormattedDataSet();
 Map map=new HashMap();
 map.put("date", new Date()); // if template has ##date the date will be dynamically replaced with it
 String html=fds.getFormattedDataSet("select * from table", map, "htmlTable");
 

java.sql.SQLException

getFormattedDataSet

public java.lang.String getFormattedDataSet(java.lang.String dataSource,
                                            java.lang.String query,
                                            java.lang.String templateName)
                                     throws java.sql.SQLException
Execute a query against the named datasource (named jdbc/MyDataSource) and format the results by using the specified template. This method will execute the query using the FormattedDataSet's DataAccess interface. Note FormattedDataSet handles all JDBC calls.

Sample Call:

 FormattedDataSet fds=new FormattedDataSet();
 String html=fds.getFormattedDataSet("myDataSource", "select * from table", "htmlTable");
 

java.sql.SQLException

getFormattedDataSet

public java.lang.String getFormattedDataSet(java.lang.String dataSource,
                                            java.lang.String query,
                                            java.util.Map miscData,
                                            java.lang.String templateName)
                                     throws java.sql.SQLException
Execute a query against the named datasource (named jdbc/MyDataSource) and format the results by using the specified template. Also accept a Map which can be used to specify dynamic template variables. This method will execute the query using the FormattedDataSet's DataAccess interface. Note FormattedDataSet handles all JDBC calls.

Sample Call:

 FormattedDataSet fds=new FormattedDataSet();
 Map map=new HashMap();
 map.put("date", new Date()); // if template has ##date the date will be dynamically replaced with it
 String html=fds.getFormattedDataSet("myDataSource", "select * from table", map, "htmlTable");
 

java.sql.SQLException

getFormattedDataSet

public java.lang.String getFormattedDataSet(java.lang.String dataSource,
                                            java.lang.String query,
                                            java.util.Map miscData,
                                            Template template)
                                     throws java.sql.SQLException
Execute a query against the named datasource (named jdbc/MyDataSource) and format the results by using the specified Template object. Also accept a Map which can be used to specify dynamic template variables. This method will execute the query using the FormattedDataSet's DataAccess interface. Note FormattedDataSet handles all JDBC calls.

Sample Call:

 FormattedDataSet fds=new FormattedDataSet();
 Map map=new HashMap();
 map.put("date", new Date()); // if template has ##date the date will be dynamically replaced with it
 Template template=fds.getTemplate("htmlTable").copy();// clone template so as not to change the original
 template.initialize("body_cell_data", 0, 2, "##this-##date");
 String html=fds.getFormattedDataSet("myDataSource", "select * from table", map, template);
 

java.sql.SQLException

getResultSetConverter

public ResultSetConverter getResultSetConverter(java.lang.String dataSource,
                                                java.lang.String query)
                                         throws java.sql.SQLException
Execute the query against the named DataSource, and return a ResultSetConverter object. The ResultSetConverter represents the ResultSet and ResultSetMetaData as arrays. This allows the data to more easily be sorted, cached and manipulated in general.

Sample Call:

 FormattedDataSet fds=new FormattedDataSet();
 ResultSetConverter rsc=fds.getResultSetConverter("myDataSource", "select * from table");
 

java.sql.SQLException

getResultSetConverter

public ResultSetConverter getResultSetConverter(java.lang.String query)
                                         throws java.sql.SQLException
Execute the query against the default DataSource (jdbc/DataSource) and return a ResultSetConverter object. The ResultSetConverter represents the ResultSet and ResultSetMetaData as arrays. This allows the data to more easily be sorted, cached and manipulated in general.

Sample Call:

 FormattedDataSet fds=new FormattedDataSet();
 ResultSetConverter rsc=fds.getResultSetConverter("select * from table");
 

java.sql.SQLException

getArrayConverter

public ArrayConverter getArrayConverter()
Get the ArrayConverter that is set for any arrays. The arrayConverter will format for display any arrays or ResultSetConverters passed to the getSorted text method.


setArrayConverter

public void setArrayConverter(ArrayConverter arrayConverter)
Set the ArrayConverter that is used to Format any passed in data to the getSortedText routines


getFormattedDataSet

public java.lang.String getFormattedDataSet(java.lang.Object header,
                                            java.lang.Object body,
                                            java.lang.String templateName)
Format the passed data using the passed template. Note both the header, and body must either implement the TabularData interface or be objects that have been registered with the TabularDataFactory.

Sample Call: (using array TabularData):

 FormattedDataSet fds=new FormattedDataSet();
 String[]header={"fname", "lname"};
 Object[][] body={{"jeff", "beck"}, {"william", "reid"}};
 String html=fds.getFormattedDataSet(header, body, "htmlTable");
 

Sample Output: Note the "htmltable" output looks best when formatteddataset.css is included


getFormattedDataSet

public java.lang.String getFormattedDataSet(java.lang.Object header,
                                            java.lang.Object body,
                                            java.util.Map miscData,
                                            java.lang.String templateName)
Format the passed data using the passed template and pass in dynamic template variables. Note both the header, and body must either implement the TabularData interface or be objects that have been registered with the TabularDataFactory.

Sample Call (using String[], and Object[][] which are both predefined TabularData types):

 FormattedDataSet fds=new FormattedDataSet();
 String[]header={"fname", "lname"};
 Object[][] body={{"jeff", "beck"}, {"william", "reid"}};
 Map map=new TreeMap();
 map.put("rootElement", "guitarists");
 String html=fds.getFormattedDataSet(header, body, map, "xml1");
 


getFormattedDataSet

public java.lang.String getFormattedDataSet(java.lang.Object header,
                                            java.lang.Object body,
                                            java.util.Map miscData,
                                            Template template)
Format the passed data using the passed template object and pass in dynamic template variables. Note both the header, and body must either implement the TabularData interface or be objects that have been registered with the TabularDataFactory.

Sample Call (using String[], and Object[][] which are both predefined TabularData types):

 FormattedDataSet fds=new FormattedDataSet();
 String[]header={"fname", "fullname"};
 Object[][] body={{"jeff", "beck"}, {"william", "reid"}};
 Map map=new TreeMap();
 map.put("rootElement", "guitarists");
 Template template=fds.getTemplate("xml1").copy();// clone so as not to change the original
 template.initialize("body_cell_data", 0, 2, "##1 ##2");
 String html=fds.getFormattedDataSet(header, body, map, template);
 


getFormattedDataSet

public java.lang.String getFormattedDataSet(ResultSetConverter rsConverter,
                                            java.lang.String templateName)
Format the ResultSetConverter using the passed template.

Sample Call:

 FormattedDataSet fds=new FormattedDataSet();
 String html=fds.getFormattedDataSet(fds.getResultSetConverter("select * from table"), "htmlTable");
 


getFormattedDataSet

public java.lang.String getFormattedDataSet(ResultSetConverter rsConverter,
                                            java.util.Map miscData,
                                            java.lang.String templateName)
Format the ResultSetConverter using the passed template and pass in dynamic template variables.

Sample Call:

 FormattedDataSet fds=new FormattedDataSet();
 Map map=new HashMap();
 map.put("rootElement", "guitarists");
 String html=fds.getFormattedDataSet(fds.getResultSetConverter("select * from guitarists"), map, "xml1");
 


getFormattedDataSet

public java.lang.String getFormattedDataSet(ResultSetConverter rsConverter,
                                            java.util.Map miscData,
                                            Template template)
Format the ResultSetConverter using the passed template object and pass in dynamic template variables.

Sample Call:

 FormattedDataSet fds=new FormattedDataSet();
 Template template=fds.getTemplate("xml1").copy(); // so as not to change the original
 template.initialize("body_cell_data",0,2,"##2, ##1"); // i.e. beck, jeff in col 2
 String html=fds.getFormattedDataSet(fds.getResultSetConverter("select * from guitarists"), map, template);
 


getSortedText

public java.lang.String getSortedText(java.lang.Object[] header,
                                      java.lang.Object[][] body,
                                      java.util.Map miscData,
                                      int sortCol,
                                      java.lang.String sortOrder,
                                      Template template)
Sort and format the input on the specified sort column and order (ascending, or descending). Formatting will be done by the passed in Template object. Also a Map is passed in that contains extra information accessible in the template.
Note the sortCol will sort the body (Object[][]) using the specified sortOrder ("asc", "desc" are valid). To sort the first column use a sortCol value of 1 (in the array this would be specified by index 0). A value greater than the number of columns or an invalid sortOrder throws an exception.

Sample Call:

  FormattedDataSet fds=new FormattedDataSet();
  Map miscData=new HashMap();
  miscData.put("myVar", "HelloWorld");
  miscData.put("sortPageName", "mypage.jsp");
  Template template=new Template();
  ...
  // sorts column 2 (array index 1) in ascending order.  possibilites for the sortOrder field are "asc" or "desc"
  String html=fds.getSortedText(header, body, miscData, 2, "asc", template); // header=Object[] and body=Object[][]
 


getSortedText

public java.lang.String getSortedText(java.lang.Object[] header,
                                      java.lang.Object[][] body,
                                      java.util.Map miscData,
                                      int sortCol,
                                      java.lang.String sortOrder,
                                      java.lang.String templateName)
Sort and format the input on the specified sort column and order (ascending, or descending). Formatting will be done by the Template object associated with the template name. Also a Map is passed in that contains extra information accessible in the template.

Sample Call: See other getSortedText(...) methods for an example.


getSortedText

public java.lang.String getSortedText(ResultSetConverter rsConverter,
                                      java.util.Map miscData,
                                      int sortCol,
                                      java.lang.String sortOrder,
                                      java.lang.String templateName)
Sort and format the ResultSetConverter on the specified sort column and order (ascending, or descending). Formatting will be done by the Template object associated with the template name. Also a Map is passed in that contains extra information accessible in the template.

Sample Call: Note the "sortedHTMLTable" template used in the code sample is a default template and so will so will work out of the box.

  FormattedDataSet fds=new FormattedDataSet();
  String query="select * from table";
  ResultSetConveter rsc=fds.getResultSetConverter(query);
  Map miscData=new HashMap();
  miscData.put("myVar", "HelloWorld");
  miscData.put("sortPageName", "mypage.jsp");
  // query must be encoded.  this gets put in the clickable header.
  miscData.put("query", "&query="+java.net.URLEncoder.encode(query));
  ...
  // sorts column 2 (array index 1) in ascending order.  possibilites for the sortOrder field are "asc" or "desc"
  String html=fds.getSortedText(rsc, miscData, 2, "asc", "sortedHTMLTable"); // header=Object[] and body=Object[][]
 


getSortedText

public java.lang.String getSortedText(java.lang.String query,
                                      java.util.Map miscData,
                                      int sortCol,
                                      java.lang.String sortOrder,
                                      java.lang.String templateName)
                               throws java.sql.SQLException
Sort and format the query on the specified sort column and order (ascending, or descending). Formatting will be done by the Template object associated with the template name. The default DataSource will be used. Also a Map is passed in that contains extra information accessible in the template.

Sample Call: See other getSortedText(...) methods for an example.

java.sql.SQLException

getSortedText

public java.lang.String getSortedText(java.lang.String dataSource,
                                      java.lang.String query,
                                      java.util.Map miscData,
                                      int sortCol,
                                      java.lang.String sortOrder,
                                      java.lang.String templateName)
                               throws java.sql.SQLException
Sort and format the query on the specified sort column and order (ascending, or descending). Formatting will be done by the Template object associated with the template name. The specified DataSource will be used. Also a Map is passed in that contains extra information accessible in the template.

Note this method uses the deprecated URLEncoder.encode(String) which was deprecated in 1.4 and replaced by a different method. However, to keep this library compatible with JDK 1.2 I elected to use the deprecated method instead. When jdk 1.2 becomes less pervasive the jdk 1.4 method should be used instead.

Sample Call: See other getSortedText(...) methods for an example.

java.sql.SQLException

getDropDownListBox

public java.lang.String getDropDownListBox(java.lang.String dataSource,
                                           java.lang.String query,
                                           java.lang.String selectedItem)
                                    throws java.sql.SQLException
Using the specified query and DataSource display an html drop down listbox. The passed selectedItem will be highlighted.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 String html=fds.getDropDownListBox("MyDataSourceName", "select dataValue, displayValue from table", "selectedDataValue");
 

java.sql.SQLException

getDropDownListBox

public java.lang.String getDropDownListBox(java.lang.String dataSource,
                                           java.lang.String query,
                                           java.util.Map miscData,
                                           java.lang.String selectedItem)
                                    throws java.sql.SQLException
Using the specified query and DataSource display an html drop down listbox (extra info can be passed in via a Map). The passed selectedItem will be highlighted.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 Map map=new HashMap();
 map.put("date", new Date()); // referenced in template with ##date
 String html=fds.getDropDownListBox("MyDataSourceName", "select dataValue, displayValue from table", map, "selectedDataValue");
 

java.sql.SQLException

getDropDownListBox

public java.lang.String getDropDownListBox(java.lang.String query,
                                           java.lang.String selectedItem)
                                    throws java.sql.SQLException
Using the specified query and the default DataSource display an html drop down listbox. The passed selectedItem will be highlighted.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 String html=fds.getDropDownListBox("select dataValue, displayValue from table", "selectedDataValue");
 

java.sql.SQLException

getDropDownListBox

public java.lang.String getDropDownListBox(java.lang.String query,
                                           java.util.Map miscData,
                                           java.lang.String selectedItem)
                                    throws java.sql.SQLException
Using the specified query and default DataSource display an html drop down listbox (extra info can be passed in via a Map). The passed selectedItem will be highlighted.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 Map map=new HashMap();
 map.put("date", new Date()); // referenced in template with ##date
 String html=fds.getDropDownListBox("select dataValue, displayValue from table", map, "selectedDataValue");
 

java.sql.SQLException

getDropDownListBox

public java.lang.String getDropDownListBox(java.lang.Object header,
                                           java.lang.Object body,
                                           java.lang.String selectedItem)
Using the specified data (which has to either implement TabularData or have been checked into the TabularData factory) display an html drop down listbox. The passed selectedItem will be highlighted.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 String[] header={"lastNameValue", "lastNameDisplay"};
 String[][] body={{"SouzaValue", "SouzaDisplay"}, {"BeckValue", "BeckDisplay"}};
 String html=fds.getDropDownListBox(header, body, "BeckValue");
 

Sample Output:


getDropDownListBox

public java.lang.String getDropDownListBox(java.lang.Object header,
                                           java.lang.Object body,
                                           java.util.Map miscData,
                                           java.lang.String selectedItem)
Using the specified data (which has to either implement TabularData or have been checked into the TabularData factory) display an html drop down listbox. Misc data can also be passed in via a Map. The passed selectedItem will be highlighted.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 String[] header={"lastNameValue", "lastNameDisplay"};
 String[][] body={{"Souza", "Souza"}, {"Beck", "Beck"}};
 Map map=new HashMap();
 map.put("myVar", "myVarValue");
 String html=fds.getDropDownListBox(header, body, "Beck");
 


getDropDownListBox

public java.lang.String getDropDownListBox(ResultSetConverter rsc,
                                           java.lang.String selectedItem)
Using a ResultSetConverter display an html drop down listbox. The passed selectedItem will be highlighted.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 ResultSetConverter rsc=fds.getResultSetConverter("select lnameValue, lnameDisplay from table");
 String html=fds.getDropDownListBox(rsc, "Beck");
 


getDropDownListBox

public java.lang.String getDropDownListBox(ResultSetConverter rsc,
                                           java.util.Map miscData,
                                           java.lang.String selectedItem)
Using a ResultSetConverter display an html drop down listbox. The passed selectedItem will be highlighted.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 ResultSetConverter rsc=fds.getResultSetConverter("select lnameValue, lnameDisplay from table");
 Map map=new HashMap();
 map.put("myVar", "myVarValue");
 String html=fds.getDropDownListBox(rsc, map, "Beck");
 


getListBox

public java.lang.String getListBox(java.lang.String dataSource,
                                   java.lang.String query,
                                   java.lang.String selectedItem,
                                   int size)
                            throws java.sql.SQLException
Using the specified query and DataSource display an html listbox. The passed selectedItem will be highlighted, and the listbox will be as big as the passed in size specifies. Note except for the size parameter getListBox(...) methods work the same as getDropDownListBox(...) methods.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 String html=fds.getListBox("MyDataSource", "select dataValue, displayValue from table", "selectedDataValue", 10);
 

java.sql.SQLException

getListBox

public java.lang.String getListBox(java.lang.String dataSource,
                                   java.lang.String query,
                                   java.util.Map miscData,
                                   java.lang.String selectedItem,
                                   int size)
                            throws java.sql.SQLException
Using the specified query and a named DataSource display an html listbox (extra info can be passed in via a Map). The passed selectedItem will be highlighted. Note except for the size parameter getListBox(...) methods work the same as getDropDownListBox(...) methods.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 Map map=new HashMap();
 map.put("date", new Date()); // referenced in template with ##date
 String html=fds.getListBox("MyDataSource", "select dataValue, displayValue from table", map, "selectedDataValue", 5);
 

java.sql.SQLException

getListBox

public java.lang.String getListBox(java.lang.String query,
                                   java.lang.String selectedItem,
                                   int size)
                            throws java.sql.SQLException
Using the specified query and default DataSource display an html listbox. The passed selectedItem will be highlighted. Note except for the size parameter getListBox(...) methods work the same as getDropDownListBox(...) methods.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 String html=fds.getListBox("select dataValue, displayValue from table", "selectedDataValue", 5);
 

java.sql.SQLException

getListBox

public java.lang.String getListBox(java.lang.String query,
                                   java.util.Map miscData,
                                   java.lang.String selectedItem,
                                   int size)
                            throws java.sql.SQLException
Using the specified query and default DataSource display an html listbox (extra info can be passed in via a Map). The passed selectedItem will be highlighted. Note except for the size parameter getListBox(...) methods work the same as getDropDownListBox(...) methods.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 Map map=new HashMap();
 map.put("date", new Date()); // referenced in template with ##date
 String html=fds.getListBox("select dataValue, displayValue from table", map, "selectedDataValue", 5);
 

java.sql.SQLException

getListBox

public java.lang.String getListBox(java.lang.Object header,
                                   java.lang.Object body,
                                   java.lang.String selectedItem,
                                   int size)
Using the specified data (which can either be a TabularData interface or an Object that can implement this interface) display an html listbox. The passed selectedItem will be highlighted. Note except for the size parameter getListBox(...) methods work the same as getDropDownListBox(...) methods.

Sample Call: Using ResultSet and ResultSetMetaData as the TabularData types (The code below assumes the ResultSet has already been opened)

 FormattedDataSet fds=FormattedDataSet.createInstance();
 String html=fds.getListBox(resultSet.getMetaData(), resultSet, "BeckValue", 5);
 

Sample Output:


getListBox

public java.lang.String getListBox(java.lang.Object header,
                                   java.lang.Object body,
                                   java.util.Map miscData,
                                   java.lang.String selectedItem,
                                   int size)
Using the specified data (which can either be a TabularData interface or an Object that can implement this interface) display an html listbox (extra info may be passed in to the template via a Map). The passed selectedItem will be highlighted. Note except for the size parameter getListBox(...) methods work the same as getDropDownListBox(...) methods.

Sample Call: Using ResultSet and ResultSetMetaData as the TabularData types (The code below assumes the ResultSet has already been opened)

 FormattedDataSet fds=FormattedDataSet.createInstance();
 Map map=new HashMap();
 map.put("date", new Date()); // referenced in template with ##date
 String html=fds.getListBox(resultSet.getResultSetMetaData(), resultSet, map, "selectedDataValue", 5);
 


getListBox

public java.lang.String getListBox(ResultSetConverter rsc,
                                   java.lang.String selectedItem,
                                   int size)
Using a ResultSetConverter display an html listbox (extra info may be passed in to the template via a Map). The passed selectedItem will be highlighted. Note except for the size parameter getListBox(...) methods work the same as getDropDownListBox(...) methods.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 ResultSetConverter rsc=fds.getResultSetConverter("select dataValue, displayValue from table");
 String html=fds.getListBox(rsc, map, "selectedDataValue", 5);
 


getListBox

public java.lang.String getListBox(ResultSetConverter rsc,
                                   java.util.Map miscData,
                                   java.lang.String selectedItem,
                                   int size)
Using a ResultSetConverter display an html listbox (extra info may be passed in to the template via a Map). The passed selectedItem will be highlighted. Note except for the size parameter getListBox(...) methods work the same as getDropDownListBox(...) methods.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 ResultSetConverter rsc=fds.getResultSetConverter("select dataValue, displayValue from table");
 Map map=new HashMap();
 map.put("date", new Date()); // referenced in template with ##date
 String html=fds.getListBox(rsc, map, "selectedDataValue", 5);
 


getMultiSelectListBox

public java.lang.String getMultiSelectListBox(java.lang.String dataSource,
                                              java.lang.String query,
                                              java.lang.String[] selectedItems,
                                              int size)
                                       throws java.sql.SQLException
Using the specified query and a named DataSource display an html multi-select listbox. All values in the passed selectedItems array will be highlighted/selected. The size of the multi-select list box is also passed.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 // both values will be selected in the listbox
 String[] selectedValues={"SouzaValue", "BeckValue"};  
 String html=fds.getMultiSelectListBox("MyDataSource", "select dataValue, displayValue from table", selectedValues, 5);
 

java.sql.SQLException

getMultiSelectListBox

public java.lang.String getMultiSelectListBox(java.lang.String dataSource,
                                              java.lang.String query,
                                              java.util.Map miscData,
                                              java.lang.String[] selectedItems,
                                              int size)
                                       throws java.sql.SQLException
Using the specified query and a named DataSource display an html multi-select listbox (extra info can be passed in via a Map). The passed selectedItems array will be highlighted/selected. The size parameter specifies the size of the multi-select listbox.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 Map map=new HashMap();
 map.put("date", new Date()); // referenced in template with ##date
 // both values will be selected in the listbox
 String[] selectedValues={"SouzaValue", "BeckValue"};
 String html=fds.getMultiSelectListBox("MyDataSource", "select dataValue, displayValue from table", map, selectedValues, 5);
 

java.sql.SQLException

getMultiSelectListBox

public java.lang.String getMultiSelectListBox(java.lang.String query,
                                              java.lang.String[] selectedItems,
                                              int size)
                                       throws java.sql.SQLException
Using the specified query and the default DataSource display an html multi-select listbox. All values in the passed selectedItems array will be highlighted/selected. The size of the multi-select list box is also passed.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 String[] selectedValues={"SouzaValue", "BeckValue"};
 // both values will be selected in the listbox
 String html=fds.getMultiSelectListBox("select dataValue, displayValue from table", selectedValues, 5);
 

java.sql.SQLException

getMultiSelectListBox

public java.lang.String getMultiSelectListBox(java.lang.String query,
                                              java.util.Map miscData,
                                              java.lang.String[] selectedItems,
                                              int size)
                                       throws java.sql.SQLException
Using the specified query and the default DataSource display an html multi-select listbox (extra info can be passed in via a Map). The passed selectedItems array will be highlighted/selected. The size parameter specifies the size of the multi-select listbox.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 Map map=new HashMap();
 map.put("date", new Date()); // referenced in template with ##date
 // both values will be selected in the listbox
 String[] selectedValues={"SouzaValue", "BeckValue"};
 String html=fds.getMultiSelectListBox("select dataValue, displayValue from table", map, selectedValues, 5);
 

java.sql.SQLException

getMultiSelectListBox

public java.lang.String getMultiSelectListBox(java.lang.Object header,
                                              java.lang.Object body,
                                              java.lang.String[] selectedItems,
                                              int size)
Use the specified header and body to display an html multi-select lisbox (which must either be an implementation of the TabularData interface or the Objects must be in the TabularData factory). The passed selectedItems array will be highlighted/selected. The size parameter specifies the size of the multi-select listbox.

Sample Call: The example below uses ResultSetMetaData and ResultSets both of which are forms of TabularData

 FormattedDataSet fds=FormattedDataSet.createInstance();
 // both values will be selected in the listbox
 String[] selectedValues={"SouzaValue", "BeckValue"};
 String html=fds.getMultiSelectListBox(resultSet.getMetaData(), resultSet, selectedValues, 5);
 

Sample Output:



getMultiSelectListBox

public java.lang.String getMultiSelectListBox(java.lang.Object header,
                                              java.lang.Object body,
                                              java.util.Map miscData,
                                              java.lang.String[] selectedItems,
                                              int size)
Use the specified header and body to display an html multi-select listbox (which must either be an implementation of the TabularData interface or the Objects must be in the TabularData factory. Also Extra info may be passed in via a Map) The passed selectedItems array will be highlighted/selected. The size parameter specifies the size of the multi-select listbox.

Sample Call: The example below uses ResultSetMetaData and ResultSets both of which are forms of TabularData

 FormattedDataSet fds=FormattedDataSet.createInstance();
 // both values will be selected in the listbox
 String[] selectedValues={"SouzaValue", "BeckValue"};
 String html=fds.getMultiSelectListBox(resultSet.getMetaData(), resultSet, selectedValues, 5);
 


getMultiSelectListBox

public java.lang.String getMultiSelectListBox(ResultSetConverter rsc,
                                              java.lang.String[] selectedItems,
                                              int size)
Using a ResultSetConverter display an html multi-select listbox. The passed selectedItems array will be highlighted/selected. The size parameter specifies the size of the multi-select listbox.

Sample Call: The example below uses ResultSetMetaData and ResultSets both of which are forms of TabularData

 FormattedDataSet fds=FormattedDataSet.createInstance();
 ResultSetConverter rsc=fds.getResultSetConverter("select dataValue, displayValue from table");
 // both values will be selected in the listbox
 String[] selectedValues={"SouzaValue", "BeckValue"};
 String html=fds.getMultiSelectListBox(rsc, selectedValues, 5);
 


getMultiSelectListBox

public java.lang.String getMultiSelectListBox(ResultSetConverter rsc,
                                              java.util.Map miscData,
                                              java.lang.String[] selectedItems,
                                              int size)
Using a ResultSetConverter display an html multi-select listbox (extra info may be passed into the template via a Map). The passed selectedItems array will be highlighted/selected. The size parameter specifies the size of the multi-select listbox.

Sample Call: The example below uses ResultSetMetaData and ResultSets both of which are forms of TabularData

 FormattedDataSet fds=FormattedDataSet.createInstance();
 ResultSetConverter rsc=fds.getResultSetConverter("select dataValue, displayValue from table");
 Map map=new HashMap();
 map.put("date", new Date()); // referenced in template with ##date
 // both values will be selected in the listbox
 String[] selectedValues={"SouzaValue", "BeckValue"};
 String html=fds.getRadioButton(rsc, map, selectedValues, 5);


highLightMultiSelect

protected java.lang.String highLightMultiSelect(java.lang.String listBox,
                                                java.lang.String[] selectedItems)
Method that can be used to highlight selected entries in a multi-select listbox


getRadioButton

public java.lang.String getRadioButton(java.lang.String dataSource,
                                       java.lang.String query,
                                       java.lang.String selectedItem)
                                throws java.sql.SQLException
Using the specified query and DataSource display an HTML radio-button listbox. A value is passed in for the highlighted/selected data value.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 String html=fds.getRadioButton("MyDataSource", "select dataValue, displayValue from table", "selectedDataValue");
 

java.sql.SQLException

getRadioButton

public java.lang.String getRadioButton(java.lang.String dataSource,
                                       java.lang.String query,
                                       java.util.Map miscData,
                                       java.lang.String selectedItem)
                                throws java.sql.SQLException
Use the specified query and DataSource to display an HTML radio-button listbox. A value is passed in for the highlighted/selected data value.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 String html=fds.getRadioButton("MyDataSource", "select dataValue, displayValue from table", "selectedDataValue");
 

java.sql.SQLException

getRadioButton

public java.lang.String getRadioButton(java.lang.String query,
                                       java.lang.String selectedItem)
                                throws java.sql.SQLException
Using the specified query and the default DataSource display an HTML radio-button listbox. A value is passed in for the highlighted/selected data value.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 String html=fds.getRadioButton("select dataValue, displayValue from table", "selectedDataValue");
 

java.sql.SQLException

getRadioButton

public java.lang.String getRadioButton(java.lang.Object header,
                                       java.lang.Object body,
                                       java.lang.String selectedItem)
Use the specified data (Either the TabularData interface or an object that has been placed in the TabularData factory.) to display an html radio button listbox. A value is passed in for the highlighted/selected data value.

Sample Call: The sample uses a ResultSet and ResultSetMetaData, however other types of TabularData are also supported via this method.

 FormattedDataSet fds=FormattedDataSet.createInstance();
 String html=fds.getRadioButton(resultSet.getMetaData(), resultSet, "BeckValue");
 

Sample Output:

SouzaDisplay BeckDisplay ReidDisplay HibbertDisplay RichardsDisplay


getRadioButton

public java.lang.String getRadioButton(java.lang.Object header,
                                       java.lang.Object body,
                                       java.util.Map miscData,
                                       java.lang.String selectedItem)
Use the specified data (Either the TabularData interface or an object that has been placed in the TabularData factory) to display an html radio button listbox (extra info may be passed in via a Map). A value is passed in for the highlighted/selected data value.

Sample Call: The sample uses a ResultSet and ResultSetMetaData, however other types of TabularData are also supported via this method.

 FormattedDataSet fds=FormattedDataSet.createInstance();
 Map map=new HashMap();
 map.put("date", new Date()); // referenced in template with ##date
 String html=fds.getRadioButton(resultSet.getMetaData(), resultSet, map, "BeckValue");
 


getRadioButton

public java.lang.String getRadioButton(ResultSetConverter rsc,
                                       java.lang.String selectedItem)
Use a ResultSetConverter to display an html radio button listbox. A value is passed in for the highlighted/selected data value.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 ResultSetConverter rsc=fds.getResultSetConverter("select dataValue, displayValue from table");
 String html=fds.getRadioButton(rsc, "BeckValue");
 


getRadioButton

public java.lang.String getRadioButton(ResultSetConverter rsc,
                                       java.util.Map miscData,
                                       java.lang.String selectedItem)
Use a ResultSetConverter to display an html radio button listbox (extra info accessible in the template can be passed in via a Map). A value is passed in for the highlighted/selected data value.

Sample Call:

 FormattedDataSet fds=FormattedDataSet.createInstance();
 ResultSetConverter rsc=fds.getResultSetConverter("select dataValue, displayValue from table");
 Map map=new HashMap();
 map.put("date", new Date()); // referenced in template with ##date
 String html=fds.getRadioButton(rsc, map, "BeckValue");
 


setDebug

public void setDebug(boolean debug)
Enable/Disable debugging. This enables/disables logging for all classes in the FormattedDataSet API. Debugging is disabled by default.


getDebug

public boolean getDebug()
Enable/Disable debugging. This determines if debug mode is currently enabled.


sizeList

protected java.lang.String sizeList(java.lang.String listBox,
                                    int size)
Change the size of an html listbox passed in as a String


formatList

protected java.lang.String formatList(java.lang.String listBox,
                                      java.lang.String selectedItem)
Select/hightlight an item in an html list box


formatRadioButton

protected java.lang.String formatRadioButton(java.lang.String radioButton,
                                             java.lang.String selectedItem)
Select/highlight an item in an html radio button list box


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Test code for the FormattedDataSet

java.lang.Exception