Class Form

Table
  |
  +--Form

public class Form
extends Table

This class represents the entity of a Form. The idea is that each "form" will be based on a table of 3 columns. From that, you build on. If you want forms next to each other, then create two form objects and stick them into a table, side by side.


Constructor Summary
Form(var $fp, var $tp, var $ftp)
          Constructs a Form with the default values.
 
Method Summary
 void addItem(var $title, var $separator, var $formItem, var $fontProperties)
          Adding a "form entry" to the form.
 void addItemColumns(var $formItem, var $colSpan, var $ftp, var $hAlign)
          Adds a formItem that is able to span columns.
 void closeForm()
          Creates an HTML footer of the form.
static java.lang.String createButton(var $type, var $value, var $size)
          Creates a string representing a button.
static java.lang.String createHidden(var $name, var $value)
          Creates a string representation of a hidden form item.
static java.lang.String createSelectBox(var $name, var $data, var $match)
          Creates a string representing a selectbox.
static java.lang.String createTextArea(var $name, var $cols, var $rows, var $value)
          Creates a string representation of a text area.
static java.lang.String createTextBox(var $name, var $size, var $maxLength, var $value, var $secret)
          Creates a string representing a textbox.
 FormProperties getFormProperties()
          Gets the form properties.
 void openForm()
          Creates an HTML heading of the form.
 void setFormproperties(var $fp)
          Sets the form properties to the specified value.
 java.lang.String toString()
          Returns string representation of the form.
 
Methods inherited from class Table
add, closeTable, fillRow, getFontProperties, getTableProperties, nextRow, openTable, setFontProperties, setTableProperties, spacerRow
 

Constructor Detail

Form

public Form(var $fp,
            var $tp,
            var $ftp)
Constructs a Form with the default values. Otherwise, it will set the values of the respective variables to the specified values, if given.
Parameters:
$fp - FormProperties specifying form properties
$tp - TableProperties specifying table properties
$ftp - FontProperties specifying font properties of table
$fp - Default Value: ""
$tp - Default Value: ""
$ftp - Default Value: ""
Method Detail

getFormProperties

public FormProperties getFormProperties()
Gets the form properties.

setFormproperties

public void setFormproperties(var $fp)
Sets the form properties to the specified value.
Parameters:
$fp - FormProperties specifying form properties

toString

public java.lang.String toString()
Returns string representation of the form.
Overrides:
toString in class Table

addItem

public void addItem(var $title,
                    var $separator,
                    var $formItem,
                    var $fontProperties)
Adding a "form entry" to the form. A form entry typically consists of a title, separator, and a formItem. A formItem is generated by calling the appropriate static function of Form. A formItem is really a string specifying the HTML of the desired form item. Also, if passed a FontProperties, then the entire form entry will use said form formatting.
Parameters:
$title - String specifying title
$separator - String specifying what separator to use
$formItem - String consisting of a formItem
$fontProperties - FontProperties specifying font formatting to use
$title - Default Value: ""
$separator - Default Value: ""
$formItem - Default Value: ""
$fontProperties - Default Value: ""

addItemColumns

public void addItemColumns(var $formItem,
                           var $colSpan,
                           var $ftp,
                           var $hAlign)
Adds a formItem that is able to span columns. If passed other variables, then the properties of those variables will be used for the formItem being added.
Parameters:
$formItem - String specifying the form item
$colSpan - int specifying amount of columns to span
$ftp - FontProperties specifying font formatting
$hAlign - String specifying horizontal alignment
$colSpan - Default Value: 1
$ftp - Default Value: ""
$hAlign - Default Value: "center"

createTextBox

public static java.lang.String createTextBox(var $name,
                                             var $size,
                                             var $maxLength,
                                             var $value,
                                             var $secret)
Creates a string representing a textbox. Whichever values that are passed along with the function call, the specified values will be used in the creation of a textbox with said values. If one wants for the data entry to be masked by asterisks, then any value other other than nothing should be passed for the secret parameter.
Parameters:
$name - String specifying name of formItem
$size - int specifying length of formItem itself
$maxLength - int specifying max length of data in formItem
$value - String specifying default value to place in item
$secret - String specifying whether or not to be "secret"
$name - Default Value: ""
$size - Default Value: "20"
$maxLength - Default Value: "50"
$value - Default Value: ""
$secret - Default Value: ""

createTextArea

public static java.lang.String createTextArea(var $name,
                                              var $cols,
                                              var $rows,
                                              var $value)
Creates a string representation of a text area. Whichever values passed along will be selectively used in the creation of the select box.
Parameters:
$name - String specifying name of formItem
$cols - int specifying columns of the area
$rows - int specifying rows of the area
$value - String specifying default value of text area
$name - Default Value: ""
$cols - Default Value: "5"
$rows - Default Value: "5"
$value - Default Value: ""

createHidden

public static java.lang.String createHidden(var $name,
                                            var $value)
Creates a string representation of a hidden form item. This technique is useful in programming. Whichever values passed will be selectively used in the creation of the hidden entry.
Parameters:
$name - String specifying name of formItem
$value - String specifying value
$name - Default Value: ""
$value - Default Value: ""

createSelectBox

public static java.lang.String createSelectBox(var $name,
                                               var $data,
                                               var $match)
Creates a string representing a selectbox. Whichever values are passed along, will be used in the creation of the selectbox. Will either take a 2d array as the data or will take a database result as the data, which, then, it will set the id as the first column and the value as the second column. If a $match was passed, the function will select the first item matching it as the default.
Parameters:
$name - String specifying name of formItem
$data - 2d array specifying key-value pairs
$match - string specifying a match to look for
$name - Default Value: ""
$data - Default Value: ""
$match - Default Value: ""

createButton

public static java.lang.String createButton(var $type,
                                            var $value,
                                            var $size)
Creates a string representing a button. Whichever values are passed along, will be used in the creation of the button.
Parameters:
$type - String specifying which type of button
$value - String specifying label of the button
$size - int specifying size of the button itself
$type - Default Value: "submit"
$value - Default Value: "submit"
$size - Default Value: ""

openForm

public void openForm()
Creates an HTML heading of the form. Isn't necessary, in that one could just create a form without any headings and footers and place it in some other object that already possesses a header and footer.

closeForm

public void closeForm()
Creates an HTML footer of the form. Isn't necessary, in that one could just create a form without any headings and footers and place it in some other object that already possesses a header and footer.