cancel
Showing results for 
Search instead for 
Did you mean: 

Tree UI Element: Disabling the expanding property in tree

Former Member
0 Kudos

Hi

I'm trying the example of Tree Structure and now trying to disable the expansion property of Tree when there is no file or folder under it. But its not happening? How to go about it ??

And also if i just want to show folders under tree structure & not the files under tree how to do it??

Thanks in advance

Srikant

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi All,

I'm unable to stop the expansion of tree node where there is no file or folder under it.

Can someone help me with it?

Regards

Srikant

Former Member
0 Kudos

D.V.,

What are the settings for TreeNodeType / TreeItemType?

Seems that property "hasChildren" is not handled correctly for TreeNodeType...

VS

Former Member
0 Kudos

Hi Valery,

I'm following the example " Constructing a Recursive and Loadable Web Dynpro Tree". My "TreeNodeType" has properties as mentioned in the project.

My requirement is to stop the expansion of node when it doesn't have child. In this project presently it results in expansion of node and under that "Empty folder" is described. I don't want this to happen.

Valery, I've been through your weblog "Master of Columns" .. its been informative. But how can we implement your project or " Integration of a tree struture in a Web Dynpro Table" so that I can see that in tree structure without using Table?

The code which i've written is as follows:


public void wdDoInit()
  {
    //@@begin wdDoInit()
    addFolderEntries(wdContext.nodeFolderContent(),"Root");
    //@@end
  }

public static void wdDoModifyView(IPrivateFolderStructView wdThis, IPrivateFolderStructView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
  {
    //@@begin wdDoModifyView
    if(firstTime)
    {
    	IWDTreeNodeType treeNode = (IWDTreeNodeType)view.getElement("TheNode");
    	treeNode.mappingOfOnAction().addSourceMapping("path","selectedElement");
    	treeNode.mappingOfOnLoadChildren().addSourceMapping("path","parent");
    }
    //@@end
  }

public void addFolderEntries( com.examples.tree.wdp.IPrivateFolderStructView.IFolderContentNode node, java.lang.String parent )
  {
    //@@begin addFolderEntries()
    IPrivateFolderStructView.IFolderContentElement folderContentElement;
    for(int i=0;i<Tree.getLength();i++)
    {
    	if(parent.equals(Tree.getParent(i)))
    	{
			folderContentElement = node.createFolderContentElement();
    		folderContentElement.setText(Tree.getParent(i));
    		folderContentElement.setHasChildren(true);
    		folderContentElement.setIgnoreAction(false);
    		folderContentElement.setIsExpanded(true);
    		folderContentElement.setIconSource("~sapicons/s_clofol.gif");
    		node.addElement(folderContentElement);
       	}
    	
    }
    //@@end
  }

  //@@begin javadoc:onActionLoad(ServerEvent)
  /** Declared validating event handler. */
  //@@end
  public void onActionLoad(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.examples.tree.wdp.IPrivateFolderStructView.IFolderContentElement parent )
  {
    //@@begin onActionLoad(ServerEvent)
   	 addFolderEntries(parent.nodeSubFolderContent(),parent.getText());
   	
    //@@end
  }

  //@@begin javadoc:onActionSelect(ServerEvent)
  /** Declared validating event handler. */
  //@@end
  public void onActionSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.examples.tree.wdp.IPrivateFolderStructView.IFolderContentElement selectedElement )
  {
    //@@begin onActionSelect(ServerEvent)
    wdContext.currentContextElement().setTextOfSelectedNode(selectedElement.getText());
    //@@end
  }

Can you please guide me this ?

Thanks in advance

Srikant

Former Member
0 Kudos

D.V,

The problem is that call:


folderContentElement.setHasChildren(true);

I'm not familiar with the sameple, but you have to somehow query Tree object <b>in advance</b> about whether or not it has children. As I understand, Tree is your own class, it is not present in tutorial files.

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Hi Valery

The Tree class has an array which has following structure:

TREE[][]={{child1, Root},{child2,child1}...}

Here first element is child and second its parent.

I'm matching the parent with element.getText and trying to get the structure of tree.

My present program shows only "Root" and no child nodes below it. So the code in wdDoInit() runs and nothing else runs.

My question is:

1. How do I make the Action run for the child nodes.

2. How do I use your example to implement a normal tree structure.

Can you please add on where I'm going wrong? How do i make query and how to pass on that ??

Thanks in advance

Srikant

Former Member
0 Kudos

Hi All,

I'm reposting the question as i wasn't able to figure out how to approach to any solution.

I've BAPI which gives output in form of table..I'm accessing the BAPI using java.class. The table has many columns but thru the class file i'm selecting only two columns : CHILD and PARENT. and storing them in an array.

The structure of the class:

TREE[][]= { {parent1, Root},{parent2, Root},{child 1, parent 1} ,{child 2, parent 1},{child 3, child 1} }

public string getChild<i>[0]{return TREE<i>[]}

public string getParent<i>[1]{return TREE<i>[]}

Now i want the this to be in tree structure without having any table or master column.

The Structure I want to get is :

Root----|

-


|Parent 1

-


|Child 1

-


|Child 3

-


|Child 2

-


|Parent 2

For this I've coded as described above.

In the example " Integration of Tree Structure in a Web Dynpro Table"

In the Action handlerevent :


element.nodeChildCatalogEntries(element.nodeChildCatalogEntries, element.getText);
element.setChildrenLoaded(true);

ensures the tree gets expanded in table..

My problem that there is no property called ChildrenLoaded in tree like Master column

So my difficulty is how to implement the expanding of the root folder listing the leaves it has also the expanding to inner most children under each node. if Some one can guide me where i'm going wrong or modify my approach.

Thanks n Regards

Srikant