net.sf.click.extras.cayenne
Class TabbedCayenneForm

java.lang.Object
  extended bynet.sf.click.control.AbstractControl
      extended bynet.sf.click.control.AbstractContainer
          extended bynet.sf.click.control.Form
              extended bynet.sf.click.extras.cayenne.CayenneForm
                  extended bynet.sf.click.extras.cayenne.TabbedCayenneForm
All Implemented Interfaces:
Container, Control, Serializable

public class TabbedCayenneForm
extends CayenneForm

Provides Cayenne data aware tabbed Form control:   <form method='POST'>.

This control provides t form capabilities to the standard CayenneForm. For more information and examples please see:

 

Author:
Malcolm Edgar
See Also:
Serialized Form

Field Summary
protected  String backgroundColor
          The form HTML background color.
protected  int displayTab
          The tab number to display (indexed from 1).
protected  String tabHeight
          The tab sheet height HTML attribute value.
protected  List tabSheets
          The list of FieldSet tab sheets.
protected  String tabWidth
          The tab sheet width HTML attribute value.
protected  String template
          The path of the tabbed form Velocity template to render.
 
Fields inherited from class net.sf.click.extras.cayenne.CayenneForm
classField, dataObject, FO_CLASS, FO_ID, metaDataApplied, oidField
 
Fields inherited from class net.sf.click.control.Form
actionURL, ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, buttonAlign, buttonList, buttonStyle, columns, defaultFieldSize, disabled, enctype, error, errorsAlign, errorsPosition, errorsStyle, fieldList, fieldStyle, fieldWidths, FOCUS_JAVASCRIPT, FORM_NAME, HTML_IMPORTS, javaScriptValidation, labelAlign, labelsPosition, labelStyle, method, MULTIPART_FORM_DATA, POSITION_BOTTOM, POSITION_LEFT, POSITION_MIDDLE, POSITION_TOP, readonly, SUBMIT_CHECK, validate
 
Fields inherited from class net.sf.click.control.AbstractContainer
controlMap, controls
 
Fields inherited from class net.sf.click.control.AbstractControl
actionListener, attributes, listener, listenerMethod, messages, name, parent, styles
 
Fields inherited from interface net.sf.click.Control
CONTROL_MESSAGES
 
Constructor Summary
TabbedCayenneForm()
          Create a Tabbed Cayenne Form with no name or dataObjectClass.
TabbedCayenneForm(Class dataClass)
          Create a Tabbed Cayenne Form with the given DataObject class.
TabbedCayenneForm(String name, Class dataClass)
          Create a Tabbed Cayenne Form with the given form name and DataObject class.
 
Method Summary
 void addTabSheet(FieldSet tabSheet)
          Add the given FieldSet tab sheet to the form.
 String getBackgroundColor()
          Return the form HTML background color.
 int getDisplayTab()
          Return the number of the tab sheet to display (indexed from 1).
 String getHtmlImports()
          Return the HTML head import statements for the CSS stylesheet file: click/TabbedForm.css.
 String getTabHeight()
          Return the tab sheet height HTML attribute value.
 int getTabSheetNumber(String fieldName)
          Return the tab sheet number for the given field name, indexed from 1.
 List getTabSheets()
          Return list FieldSet tab sheets.
 String getTabWidth()
          Return the tab sheet width HTML attribute value.
 String getTemplate()
          Return the path of the Velocity template to render.
 void onDeploy(ServletContext servletContext)
          Deploy the table.css file to the click web directory when the application is initialized.
 boolean onProcess()
          Process the Form request.
 void render(HtmlStringBuffer buffer)
          Render the HTML representation of the form.
 void setBackgroundColor(String value)
          Set the form HTML background color.
 void setDisplayTab(int value)
          Set the number of the tab sheet to display (indexed from 1).
 void setTabHeight(String value)
          Set the tab sheet height HTML attribute value.
 void setTabWidth(String value)
          Set the tab sheet width HTML attribute value.
 void setTemplate(String template)
          Set the path of the Velocity template to render.
 
Methods inherited from class net.sf.click.extras.cayenne.CayenneForm
applyMetaData, clearValues, getDataContext, getDataObject, getDataObject, getDataObjectClass, getDataObjectPk, isPersistent, onDestroy, saveChanges, setDataObject, setDataObjectClass, setObjEntityFieldConstrains
 
Methods inherited from class net.sf.click.control.Form
add, add, add, add, clearErrors, copyFrom, copyFrom, copyTo, copyTo, endTag, getActionURL, getButtonAlign, getButtonList, getButtonStyle, getColumns, getControlSizeEst, getDefaultFieldSize, getEnctype, getError, getErrorFields, getErrorsAlign, getErrorsPosition, getErrorsStyle, getField, getFieldList, getFields, getFieldStyle, getFieldValue, getFieldWidths, getFormSizeEst, getJavaScriptValidation, getLabelAlign, getLabelsPosition, getLabelStyle, getMethod, getTag, getValidate, hasPostError, insert, isDisabled, isFormSubmission, isReadonly, isValid, onSubmitCheck, onSubmitCheck, onSubmitCheck, performSubmitCheck, remove, removeField, removeFields, renderButtons, renderControls, renderErrors, renderFields, renderFocusJavaScript, renderHeader, renderTagEnd, renderValidationJavaScript, setActionURL, setButtonAlign, setButtonStyle, setColumns, setDefaultFieldSize, setDisabled, setEnctype, setError, setErrorsAlign, setErrorsPosition, setErrorsStyle, setFieldStyle, setJavaScriptValidation, setLabelAlign, setLabelsPosition, setLabelStyle, setListener, setMethod, setName, setReadonly, setValidate, startTag, validate
 
