com.sapportals.htmlb.page

Class DynPage

java.lang.Object
  extended bycom.sapportals.htmlb.page.DynPage

public abstract class DynPage
extends Object

Base class for pages. This class does some rudimentary event handling by invoking appropriate methods.

Copyright 2004 SAP AG


Field Summary
protected  Document document
           
protected  Form form
           
protected  String forward
           
protected  String title
           
 
Constructor Summary
DynPage()
          creates a new DynPage.
 
Method Summary
abstract  void doInitialization()
          initialize your DynPage.
 void doOutput(PageProcessor processor)
          actually do your output.
abstract  void doProcessAfterInput()
          Process any user input.
abstract  void doProcessBeforeOutput()
          preprocess your output.
 void doProcessCurrentEvent(Event theEvent)
          processes the current event by invoking a method with an appropriate name and signature.
 void doSetupOutput()
          sets up the output for this DynPage.
 ClassLoader getClassLoader()
          Get the actual classloader object.
 Component getComponentByName(String name)
           
 Component[] getComponents()
          gets an array of all components from the last submitted form or null if there were no components
 Document getDocument()
          returns the Document object of the page
 Form getForm()
          gets the Form to be used in this DynPage.
 String getForward()
           
 IPageContext getPageContext()
          gets the IPageContext of the current request.
protected  Object getRequest()
           
protected  Object getResponse()
           
 String getTitle()
           
 void setClassLoader(ClassLoader classLoader)
          Set the classloader to use.
 void setComponents(Component[] components)
          Deprecated.  
 void setForm(Form form)
          sets the Form to be used in this DynPage.
 void setForward(String url)
          set forward url e.g.
 void setPageContext(IPageContext pageContext)
          Set the IPageContext of the current request.
 void setRequest(Object request)
          Sets the request object.
 void setResponse(Object response)
          Set the response object.
 void setTitle(String title)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

document

protected Document document

form

protected Form form

title

protected String title

forward

protected String forward
Constructor Detail

DynPage

public DynPage()
creates a new DynPage. Subclasses should use setTitle() in their own constructors to set a title for the generated document.

Method Detail

doSetupOutput

public void doSetupOutput()
                   throws PageException
sets up the output for this DynPage. The default implementation creates a document and sets up a Form that you can access using the getForm() method. Note that this method is called first, i.e. before any input processing or event handling!

You may want to override this method if you do not process output directly, e.g. if you use JSPs to render the output in which case you might setup your data beans.

Throws:
PageException

doInitialization

public abstract void doInitialization()
                               throws PageException
initialize your DynPage. This method is called the first time your MiniApp is invoked.

Throws:
PageException

doProcessAfterInput

public abstract void doProcessAfterInput()
                                  throws PageException
Process any user input.

Throws:
PageException

doProcessCurrentEvent

public void doProcessCurrentEvent(Event theEvent)
                           throws PageException
processes the current event by invoking a method with an appropriate name and signature.

'appropriate' means that we look for a method with the name of the event action and a single Event parameter. If no such method exists we try to prefix the event action with 'on' and capitalize the first letter. E.g. if the event action is 'submit' we first try to invoke a method

 public void submit(Event event) {}
 
if no such method exists, we try to invoke
 public void onSubmit(Event event) {}
 
If there is no such method either a PageException is thrown.

Subclasses may override this method to install their own event handling.

Parameters:
theEvent - the current event from the PageContext
Throws:
PageException

doProcessBeforeOutput

public abstract void doProcessBeforeOutput()
                                    throws PageException
preprocess your output. You can set up a component tree in this method and add it to your current form.

Throws:
PageException

doOutput

public void doOutput(PageProcessor processor)
              throws PageException
actually do your output. If you do not want to do any output yourself you can override this method to include JSPs in your output or redirect the request or ...

Throws:
PageException

setForm

public void setForm(Form form)
sets the Form to be used in this DynPage.

Parameters:
form - the Form to be used

getForm

public Form getForm()
gets the Form to be used in this DynPage.

Returns:
the Form to be used

setRequest

public void setRequest(Object request)
Sets the request object.


getRequest

protected Object getRequest()
Returns:
the current request object. The class of the object depends on the environment, e.g. HttpServletRequest in a servlet environment or IPortalComponentRequest in Workplace environment.

setResponse

public void setResponse(Object response)
Set the response object.


getResponse

protected Object getResponse()
Returns:
the current response object. The class of the object depends on the environment, e.g. HttpServletResponse in a servlet environment or IPortalComponentResponse in Workplace environment.

getPageContext

public IPageContext getPageContext()
gets the IPageContext of the current request.

Returns:
the current IPageContext

setPageContext

public void setPageContext(IPageContext pageContext)
Set the IPageContext of the current request.


getComponents

public Component[] getComponents()
gets an array of all components from the last submitted form or null if there were no components

Returns:
an array of components

setComponents

public void setComponents(Component[] components)
Deprecated.  


getComponentByName

public Component getComponentByName(String name)

setTitle

public void setTitle(String title)

getTitle

public String getTitle()

getDocument

public Document getDocument()
returns the Document object of the page


setForward

public void setForward(String url)
set forward url e.g. /webapp/myJSP.jsp


getForward

public String getForward()

getClassLoader

public ClassLoader getClassLoader()
Get the actual classloader object.


setClassLoader

public void setClassLoader(ClassLoader classLoader)
Set the classloader to use.



Copyright 2006 SAP AG Complete Copyright Notice