on 02-23-2007 2:03 PM
Hi All,
I'm struggling with creating a navigation link between a dynamically generated outbound plug and an existing inbound plug of an interface view in another DC.
I get a NullPointerException on the createNavigationTarget statement:
// generate outbound plug
IWDOutboundPlugInfo outboundPlug = wdThis.wdGetAPI().getViewInfo()
.createOutboundPlug();
// get reference to inbound plug
IWDInboundPlugInfo inboundPlug = wdThis.wdGetMIMENUController()
.wdGetAPI().getComponentInfo()
.findInComponentUsages("myUsedComponent")
.getUsedComponent().findInInterfaceViews("MainWindowInterfaceView")
.findInInboundPlugs("Default");
// get reference to target view
IWDViewUsageInfo targetView = wdThis.wdGetMIMENUController().wdGetAPI()
.getComponentInfo()
.findInComponentUsages("myUsedComponent")
.getUsedComponent().findInInterfaceViews("MainWindowInterfaceView")
.getImplementationWindow().getDefaultRootViewUsage();
// link outbound plug to inbound plug "default" of used DC
wdThis.wdGetAPI().getComponent().getComponentInfo()
.findInWindows("MainWindow")
.getViewUsageByID("TreeMenu")
.createNavigationTarget(outboundPlug.getName(), targetView, inboundPlug.getName());
// fire outbound plug
wdThis.wdGetAPI().firePlug(outboundPlug, new HashMap());
I tried to debug and looks like all three parameters of createNavigationTarget are good. Is there a problem with this method? Or my code?
Please let me know if I'm missing anything.
Regards,
Roman D.
Hi Roman
In the Web Dynpro explorer, under the window node,select the view "TreeMenu" under the window "MainWindow". In the properties tab enter the id of the window as "TreeMenu" (This id must be missing).
Hope this helps.
kk.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hallo Roman,
what's exactly your use case, or why do you have to create plugs and navigation links dynamically? Perhaps there is a more simple static solution for your problem.
Best regards, Bertram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Bertram,
I am adding component usages at runtime, followed by creating a link to Interface Views of those components. Since I don't know which components will become "Used DCs" at runtime, I have to create the outbound plug and links between that outbound plug and the inbound plug of Interface View at runtime.
Possibly, the problem is that my "launcher" view is embedded into a View Container of another "wrapper" view. May be Interface Views have to be embedded into that View Container prior to creating a dynamic link?
There are so many things that could go wrong here...
Thanks,
Roman
Split the following line into multiple lines to find out exact error location.
wdThis.wdGetAPI().getComponent().getComponentInfo()
.findInWindows("MainWindow")
.getViewUsageByID("TreeMenu")
.createNavigationTarget(outboundPlug.getName(), targetView, inboundPlug.getName());
IWDWindowInfo winInfo=
wdThis.wdGetAPI().getComponent().getComponentInfo()
.findInWindows("MainWindow");
IWDViewUsageInfo viewUsageInfo= winInfo.getViewUsageByID("TreeMenu");
viewUsageInfo.createNavigationTarget(outboundPlug.getName(), targetView, inboundPlug.getName());
The error may be due to wrong Window ID or the view might not have been embeded in the window.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your replies. I was able to get past this, but now running into another issue:
java.lang.NullPointerException: Can't set a relation role because o==null and the role cardinality is 1.
I think this has something to do with a missing plug. There is <a href="https://forums.sdn.sap.com/click.jspa?searchID=1348322&messageID=1270402">one post</a> on SDN that mentions it, but there wasn't enough info to solve the error.
When I debug, all four objects involved (targetView, sourceView, outboundPlug, and inboundPlug) appear to be correct.
Any ideas what else could go wrong?
Thanks in advance!
Is your Used DC created automatically or manually?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.