cancel
Showing results for 
Search instead for 
Did you mean: 

create a link node in tree

Former Member
0 Kudos

Hi all,

I hope someone already worked on this.

I am using TutWD_Tree template to develop my menu.

I changed filesystem.properties file to following.

                                                                                                                        1. Filesystem resources for Web Dynpro Tutorial Tree

##

##########################################################

Menulinks = AboutUs

AboutUs = Corporate Profile;Global locations

####

file system ends here

####

Menu is coming properly.

Now i want to create links to my two nodes.

Example:

When i click on corporate profile it will go to www.test.com/corporate profile and when user clicks on Global locations it will go to www.test.com/Global locations.

Thanks in advance.

Message was edited by: Armin Reichert

Marked topic as a question

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi all,

Where can I download the TutWD_Tree.Zip

Former Member
0 Kudos

Hi,

Please find the help in the API doc.

1. Method createExternalWindow creates a window that contains/displays a Web Dynpro Components window with its view hiearchie. The window type is "external". External means a new browser window besides the current one

2.Method createWindow creates a window that contains/displays a Web Dynpro Components window with its view hiearchie. The window type is "internal". Internal means some clients that will be able to display it above the current view assembly and others will replace the view assemply. Each createWindow corresponds to a destroy on the created window instance: a creation of a new instance of a windowInfo is only possible, if it doesn't exist any other window instance with the same windowInfo (including interface views, which are embedded in other component instances). In 6.30+, this window must be internal and modal

Regards, VIP

Former Member
0 Kudos

Hi everyone

Thanks for the good tips in this thread. I've implemented a quite similiar scenario in where I run into a problem. Maybe one of you can help me. What I have is a tree (the logic is taken from a resource file), that holds nodes and leaves. By clicking on the leaves an action is called, that opens a new external window with an URL to a PDF. The window opens just fine and the PDF will be displayed in it. The problem is when I close the window and get back to the WebDynproApp I get a JavaScript error:

Line: 56
Char: 18
Error: 'childNodes.length' is not null or not an object
Code: 0

I have tried the application on different pc's and on different platforms (XP and Win2k). Thank you for any tips that help to resolve the problem.

Regards, Andreas

Former Member
0 Kudos

hi all,

Thanks for the insightful information Armin.You have said they are planning to make IFrameUI as deprecated.Does it also imply that there might be some other elements which will serve this purpose or we have to solve it in our own ways.Please do share ur expertise in this regae

And for Anjan , its seems like there is no direct solution for ur problem since u neither prefer a window nor a IFrameUI.

Better opt for portal components and use URL iviews.

And please close the discussion when u have decided on a solution .

Regards

Bharathwaj

Former Member
0 Kudos

Can’t we use any java libraries to open link in same window?

(or)

Instead of using createexternalwindow cant we use createwindow?

using createexternalwindow :

IWDWindow i = (IWDWindow)wdComponentAPI.getWindowManager().createExternalWindow(selectedelement.getUrl(),selectedelement.getLinkname(),true);

using createwindow:

IWDWindow i=(IWDWindow)wdComponentAPI.getWindowManager().createWindow(selectedelement.getUrl(),true);

Thanks in advance

Former Member
0 Kudos

hi,,

What do u mean by page.. The IE page rite...! When we create a external window its not possible to obtain it in the old window itself.

For your requirement you have to opt for the IFrameUI.

Guess my code was useful.Dont forget to award points if u find it useful.

Regards

Bharathwaj

Former Member
0 Kudos

hi bharath,

Cant we use createwindow to open the link in same window? I cant use IFrameUI as per our customer requirement.

Former Member
0 Kudos

The problem with IFrame is that its content is reloaded on every server roundtrip. This makes it not very usable (in fact, it will be deprecated in coming Web Dynpro versions).

If you can display the content at the selected URL in a Web Dynpro view, navigate to this view from the action handler.

If not, use an "external" window.

If that's also not possible, you might try to use portal navigation and display the content in another portal Iview.

Armin

Former Member
0 Kudos

Hi ,

You can use data from the properties file but still have to write the code.

First you have to get the data from the resource bundle ..

treeDataElement.setlink(resourceHandlerForQuestions.getString("treedataelement.getlinkname"));

Use the link name as the key and get the corresponding value which is the url and set it to the source of IFrameUI or as a Url value for a external window.

The property file will just ensure that the linkvalue is independent of the code.

Regards

Bharathwaj

Message was edited by: Bharathwaj R

Former Member
0 Kudos

Hi all,

Now i am able to get link on my node .

