com.sapportals.htmlb

Class Form

java.lang.Object
  extended bycom.sapportals.htmlb.Component
      extended bycom.sapportals.htmlb.Container
          extended bycom.sapportals.htmlb.Form

public class Form
extends Container

The Form element which encapsulates all entry or event-firing controls.

Copyright 2004 SAP AG


Nested Class Summary
 class Form.FormElement
          internal class for encapsulating form meta-data
 
Field Summary
static String UI_ID
           
static int VAR_BEGIN
          constant for render call. render the begin of the form
static int VAR_END
          constant for render call. render the end of the form
 
Fields inherited from class com.sapportals.htmlb.Container
elements
 
Constructor Summary
Form()
          Application developers should not use this constructor directly.
Form(String formId)
          Application developers should not use this constructor directly.
 
Method Summary
 void addForcedEnabledElement(String generatedId, Component component)
          internal use only
 void addForceJavascriptInterface(IJavascriptComponent c, String generatedId)
           
 void addFormEndJavascript(JavascriptFragment javascript)
           
 void addFullIdFormElement(String componentId, String fullId)
           
 void addStandAloneHoverMenusAsString(StringBuffer hoverMenusAsString)
           
 void clearForceJavascriptInterface()
           
 void clearFormEndJavascripts()
           
 void decodeFormElements(String encodedString)
          decode Form meta-data from a String representation.
 String encodeFormElements()
          encode all form elements in a String.
 String getAction()
          get the action for this form, i.e. the URL that will receive the request for this form when submitted
 Class getClassForId(int index)
          INTERNAL USE ONLY.
 String getClassIdForComponent(String name)
          INTERNAL USE ONLY.
 String getClassIdForComponent(String tableName, String name)
          INTERNAL USE ONLY.
 ClassLoader getClassLoader()
           
 Component getComponentById(String id)
          INTERNAL USE ONLY.
 String getComponentIdForLabel(String id)
          INTERNAL USE ONLY.
 IEventModifier getCurrentEventModifier()
           
 Button getDefaultButton()
          get the current default button for this page.
 String getEncodingType()
          get the encoding type for this form, e.g.
 ArrayList getEventModifier()
           
 String getEventNameForId(int index)
          INTERNAL USE ONLY.
 Component getFocusedControl()
          get the control which will get the focus after loading the page
 HashMap getForcedEnabledElement()
          internal use only
 TreeMap getForceJavascriptInterface()
           
 ArrayList getFormEndJavascripts()
           
 String getFormId()
          get the Id of this form
 String getFullIdForComponent(Component component)
          INTERNAL USE ONLY.
 String getFullIdForComponent(String name)
          INTERNAL USE ONLY.
 String getFullIdForComponent(String modifierName, String name, int row)
          INTERNAL USE ONLY.
 HashMap getFullIdFormElements()
           
 HashSet getHoverMenus()
          returns the hover menus for rendering
 int getIdForClass(Class aClass)
          INTERNAL USE ONLY.
 int getIdForEvent(String eventName)
          INTERNAL USE ONLY.
 int getIndexOfElement(Component component)
          internal use.
 int getIndexOfLabel(String id)
           
 String getLanguage()
          gets the language identification for this component.
 MessageBar getMessageBar()
           
 String getMethod()
          get the method associated with this form, either 'GET' or 'POST'
 Iterator getRegisteredElementNames()
          get a HashMap containing all registered elements for this form.
 HashMap getRegisteredElements()
          get a HashMap containing all registered elements for this form.
 HashSet getScrollContainerSet()
           
 StringBuffer getStandAloneHoverMenusAsString()
           
 String getTarget()
          get the target frame for this form
 String getUI()
          get a identification String for the renderer that is unique across all supported components.
 String getUserIdForIndex(int index)
          INTERNAL USE ONLY.
 HashSet getValueHelpMappingFields()
          returns the value help mapping fields
 boolean isDiscardFocusFirstElement()
           
 boolean isHeightInHundredPercent()
          returns if the height should be in hundert percent
 boolean isLabeled(String id)
           
 boolean isLoadingMessage()
           
 boolean isMessageBarAtFormEnd()
           
 boolean isMessageBarRequired()
          returns if a message bar is required for this form or not
 boolean isScrollingToLastPosition()
           
 boolean isUserDefinedMessageBar()
           
 boolean isWidthInHundredPercent()
          returns if the width of the form is hundert percent
 IEventModifier popEventModifier()
           
 void pushEventModifier(IEventModifier eventModifier)
           
