com.sapportals.htmlb

Class Component

java.lang.Object
  extended bycom.sapportals.htmlb.Component
Direct Known Subclasses:
AppletContainer, Bookmark, BreadCrumb, Chart, Container, DateNavigator, EventValidationComponent, FileUpload, GridLayoutCell, HoverMenu, HoverMenuItem, HtmlEdit, HTMLFragment, Image, ImageMap, Includes, IsolatedHtmlContainer, LinkForHoverMenu, MenuBar, MessageBar, NonIsolatedHtmlContainer, PopupTrigger, ProgressIndicator, TextView, ToolbarSeparator, Tree

public abstract class Component
extends Object

Base class for all control model classes

Copyright 2004 SAP AG


Constructor Summary
Component()
           
Component(String id)
           
 
Method Summary
protected  String getEncodedIdForForm(Form theForm)
          internal use only.
 String getId()
          get the name of this component
 Container getParent()
           
abstract  String getUI()
          get a identification String for the renderer that is unique across all supported components.
protected  void initFromPageContext(IPageContext pc, String baseId)
          internal use only.
protected  void initFromShortId(IPageContext pc, String id)
          internal use only.
static Component initializeFromId(String originalId, String id, IPageContext pc, String idInPage)
          internal use only.
 boolean isJsObjectNeeded()
          return if a js object is needed on the client side for this component
 void preRender(IPageContext pc)
          preRender traverses the component tree right before rendering
 void render(IPageContext rendererContext)
          render the component using the current context.
 String renderAsString(IPageContext pageContext)
          Experimental.
 boolean requiresForm()
          check if a special component really requires a form around it.
 void setId(String id)
          set the name of this component
 void setJsObjectNeeded(boolean jsObjectNeeded)
          determines if a js object is needed for this component
 void setParent(Container parent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Component

public Component()

Component

public Component(String id)
Method Detail

getParent

public Container getParent()

setParent

public void setParent(Container parent)

getId

public String getId()
get the name of this component

Returns:
the name of this component

setId

public void setId(String id)
set the name of this component

Parameters:
id - the name of this component

getUI

public abstract String getUI()
get a identification String for the renderer that is unique across all supported components. E.g. you could simply return the class name of the component class. The reason for using a separate method and not some internal reflection method is that you can more easily extend the functionality or your Component class without having to rewrite the view class.

Returns:
a unique identification string for this Component

render

public void render(IPageContext rendererContext)
render the component using the current context. This is the default method that is useful for components with atomic HTML code. Component classes that require separate pieces of HTML code in their output should use separate methods with appropriate names, e.g. renderBegin(IPageContext rc), renderEnd(..). The IPageContext provides a separate method render(Component c, String selector) to use separate view classes for the fragments.

Parameters:
rendererContext - the context in which to render.

renderAsString

public String renderAsString(IPageContext pageContext)
Experimental. Render a component into a String

Parameters:
pageContext - the current IPageContext for rendering.
Returns:
a String containing the output from rendering this Component

getEncodedIdForForm

protected String getEncodedIdForForm(Form theForm)
internal use only. This returns a string that uniquely identifies the class of the component. Special subclasses may add more information, separated with a '_'

Returns:
a String that uniquely identifies the class of this component

initializeFromId

public static Component initializeFromId(String originalId,
                                         String id,
                                         IPageContext pc,
                                         String idInPage)
internal use only. This re-initializes a component from the submitted form data.

Parameters:
originalId - the ID the user used for the component
id - the internal class ID, generated by getEncodedIdForForm
pc - the IPageContext, required for accessing parameters
idInPage - the ID used internally in the HTML page
Returns:
a Component that encapsulates user input.

initFromShortId

protected void initFromShortId(IPageContext pc,
                               String id)
internal use only. Set up the class for the component. If a Component added some special information to the getEncodedIdForForm() this method should be used to regain the additionally encoded information.

Parameters:
id - the Id as it was returned by getEncodedIdForForm()

initFromPageContext

protected void initFromPageContext(IPageContext pc,
                                   String baseId)
internal use only. Components should override this method to analyse the parameters from the request object (via IPageContext) and set their internal data structures accordingly.

Parameters:
pc - the context, including the parameters
baseId - the prefix used for the component. (The result of a former RenderUtil.getIdForForm(rc, c);)

requiresForm

public boolean requiresForm()
check if a special component really requires a form around it. Subclasses should override this if they do not require a form.

Basically, any Component that is capable of firing a server side event or that contains user input must be placed in a form.

Returns:
true if the component must be placed in a form.

isJsObjectNeeded

public boolean isJsObjectNeeded()
return if a js object is needed on the client side for this component


setJsObjectNeeded

public void setJsObjectNeeded(boolean jsObjectNeeded)
determines if a js object is needed for this component


preRender

public void preRender(IPageContext pc)
preRender traverses the component tree right before rendering



Copyright 2006 SAP AG Complete Copyright Notice