Checking TreeView if TreeModel contains an tree item with a specified label

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Checking TreeView if TreeModel contains an tree item with a specified label

Gruenewald, Tom-2

Hello,

 

I have a TreeView in which the user can add dynamically tree items. But before adding, I like to check the TreeModel if a tree item with the same label already exists. Regardless if the tree item is visible (expanded) or invisible (not expanded).

 

How can this be done?

 

Best regards,
Tom Grünewald

________

Carl Zeiss Industrielle Messtechnik GmbH
Softwareentwicklung/Software Development

T o m   G r ü n e w a l d

73446 Oberkochen, Germany
tel: +49.7364.20-8541
fax: +49.7364.20-4800
email: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Michael Kaschke
Geschäftsführer: Dr. Rainer Ohnheiser (Vorsitzender), Felix Hoben, Harald Klaiber
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Handelsregister: Amtsgericht Ulm, HRB 501561
USt-IdNr.: DE 811 515 346

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Checking TreeView if TreeModel contains an tree item with a specified label

Maarten Mostert-2
Taken the fact that TreeView takes an AssociationTreeWithParent you can take the root item and then implement something like:

findAtKey: aKey

| nodeOrNil |
self key = aKey
ifTrue: [^self]
ifFalse: 
[nodeOrNil := nil.
self children do: 
[:each |
nodeOrNil := each findAtKey: aKey.
nodeOrNil isNil ifFalse: [^nodeOrNil]].
^nodeOrNil]

Notice that you can make sorts of variants of this method 

Hope this helps.

@+Maarten,


Le 9 juil. 2015 à 15:59, Gruenewald, Tom <[hidden email]> a écrit :

Hello,
 
I have a TreeView in which the user can add dynamically tree items. But before adding, I like to check the TreeModel if a tree item with the same label already exists. Regardless if the tree item is visible (expanded) or invisible (not expanded).
 
How can this be done?
 
Best regards,
Tom Grünewald

________

Carl Zeiss Industrielle Messtechnik GmbH
Softwareentwicklung/Software Development

T o m   G r ü n e w a l d

73446 Oberkochen, Germany
tel: +49.7364.20-8541
fax: +49.7364.20-4800
email: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Michael Kaschke
Geschäftsführer: Dr. Rainer Ohnheiser (Vorsitzender), Felix Hoben, Harald Klaiber
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Handelsregister: Amtsgericht Ulm, HRB 501561
USt-IdNr.: DE 811 515 346
 
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc