com.ibm.commerce.pa.widget
Class DynamicForm

com.ibm.commerce.pa.widget.DynamicForm

public class DynamicForm

This class renders a form of form elements. It is used to render the data entry form for the ProductExploreDataBean.


Field Summary
protected  int columns
           
protected  int rows
           
 
Constructor Summary
DynamicForm()
          DynamicForm constructor.
 
Method Summary
protected  int calculateNumberOfRows(int max, int cols)
          This method will calculate the numer of rows given the number of columns and the maximum data elements.
 int getColumns()
          This method will return the number of columns in the table.
 int getRows()
          This method will return the number of rows in the table.
 void render(com.ibm.commerce.pa.widget.HttpServletRequest request, com.ibm.commerce.pa.widget.HttpServletResponse response)
          This method renders the form.
protected  void renderHorizontalTable(com.ibm.commerce.pa.widget.HttpServletRequest request, com.ibm.commerce.pa.widget.HttpServletResponse response, FormDataBean table)
          This method will output the table with products as rows and features as columns
protected  void renderVerticalTable(com.ibm.commerce.pa.widget.HttpServletRequest request, com.ibm.commerce.pa.widget.HttpServletResponse response, FormDataBean table)
          This method will output the table with features as rows and products as columns
 void setColumns(int newValue)
          Set the number of columns in the form.
 void setColumns(java.lang.String newValue)
          Set the number of columns using a String of the numeric value.
 void setRows(int newValue)
          Set the number of rows in the form.
 java.lang.String writeAllValues(ColumnDataBean row)
          This method renders the feature values for the row passed in.
 

Field Detail

columns

protected int columns

rows

protected int rows
Constructor Detail

DynamicForm

public DynamicForm()
DynamicForm constructor.
Method Detail

calculateNumberOfRows

protected int calculateNumberOfRows(int max,
                                    int cols)
This method will calculate the numer of rows given the number of columns and the maximum data elements. The number of columns cannot be greater than half of the number of data items. Otherwise it will return 2 rows.
Parameters:
max - int the maximum number of data elements
cols - int the number of columns you want
Returns:
int the number of rows in each column

getColumns

public int getColumns()
This method will return the number of columns in the table.
Returns:
int

getRows

public int getRows()
This method will return the number of rows in the table.
Returns:
int

render

public void render(com.ibm.commerce.pa.widget.HttpServletRequest request,
                   com.ibm.commerce.pa.widget.HttpServletResponse response)
This method renders the form. Using the databean assigned to it, this method obtains the features and the data entry widgets to use for the feature values, and creates a form containing them all.

renderHorizontalTable

protected void renderHorizontalTable(com.ibm.commerce.pa.widget.HttpServletRequest request,
                                     com.ibm.commerce.pa.widget.HttpServletResponse response,
                                     FormDataBean table)
                              throws java.io.IOException
This method will output the table with products as rows and features as columns
Parameters:
table - com.ibm.commerce.beans.TableDataBean the table to render
out - java.io.PrintWriter the output stream to render on

renderVerticalTable

protected void renderVerticalTable(com.ibm.commerce.pa.widget.HttpServletRequest request,
                                   com.ibm.commerce.pa.widget.HttpServletResponse response,
                                   FormDataBean table)
                            throws java.io.IOException
This method will output the table with features as rows and products as columns
Parameters:
table - com.ibm.commerce.beans.TableDataBean the table to render
out - java.io.PrintWriter the output stream to render on

setColumns

public void setColumns(int newValue)
Set the number of columns in the form.
Parameters:
newValue - int

setColumns

public void setColumns(java.lang.String newValue)
Set the number of columns using a String of the numeric value.
Parameters:
newValue - java.lang.String

setRows

public void setRows(int newValue)
Set the number of rows in the form.
Parameters:
newValue - int

writeAllValues

public java.lang.String writeAllValues(ColumnDataBean row)
This method renders the feature values for the row passed in.
Returns:
java.lang.String