cancel
Showing results for 
Search instead for 
Did you mean: 

Tree UI Element

former_member193726
Active Participant
0 Kudos

Hi All,

This question is for those who have worked on the Tree UI Element.

My requirement is, I have a node and three children under them.

For Example:

Transport

|_Car

|_Bus

|_Taxi

I have to make one among the chidren highlighted and the rest should be asusual. I changed the design option of the TreeNodeType to "EMPHAZISED". It highlighted the node and all the three children under it.

I want only one child to get highlighted.

If anyone can help, I would appreciate.

Regards,

Rekha Malavathu.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member193726
Active Participant
0 Kudos

Hi Armin,

I solved the problem. I wasnt clear that we could choose the TreeNodeDesign through the dictionary rather than the Java type. That was the problem.

I am sure that you were under the impression that Rekha knows where the TreeNodeDesign class is! Sorry for the trouble caused.

I am giving you 6 points for the reply.

Thanx a lot and appreciate you taking time to solve the issue.

Regards,

Rekha Malavathu

Former Member
0 Kudos

Yes, I probably assumed that you know about the TreeNodeDesign class: At designtime, you have to choose the DDIC simple type from com.sap.ide.webdynpro.uielementdefinitions, at runtime the WDTreeNodeDesign class.

The singleton=false is needed if your tree root node is inside some other context node.

Armin

former_member193726
Active Participant
0 Kudos

Hi Armin,

Thanx a lot for your reply.

I have few concerns over here. I assume that we wont be able to set the root node (i.e : Vehicle) with singleton parameter value set to false. By default it will be true and we wont be able to change it.

Binding:

Tree.dataSource = Vehicles
TreeItemType.dataSource = Vehicles
TreeItemType.text = Vehicles.Name
TreeItemType.design = Vehicles.Design

While binding the value for design attribute, it asks for a class called TreeNodeDesign whereas we will be able to select only WDTreeNodeDesign class. Its not compatible and doesnt allow us to bind the same.

So I am stuck here and unable to proceed further.

Let me know if my understanding is wrong or you may try it in your system and let me know the process.

Regards,

Rekha Malavathu

Former Member
0 Kudos

Assuming the following context structure:

Vehicle (node, cardinality 0:N, singleton=false)
- Name (attribute, string)

Create data like this:

String[] vehicles = { "Car", "Bus", "Taxi" };
for (int ix = 0; ix < vehicles.length; ++ix)
{
  IVehicleElement vehicle = wdContext.nodeVehicle().createAndAddVehicleElement();
  vehicle.setName(vehicles[ix]);
}

Binding:

Tree.dataSource = Vehicle
TreeItemType.dataSource = Vehicle
TreeItemType.text = Vehicle.Name
TreeItemType.design = Vehicle.Design

Now your tree should display the 3 items.

To set item #1 (=Bus) to emphasized, set the attribute in the node element at index 1:

wdContext.nodeVehicles().getVehiclesElementAt(1).setDesign(WDTreeNodeDesign.EMPHASIZED);

Armin