com.sapportals.htmlb

Class DropdownListBox

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

public class DropdownListBox
extends EventValidationComponent
implements IUserDataComponent, LabeledComponent

Title: Description: Copyright: Copyright (c) 2001 Company: SAP AG


Field Summary
static String UI_ID
           
 
Constructor Summary
DropdownListBox(String name)
          Create a new DropdownListBox with a unique identifier.
 
Method Summary
 void addItem(String key, String text)
          add a key-value pair to the DropdownListBox
protected  IListModel createDefaultModel()
          Internal constructor for a default ListModel.
 DropdownListBoxDesign getDesign()
           
 Iterator getKeys()
          gets an Iterator for all keys contained in this DropdownListBox
 Iterator getKeySet()
          returns the key set of the ddlb
 IListModel getModel()
          get the model underlying this DropdownListBox
 String getNameOfKeyColumn()
          get the name of the column that contains the keys.
 String getNameOfValueColumn()
          get the name of the column that contains the visible texts.
 String getOnClientSelect()
          get the JavaScript fragment that is executed on the client side if the user changes the selection
 String getOnSelect()
          get the event identifier for a selection event.
 String getSelection()
          get the key for the currently selected entry
 String getTextForKey(String key)
          get the visible text associated with the given key
 String getTooltip()
          gets the Tooltip for this DropdownListBox.
 String getUI()
          get a identification String for the renderer that is unique across all supported components.
 AbstractDataType getValueAsDataType()
           
 String getWidth()
          gets the width of the DropdownListBox
protected  void initFromPageContext(IPageContext pc, String baseId)
          internal method to set user input to the appropriate properties of the listbox
 boolean isLabeled()
          checks if a label has been assigned to this component.
 boolean isRequiresValidation()
          returns if validation is required before sending the server event
 boolean isSelected(String key)
          test is a specified key has been selected in the DropdownListBox
 void setDesign(DropdownListBoxDesign design)
           
 void setLabeled(boolean isLabeled)
          notify the component that a label has been assigned to it.
 void setModel(IListModel model)
          set the model for this DropdownListBox
 void setNameOfKeyColumn(String nameOfKeyColumn)
          specify the name of the column that contains the keys.
 void setNameOfValueColumn(String nameOfValueColumn)
          specify the name of the column that contains the visible texts.
 void setOnClientSelect(String onClientSelect)
          specify a clientside JavaScript that should be executed if the user changes the selection
 void setOnSelect(String onSelect)
          set the event identifier for a selection event.
 void setRequiresValidation(boolean requiresValidation)
          determines if validation is required before sending the server event
 void setSelection(String selection)
          set the selection to the entry with the given key
 void setTooltip(String tooltip)
          sets the Tooltip for this DropdownListBox.
 void setWidth(String width)
          sets the width of the DropdownListBox
 
Methods inherited from class com.sapportals.htmlb.EventValidationComponent
getAllValidators, getClientEvent, getClientEventMap, getErrorText, getServerEvent, getServerEventMap, getValidator, isDisabled, isEnabled, renderJavascriptInterface, setClientEvent, setDisabled, setEnabled, setErrorText, 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, toString, wait, wait, wait
 

Field Detail

UI_ID

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

DropdownListBox

public DropdownListBox(String name)
Create a new DropdownListBox with a unique identifier.

Parameters:
name - the identifier for this DropdownListBox
Method Detail

createDefaultModel

protected IListModel createDefaultModel()
Internal constructor for a default ListModel. protected so that subclasses can override

Returns:
a default model for the listbox

initFromPageContext

protected void initFromPageContext(IPageContext pc,
                                   String baseId)
internal method to set user input to the appropriate properties of the listbox

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

getTooltip

public String getTooltip()
gets the Tooltip for this DropdownListBox. Tooltips can not contain HTML coding.

Returns:
the tooltip text

setTooltip

public void setTooltip(String tooltip)
sets the Tooltip for this DropdownListBox. Tooltips can not contain HTML coding.

Parameters:
tooltip - the tooltip text

getModel

public IListModel getModel()
get the model underlying this DropdownListBox

Returns:
the model

setModel

public void setModel(IListModel model)
set the model for this DropdownListBox

Parameters:
model - the model

isSelected

public boolean isSelected(String key)
test is a specified key has been selected in the DropdownListBox

Parameters:
key - the key to test
Returns:
true if the entry for this key is selected

getSelection

public String getSelection()
get the key for the currently selected entry

Returns:
the key for the current selection

setSelection

public void setSelection(String selection)
set the selection to the entry with the given key

Parameters:
selection - the key for the current selection

getNameOfKeyColumn

public String getNameOfKeyColumn()
get the name of the column that contains the keys. Used if you use an underlying table in the model

Returns:
the name/identifier of the key column

setNameOfKeyColumn

public void setNameOfKeyColumn(String nameOfKeyColumn)
specify the name of the column that contains the keys. Used if you use an underlying table in the model

Parameters:
nameOfKeyColumn - the name/identifier of the key column

getNameOfValueColumn

public String getNameOfValueColumn()
get the name of the column that contains the visible texts. Used if you use an underlying table in the model

Returns:
the name/identifier of the key column

setNameOfValueColumn

public void setNameOfValueColumn(String nameOfValueColumn)
specify the name of the column that contains the visible texts. Used if you use an underlying table in the model

Parameters:
nameOfValueColumn - the name/identifier of the key column

getOnSelect

public String getOnSelect()
get the event identifier for a selection event.

Returns:
the identifier for the event

setOnSelect

public void setOnSelect(String onSelect)
set the event identifier for a selection event. A selection event is fired if the user changes the selection of the DropdownListBox

Parameters:
onSelect - the identifier for the event

getOnClientSelect

public String getOnClientSelect()
get the JavaScript fragment that is executed on the client side if the user changes the selection

Returns:
the JavaScript fragment.

setOnClientSelect

public void setOnClientSelect(String onClientSelect)
specify a clientside JavaScript that should be executed if the user changes the selection

Parameters:
onClientSelect - a JavaScript fragment.

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

addItem

public void addItem(String key,
                    String text)
add a key-value pair to the DropdownListBox

Parameters:
key - the internal key for the entry
text - the visible text for the entry

getTextForKey

public String getTextForKey(String key)
get the visible text associated with the given key

Parameters:
key - the key for the entry
Returns:
the visible text for this key

getKeys

public Iterator getKeys()
gets an Iterator for all keys contained in this DropdownListBox

Returns:
an Iterator for the keys

getWidth

public String getWidth()
gets the width of the DropdownListBox

Returns:
the width of the DropdownListBox

setWidth

public void setWidth(String width)
sets the width of the DropdownListBox

Parameters:
width - the width of the DropdownListBox

getValueAsDataType

public AbstractDataType getValueAsDataType()
Specified by:
getValueAsDataType in interface IUserDataComponent

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

getKeySet

public Iterator getKeySet()
returns the key set of the ddlb


getDesign

public DropdownListBoxDesign getDesign()

setDesign

public void setDesign(DropdownListBoxDesign design)

isRequiresValidation

public boolean isRequiresValidation()
returns if validation is required before sending the server event

Specified by:
isRequiresValidation in interface IEventValidationComponent
Overrides:
isRequiresValidation in class EventValidationComponent

setRequiresValidation

public void setRequiresValidation(boolean requiresValidation)
determines if validation is required before sending the server event

Overrides:
setRequiresValidation in class EventValidationComponent


Copyright 2006 SAP AG Complete Copyright Notice