com.sapportals.htmlb

Class Checkbox

java.lang.Object
  extended bycom.sapportals.htmlb.Component
      extended bycom.sapportals.htmlb.EventValidationComponent
          extended bycom.sapportals.htmlb.StatefulButtonBase
              extended bycom.sapportals.htmlb.Checkbox
All Implemented Interfaces:
IEventValidationComponent, IUserDataComponent, LabeledComponent

public class Checkbox
extends StatefulButtonBase
implements IUserDataComponent, LabeledComponent

Basic Checkbox Control.
Copyright 2004 SAP AG


Field Summary
static String UI_ID
           
 
Fields inherited from class com.sapportals.htmlb.StatefulButtonBase
VAR_CONTENT, VAR_CONTENTFORGROUP, VAR_ELEMENT, VAR_ELEMENTFORGROUP
 
Constructor Summary
protected Checkbox()
          Create Checkbox.
  Checkbox(String key)
          create Checkbox with key
 
Method Summary
 String getOnClick()
          get the event name
 String getOnClientClick()
          get a Javascript fragment that is executed when the user clicks on this button
 ForcedTextDirection getTextDirection()
          Gets the text direction for the component
 String getUI()
          Get String identifier for this component.
 AbstractDataType getValueAsDataType()
          Get select state as AbstractDataType
protected  void initFromPageContext(IPageContext pc, String baseId)
          internal method to set users selection to the appropriate properties of the checkbox
 boolean isChecked()
          Check select state.
 boolean isLabeled()
          checks if a label has been assigned to this component.
 void render(int selector, IPageContext rendererContext)
          render an aspect of the component using the current context.
 void setChecked(boolean checked)
          Set select state.
 void setKey(String key)
          Deprecated. Use Component.setId(String). You should not use setKey on a Checkbox since it is basically the same as setId()
 void setLabeled(boolean isLabeled)
          notify the component that a label has been assigned to it.
 void setOnClick(String onClick)
          set the event name that is fired when the user clicks on this button
 void setOnClientClick(String onClientClick)
          set a Javascript fragment that is executed when the user clicks on this button
 void setTextDirection(ForcedTextDirection textDirection)
          Sets the text direction for the component
 
Methods inherited from class com.sapportals.htmlb.StatefulButtonBase
getElement, getKey, getText, getTooltip, hasValidTooltip, isEncode, setElement, setEncode, setText, setTooltip, toString
 
Methods inherited from class com.sapportals.htmlb.EventValidationComponent
getAllValidators, getClientEvent, getClientEventMap, getErrorText, getServerEvent, getServerEventMap, getValidator, isDisabled, isEnabled, isRequiresValidation, renderJavascriptInterface, setClientEvent, setDisabled, setEnabled, setErrorText, setRequiresValidation, setServerEvent, setValidator
 
Methods inherited from class com.sapportals.htmlb.Component
getEncodedIdForForm, getId, getParent, initFromShortId, initializeFromId, isJsObjectNeeded, preRender, render, renderAsString, requiresForm, setId, setJsObjectNeeded, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UI_ID

public static final String UI_ID
See Also:
Constant Field Values
Constructor Detail

Checkbox

public Checkbox(String key)
create Checkbox with key

Parameters:
key - the key/id/name for the checkbox

Checkbox

protected Checkbox()
Create Checkbox. Default Constructor is protected to enforce key creation.

Method Detail

setKey

public void setKey(String key)
Deprecated. Use Component.setId(String). You should not use setKey on a Checkbox since it is basically the same as setId()

Set key of Checkbox. This will also reset name of the checkbox

Overrides:
setKey in class StatefulButtonBase
Parameters:
key - new key and name

isChecked

public boolean isChecked()
Check select state.

Returns:
true if Checkbox was/is checked

setChecked

public void setChecked(boolean checked)
Set select state.

Parameters:
checked - boolean specifying select state

initFromPageContext

protected void initFromPageContext(IPageContext pc,
                                   String baseId)
internal method to set users selection to the appropriate properties of the checkbox

Overrides:
initFromPageContext in class Component
Parameters:
pc - the pagecontext from which to read the data
baseId - the prefix for the parameter keys

getValueAsDataType

public AbstractDataType getValueAsDataType()
Get select state as AbstractDataType

Specified by:
getValueAsDataType in interface IUserDataComponent
Returns:
DataBoolean instance indicating the select state

getOnClick

public String getOnClick()
get the event name

Returns:
the event name

setOnClick

public void setOnClick(String onClick)
set the event name that is fired when the user clicks on this button

Parameters:
onClick - the name of the event

getOnClientClick

public String getOnClientClick()
get a Javascript fragment that is executed when the user clicks on this button


setOnClientClick

public void setOnClientClick(String onClientClick)
set a Javascript fragment that is executed when the user clicks on this button

Parameters:
onClientClick - the Javascript

getUI

public String getUI()
Get String identifier for this component.

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

render

public void render(int selector,
                   IPageContext rendererContext)
render an aspect of the component using the current context. This method can be used by components that do not produce an atomic HTML code.

Parameters:
selector - the aspect to render.
rendererContext - the context in which to render.

setLabeled

public void setLabeled(boolean isLabeled)
Description copied from interface: LabeledComponent
notify the component that a label has been assigned to it.

Specified by:
setLabeled in interface LabeledComponent

isLabeled

public boolean isLabeled()
Description copied from interface: LabeledComponent
checks if a label has been assigned to this component.

Specified by:
isLabeled in interface LabeledComponent

getTextDirection

public ForcedTextDirection getTextDirection()
Gets the text direction for the component

Returns:
com.sapportals.htmlb.enum.ForcedTextDirection

setTextDirection

public void setTextDirection(ForcedTextDirection textDirection)
Sets the text direction for the component

Parameters:
textDirection - com.sapportals.htmlb.enum.ForcedTextDirection


Copyright 2006 SAP AG Complete Copyright Notice