jet.html.impl
Class JetForm

java.lang.Object
  extended by jet.html.core.JetComponent
      extended by jet.html.core.JetChildComponent
          extended by jet.html.core.JetParentComponent
              extended by jet.html.impl.JetForm
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Decodeable, JetChildComponent, JetChildComponent.HasNoParent, JetComponent, JetForm, JetParentComponent, Identifiable, Poolable, Resetable

public class JetForm
extends JetParentComponent
implements JetForm

Author:
Markus.Meisters@web.de
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface jet.html.JetChildComponent
JetChildComponent.HasNoParent
 
Field Summary
protected  java.lang.String acceptCharset
          accept-charset
protected  java.lang.String action
          The action url of the form
protected  java.lang.String ajaxjavascript
          Cache for generated javascript
protected  java.util.HashMap<java.lang.String,java.util.List<ValidationRule>> ajaxvalidations
          Holds the client validations
protected  java.lang.StringBuilder builder
          internal buffer do render form
protected  java.util.HashMap<java.lang.String,java.util.List<ValidationRule>> clientvalidations
          Holds the client validations
private  int cols
          default cols rendering
protected  java.util.Collection displayMessages
           
protected  java.util.HashMap elements
          Hashmap holding all html input elements like textbos, checkbox etc for faster access
protected  java.lang.String enctype
          encoding type
protected  boolean fileUpload
          Indicates if the form has a file uploaded
protected  java.lang.String formheader
          prerendered form header information
protected  java.lang.String javascript
          Cache for generated ajax javascript
protected  org.apache.log4j.Logger log
          Internal logger object
protected  java.lang.String method
          Holds throws form submit type
protected  java.util.HashMap<java.lang.String,java.util.List<ValidationRule>> servervalidations
          Holds the server validations
 
Fields inherited from class jet.html.core.JetComponent
eventSupport
 
Fields inherited from interface jet.html.JetForm
GET, POST
 
Constructor Summary
JetForm(java.lang.String identifier)
          Creates new Component - name and styleclass would be the same as identifier
JetForm(java.lang.String identifier, java.lang.String styleclass)
          Creates new Component
JetForm(java.lang.String identifier, java.lang.String name, java.lang.String styleclass)
          Creates new Component
 
Method Summary
protected  void addElement(JetComponent element)
           
 void addValidation(JetComponent component, java.util.List validationRules)
           
 void buildHashmap()
           
 java.lang.Object clone()
          This method retruns a clone from the component
 JetForm copy()
           
 java.lang.String decode(JetContext jetContext)
          This method decodes the form with the given messages
 void decodeForm(java.lang.StringBuilder builder, JetContext jetContext)
          This method decodes the form with the given messages
 java.lang.String decodeGetString(JetContext jetContext)
          Method to decode GET string fro childs
 java.util.Collection findComponent(java.lang.Class c)
           
 JetComponent findComponent(java.lang.String identifier)
          Method to get component by identifier
 java.lang.String getAcceptCharset()
           
 java.lang.String getAction()
          Returns the action url
 java.lang.String getAjaxValidation(JetContext context, boolean hasClientValidation, boolean renderScriptTags)
           
 java.util.HashMap getAjaxValidationRules()
          Returns ajax validations
 java.util.HashMap getClientValidationRules()
          Returns client validations
 int getCols()
           
protected  JetComponent getElement(java.lang.String identifier)
           
protected  java.util.Collection getElements(java.lang.Class c)
           
 java.lang.String getEnctype()
          Returns the encoding type of the form
 java.lang.String getJavascriptValidation(JetContext context, boolean renderScriptTags, boolean formtag)
           
 java.lang.String getMethod()
          Returns the form method GET/POST
 java.util.HashMap getServerValidationRules()
          Returns server validations
 boolean hasAjaxValidations()
          indicates if ajax validations exists
 boolean hasClientValidations()
          indicates if client side validations exists
 boolean hasFileUpload()
          Returns if the form has a file
 boolean hasServerValidations()
          indicates if server side validations exists
 boolean hasValues()
          Method to indicate if the form has values
 void reset()
          This method resets the value - need by ObjectPool
 void setAcceptCharset(java.lang.String acceptCharset)
           
 void setAction(java.lang.String action)
          Set the action url
protected  void setAjaxValidationRules(java.util.HashMap<java.lang.String,java.util.List<ValidationRule>> ajaxvalidations)
           
protected  void setClientValidationRules(java.util.HashMap<java.lang.String,java.util.List<ValidationRule>> clientvalidations)
           
 void setCols(int cols)
           
 void setEnctype(java.lang.String enctype)
          Set the encoding type
 void setHasFileUpload(boolean val)
          Set if the form has a file uploaded
 void setMethod(java.lang.String method)
          Set the form method
