com.plumtree.uiinfrastructure.pagecontrols.framework
Class ComponentMgr

java.lang.Object
  extended by com.plumtree.uiinfrastructure.pagecontrols.framework.ComponentMgr
Direct Known Subclasses:
HTMLComponentMgr, JSComponentMgr

public class ComponentMgr
extends java.lang.Object

This class manages instances of like components that all appear on a single page. For more information on the page controls framework in general, please consult the documentation for AComponent. There is one important concept to understand when it comes to the ComponentMgr class: for page controls, there is script to be outputted that has "component scope" and script to be outputted that has "page scope." Component scope means that the data needs to be printed once per component. Page scope means that the data needs to be printed once per page, independent of the number of times a component of that type is written to the page. The component manager allows you to print data for either or both scopes through a series of methods. Components may be registered with the component manager and then obtained either using their unique instance ID or by way of an int index. The index is determined by the order in which you registered the components.

Author:
John Osborne

Field Summary
 java.lang.String STR_CLASS_NAME
          class name constant
 
Constructor Summary
ComponentMgr(PageMgr _ptPageMgr)
          Creates a new ComponentMgr object.
 
Method Summary
 void AddToValidationFunction(AFormDP _ptAFormDP)
          For all registered components, for every Validator associated with that component call AFormDP.AddToValidationFunction for the validator.
 HTMLElementCollection GetAllHeadContent()
          This method returns ALL HTML--page scope and component scope for all components under this manger--that belongs between the HTML head tags.
 HTMLElementCollection GetAllPostContent()
          This method returns ALL HTML--page scope and component scope for all components under this manger--that should be printed after the component itself.
 HTMLElementCollection GetAllPreContent()
          This method returns ALL HTML--page scope and component scope for all components under this manger--that should be printed before the component itself.
 HTMLElementCollection GetAllPreFormContent()
          This method returns ALL HTML--page scope and component scope for all components under this manger--that should be printed before the form in which this group of components is embedded.
 AComponent GetComponent(int _nIndex)
          Returns an AComponent given an index.
 AComponent GetComponent(java.lang.String _strUniqueInstanceID)
          This method returns an AComponent object given its unique instance ID.
 HTMLElementCollection GetComponentHeadContent(int _nIndex)
          Returns the HTML for the designated component that is should be written out within the HTML head tags.
 HTMLElementCollection GetComponentHeadContent(java.lang.String _strUniqueInstanceID)
          Returns the HTML for the designated component that is should be written out within the HTML head tags.
 HTMLElementCollection GetComponentHTML(int _nIndex)
          Returns the HTML for the designated component.
 HTMLElementCollection GetComponentHTML(java.lang.String _strUniqueInstanceID)
          Returns the HTML for the designated component.
 HTMLElementCollection GetComponentPostContent(int _nIndex)
          Returns the HTML for the designated component that should be written out after the component itself.
 HTMLElementCollection GetComponentPostContent(java.lang.String _strUniqueInstanceID)
          Returns the HTML for the designated component that should be written out after the component itself.
 HTMLElementCollection GetComponentPreContent(int _nIndex)
          Returns the HTML for the designated component that should be written out before the component itself.
 HTMLElementCollection GetComponentPreContent(java.lang.String _strUniqueInstanceID)
          Returns the HTML for the designated component that should be written out before the component itself.
 HTMLElementCollection GetComponentPreFormContent(int _nIndex)
          Returns the HTML for the designated component that should be written out before the form in which the component is embedded.
 HTMLElementCollection GetComponentPreFormContent(java.lang.String _strUniqueInstanceID)
          Returns the HTML for the designated component that should be written out before the form in which the component is embedded.
 java.lang.String GetJSValidationCode()
          Return JavaScript validation code for each of the validators associated with all components.
 int GetNumComponents()
          Returns the number of components registered with this component manger.
 HTMLElementCollection GetPageHeadContent()
          This method is meant to return the page-level head content for components of this type.
 PageMgr GetPageMgr()
          Returns the page manger that is associated with this component manager.
 HTMLElementCollection GetPagePostContent()
          This method is meant to return the page-level "post" content for components of this type.
 HTMLElementCollection GetPagePreContent()
          This method is meant to return the page-level head "pre" for components of this type.
 HTMLElementCollection GetPagePreFormContent()
          This method is meant to return the page-level head content for components of this type.
 void RegisterComponent(IPageControl _ptComponent)
          This method allows you to register a component with the component manager.
 int StoreAllUserInput(XPHashtable _htRequestParameters)
          Stores the user input for all componets registered with this component manager.
 int StoreUserInput(int _nIndex, XPHashtable _htRequestParameters)
          This method stores the user input for a particular component given its index.
 void StoreUserInput(java.lang.String _strUniqueInstanceID, XPHashtable _htRequestParameters)
          This method stores the user input for a particular component given its unique ID.
 void UnRegisterComponent(java.lang.String _strUniqueInstanceID)
          This method unregisters a component given its unique instance ID.
 XPArrayList Validate()
          Call the validation method on all registered componenets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STR_CLASS_NAME