Methods inherited from class net.sf.click.control.AbstractContainer
contains, getControl, getControlMap, getControls, hasControls, onInit, onRender, renderChildren, renderContent, renderTagEnd, toString
 
Methods inherited from class net.sf.click.control.AbstractControl
addStyleClass, appendAttributes, getActionListener, getAttribute, getAttributes, getContext, getId, getMessage, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasStyles, registerActionEvent, removeStyleClass, renderTagBegin, setActionListener, setAttribute, setId, setParent, setStyle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.click.Control
getContext, getId, getMessages, getName, getParent, setParent
 

Field Detail

backgroundColor

protected String backgroundColor
The form HTML background color. The default background color is "#EFEFEF".


displayTab

protected int displayTab
The tab number to display (indexed from 1). The default tab number is 1.


tabHeight

protected String tabHeight
The tab sheet height HTML attribute value.


tabSheets

protected List tabSheets
The list of FieldSet tab sheets.


tabWidth

protected String tabWidth
The tab sheet width HTML attribute value.


template

protected String template
The path of the tabbed form Velocity template to render. The default template path is "/net/sf/click/extras/control/TabbedForm.htm".

Constructor Detail

TabbedCayenneForm

public TabbedCayenneForm(String name,
                         Class dataClass)
Create a Tabbed Cayenne Form with the given form name and DataObject class.

Parameters:
name - the form name
dataClass - the DataObject class

TabbedCayenneForm

public TabbedCayenneForm(Class dataClass)
Create a Tabbed Cayenne Form with the given DataObject class.

Parameters:
dataClass - the DataObject class

TabbedCayenneForm

public TabbedCayenneForm()
Create a Tabbed Cayenne Form with no name or dataObjectClass.

Important Note the forms's name and dataObjectClass must be defined before it is valid.

Method Detail

addTabSheet

public void addTabSheet(FieldSet tabSheet)
Add the given FieldSet tab sheet to the form.

Parameters:
tabSheet - the FieldSet tab sheet to add

getBackgroundColor

public String getBackgroundColor()
Return the form HTML background color.

Returns:
the form HTML background color

setBackgroundColor

public void setBackgroundColor(String value)
Set the form HTML background color.

Parameters:
value - the form HTML background color

getDisplayTab

public int getDisplayTab()
Return the number of the tab sheet to display (indexed from 1).

Returns:
the number of the tab sheet to display

getHtmlImports

public String getHtmlImports()
Return the HTML head import statements for the CSS stylesheet file: click/TabbedForm.css.

Returns:
the HTML head import statements for the control stylesheet and JavaScript files

setDisplayTab

public void setDisplayTab(int value)
Set the number of the tab sheet to display (indexed from 1).

Parameters:
value - the number of the tab sheet to display

getTabHeight

public String getTabHeight()
Return the tab sheet height HTML attribute value.

Returns:
the tab sheet height attribute value

setTabHeight

public void setTabHeight(String value)
Set the tab sheet height HTML attribute value.

Parameters:
value - the tab sheet height attribute value

getTabSheets

public List getTabSheets()
Return list FieldSet tab sheets.

Returns:
list FieldSet tab sheets

getTabSheetNumber

public int getTabSheetNumber(String fieldName)
Return the tab sheet number for the given field name, indexed from 1. If the field is not found this method will return 1.

Parameters:
fieldName - the name of the form field
Returns:
the tab sheet number for the given field (indexed from 1)

getTabWidth

public String getTabWidth()
Return the tab sheet width HTML attribute value.

Returns:
the tab sheet width attribute value

setTabWidth

public void setTabWidth(String value)
Set the tab sheet width HTML attribute value.

Parameters:
value - the tab sheet width attribute value

getTemplate

public String getTemplate()
Return the path of the Velocity template to render.

Returns:
the path of the Velocity template to render

setTemplate

public void setTemplate(String template)
Set the path of the Velocity template to render.

Parameters:
template - the path of the Velocity template to render

onDeploy

public void onDeploy(ServletContext servletContext)
Deploy the table.css file to the click web directory when the application is initialized.

Parameters:
servletContext - the servlet context
See Also:
Control.onDeploy(ServletContext)

onProcess

public boolean onProcess()
Process the Form request. In addition to the normal Form onProcess() processing, if the Form is invalid this method will display the tab sheet with the first field error.

Specified by:
onProcess in interface Control
Overrides:
onProcess in class CayenneForm
Returns:
true to continue Page event processing or false otherwise
See Also:
Form.onProcess()

render

public void render(HtmlStringBuffer buffer)
Render the HTML representation of the form.

The form will be rendered using the classpath template:

 /net/sf/click/extras/control/TabbedForm.htm 
If the form contains errors after processing, these errors will be rendered.

Specified by:
render in interface Control
Overrides:
render in class CayenneForm
Parameters:
buffer - the specified buffer to render the control's output to
See Also:
AbstractContainer.toString()