cancel
Showing results for 
Search instead for 
Did you mean: 

2 message areas in tab strip

Former Member
0 Kudos

Hi,

I am facing the following problem:

My application has 2 tabs in a tab strip. each tab hosts 1 view.

I need to have 1 message areas in each view.

However, if I define 2 message areas, one for each view, all the messages I raise, go to only one of the views...

Is it impossible to have 2 message areas in the application?

This is how i raise messages to the messager area:

errorMsg = wdComponentAPI.getTextAccessor().getText(IMessageTaskList.MSG__TASK__NAME__ALREADY__EXISTS);

wdComponentAPI.getMessageManager().reportException(errorMsg, true);

Please assist.

Reagrds,

Oren.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

I am on my way to solve this.

However, I ran to the following problem:

As you know, the TabStrip element has an "onSelect" handler. As long as I left it empty and didn't bind any method to it, switching tabs worked ok.

The moment I bind a method to it, no matter what is written there (even an empty method) switching tabs is impossible (you can't move from one tab to another by choosing the desired tab). Any ideas why? Is this a bug?

Regards,

Oren.

Former Member
0 Kudos

Hi Murtuza,

how do I give a value to tabNo according to the selected tab? Do tabs have an id? how can i get it?

Thanks,

Oren.

Former Member
0 Kudos

Hi,

Create a event handler on onSelect of the tab Control UI.

Map the parameter tab as one of the parameter.

@tab will return you the currently selected tab.

Your method signature will be as shown below

public void onActionTabSelectionChange(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String tabName )

tabName should be mapped to tab.

write the following code snippet in wdDoModify

if(firstTime)

{

IWDTabStrip tabStrip = (IWDTabStrip)view.getElement("tab");

IWDParameterMapping mapping = tabStrip.mappingOfOnSelect();

mapping.addSourceMapping("tab", "tabName");

}

Regards

Ayyapparaj

Message was edited by:

Ayyapparaj KV

Former Member
0 Kudos

Hi Oren,

1. Create an action called and bind it to OnAction Property fo your TabStrip.

2. Create a context called selectedTab of type String and bind it to your SelectedTab property of your TabStrip.

3. Now in the action you can get the id of the selected tab as

wdContext.currentContextElement().getSelectedTab();

Warm Regards,

Murtuza

Former Member
0 Kudos

Hi Murtuza,

Thank you for your reply!

I have 2 questions about it:

1. The main view in my application is the one that contains the tab strip. and each tab consists of one more view.one of these views includes the message area, and the prupose is to change its position according to the selsected tab.

so, does it mean I need to include the "swap" code in the "modifyView" of the main view?

2. you wrote:

root.swapChildren(<original location of message area>,<new location of message area>);

How do I get the new/original locations?

Thanks for your assistance!

Best Regards,

Oren.

Former Member
0 Kudos

Hi Oren,

You can define a context in the component controller called tabno of type integer.

--> Map this context to the main view and all the views for your respective tabs.

--> Set the value of this context in the main view based on which tab is clicked(ie from the event defined for tabs).

--> Now in wdDoModifyView of all the views embedded in the tab, you can swap its position.

Hope now its clear to you.

Regards,

Murtuza

Former Member
0 Kudos

Hi Oren,

Even if you have n number of message areas in your view, all your messages woule appear in the message area that appears first in the list.

You can change the position of messageArea as per your requirement at runtime.

In WDDoModifyView()

IWDTransparentContainer root = (IWDTransparentContainer)view.getElement("RootUIElementContainer");

IWDMessageArea msg = (IWDMessageArea)view.getElement("MessageArea");

root.swapChildren(<original location of message area>,<new location of message area>);

Regards,

Murtuza