i am using following code to open the url:

IWDWindow i = (IWDWindow)wdComponentAPI.getWindowManager().createExternalWindow(selectedelement.getUrl(),selectedelement.getLinkname(),true);

i.open();

Now its opening the new window,I want to open the window on the same page.

I tried using createwindow but unable to open in same page.

Any help is appreciated.

Former Member
0 Kudos

hi anjan,

If u find IFrameUI to be tough to work with u can do it in Armin s way..

As Armin has said you can create a external window and say

public void onActiontreelink(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, p.wdp.IPrivatePhasesView.ITreeElement selected )

{

//@@begin onActiontreelink(ServerEvent)

IWDWindow i = (IWDWindow)wdComponentAPI.getWindowManager().createExternalWindow(selected.getUrl(),selected.getText(),true);

i.open();

//@@end

}

where the selected is the argument passed from sourcemapping

IWDTreeNodeType tree = (IWDTreeNodeType)view.getElement("TreeNodeType1");

tree.mappingOfOnAction().addSourceMapping("path","selected");

For IFrameUI...

Create a IframeUI element.Check for a property called source in it. Map this to the context attribute URL of the tree node you have created and do the same i mentioned.

If u find these details as insufficient please do mention.

Do u want me to send u a example project ??

Regards

bharathwaj

Former Member
0 Kudos

Hi bharathwaj ,

Thanks for your reply. Pls send me the example project so that i can refer ur project if i face any problems.

Former Member
0 Kudos

Hi bharathwaj,

Pls send me the example project

Thanks in advance.

Message was edited by: Anjan Sen

Former Member
0 Kudos

Hi bharathwaj,

Pls send me the sample project.

Thanks in advance.

Message was edited by: Anjan Sen

Message was edited by: Anjan Sen

Former Member
0 Kudos

Hi all,

Instead of writing the code in web dynpro, is there any way to add hyperlink data into filesystem.properties file so that without any coding we can acheave the functionality.

filesystem.properties file :

Menulinks = AboutUs

AboutUs = <a href="www.test.com/corporateprofile">Corporate Profile</a>;<a href="www.test.com/globallocation">Global locations</a>

Thanks.

Former Member
0 Kudos

hi Anjan,

I assume you have knowledge about how to get the selected element(using addsourcemapping...)

For the clicked element have a attribute which stores the URL value.

Create a IFrame UI .

On action of the treeitemtype set the Iframe UI proerty SOURCE to the corresponding url attribute value.

so whenever we click a elementh the corresponding url will be displayed in the IFrame we have created

Is this solution fine.Please do indicate if any further clarification is required

regards

Bharathwaj

Former Member
0 Kudos

Hi Bharathwaj ,

Thanks for your reply. Is there any way to create a link node without using IFrame UI ?

I will try this IFrame UI option.

Thanks and regards,

Anjan sen

Former Member
0 Kudos

You cannot embed a LinkToURL element in a tree node, but you can bind an action to the tree node.

In the action handler, you have to determine which tree node triggered the action, or better, which context element provides the data for this node.

How to get this context element?

Define an action parameter "nodeElement" of type IPrivate.IElement.

At runtime, when the action handler is called, Web Dynpro fills this parameter with the node element that belongs to the clicked tree node. This element might also contain the URL value to be navigated.

How to connect the tree node event with the action?

Answer: Use event parameter mapping.

The IWDAbstractTreeNodeType.onAction event has a parameter "path" of type "string". (See Javadoc for method "mappingOfOnAction").

This event parameter has to be mapped to the action handler parameter. To do so, you have to write a line of code in the wdDoModifyView() method, because only there, you can reference UI elements.

wdDoModifyView():


if (firstTime)
{
  // get the tree node type UI element
  IWDAbstractTreeNodeType node = (IWDAbstractTreeNodeType)
    view.getElement("however you called it");
  node.mappingOfOnAction().addSourceMapping(
    "path", // name of event parameter
    "nodeElement" // name of action handler parameter
  );
}

This is also described in detail in Chris Whealy, "Inside Web Dynpro for Java", page 136.

In the action handler, you can get the URL from the "nodeElement" parameter and use one of the IWDWindowManager methods to display the content at this URL in an external window.

Armin

Former Member
0 Kudos

hi,

I am new to web dynpro, this is my first project. Can u give step-by-step instructions how i can develop link node using IFrame UI.

If you already have some code pls share with me.

I created the menu using javascript (embedded through IFrame)and working fine. But we dont want to use IFrame in my application.

Thanks .