Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Using treeview for objects and hierarchies
Topic Summary:
Created On: 12-Aug-2003 13:53
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Michael Sutherland, on Thursday, August 14, 2003 2:44 PM

Answer:
Daniel,

(1) You need to insert the parent nodes of "one/two/three" before inserting node "one/two/three"
(2) You need to run insertNodes(), not use it in the set() function. The way you are using set(), the list will be populated every time the list is activated.
(3) You need to run insertNodes() after the call to realize()

See the attached code for a corrected example.
 13-Aug-2003 01:54
User is offline View Users Profile Print this message


Michael Sutherland

Posts: 248
Joined: 13-Sep-2002

Daniel,

You can populate a treeView with anything you want. You just have to understand that the "depth" of each node in the tree is controlled by how many "/" characters are in the string used to populate the node.

For example, inserting "one/two/three" will insert a node "three" that is a child of "two" that is a child of "one", or a node of depth three.

You also need to insert the nodes in the order you wish to see them.

Usually, I keep a skip list with the full path as the string key, so you can keep track of the mapping between the paths in your treeView, and the data items they represent (Objects, etc.)

If you want to build a representation of the Object Hierarchy in a DOORS Module, loop throught the Objects and build a unique path for each Object, making sure no "/" characters appear in the path other than those which will represent the path level separators.

-------------------------
Michael Sutherland
michael@galactic-solutions.com
http://galactic-solutions.com
Report this to a Moderator Report this to a Moderator
 14-Aug-2003 00:20
User is offline View Users Profile Print this message


Michael Sutherland

Posts: 248
Joined: 13-Sep-2002

Answer Answer
Daniel,

(1) You need to insert the parent nodes of "one/two/three" before inserting node "one/two/three"
(2) You need to run insertNodes(), not use it in the set() function. The way you are using set(), the list will be populated every time the list is activated.
(3) You need to run insertNodes() after the call to realize()

See the attached code for a corrected example.

-------------------------
Michael Sutherland
michael@galactic-solutions.com
http://galactic-solutions.com
Report this to a Moderator Report this to a Moderator
 8-Jan-2004 18:22
User is offline View Users Profile Print this message


Christian Hansen

Posts: 8
Joined: 8-Jan-2004

I have written some code for expanding and collapsing the nodes in a hierarchy in the object view

Works in 6.0SP1 not tested in 7.0.

I set these up as keyboard shortcuts in a menu specific to our company.

Please refer to the manuals for info on how to do this. It is quite well-documented.

The code is left here as it is. I am not using it now and I will not answer to any questions concerning this code.


-------------------------- DXL code

//Expand Node

/*
Expand Node

*/


int lev,levnxt
Object obj = current
lev = level(obj)
Object trav, chempt
int cemt = 0

for chempt in obj do{
cemt ++
}

if (cemt >0){

Object lst = last(current Module)
bool hit = false
bool show = false
int round = 0

filtering off
refresh current
filtering on


filtering off



for trav in entire(current Module) do{

if (trav == obj){hit = true;accept trav}

if (level(trav) < lev){hit = false}

if (level(trav) == lev and hit == true and trav!= obj){hit = false}
if (hit == true and level(trav) > lev){accept trav}

if (hit == false){reject trav}


}


filtering on
level (0)
refresh current

} //if cemt > 0


-------------------------------------------


//Collapse Node

/*
Collapse Node

*/


int lev,levnxt
Object cur = current
Object obj = parent current

if (!null obj){

lev = level(obj)
Object trav, chempt
int cemt = 0

for chempt in obj do{
cemt ++
}

if (cemt >0){

Object lst = last(current Module)
bool hit = false
bool show = false
int round = 0

filtering off
refresh current
filtering on


filtering off



for trav in entire(current Module) do{

if (trav == obj){hit = true;accept trav}

if (level(trav) < lev){hit = false}

if (level(trav) == lev and hit == true and trav!= obj){hit = false}
if (hit == true and level(trav) > lev){accept trav}

if (hit == false){reject trav}


}


filtering on
level (0)
current = cur
refresh current
} //if cemt > 0


} //if nut null parent


if (null obj){
filtering off
level (1)
refresh current
}



---------------------------------





Edited: 8-Jan-2004 at 18:27 by Christian Hansen
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.