protected  int registerFormElement(Component component)
          INTERNAL USE ONLY.
 int registerFormElement(Component component, String id)
          INTERNAL USE ONLY.
 void registerHoverMenu(HoverMenu hoverMenu)
          register the hover menu hover menus within one page should be collected before they'll be rendered, for saving performance
 void registerScrollContainer(String id)
           
 void registerValueHelpMappingField(InputField field)
          register the value help mapping fields
 void setAction(String theAction)
          set the action for this form, i.e. the URL that will receive the request for this form when submitted
 void setClassLoader(ClassLoader classLoader)
           
 void setDefaultButton(Button defaultButton)
          sets the current default button for this page.
 void setDiscardFocusFirstElement(boolean discardFocus)
          If false (default) the focus in 508 mode should go to the first possible element.
 void setEncodingType(String theEncodingType)
          set the encoding type for this form, e.g.
 void setFocusedControl(Button focusedButton)
          set the control which will get the focus after loading the page
 void setFocusedControl(Component focusedComponent)
          set the control which will get the focus after loading the page
 void setFocusedControl(DropdownListBox focusedDropdownListBox)
          set the control which will get the focus after loading the page
 void setFocusedControl(InputField focusedInputField)
          set the control which will get the focus after loading the page
 void setFocusedControl(TextEdit focusedTextEdit)
          set the control which will get the focus after loading the page
 void setFormId(String theFormId)
          set the Id of this form.
 void setHeightInHundredPercent(boolean heightInHundredPercent)
          sets the height of the form to 100%
 void setLanguage(String language)
          sets the language identification for this component.
 void setLoadingMessage(boolean show)
           
 void setMessageBar(MessageBar messageBar)
          sets the message bar for validation
 void setMessageBarAtFormEnd(boolean messageBarAtBodyEnd)
           
 void setMessageBarRequired(boolean messageBarRequired)
          determines if a message bar is required for this form or not
 void setMethod(String theMethod)
          set the method associated with this form, either 'GET' or 'POST'
 void setScrollingToLastPosition(boolean scrollingToLastPosition)
           
 void setTarget(String target)
          set the target frame for this form.
 void setUserDefinedMessageBar(boolean userDefinedMessageBar)
           
 void setWidthInHundredPercent(boolean widthInHundredPercent)
          sets the width of the form to hundert percent
 
Methods inherited from class com.sapportals.htmlb.Container
addComponent, addRawText, addText, getChildCount, iterator, preRender, removeComponent, render
 
Methods inherited from class com.sapportals.htmlb.Component
getEncodedIdForForm, getId, getParent, initFromPageContext, initFromShortId, initializeFromId, isJsObjectNeeded, render, renderAsString, requiresForm, setId, setJsObjectNeeded, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UI_ID

public static final String UI_ID
See Also:
Constant Field Values

VAR_BEGIN

public static final int VAR_BEGIN
constant for render call. render the begin of the form

See Also:
Constant Field Values

VAR_END

public static final int VAR_END
constant for render call. render the end of the form

See Also:
Constant Field Values
Constructor Detail

Form

public Form()
Application developers should not use this constructor directly. Use createForm() or createFormDocument() in interface IPageContext.

convenience constructor for a new form. An ID will automatically be supplied.

See Also:
IPageContext.createForm(), IPageContext.createFormDocument(String)

Form

public Form(String formId)
Application developers should not use this constructor directly. Use createForm() or createFormDocument() in interface IPageContext.

creates a Form with a given ID.

Parameters:
formId - the Id to be used for this form. Must be 'clean' for HTML usage!
See Also:
IPageContext.createForm(), IPageContext.createFormDocument(String)
Method Detail

pushEventModifier

public void pushEventModifier(IEventModifier eventModifier)

popEventModifier

