org.jaffa.presentation.portlet.component
Class Component

java.lang.Object
  extended byorg.jaffa.presentation.portlet.component.Component
All Implemented Interfaces:
IComponent
Direct Known Subclasses:
CreateComponent, DeleteComponent, FinderComponent, FinderComponent2, MaintComponent, MaintComponent2, SessionExplorerComponent, UpdateComponent

public abstract class Component
extends Object
implements IComponent

The base class for all Components


Constructor Summary
Component()
           
 
Method Summary
 void addChildComponent(Component component)
          This adds a child component to an internal list.
 void addFormKeyChangeListener(FormKeyChangeListener listener)
          Registers listener so that it will receive FormKeyChangeEvents.
abstract  FormKey display()
          Returns a FormKey, which has the componentId & the formName to which control should be passed
 ComponentDefinition getComponentDefinition()
          Returns the ComponentDefinition based on which this Component was created
 String getComponentId()
          Returns the Id for the component
 FormKey getContainerFormKey()
          Getter for property containerFormKey.
 FormKeyChangeListener[] getFormKeyChangeListeners()
          Returns an array of all the FormKeyChangeListeners registered on this component.
 FormKey getReturnToFormKey()
          Getter for property returnToFormKey.
 String getToken()
          Getter for property token.
 UserSession getUserSession()
          Returns the UserSession, under which the Component was created
 boolean isActive()
          Returns a true if the component is still active.
 void quit()
          This will kill all the Forms Finally de-register itself from the UserSession
 FormKey quitAndReturnToCallingScreen()
          This should invoke the quit() method, and then return the FormKey for the calling screen.
 void reflectAndSetParms(HttpServletRequest request)
          Invoke the setters on the component passing the parameters in the request-stream This is a convenience method which can be invoked after creation of a new Component
 void removeFormKeyChangeListener(FormKeyChangeListener listener)
          Unregisters listener so that it will no longer receive FormKeyChangeEvents.
 Collection returnChildComponents()
          This returns a collection of components which were created by this component.
 DateTime returnLastActivityDate()
          This returns the timestamp for the last known activity on the component.
 Component run(String component)
          Convenience Method for 'ComponentManager.run()'.
 void setContainerFormKey(FormKey containerFormKey)
          Setter for property containerFormKey.
 void setReturnToFormKey(FormKey returnToFormKey)
          Setter for property returnToFormKey.
 void setToken(String token)
          Setter for property token.
 void updateLastActivityDate()
          This updates the activity timestamp on the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Component

public Component()
Method Detail

display

public abstract FormKey display()
                         throws FrameworkException,
                                ApplicationExceptions
Returns a FormKey, which has the componentId & the formName to which control should be passed

Specified by:
display in interface IComponent
Returns:
the FormKey object
Throws:
FrameworkException - if any framework error occurs.
ApplicationExceptions - if any application error occurs.

quit

public void quit()
This will kill all the Forms Finally de-register itself from the UserSession

Specified by:
quit in interface IComponent

quitAndReturnToCallingScreen

public FormKey quitAndReturnToCallingScreen()
This should invoke the quit() method, and then return the FormKey for the calling screen. The FormKey should have been set by a call to setReturnToFormKey().

Specified by:
quitAndReturnToCallingScreen in interface IComponent
Returns:
The FormKey for the caling screen. A null will be returned, if no calling screen was specified.

getComponentId

public String getComponentId()
Returns the Id for the component

Specified by:
getComponentId in interface IComponent
Returns:
The componentId

getComponentDefinition

public ComponentDefinition getComponentDefinition()
Returns the ComponentDefinition based on which this Component was created

Specified by:
getComponentDefinition in interface IComponent
Returns:
The ComponentDefintion object for the Component

getUserSession

public UserSession getUserSession()
Returns the UserSession, under which the Component was created

Specified by:
getUserSession in interface IComponent
Returns:
The UserSession object

getReturnToFormKey

public FormKey getReturnToFormKey()
Getter for property returnToFormKey. This FormKey determines the screen to display when quitting from a component.

Specified by:
getReturnToFormKey in interface IComponent
Returns:
Value of property returnToFormKey.

setReturnToFormKey

public void setReturnToFormKey(FormKey returnToFormKey)
Setter for property returnToFormKey. This FormKey determines the screen to display when quitting from a component.