public final java.lang.String STR_CLASS_NAME
class name constant

See Also:
Constant Field Values
Constructor Detail

ComponentMgr

public ComponentMgr(PageMgr _ptPageMgr)
Creates a new ComponentMgr object. Clients need one of these per component type (i.e. datepicker).

Parameters:
_ptPageMgr - The page manager for this component manager.
Method Detail

GetAllHeadContent

public HTMLElementCollection GetAllHeadContent()
This method returns ALL HTML--page scope and component scope for all components under this manger--that belongs between the HTML head tags.

Returns:
All HTML content that should go between the head tags for components of this type.

GetAllPostContent

public HTMLElementCollection GetAllPostContent()
This method returns ALL HTML--page scope and component scope for all components under this manger--that should be printed after the component itself.

Returns:
All HTML content that should be printed after the component itself.

GetAllPreContent

public HTMLElementCollection GetAllPreContent()
This method returns ALL HTML--page scope and component scope for all components under this manger--that should be printed before the component itself.

Returns:
All HTML content that should be printed before the component itself.

GetAllPreFormContent

public HTMLElementCollection GetAllPreFormContent()
This method returns ALL HTML--page scope and component scope for all components under this manger--that should be printed before the form in which this group of components is embedded.

Returns:
All HTML content that should be printed before the form.

GetComponent

public AComponent GetComponent(java.lang.String _strUniqueInstanceID)
This method returns an AComponent object given its unique instance ID. Null is returned if the component is not found.

Parameters:
_strUniqueInstanceID - The ID that uniquely represents the component that you want.
Returns:
The AComponent instance requested (or null).

GetComponent

public AComponent GetComponent(int _nIndex)
Returns an AComponent given an index. The index is determined by the registration order. This method can help you loop through all registered AComponents.

Parameters:
_nIndex - The index of the component you want.
Returns:
The AComponent instance requested (or null).

GetComponentHTML

public HTMLElementCollection GetComponentHTML(java.lang.String _strUniqueInstanceID)
Returns the HTML for the designated component.

Parameters:
_strUniqueInstanceID - The unique instance ID by which to identify the component.
Returns:
The HTML for the component itself.

GetComponentHTML

public HTMLElementCollection GetComponentHTML(int _nIndex)
Returns the HTML for the designated component.

Parameters:
_nIndex - The index by which to identify the component.
Returns:
The HTML for the component itself.

GetComponentHeadContent

public HTMLElementCollection GetComponentHeadContent(java.lang.String _strUniqueInstanceID)
Returns the HTML for the designated component that is should be written out within the HTML head tags.

Parameters:
_strUniqueInstanceID - The unique instance ID by which to identify the component.
Returns:
The script to write into the HTML head.

GetComponentHeadContent

public HTMLElementCollection GetComponentHeadContent(int _nIndex)
Returns the HTML for the designated component that is should be written out within the HTML head tags.

Parameters:
_nIndex - The index by which to identify the component.
Returns:
The script to write into the HTML head.

GetComponentPostContent

public HTMLElementCollection GetComponentPostContent(java.lang.String _strUniqueInstanceID)
Returns the HTML for the designated component that should be written out after the component itself.

Parameters:
_strUniqueInstanceID - The unique instance ID by which to identify the component.
Returns:
The script to write after the component.

GetComponentPostContent

public HTMLElementCollection GetComponentPostContent(int _nIndex)
Returns the HTML for the designated component that should be written out after the component itself.

Parameters:
_nIndex - The index by which to identify the component.
Returns:
The script to write after the component.

GetComponentPreContent

public HTMLElementCollection GetComponentPreContent(java.lang.String _strUniqueInstanceID)
Returns the HTML for the designated component that should be written out before the component itself.

Parameters:
_strUniqueInstanceID - The unique instance ID by which to identify the component.
Returns:
The script to write before the component.

GetComponentPreContent