public IEventModifier popEventModifier()

getCurrentEventModifier

public IEventModifier getCurrentEventModifier()

getEventModifier

public ArrayList getEventModifier()

getUI

public 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.

Specified by:
getUI in class Component
Returns:
a unique identification string for this Component

getMethod

public String getMethod()
get the method associated with this form, either 'GET' or 'POST'

Returns:
the method for this form

setMethod

public void setMethod(String theMethod)
set the method associated with this form, either 'GET' or 'POST'

Parameters:
theMethod - the method to be used

getAction

public String getAction()
get the action for this form, i.e. the URL that will receive the request for this form when submitted

Returns:
the Action for this form

setAction

public void setAction(String theAction)
set the action for this form, i.e. the URL that will receive the request for this form when submitted

Parameters:
theAction - the Action, i.e. URL for this form

getFormId

public String getFormId()
get the Id of this form

Returns:
the id

setFormId

public void setFormId(String theFormId)
set the Id of this form. You must not change any form ID while already rendering content!

Parameters:
theFormId - the id

getEncodingType

public String getEncodingType()
get the encoding type for this form, e.g. "multipart/form-data" if you want to use a file-upload button

Returns:
the encoding type for this form.

setEncodingType

public void setEncodingType(String theEncodingType)
set the encoding type for this form, e.g. "multipart/form-data" if you want to use a file-upload button

Parameters:
theEncodingType - the encoding type for this form.

getTarget

public String getTarget()
get the target frame for this form

Returns:
the target for this form

setTarget

public void setTarget(String target)
set the target frame for this form. E.g. "_blank", "_self", "_parent", "_top" or any freely chosen name.

Parameters:
target - the target for this form

getDefaultButton

public Button getDefaultButton()
get the current default button for this page. This button will be triggered if the user presses the return key in the browser.

Returns:
the default Button for this form

setDefaultButton

public void setDefaultButton(Button defaultButton)
sets the current default button for this page. This button will be triggered if the user presses the return key in the browser.

Parameters:
defaultButton - the default Button for this form

getFocusedControl

public Component getFocusedControl()
get the control which will get the focus after loading the page

Returns:
control id

setFocusedControl

public void setFocusedControl(InputField focusedInputField)
set the control which will get the focus after loading the page

Parameters:
focusedInputField - input field which should get the focus

setFocusedControl

public void setFocusedControl(DropdownListBox focusedDropdownListBox)
set the control which will get the focus after loading the page


setFocusedControl

public void setFocusedControl(TextEdit focusedTextEdit)
set the control which will get the focus after loading the page


setFocusedControl

public void setFocusedControl(Button focusedButton)
set the control which will get the focus after loading the page

Parameters:
focusedButton - button which should get the focus

setFocusedControl

public void setFocusedControl(Component focusedComponent)
set the control which will get the focus after loading the page


getLanguage

public String getLanguage()
gets the language identification for this component. See rfc1766 for details.

Returns:
a String representing the language for this component

setLanguage

public void setLanguage(String language)
sets the language identification for this component. See rfc1766 for details.

Parameters:
language - a String representing the language for this component

registerFormElement

protected int registerFormElement(Component component)
INTERNAL USE ONLY. APPLICATION DEVELOPERS MUST NOT RELY ON THIS METHOD. internal method to register elements that are contained in the form. This assigns a unique number to the element.

Parameters:
component - the component to include
Returns:
the index of the component within this Form

registerFormElement

public int registerFormElement(Component component,
                               String id)
INTERNAL USE ONLY. APPLICATION DEVELOPERS MUST NOT RELY ON THIS METHOD. internal method to register elements that are contained in the form. This assigns a unique number to the element.

Parameters:
component - the component to include
Returns:
the index of the component within this Form

getIndexOfElement

public int getIndexOfElement(Component component)
internal use. Get the Index of a component within a form

Parameters:
component - the component
Returns:
the index of the component within the current form

getRegisteredElements

public HashMap getRegisteredElements()
get a HashMap containing all registered elements for this form. HashMap entries are of class Form.FormElement.

Returns:
a HashMap containing all elements.

getRegisteredElementNames