protected  void setServerValidationRules(java.util.HashMap<java.lang.String,java.util.List<ValidationRule>> servervalidations)
           
 
Methods inherited from class jet.html.core.JetParentComponent
add, add, encode, getChild, getChilds, remove, setChilds
 
Methods inherited from class jet.html.core.JetChildComponent
getForm, getParent, isHidden, setParent, toggleHidden
 
Methods inherited from class jet.html.core.JetComponent
addListener, addListener, componentChanged, findComponents, getGeneratedComponentIdentifier, getIdentifier, getName, getNewIdentifier, getStyleclass, incrementIdentifier, removeListener, removeListener, setComponentChanged, setContinueIdentifier, setIdentifier, setName, setStyleclass
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jet.html.JetForm
findComponents
 
Methods inherited from interface jet.html.JetParentComponent
add, add, encode, getChild, getChilds, remove, setChilds
 
Methods inherited from interface jet.html.JetChildComponent
getForm, getParent, isHidden, setParent, toggleHidden
 
Methods inherited from interface jet.html.JetComponent
addListener, addListener, componentChanged, getIdentifier, getName, getStyleclass, incrementIdentifier, removeListener, removeListener, setComponentChanged, setContinueIdentifier, setIdentifier, setName, setStyleclass
 
Methods inherited from interface jet.pool.Identifiable
getIdentifier
 

Field Detail

elements

protected java.util.HashMap elements
Hashmap holding all html input elements like textbos, checkbox etc for faster access


cols

private int cols
default cols rendering


log

protected org.apache.log4j.Logger log
Internal logger object


ajaxjavascript

protected java.lang.String ajaxjavascript
Cache for generated javascript


javascript

protected java.lang.String javascript
Cache for generated ajax javascript


servervalidations

protected java.util.HashMap<java.lang.String,java.util.List<ValidationRule>> servervalidations
Holds the server validations


clientvalidations

protected java.util.HashMap<java.lang.String,java.util.List<ValidationRule>> clientvalidations
Holds the client validations


ajaxvalidations

protected java.util.HashMap<java.lang.String,java.util.List<ValidationRule>> ajaxvalidations
Holds the client validations


builder

protected java.lang.StringBuilder builder
internal buffer do render form


formheader

protected java.lang.String formheader
prerendered form header information


displayMessages

protected java.util.Collection displayMessages

action

protected java.lang.String action
The action url of the form


method

protected java.lang.String method
Holds throws form submit type


enctype

protected java.lang.String enctype
encoding type


acceptCharset

protected java.lang.String acceptCharset
accept-charset


fileUpload

protected boolean fileUpload
Indicates if the form has a file uploaded

Constructor Detail

JetForm

public JetForm(java.lang.String identifier)
Creates new Component - name and styleclass would be the same as identifier

Parameters:
identifier - the identifier

JetForm

public JetForm(java.lang.String identifier,
               java.lang.String styleclass)
Creates new Component

Parameters:
identifier - the identifier
styleclass - the css style class

JetForm

public JetForm(java.lang.String identifier,
               java.lang.String name,
               java.lang.String styleclass)
Creates new Component

Parameters:
identifier - the identifier
name - the name of the component if different to identifier
styleclass - the css style class
Method Detail

decodeForm

public void decodeForm(java.lang.StringBuilder builder,
                       JetContext jetContext)
This method decodes the form with the given messages

Specified by:
decodeForm in interface Decodeable
Specified by:
decodeForm in interface JetComponent
Specified by:
decodeForm in interface JetForm
Specified by:
decodeForm in class JetComponent
Parameters:
builder - Stringbuilder

decodeGetString

public java.lang.String decodeGetString(JetContext jetContext)
                                 throws java.io.UnsupportedEncodingException
Description copied from class: JetParentComponent
Method to decode GET string fro childs

Specified by:
decodeGetString in interface JetForm
Specified by:
decodeGetString in interface JetParentComponent
Overrides:
decodeGetString in class JetParentComponent
Throws:
java.io.UnsupportedEncodingException

decode

public java.lang.String decode(JetContext jetContext)
This method decodes the form with the given messages

Specified by:
decode in interface JetForm
Parameters:
jetContext - JetContext

clone

public java.lang.Object clone()
This method retruns a clone from the component

Specified by:
clone in interface JetComponent
Specified by:
clone in interface JetForm
Specified by:
clone in class JetComponent
Returns:
the cloned object

getAction

