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, com.sapportals.htmlb.IJavascriptComponent, 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
 com.sapportals.htmlb.enum.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(com.sapportals.htmlb.enum.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 com.sapportals.htmlb.enum.ForcedTextDirection getTextDirection()
Gets the text direction for the component

Returns:
com.sapportals.htmlb.enum.ForcedTextDirection

setTextDirection

public void setTextDirection(com.sapportals.htmlb.enum.ForcedTextDirection textDirection)
Sets the text direction for the component

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


Copyright 2006 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.