public Iterator getRegisteredElementNames()
get a HashMap containing all registered elements for this form. HashMap entries are of class Form.FormElement.

Returns:
a HashMap containing all elements.

getIdForEvent

public int getIdForEvent(String eventName)
INTERNAL USE ONLY. APPLICATION DEVELOPERS MUST NOT RELY ON THIS METHOD. get a unique number for an event name. Number are used in generated code to avoid naming problems.

Parameters:
eventName - the name of the event
Returns:
a unique number for this form.

getEventNameForId

public String getEventNameForId(int index)
INTERNAL USE ONLY. APPLICATION DEVELOPERS MUST NOT RELY ON THIS METHOD. get the name for an event given the id

Parameters:
index - the int id of the event
Returns:
the name of the event

getIdForClass

public int getIdForClass(Class aClass)
INTERNAL USE ONLY. APPLICATION DEVELOPERS MUST NOT RELY ON THIS METHOD. get a unique number for a class. Numbers are used in generated code to avoid naming problems.

Parameters:
aClass - the class
Returns:
a unique number for the class.

getClassForId

public Class getClassForId(int index)
INTERNAL USE ONLY. APPLICATION DEVELOPERS MUST NOT RELY ON THIS METHOD. get the name for an event given the id

Parameters:
index - the int id of the event
Returns:
the class for that index

encodeFormElements

public String encodeFormElements()
encode all form elements in a String. This is used to store required meta-data for a form in a HTML page.

Returns:
a String

decodeFormElements

public void decodeFormElements(String encodedString)
decode Form meta-data from a String representation. Used when the Form content is reconstructed.

Parameters:
encodedString - the String containing the encoded information

getFullIdForComponent

public String getFullIdForComponent(Component component)
INTERNAL USE ONLY. APPLICATION DEVELOPERS SHOULD USE getParamIdForComponent(Component) in IPageContext.

gets a unique ID for a component for encoding in the generated output.

Parameters:
component - the component for which a unique ID is requested
See Also:
IPageContext.getParamIdForComponent(Component)

registerHoverMenu

public void registerHoverMenu(HoverMenu hoverMenu)
register the hover menu hover menus within one page should be collected before they'll be rendered, for saving performance


getHoverMenus

public HashSet getHoverMenus()
returns the hover menus for rendering


getComponentIdForLabel

public String getComponentIdForLabel(String id)
INTERNAL USE ONLY. APPLICATION DEVELOPERS MUST NOT USE THIS METHOD!


getIndexOfLabel

public int getIndexOfLabel(String id)

isLabeled

public boolean isLabeled(String id)

getFullIdForComponent

public String getFullIdForComponent(String name)
INTERNAL USE ONLY. APPLICATION DEVELOPERS SHOULD USE getParamIdForComponent(String) in IPageContext.

for retrieving the old ID after submission

Parameters:
name - the id of the original component as specified by the application developer
Returns:
a String containing the unique ID that was used in the form
See Also:
IPageContext.getParamIdForComponent(String)

getComponentById

public Component getComponentById(String id)
INTERNAL USE ONLY.

for retrieving the a component by ID during rendering warning: this does not work for reference to controls contained in some modifier from outside of the scope of that modifier. from within the same modifier it may work but is highly at risk someone should write a test that uses eventing within a table row to check.

Parameters:
id - the id of the component as specified by the application developer
Returns:
Component

getUserIdForIndex

public String getUserIdForIndex(int index)
INTERNAL USE ONLY. APPLICATION DEVELOPERS MUST NOT RELY ON THIS METHOD.

get the component name for the component at the index position within this form

Parameters:
index - the index of the component within this form
Returns:
the name the use chose for the component

getFullIdForComponent

public String getFullIdForComponent(String modifierName,
                                    String name,
                                    int row)
INTERNAL USE ONLY. APPLICATION DEVELOPERS SHOULD USE getTableComponentForId() IN CLASS IPageContext.

for retrieving the old ID after submission

Parameters:
modifierName - the id of the outer component, e.g. a TableView
name - the id of the original component as specified by the application developer
Returns:
a String containing the unique ID that was used in the form
See Also:
IPageContext.getTableComponentForId(String,String,int)

