SilverStream
Application Server 3.5

com.sssw.shr.page
Interface AgiPageControl

All Known Implementing Classes:
AgpData, AgpPage, AgpTag, AgpText

public interface AgiPageControl

Basic interface that all page controls must implement. In addition to implementing this interface, a page control must also be serializable.

Although not required, it is recommended that custom page controls inherit from AgpControlBase. AgpControlBase, together with its base class AgpTag, provide a convenient base implementation for serialization and HTML generation.


Method Summary
 void generateHTML(String namespace, PrintWriter writer)
          Generates the HTML that the server should return to the browser for rendering at run-time.
 String getPrefix()
          Returns the prefix of the default name for the control.
 int notifyPageLoaded(AgpPage parentpage, AgiHttpServletRequest req, AgiHttpServletResponse resp)
          Invoked when the page is first loaded.
 void notifyPageRequestBegin(AgiHttpServletRequest req, AgiHttpServletResponse resp)
          Invoked when the page request is begun.
 void notifyPageRequestEnd(AgiHttpServletRequest req, AgiHttpServletResponse resp)
          Invoked each time that a request is finished.
 AgiPageSubmitProcessor notifyPostValue(String name, String value)
          Handles any processing of new values.
 AgiPageSubmitProcessor notifyPostValues(String name, String[] values)
          Invoked when an HTTP POST request includes a multi-valued field falling under the namespace of this control.
 

Method Detail

getPrefix

public String getPrefix()
Returns the prefix of the default name for the control. It is the root used for naming controls of this class. For example, if this method returns "Button", the design environment will automatically name the instances of this class "Button1", "Button2"...etc.
Returns:
the prefix of the control.
Example:
 

notifyPageLoaded

public int notifyPageLoaded(AgpPage parentpage,
                            AgiHttpServletRequest req,
                            AgiHttpServletResponse resp)
                     throws IOException,
                            ServletException
Invoked when the page is first loaded.
Parameters:
parentpage - the parent page.
req - a servlet request.
resp - a servlet reqponse.
Usage:

This method must return an OR'ed set of flags indicating what other interface methods it would like to be called on:

  • NOTIFY_REQUEST_BEGIN - notifies this control when the page is requested
  • NOTIFY_REQUEST_END - notifies this control when the page completed a request
  • NOTIFY_POST_VALUE_ALWAYS - notifies this control always when all posted values are delivered
  • GENERATE_HTML - notifies this control to generate its HTML.
Example:
 
See Also:
AgiPageControl.notifyPageRequestBegin(AgiHttpServletRequest req, AgiHttpServletResponse resp), AgiPageControl.notifyPageRequestEnd(AgiHttpServletRequest req, AgiHttpServletResponse resp), AgiPageControl.notifyPostValue(String name, String value)

notifyPageRequestBegin

public void notifyPageRequestBegin(AgiHttpServletRequest req,
                                   AgiHttpServletResponse resp)
                            throws IOException,
                                   ServletException
Invoked when the page request is begun.
Parameters:
req - a servlet request.
resp - a servlet response.
Example:
 
See Also:
AgiPageControl.notifyPageLoaded(AgpPage parentpage, AgiHttpServletRequest req, AgiHttpServletResponse resp), AgiPageControl.notifyPageRequestEnd(AgiHttpServletRequest req, AgiHttpServletResponse resp), AgiPageControl.notifyPostValue(String name, String value)

notifyPageRequestEnd

public void notifyPageRequestEnd(AgiHttpServletRequest req,
                                 AgiHttpServletResponse resp)
                          throws IOException,
                                 ServletException
Invoked each time that a request is finished.
Parameters:
req - a servlet request.
resp - a servlet response.
Example:
 
See Also:
AgiPageControl.notifyPageLoaded(AgpPage parentpage, AgiHttpServletRequest req, AgiHttpServletResponse resp), AgiPageControl.notifyPageRequestBegin(AgiHttpServletRequest req, AgiHttpServletResponse resp), AgiPageControl.notifyPostValue(String name, String value)

generateHTML

public void generateHTML(String namespace,
                         PrintWriter writer)
                  throws IOException,
                         ServletException
Generates the HTML that the server should return to the browser for rendering at run-time.
Parameters:
namespace - name anything in HTML using this namespace. If this is a simple control, the namespace may be used as the name.
PrintWriter - a character output stream.
Example:

This Java code fragment generates the current date-time and put it in a square bracket:

 	writer.write("[" + new Date() + "]");
 

notifyPostValue

public AgiPageSubmitProcessor notifyPostValue(String name,
                                              String value)
                                       throws IOException,
                                              ServletException
Handles any processing of new values. This method is invoked when an HTTP POST request includes a field which falls under the namespace of this control. It should return an AgiPageSubmitProcessor if submit-event processing is needed. For example, if this control is a Submit button that implements AgiPageSubmitProcessor, it may return itself.
Parameters:
name - the namespace has been stripped off from the name.
value - the value.
Example:
 
See Also:
AgiPageControl.notifyPageLoaded(AgpPage parentpage, AgiHttpServletRequest req, AgiHttpServletResponse resp), AgiPageControl.notifyPageRequestBegin(AgiHttpServletRequest req, AgiHttpServletResponse resp), AgiPageControl.notifyPageRequestEnd(AgiHttpServletRequest req, AgiHttpServletResponse resp)

notifyPostValues

public AgiPageSubmitProcessor notifyPostValues(String name,
                                               String[] values)
                                        throws IOException,
                                               ServletException
Invoked when an HTTP POST request includes a multi-valued field falling under the namespace of this control.
Parameters:
name - The namespace has been stripped off from the name.
values - The value as an array of strings (String[])
Returns:
an AgiPageSumbmitProcessor if submit-event processing is needed. For example, if this control is a submit button it will return itself.

SilverStream
Application Server 3.5