public HTMLElementCollection GetComponentPreContent(int _nIndex)
Returns the HTML for the designated component that should be written out before the component itself.

Parameters:
_nIndex - The index by which to identify the component.
Returns:
The script to write before the component.

GetComponentPreFormContent

public HTMLElementCollection GetComponentPreFormContent(int _nIndex)
Returns the HTML for the designated component that should be written out before the form in which the component is embedded.

Parameters:
_nIndex - The index by which to identify the component.
Returns:
The script to write before the form in which the component is embedded.

GetComponentPreFormContent

public HTMLElementCollection GetComponentPreFormContent(java.lang.String _strUniqueInstanceID)
Returns the HTML for the designated component that should be written out before the form in which the component is embedded.

Parameters:
_strUniqueInstanceID - The unique instance ID by which to identify the component.
Returns:
The script to write before the form in which the component is embedded.

GetNumComponents

public int GetNumComponents()
Returns the number of components registered with this component manger.

Returns:
An int representing the number of registered components.

GetPageHeadContent

public HTMLElementCollection GetPageHeadContent()
This method is meant to return the page-level head content for components of this type. This method just returns null. It could have been abstract, but many components do need to use it. If you need this, you should override it.

Returns:
The HTML and script that should go into the head tag.

GetPageMgr

public PageMgr GetPageMgr()
Returns the page manger that is associated with this component manager.

Returns:
The page manger.

GetPagePostContent

public HTMLElementCollection GetPagePostContent()
This method is meant to return the page-level "post" content for components of this type. This method just returns null. It could have been abstract, but many components do need to use it. If you need this, you should override it.

Returns:
The HTML and script that should be written after the component.

GetPagePreContent

public HTMLElementCollection GetPagePreContent()
This method is meant to return the page-level head "pre" for components of this type. This method just returns null. It could have been abstract, but many components do need to use it. If you need this, you should override it.

Returns:
The HTML and script that should be written before the component.

GetPagePreFormContent

public HTMLElementCollection GetPagePreFormContent()
This method is meant to return the page-level head content for components of this type. This method just returns null. It could have been abstract, but many components do need to use it. If you need this, you should override it.

Returns:
The HTML and script that should be written before the form in which this component is embedded.

RegisterComponent

public void RegisterComponent(IPageControl _ptComponent)
This method allows you to register a component with the component manager. The order in which you register components is the order in which calls will be made when doing any looping operation--storing or printing. If you attempt to re-register the same component, it will overwrite the one that existed there before.

Parameters:
_ptComponent - The component that you wish to register.

StoreAllUserInput

public int StoreAllUserInput(XPHashtable _htRequestParameters)
Stores the user input for all componets registered with this component manager.

Parameters:
_htRequestParameters - A hashtable of name-value pairs passed in with the request.

Validate

public XPArrayList Validate()
Call the validation method on all registered componenets. Returns an XPArrayList of all UIErrors generated by the componenets.

Returns:
an XPArrayList of UIError objects

GetJSValidationCode

public java.lang.String GetJSValidationCode()
Return JavaScript validation code for each of the validators associated with all components. This function returns the validation code once for each validator. Although the validator may be used several times it is assumed that the JavaScript code is only required one time.

Returns:
String JavaScript code for validators

AddToValidationFunction

public void AddToValidationFunction(AFormDP _ptAFormDP)
For all registered components, for every Validator associated with that component call AFormDP.AddToValidationFunction for the validator. This inserts the JavaScript Validation function name from the Validator to the page's JavaScript Validate method.

Parameters:
_ptAFormDP - AFormDP from the activity space where this ComponentMgr is used.

StoreUserInput

public void StoreUserInput(java.lang.String _strUniqueInstanceID,
                           XPHashtable _htRequestParameters)
This method stores the user input for a particular component given its unique ID.

Parameters:
_strUniqueInstanceID - The unique instance ID by which to identify the component.
_htRequestParameters - A hashtable of name-value pairs passed in with the request.

StoreUserInput

public int StoreUserInput(int _nIndex,
                          XPHashtable _htRequestParameters)
This method stores the user input for a particular component given its index.

Parameters:
_nIndex - The index by which to identify the component.
_htRequestParameters - A hashtable of name-value pairs passed in with the request.

UnRegisterComponent

public void UnRegisterComponent(java.lang.String _strUniqueInstanceID)
This method unregisters a component given its unique instance ID.

Parameters:
_strUniqueInstanceID - The unique instance ID.



Copyright 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.