Entering content frame

Object documentation Web Dynpro AbstractDropDownByIndex API - IWDAbstractDropDownByIndex Locate the document in its SAP Library structure

Definition

The AbstractDropDownByIndex class which implements the IWDAbstractDropDownByIndex interface is the abstract base class of a dropdown list box that uses the Structure linkIndex Binding Model for data binding.

The view context provides the content to be displayed in the dropdown list box and the selected index.

The view context must contain a context node X that can store any number of node elements (X.cardinality=0..n). Each node element represents an entry in the the dropdown list box.

The context node X contains a context attribute y that provides the texts for the list entries. The data type of the context attribute y can be any simple data type – for example, String, int, and so on. If the data type of the context attribute y is not of the type String, this type is converted into a String representation by the Web Dynpro Framework. The selected value is specified by the lead selection of the node X.

The texts property of the DropDownByIndex UI element is bound to the attribute y by assigning the path of the context X.y to the texts property.

Example for Data Binding of the DropDownByIndex UI Element:

Procedure at design time:

...

       1.      Create a view with the name TestView.

       2.      Insert the DropDownByIndex UI element as a container child of the TestView view (step 1).

       3.      Create the context structure, as described in step 2.
Create the context node X with the cardinality 0..n. Insert the value attribute y of the type String into this node. This is followed by the data binding of the DropDownByIndex UI element in the Properties window of the View Designer. The
texts property must be bound to the value attribute y with the context path describtion TestView.X.y (step 3).
The context path TestView.X.y describes the attribute y in the context node X of the view context of the TestView view.

You can fill the context with test data using the following controller implementation.

public void wdDoInit()

  {

    //@@begin wdDoInit()

   String[] letters = new String []

   {"A", "B", "C", "D"};

 

//Create context elements for the node "X"

   List nodeElements = new ArrayList();

   for (int i =  0; i <letters.length; ++i)

   {

      IPrivateTestView.IXElement xElement = wdContext.createXElement();

      xElement.setY(letters[i]);

      nodeElements.add(xElement);

   }

 

//Bind node element list to the node

   wdContext.nodeX().bind(nodeElements);

 

//Set node’s lead selection which determines the selected item

   wdContext.nodeX().setLeadSelection(1);

 

    //@@end

  }

Behavior at runtime:

At runtime, a context node consists of a number of node elements, which contain the values to be displayed – as schematically illustrated in step 4. The lead selection is set to the second value (zero-based index). Step 5 shows the dropdown list box with the possible values A, B, C, and D, as it is displayed in the browser.

This graphic is explained in the accompanying text

Description of the UI Element Property

·         texts
Determines the content of the list entries.

Overview of Inherited and Additional Properties

Name

Interface

Type

Initial Value

Bindable

Value Required

enabled

IWDUIElement

boolean

true

bindable

No

readOnly

IWDAbstractDropDown

boolean

false

bindable

No

state

IWDAbstractDropDown

WDState

normal

bindable

No

texts

IWDAbstractDropDownByIndex

String

 

bindable_mandatory

Yes

tooltip

IWDUIElement

String (TranslatableText)

 

bindable

No

visible

IWDUIElement

WDVisibility

visible

bindable

No

width

IWDAbstractDropDown

String

 

bindable

No

Events

·         onSelect
This property can assign the action to be executed when the user selects a different list entry from the dropdown list box. The newly selected index (starting from zero) is passed as the event parameter t.

Event Parameter

Type

Description

index

int

Index of the newly selected context elements.

See Structure linkParameter Mapping.

Subordinated Interfaces

IWDDropDownByIndex.

Methods in the Web Dynpro IWDAbstractDropDownByIndex API

Method Name

Parameter

Return Value

Short Description

bindingOfTexts

 

String

Returns the path of the context element to which the texts property is bound. Returns NULL if no binding exists.

bindTexts

(String path)

 

Binds the texts property to the context node specified by a path.

getOnSelect

 

IWDAction

Returns the action that is executed when the onSelect event is triggered.

mappingOfOnSelect

 

IWDParameterMapping

Returns the parameter mapping for the onSelect action.

setOnSelect

(IWDAction action)

 

Sets the action that is executed when the onSelect event is triggered.

Additional methods described in the following APIs are available using inheritance: IWDAbstractDropDown, IWDUIElement, IWDViewElement.

Note

For further information about all inherited methods, refer to the documentation for the relevant APIs.

  

  

 

Leaving content frame