on 02-02-2009 11:50 AM
Hi,
When I click on the link to action i want to display the view in a diffent window. how can do it can any one help me in this.
Regards,
H.V.Swathi
hi,
to the onAction of the LinkToUrl bind a method -
in the impl of dat method use this code
IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("MyWindow");
IWDWindow window = wdComponentAPI.getWindowManager().createWindow( windowInfo, true);
window.setWindowPosition(300, 150);
window.open();
wdContext.currentPopupElement().setWindowInstance(window);
Embed ur view in a window---here the name of dat window is MyWindow
Regards
Jayapriya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Swathi,
PopUp is the node which has a Attribute say WindowInstance of type IWDWindow.
in the LinkToAction , Action method u have set the Window instance in the Attribute"WindowInstance" and finally when u are closing that window , u have delete the Window instance .
refer this link for External Window
[http://help.sap.com/saphelp_nw04/helpdata/en/fd/024640c0e56913e10000000a1550b0/content.htm]
Thanks and regards
Hi Swathi,
If you just want to open a popup window you can go through this post where I have explained step by step how to open a popup window.
You can also go through this tutorial on creating popup window.
[https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/20d2def3-f0ec-2a10-6b80-877a71eccb68]
Hope this helps,
Sanyev
Hi,
I am getting this error when i run the application.
The initial exception that caused the request to fail, was:
com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Parameter windowInfo must not be null.
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.createModalWindow(ClientComponent.java:1020)
at com.sap.travel.EtrecViewExpenseView.onActionSupportingDocument(EtrecViewExpenseView.java:210)
at com.sap.travel.wdp.InternalEtrecViewExpenseView.wdInvokeEventHandler(InternalEtrecViewExpenseView.java:215)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
... 27 more
See full exception chain for details.
Regards,
H.V.Swathi
1) You have specified invalid Window name to IWDWindowInfo
IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows(<Window Name>);
2) You have to get a reference of created window in to context for future accesses such as close popup/access its Title etc.. . For this purpose use the code
IWDWindow window = wdComponentAPI.getWindowManager().createWindow( windowInfo, true);
wdContext.currentPopupElement().setWindowInstance( window);
vinod v
Hi Swathi,
Have you created a new Window? The new view that you want to show as a popup should be created first. now a new window has to be created. Lets say the name is "popupWindow". You have to embed the newly created view to this window. once this is done. Then you have to write code to popup the window. See my previous post to know where to write the code.
IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("popupWindow");
IWDWindow window = wdComponentAPI.getWindowManager().createWindow( windowInfo, true);
Hope this helps
Sanyev
Hi,
I have done all the things and i am geetting this error
when i click the button where the action to go next window is written.
java.lang.NullPointerException
at popup.EmailView.onActionShowAddressbookPopup(EmailView.java:174)
at popup.wdp.InternalEmailView.wdInvokeEventHandler(InternalEmailView.java:192)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)
... 26 more
Reagards,
H.V.Swathi
Hi Swathi,
You are getting getting a null pointer exception at at EmailView.java: line174. Can you post what is the contents of that line?
Please see the post []. Here towards the end of the post I have mentioned exactly where you need to write the code for the popup to work properly.
In your case your onActionShowAddressbookPopup() method should look something like this.
//This is on the main view controller
public void onActionShowAddressbookPopup(){
/*
Write code to do business logic
*/
//Launch popup window
wdThis.wdGetComponentController().showPopup();
}
Some thing in your onActionShowAddressbookPopup() line 174 is giving you a null pointer exception. if you need help on that just post the contents of the line 174.
Regards,
Sanyev
Hi,
Here is the code. And i realy want your help.
IWDWindowInfo windowInfo =
(IWDWindowInfo) wdComponentAPI.getComponentInfo().findInWindows(
"AddressbookWindow");
//create the u201CAddressbookWindowu201D
IWDWindow window =
wdComponentAPI.getWindowManager().createWindow(windowInfo, true);
//set the WindowPosition on the screen
window.setWindowPosition(300, 150);
//and show the window
window.open();
// Save WindowInstance in Context
wdContext.currentPopUpElement().setWindowInstence(window);
Hi Swathi,
I guess you have written the popup launching code in your view action handler. I would recommend that you write this code in your component controller.
Your onActionShowAddressbookPopup() implementation in your view controller would look some thing like this
//This is on the main view controller
public void onActionShowAddressbookPopup(){
//Launch popup window
wdThis.wdGetComponentController().showPopup();
}
In your component controller context directly under context create an attribute "popupWindow" of type IWDWindow.
Context(Top level)
--popupWindow(attribute)
create a method in your component controller for showing the popup
public void showPopup(){
IWDWindowInfo windowInfo =
(IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("AddressbookWindow");
IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
window.setWindowPosition (300, 150);
window.show();
wdContext.currentContextElement().setpopupWindow(window);
}
Similarly create one more method in your component controller to hide the popup window.
public void hidePopup(){
IWDWindow window = wdContext.currentRootElement().getpopupWindow();
window.hide();
}
Finally in your popup window view there should be some way to close the popup. Assuming it is a button "Close".
In the action handler for the button close call the hidePopup() method of the component controller.
//This is on the popup view controller
public void onActionCloseButtonClicked(){
//close popup window
wdThis.wdGetComponentController().hidePopup();
}
Things to remember
1. You window has to be in the same component. (View can be an interface view from a different component but should be embedded in the newly created window for popup)
2. The window name given in the code should be exactly the same windows name otherwise the windowInfo will be null.
If you follow the above instructions your popup should work fine.
Hope this helps.
Regards,
Sanyev
Hi Swathi,
Have you created the new window as mentioned like " mypopwindow ". without this it will give you null pinter exception.
Or else can you provide us the code you have written so that we can check where you missed something.
Regards
Narendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In the implementation of the action associated with the UI element you can write a code for a popup window where you can code for the action to be performed on the popup.
IWDWindowInfo info=wdComponentAPI.getComponentInfo().findInWindows("WindowName");
IWDWindow pop1=wdComponentAPI.getWindowManager().createNonModalExternalWindow("http://www.google.com","google");
pop1.setWindowSize(512,600);
pop1.setWindowPosition(50,100);
pop1.show();
Here WindowName is the name of the window other than your main window.
Something similar to this can be worked out.
Regards.
Rajat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.