cancel
Showing results for 
Search instead for 
Did you mean: 

Need to find out level for tree

Former Member
0 Kudos

Hi

I have populated a Tree . Need to know which level the particular element is in.

Hope I am clear

for ex I have a tree

Continent

North America

USA

Canada

Europe

London

France

I need to know that North America, Europe is in 2nd Level and USA,CANADA,LONDON,FRANCE are in 3rd level.

is there a way to know.

Thank you

Regards

Krishna Kanth

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If you have a recursive context structure, you can climb up using the IWDNode.getParentElement() API until you reach the root node of the tree.

If you have a non-recursive context structure like


Continents
-- Countries
---- Cities

you can just check the type of node element to find out where you are, e.g.


IWDNodeElement selectedTreeNode = dataSourceNode.getTreeSelection();
if (selectedTreeNode instanceof ICountriesElement)
{
  /* a country is selected */
}

Armin

Former Member
0 Kudos

Hi Armin

Thank you For the Answer.

My Problem is I have a Folder-File Structure like

--Folder1

--- Folder 2

-


File2

-


Folder3

-


File3

File1

So Instead of Using Tree UI Element in Webdynpro. I am trying to show Folders as text View Element and Files as Link to Action.

So I need to know that File 3 in above example happens to be at 4th Level and File2 and Folder3 are in 3rd Level. So that I can adjust the spacing .

Could you please advice.

Thank you

Regards

Krishna kanth

Edited by: siddi siddi on May 14, 2008 4:37 PM

Edited by: siddi siddi on May 14, 2008 4:41 PM

Former Member
0 Kudos

You could use a Tree and ignore or disable the action for folder nodes.

Armin

Former Member
0 Kudos

Hi Armin

With the requirement the Tree UI Element is not giving satisfying Look and feel and I need to

develop those text views and Link to Actions.

I am not doing anything on action of folder and all. I have already developed tree and all.

The Thing is I am building my UI Controls in a recursive function. So I need to know at what level the particular element is being placed so that I can adjust the padding left accordingly.

Thank you

Regards

Krishna Kanth

Former Member
0 Kudos

Hi,

Why not use the treeinaTable[TreeByNesting] UI element.

Regards,

Ayyapparaj

Former Member
0 Kudos

If you already have a recursive method, then you can just add a parameter level of type int that contains the recursion depth.

Armin

Former Member
0 Kudos

Hi Armin

Thank you . That solved my problem.

Just Curious to know . I need to try anyway .. Is there any standard way to covert a tree structure to a flat file.

I was hoping some kind of API.

Anyway Thank you for your help

Regards

Krishna kanth

Former Member
0 Kudos

Which tree, the context data?

Armin

Answers (0)