Show TOC Start of Content Area

Object documentation ViewSwitch   Locate the document in its SAP Library structure

The ViewSwitch UI element is part of the ContextualPanel and should be used to navigate between views.

This graphic is explained in the accompanying text

 

Description of UI Element Properties

      itemEnabled

Specifies whether the item is enabled or disabled, that is, whether the user can trigger an action by clicking the item in question.

      itemIcon

The itemIcon property can take the following values and is represented by enumeration type WDViewSwitchIcon.

value

description

blank

Invisible placeholder icon to get the right indent if only some view switch items have an icon.

news

Icon for news.

none

No icon is displayed at the view switch item.

overview

Icon for overviews.

report

Icon for reports.

selfService

Icon for self services.

work

Icon for work related views.

      itemSource

Specifies the item source of the ViewSwitch. You can use this to specify the path to the context node, where you can define the items.

      itemText

Specifies the text for the item.

      itemVisible

Specifies whether the item is visible.

Properties Overview

Name

Interface

Type

Initial Value

Bindable

itemEnabled

IWDViewSwitch

boolean

true

bindable

itemIcon

IWDViewSwitch

WDViewSwitchIcon

none

bindable

itemSource

IWDViewSwitch

Object

 

bindable_mandatory

itemText

IWDViewSwitch

String

 

bindable

itemVisible

IWDViewSwitch

boolean

true

bindable

Events

      onSelect (int index)

The onSelect event is triggered if the user selects a ViewSwitch item. The event parameter is the zero-based index of the selected item.

Data Binding

...

       1.      To bind the data of the ViewSwitch, create a context node and the following attributes:

This graphic is explained in the accompanying text

 

       2.      Bind the property itemSource to the context node and bind the properties itemEnabled, itemText and itemVisible to the corresponding context attributes.

       3.      To create and add itemSource elements, add the following source code to the wdDoInit method:

wdDoInit()

1

 

 

2

 

 

 

 

 

for(int i =0; i<3; i++)

 {

  IPrivatePatternUIElementsView.IItemSourceElement ivse =
    wdContext.createItemSourceElement();
  wdContext.nodeItemSource().addElement(ivse);
  ivse.setItemEnabled(
true);
  ivse.setItemText(
"text no. "+i);
  ivse.setItemVisible(
true);
}

In this example, the ViewSwitch would look like the screenshot below:

This graphic is explained in the accompanying text

 

End of Content Area