com.plumtree.uiinfrastructure.pagecontrols.framework
Class AComponent

java.lang.Object
  extended by com.plumtree.uiinfrastructure.pagecontrols.framework.AComponent
Direct Known Subclasses:
ADatePickerComponent, AHTMLComponent, ATimePicker

public abstract class AComponent
extends java.lang.Object

This is the abstract class for all page controls. A page control is a single input/output component on an web page. One example of a control is the datepicker. For each instance of the datepicker on a single page, you need an instance of an AComponent. Components of like controls are managed through a single component manger. So, on a single page you might have 3 datepickers (3 instances of AComponent) all managed by a single datepicker manager. If you were to have other types of controls on that same page, you would need an instance of the appropriate componetent manager for those controls. The Page manager aggregates all instances of component mangers and provides access to page specific information that might be relevant to controls (i.e. locale and timezone). In summary: Component - Might have many on a page (i.e. datepicker). Note: There is really no difference between a "component" and a "control." Component Manager - One per type of component on a page. Page Manager - Only one per page. Aggregates all the component managers. How is the component manager differnt from the page manager? Why have both? The component manager serves two funtions. First, it aggregates like components. Second, it handles the printing of page-level content (contrast with component-level content.) Consider the datepicker example again. If you have 2 datepickers on one page, there is data that needs to be outputted once (page-level) and data that needs to be outputted once for each datepicker (component-level). One special note about the page-controls framework... It assumes that the client will be using the HTTP Session for state management. Given this, the client needs to have implemented a good HTTP Session mangment strategy that will release old or unused objects. See the documentation on Activity Spaces for such a framework.

Author:
John Osborne

Field Summary
protected  PageMgr m_ptPageMgr
          The page manager associated with this component.
 
Constructor Summary
AComponent()
          Creates a new AComponent
 
Method Summary
protected  java.lang.String AppendUniqueIDToElementName(java.lang.String _strElementName)
          This method should be used to add the unique identifier to HTML inputs related to this component.
abstract  java.lang.Object Create()
          Create method for the object returns an instance of the object.
 HTMLElementCollection GetComponentHeadContent()
          This method returns script that needs to be printed within the HTML head tag.
abstract  HTMLElementCollection GetComponentHTML()
          This method serves as a getter for component HTML.
 HTMLElementCollection GetComponentPostContent()
          This method returns script that needs to be printed after the component itself has been printed.
 HTMLElementCollection GetComponentPreContent()
          This method returns script that needs to be printed before the component itself has been printed.
 HTMLElementCollection GetComponentPreFormContent()
          This method returns script that needs to be printed before the form in which this component is embedded.
abstract  java.lang.String GetName()
          Return the name or this component.
 PageMgr GetPageMgr()
          This method returns the page manager that houses this component manager.
 HTMLElementCollection GetSubComponentHTMLByIndex(int _nSubComponentIndex)
          This method serves as a getter for "sub-component" HTML.
 java.lang.String GetUniqueInstanceID()
          This method returns the string used to uniquely idenify this component on a page.
abstract  XPArrayList GetValidators()
          Return an Arraylist of validators associated with this object.
 void Init(PageMgr _ptPageMgr, java.lang.String _strUniqueInstanceID)
          Initializes a new AComponent()
abstract  int StoreUserInput(XPHashtable _htRequestParameters)
          This abstract method stores the input submitted by the user.
abstract  XPArrayList Validate()
          For every Validator associated with this object execute it's Validate method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_ptPageMgr

protected PageMgr m_ptPageMgr
The page manager associated with this component.

Constructor Detail

AComponent

public AComponent()
Creates a new AComponent

Method Detail

Init

public void Init(PageMgr _ptPageMgr,
                 java.lang.String _strUniqueInstanceID)
Initializes a new AComponent()

Parameters:
_ptComponentMgr - The component manager for this component.
_strUniqueInstanceID - The unique ID for this component.

GetComponentHTML

public abstract HTMLElementCollection GetComponentHTML()
This method serves as a getter for component HTML. Sub-classes must implement this method.

Returns:
The HTML for the component itself.

GetPageMgr

public PageMgr GetPageMgr()
This method returns the page manager that houses this component manager.

Returns:
The page manager.

GetSubComponentHTMLByIndex

public HTMLElementCollection GetSubComponentHTMLByIndex(int _nSubComponentIndex)
This method serves as a getter for "sub-component" HTML. The breakdown of sub-components is decided by the component author. One example is the date/time-picker. It is made up of two sub-components: the date-picker and the time-picker. The constants for component sub-index should be specified in the component file and prefixed with "N_SUB_COMPONENT_INDEX." If the specified index is not valid, null should be returned. This method returns null in the parent instead of being abstract becuase many components will not need to use this method.

Parameters:
_nSubComponentIndex - The sub-component index specified in the the componet file itself.
Returns:
The HTML for the sub-component requested.

StoreUserInput

public abstract int StoreUserInput(XPHashtable _htRequestParameters)
This abstract method stores the input submitted by the user. It should be called after a POST or GET. In the case of the date picker, it would store the date.

Parameters:
_htRequestParameters - A hashtable containing the request's name- value pairs.

GetComponentHeadContent

public HTMLElementCollection GetComponentHeadContent()
This method returns script that needs to be printed within the HTML head tag. This method could have been abstract except that most components do not have a use for it. It therefore returns null and should be overridden as needed. (Note: there is an anologous method for printing page- level content in ComponentMgr.)

Returns:
HTML that goes within the head tag.

GetComponentPostContent

public HTMLElementCollection GetComponentPostContent()
This method returns script that needs to be printed after the component itself has been printed. This method could have been abstract except that most components do not have a use for it. It therefore returns null and should be overridden as needed. (Note: there is an anologous method for printing page- level content in ComponentMgr.)

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

GetComponentPreContent

public HTMLElementCollection GetComponentPreContent()
This method returns script that needs to be printed before the component itself has been printed. This method could have been abstract except that most components do not have a use for it. It therefore returns null and should be overridden as needed. (Note: there is an anologous method for printing page- level content in ComponentMgr.)

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

GetComponentPreFormContent

public HTMLElementCollection GetComponentPreFormContent()
This method returns script that needs to be printed before the form in which this component is embedded. It therefore returns null and should be overridden as needed. (Note: there is an anologous method for printing page- level content in ComponentMgr.)

Returns:

GetUniqueInstanceID

public java.lang.String GetUniqueInstanceID()
This method returns the string used to uniquely idenify this component on a page.

Returns:

AppendUniqueIDToElementName

protected final java.lang.String AppendUniqueIDToElementName(java.lang.String _strElementName)
This method should be used to add the unique identifier to HTML inputs related to this component. If my element name is "in_cb_MyCheckBox" and my unique ID is "one", then this method will return "in_cb_MyCheckBox_one".

Parameters:
_strElementName - The name of the element that needs to have the unique ID appended to it.
Returns:
The element name plus the unique ID.

GetName

public abstract java.lang.String GetName()
Return the name or this component.

Returns:
the element name

Create

public abstract java.lang.Object Create()
Create method for the object returns an instance of the object.

Returns:
and object that extends AComponent

Validate

public abstract XPArrayList Validate()
For every Validator associated with this object execute it's Validate method. Return an Arraylist of UIError objects generated from executing the Validators. Return and empty Arraylist if no problems were found.

Returns:
Arraylist of UIErrors.

GetValidators

public abstract XPArrayList GetValidators()
Return an Arraylist of validators associated with this object.

Returns:



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