org.alfresco.repo.forms
Class Form

java.lang.Object
  extended by org.alfresco.repo.forms.Form

public class Form
extends java.lang.Object

Data representation of a form to be displayed in the UI.


Field Summary
protected  FormData data
           
protected  java.util.List fieldDefinitions
           
protected  java.util.Collection fieldGroups
           
protected  Item item
           
protected  java.lang.String submissionUrl
           
 
Constructor Summary
Form(Item item)
          Constructs a Form
 
Method Summary
 void addData(java.lang.String fieldName, java.lang.Object fieldData)
          Adds some data to be displayed by the form
 void addField(Field field)
          Adds a Field to the form by adding the FieldDefinition and the value if any.
 void addFieldDefinition(FieldDefinition definition)
          Adds the given FieldDefinition to the form.
 void addFields(java.util.Collection fields)
          Adds a Collection of Fields to the form by adding the FieldDefinitions and the values if any.
 boolean dataExists(java.lang.String dataKey)
          Returns true if the Form contains FormData.FieldData for the specified dataKey.
 java.util.List getFieldDefinitionNames()
           
 java.util.List getFieldDefinitions()
          Returns the list of field definitions for the form
 java.util.Collection getFieldGroups()
          Returns the collection of field groups for the form
 FormData getFormData()
          Returns the data to display in the form
 Item getItem()
          Returns the item the form is for
 java.lang.String getSubmissionUrl()
          Returns the submission URL to use for the form
 void setFieldDefinitions(java.util.List fieldDefinitions)
          Sets the list of FieldDefinition objects representing the fields the form is able to display
 void setFieldGroups(java.util.Collection fieldGroups)
          Sets the collection of FieldGroup objects representing the groups of fields the form should display and maintain
 void setFormData(FormData data)
          Sets the data this form should display.
 void setSubmissionUrl(java.lang.String url)
          Sets the submission URL the form should use
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

item

protected Item item

submissionUrl

protected java.lang.String submissionUrl

fieldDefinitions

protected java.util.List fieldDefinitions

fieldGroups

protected java.util.Collection fieldGroups

data

protected FormData data
Constructor Detail

Form

public Form(Item item)
Constructs a Form

Parameters:
item - The item the form is for
Method Detail

getItem

public Item getItem()
Returns the item the form is for

Returns:
The item

getSubmissionUrl

public java.lang.String getSubmissionUrl()
Returns the submission URL to use for the form

Returns:
URL to submit to

setSubmissionUrl

public void setSubmissionUrl(java.lang.String url)
Sets the submission URL the form should use

Parameters:
url - URL to submit to

getFieldDefinitions

public java.util.List getFieldDefinitions()
Returns the list of field definitions for the form

Returns:
List of FieldDefinition objects or null if there are no fields

getFieldDefinitionNames

public java.util.List getFieldDefinitionNames()

setFieldDefinitions

public void setFieldDefinitions(java.util.List fieldDefinitions)
Sets the list of FieldDefinition objects representing the fields the form is able to display

Parameters:
fieldDefinitions - List of FieldDefinition objects

addFieldDefinition

public void addFieldDefinition(FieldDefinition definition)
Adds the given FieldDefinition to the form.

NOTE: Multiple fields with the same name can be added to the list, it is therefore the form processor and the client of the FormService responsibility to differentiate the fields in some way i.e. by type, property vs. association.

Parameters:
definition - The FieldDefinition to add

getFieldGroups

public java.util.Collection getFieldGroups()
Returns the collection of field groups for the form

Returns:
Collection of FieldGroup objects or null if there are no groups

setFieldGroups

public void setFieldGroups(java.util.Collection fieldGroups)
Sets the collection of FieldGroup objects representing the groups of fields the form should display and maintain

Parameters:
fieldGroups - Collection of FieldGroup objects

getFormData

public FormData getFormData()
Returns the data to display in the form

Returns:
FormData object holding the data of the form or null if there is no data i.e. for a create form

setFormData

public void setFormData(FormData data)
Sets the data this form should display. This will overwrite any existing form data being held

Parameters:
data - FormData instance containing the data

dataExists

public boolean dataExists(java.lang.String dataKey)
Returns true if the Form contains FormData.FieldData for the specified dataKey.

Parameters:
dataKey - The dataKey for the field.
Returns:

addData

public void addData(java.lang.String fieldName,
                    java.lang.Object fieldData)
Adds some data to be displayed by the form

Parameters:
fieldName - Name of the field the data is for
fieldData - The value

addField

public void addField(Field field)
Adds a Field to the form by adding the FieldDefinition and the value if any.

Parameters:
field -

addFields

public void addFields(java.util.Collection fields)
Adds a Collection of Fields to the form by adding the FieldDefinitions and the values if any.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.