Mailing list - Entries of 2005


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Bastian Bowe <Bastian.Bowe@?.de>
  • Date: Fri, 23 Sep 2005 10:10:46 +0200

Thank you very much Gregor!

Works very good. I had to remove the backquotes on the last jython
statement. result already is a string.

Bastian



<qfs@?.de>
Gesendet von: qftestjui-list-bounces@?.de
22.09.2005 18:11

An
qftestJUI-list@?.de
Kopie
Bastian Bowe <Bastian.Bowe@?.de>
Thema
Re: [qftestJUI] how to get sub element text id of a component







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
_______________________________________________
qftestJUI-list mailing list
qftestJUI-list@?.de
http://www.qfs.de/mailman/listinfo/qftestjui-list




Videos Downloads Documentation Buy Free Trial