Specified by:
setReturnToFormKey in interface IComponent
Parameters:
returnToFormKey - New value of property returnToFormKey.

getContainerFormKey

public FormKey getContainerFormKey()
Getter for property containerFormKey. This property is useful when this component is being rendered as a tile inside another component. The outer component is expected to set this property on this component. The outer component is also expected to register the FormKeyChangeListener on this component. The ActionBase will intercept all FormKeys for this component. It will then fire the FormKeyChangeEvents on the listeners. The ActionBase will then return the ContainerFormKey. The Component will fire the FormKeyChangeEvents on the listeners during the quit(), passing the ReturnToFormKey. All this helps render the tiles correctly.

Specified by:
getContainerFormKey in interface IComponent
Returns:
Value of property containerFormKey.

setContainerFormKey

public void setContainerFormKey(FormKey containerFormKey)
Setter for property containerFormKey. This property is useful when this component is being rendered as a tile inside another component. The outer component is expected to set this property on this component. The outer component is also expected to register the FormKeyChangeListener on this component. The ActionBase will intercept all FormKeys for this component. It will then fire the FormKeyChangeEvents on the listeners. The ActionBase will then return the ContainerFormKey. The Component will fire the FormKeyChangeEvents on the listeners during the quit(), passing the ReturnToFormKey. All this helps render the tiles correctly.

Specified by:
setContainerFormKey in interface IComponent
Parameters:
containerFormKey - New value of property containerFormKey.

addFormKeyChangeListener

public void addFormKeyChangeListener(FormKeyChangeListener listener)
Registers listener so that it will receive FormKeyChangeEvents. The ActionBase typically creates the FormKeyChangeEvent object, when processing an event for a component, that has a ContainerFormKey. It will then fire the FormKeyChangeListener registered with the component, passing the FormKeyChangeEvent object. The Component will fire the FormKeyChangeEvents on the listeners during the quit(), passing the ReturnToFormKey.

Specified by:
addFormKeyChangeListener in interface IComponent
Parameters:
listener - the FormKeyChangeListener to register.

removeFormKeyChangeListener

public void removeFormKeyChangeListener(FormKeyChangeListener listener)
Unregisters listener so that it will no longer receive FormKeyChangeEvents.

Specified by:
removeFormKeyChangeListener in interface IComponent
Parameters:
listener - the FormKeyChangeListener to be removed.

getFormKeyChangeListeners

public FormKeyChangeListener[] getFormKeyChangeListeners()
Returns an array of all the FormKeyChangeListeners registered on this component.

Specified by:
getFormKeyChangeListeners in interface IComponent
Returns:
all of the component's FormKeyChangeListeners or a null if no ancestor listeners are currently registered.

isActive

public boolean isActive()
Returns a true if the component is still active. The component will be set to inactive status after a quit().

Specified by:
isActive in interface IComponent
Returns:
a true if the component is still active.

getToken

public String getToken()
Getter for property token.

Specified by:
getToken in interface IComponent
Returns:
Value of property token.

setToken

public void setToken(String token)
Setter for property token.

Specified by:
setToken in interface IComponent
Parameters:
token - New value of property token.

run

public Component run(String component)
Convenience Method for 'ComponentManager.run()'. This may throw the runtime ComponentCreationRuntimeException

Parameters:
component - The name of the component to create. There should be a valid definition for this name in the 'components.xml' file
Returns:
An instance of the Component

reflectAndSetParms

public void reflectAndSetParms(HttpServletRequest request)
Invoke the setters on the component passing the parameters in the request-stream This is a convenience method which can be invoked after creation of a new Component

Parameters:
request - The HTTP request we are processing

updateLastActivityDate

public void updateLastActivityDate()
This updates the activity timestamp on the component. This will ideally be called by the central servlet that services an event on a component.


returnLastActivityDate

public DateTime returnLastActivityDate()
This returns the timestamp for the last known activity on the component.

Returns:
The timestamp for the last known activity on the component.

addChildComponent

public void addChildComponent(Component component)
This adds a child component to an internal list. A child component instantiated via the run() method, will be implicitly added to the internal list.

Parameters:
component - The child component.

returnChildComponents

public Collection returnChildComponents()
This returns a collection of components which were created by this component.

Returns:
a collection of components which were created by this component.


Copyright © 2002-2004 JAFFA Project.