Mailing list - Entries of 2005

Re: [qftestJUI] how to get sub element text id of a component

Subject: Re: [qftestJUI] how to get sub element text id of a component

From: Gregor Schmid <Gregor.Schmid@?.de>

Date: Thu, 22 Sep 2005 16:12:02 -0000

Hi Bastian,
this is some tricky stuff. Unfortunately there's no qftestJUI API that
you can call to get the tree path that qftestJUI expects. If you
really need it, you can build the path by fetching the text for each
level in the tree hierarchy as follows:
tree = rc.getComponent("...")
path = tree.getSelectionPath()
result = ""
while path and path.getPathCount() > 0:
name = rc.callProcedure("fetchPathName", {"index": tree.getRowForPath(path)})
result = "/" + name + result
path = path.getParentPath()
rc.setLocal("result", `result`)
The fetchPathName procedure needs to be implemented using a "Fetch
text" node with a flat index (no '/' path separator), i.e.
+ "Fetch text" on Hauptfenster.tree&$(idx) => ret
+ Return $(ret)
Best regards,
Greg
Bastian Bowe <Bastian.Bowe@?.de> writes:
> Hi again,
>
> how to get the sub element text id of a JTree component item? Assume I
> have a selected tree node
> Hauptfenster.tree@foo/bar/baz
> I now want to capture that value (foo/bar/baz) in a variable and want to
> "playback" the selection of that node.
>
> I managed to get the rowid of the selected node using
> myTreeComponent.getSelectionModel().getSelectionRows()[0]. I can't use the
> rowId to jump back to the selected node as there might be some folders
> expanded/folded so the index of my node got changed.
>
> I've read http://www.qfs.de/archive/qftest-list/2004/msg00545.html and
> learned some stuff about JTree and TreePath. FYI our TreePathes don't seem
> to use ordinary Strings for node selection. So it doesn't seem to be any
> help if I retrieve the selected TreePath unless I manage to extract the
> textual information (foo/bar/baz).
>
> Any ideas would be greatly appreciated.
>
> Kind regards
>
> Bastian
--
Gregor Schmid Gregor.Schmid@?.de
Quality First Software GmbH http://www.qfs.de
Tulpenstr. 41 Tel: +49 8171 919870
DE-82538 Geretsried Fax: +49 8171 919876