public java.lang.String getAction()
Returns the action url

Specified by:
getAction in interface JetForm
Returns:
the url of the action

setAction

public void setAction(java.lang.String action)
Set the action url

Specified by:
setAction in interface JetForm
Parameters:
action - the action url

getEnctype

public java.lang.String getEnctype()
Returns the encoding type of the form

Specified by:
getEnctype in interface JetForm
Returns:
the enctype of the form

setEnctype

public void setEnctype(java.lang.String enctype)
Set the encoding type

Specified by:
setEnctype in interface JetForm
Parameters:
enctype - encoding type of the form

getMethod

public java.lang.String getMethod()
Returns the form method GET/POST

Specified by:
getMethod in interface JetForm
Returns:
the form method

setMethod

public void setMethod(java.lang.String method)
Set the form method

Specified by:
setMethod in interface JetForm
Parameters:
method - the form method

hasFileUpload

public boolean hasFileUpload()
Returns if the form has a file

Specified by:
hasFileUpload in interface JetForm
Returns:
has file

setHasFileUpload

public void setHasFileUpload(boolean val)
Set if the form has a file uploaded

Specified by:
setHasFileUpload in interface JetForm
Parameters:
val - boolean if file is uploaded

reset

public void reset()
This method resets the value - need by ObjectPool

Specified by:
reset in interface JetForm
Specified by:
reset in interface JetParentComponent
Specified by:
reset in interface Resetable
Overrides:
reset in class JetParentComponent

hasServerValidations

public boolean hasServerValidations()
indicates if server side validations exists

Specified by:
hasServerValidations in interface JetForm

hasClientValidations

public boolean hasClientValidations()
indicates if client side validations exists

Specified by:
hasClientValidations in interface JetForm

hasAjaxValidations

public boolean hasAjaxValidations()
indicates if ajax validations exists

Specified by:
hasAjaxValidations in interface JetForm

getServerValidationRules

public java.util.HashMap getServerValidationRules()
Returns server validations

Specified by:
getServerValidationRules in interface JetForm
Returns:
List validations

getAjaxValidationRules

public java.util.HashMap getAjaxValidationRules()
Returns ajax validations

Specified by:
getAjaxValidationRules in interface JetForm
Returns:
List validations

getClientValidationRules

public java.util.HashMap getClientValidationRules()
Returns client validations

Specified by:
getClientValidationRules in interface JetForm
Returns:
List validations

addValidation

public void addValidation(JetComponent component,
                          java.util.List validationRules)
Specified by:
addValidation in interface JetForm

setServerValidationRules

protected void setServerValidationRules(java.util.HashMap<java.lang.String,java.util.List<ValidationRule>> servervalidations)

setClientValidationRules

protected void setClientValidationRules(java.util.HashMap<java.lang.String,java.util.List<ValidationRule>> clientvalidations)

setAjaxValidationRules

protected void setAjaxValidationRules(java.util.HashMap<java.lang.String,java.util.List<ValidationRule>> ajaxvalidations)

getAjaxValidation

public java.lang.String getAjaxValidation(JetContext context,
                                          boolean hasClientValidation,
                                          boolean renderScriptTags)
Specified by:
getAjaxValidation in interface JetForm

getJavascriptValidation

public java.lang.String getJavascriptValidation(JetContext context,
                                                boolean renderScriptTags,
                                                boolean formtag)
Specified by:
getJavascriptValidation in interface JetForm

hasValues

public boolean hasValues()
Method to indicate if the form has values

Specified by:
hasValues in interface JetForm

getAcceptCharset

public java.lang.String getAcceptCharset()
Specified by:
getAcceptCharset in interface JetForm

setAcceptCharset

public void setAcceptCharset(java.lang.String acceptCharset)
Specified by:
setAcceptCharset in interface JetForm

addElement

protected void addElement(JetComponent element)

getElement

protected JetComponent getElement(java.lang.String identifier)

getElements

protected java.util.Collection getElements(java.lang.Class c)

buildHashmap

public void buildHashmap()
Specified by:
buildHashmap in interface JetForm

findComponent

public JetComponent findComponent(java.lang.String identifier)
Description copied from class: JetComponent
Method to get component by identifier

Specified by:
findComponent in interface JetComponent
Specified by:
findComponent in interface JetForm
Overrides:
findComponent in class JetComponent

findComponent

public java.util.Collection findComponent(java.lang.Class c)

getCols

public int getCols()
Specified by:
getCols in interface JetForm

setCols

public void setCols(int cols)
Specified by:
setCols in interface JetForm

copy

public JetForm copy()
Specified by:
copy in interface JetForm