getClassIdForComponent

public String getClassIdForComponent(String name)
INTERNAL USE ONLY. APPLICATION DEVELOPERS MUST NOT RELY ON THIS METHOD.

gets an ID for the class of the component with the specified id

Parameters:
name - the id of the component
Returns:
String a String that uniquely identifies the components class

getClassIdForComponent

public String getClassIdForComponent(String tableName,
                                     String name)
INTERNAL USE ONLY. APPLICATION DEVELOPERS MUST NOT RELY ON THIS METHOD.

gets an ID for the class of the component with the specified id

Parameters:
tableName - the id of the outer component, e.g. a TableView
name - the id of the component
Returns:
String a String that uniquely identifies the components class

addFormEndJavascript

public void addFormEndJavascript(JavascriptFragment javascript)

getFormEndJavascripts

public ArrayList getFormEndJavascripts()

clearFormEndJavascripts

public void clearFormEndJavascripts()

addForceJavascriptInterface

public void addForceJavascriptInterface(IJavascriptComponent c,
                                        String generatedId)

getForceJavascriptInterface

public TreeMap getForceJavascriptInterface()

clearForceJavascriptInterface

public void clearForceJavascriptInterface()

isScrollingToLastPosition

public boolean isScrollingToLastPosition()

setScrollingToLastPosition

public void setScrollingToLastPosition(boolean scrollingToLastPosition)

addFullIdFormElement

public void addFullIdFormElement(String componentId,
                                 String fullId)

getFullIdFormElements

public HashMap getFullIdFormElements()

getMessageBar

public MessageBar getMessageBar()

setMessageBar

public void setMessageBar(MessageBar messageBar)
sets the message bar for validation


isUserDefinedMessageBar

public boolean isUserDefinedMessageBar()

setUserDefinedMessageBar

public void setUserDefinedMessageBar(boolean userDefinedMessageBar)

isMessageBarAtFormEnd

public boolean isMessageBarAtFormEnd()

setMessageBarAtFormEnd

public void setMessageBarAtFormEnd(boolean messageBarAtBodyEnd)

addStandAloneHoverMenusAsString

public void addStandAloneHoverMenusAsString(StringBuffer hoverMenusAsString)

getStandAloneHoverMenusAsString

public StringBuffer getStandAloneHoverMenusAsString()

getClassLoader

public ClassLoader getClassLoader()

setClassLoader

public void setClassLoader(ClassLoader classLoader)

registerScrollContainer

public void registerScrollContainer(String id)

getScrollContainerSet

public HashSet getScrollContainerSet()

isMessageBarRequired

public boolean isMessageBarRequired()
returns if a message bar is required for this form or not


setMessageBarRequired

public void setMessageBarRequired(boolean messageBarRequired)
determines if a message bar is required for this form or not


addForcedEnabledElement

public void addForcedEnabledElement(String generatedId,
                                    Component component)
internal use only


getForcedEnabledElement

public HashMap getForcedEnabledElement()
internal use only


isWidthInHundredPercent

public boolean isWidthInHundredPercent()
returns if the width of the form is hundert percent


setWidthInHundredPercent

public void setWidthInHundredPercent(boolean widthInHundredPercent)
sets the width of the form to hundert percent


isHeightInHundredPercent

public boolean isHeightInHundredPercent()
returns if the height should be in hundert percent


setHeightInHundredPercent

public void setHeightInHundredPercent(boolean heightInHundredPercent)
sets the height of the form to 100%


getValueHelpMappingFields

public HashSet getValueHelpMappingFields()
returns the value help mapping fields


registerValueHelpMappingField

public void registerValueHelpMappingField(InputField field)
register the value help mapping fields


setLoadingMessage

public void setLoadingMessage(boolean show)

isLoadingMessage

public boolean isLoadingMessage()

isDiscardFocusFirstElement

public boolean isDiscardFocusFirstElement()

setDiscardFocusFirstElement

public void setDiscardFocusFirstElement(boolean discardFocus)
If false (default) the focus in 508 mode should go to the first possible element.



Copyright 2006 SAP AG Complete Copyright Notice