2018 up to now | 2017 | 2016 | 2015 | 2014 | 2013 | 2012

Mailing List - Entries of 2013


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

Re: [QF-Test] Check the state of the checkbox of a tree node


  • Subject: Re: [QF-Test] Check the state of the checkbox of a tree node
  • From: Joaquin Rodriguez Guerra <Joaquin.RodriguezGuerra@?.int>
  • Date: Thu, 11 Jul 2013 10:21:15 +0200

Thank you very much Greg, I was able to make it work with your instructions using both techniques.
Just mention a typo, it should be tree.getPathForRow instead of tree.getPathForNode (at least in my case)

Cheers,
Joaquín

-----Original Message-----
From: Gregor Schmid [mailto:Gregor.Schmid@?.de]
Sent: Tuesday, July 09, 2013 6:40 PM
To: qftest-list@?.de
Cc: Joaquin Rodriguez Guerra
Subject: Re: [QF-Test] Check the state of the checkbox of a tree node


Hi Joaquin,

if you record a node image check, the check will always be relative to the node, not to the tree. The target for the check has to be a tree node like

tree@/a/b/c

If you make the index /a/b/c variable, you can apply it to any node.
The check region can be cropped to cover the checkbox only as the position of the checkbox relative to the node is unlikely to change.

At script level, to get the node of a Swing JTree, you need the
following:

# Again, you need the item syntax for your specific node tree, row = rc.getComponent("tree@/a/b/c") # now row is the row index of the target node, convert that to path path = tree.getPathForNode(row) node = path.getLastPathComponent()

Now node is the model object represented by the tree node. It is a custom part of your application. You have to ask development about how to get the checked state, or you can experiment, e.g.

print dir(node)

will print all attributes and methods of the object.

Best regards,
    Greg

Joaquin Rodriguez Guerra <Joaquin.RodriguezGuerra@?.int>
writes:

> Hi,
>
> I have been taking a look at the possibilities you offered me for checking if a node is checked or not in a jtree (each node has a checkbox) and:
>
> - First, the "node image" check seems easier to use, but I don’t see how it can be applied. If I apply the check to the tree, how does it exactly know to what node it has to apply the check? It is not easy to define the "check region inside image" because we don’t know how much expanded the tree is in a certain moment.
>
> - About the SUT script, I was trying to do the following:
>
> 	tree = rc.getComponent("TreeId")
> 	model = tree.getModel()
> 	// now i am not sure how to access the node I want to check,
> 	// from the gui I could invoke:
> 	// qfs.swing.tree.selectNode(id:"treeId",node:"node label", sepatator:"@")
> 	// Shall I iterate over all the leafs to find my node?
>
> And then, once I have the node, how could I check if the checkbox is selected or not? Will the checkbox be accessible from the Component object?
>
> Thanks in adavance!
>
> Cheers,
> Joaquín
>
>
> -----Original Message-----
> From: qftest-list-bounces@?.de [mailto:qftest-list-bounces@?.de]
> On Behalf Of Joaquin Rodriguez Guerra
> Sent: Tuesday, June 25, 2013 3:47 PM
> To: 'Martin Moser'; 'qftest-list@?.de'
> Subject: Re: [QF-Test] Check the state of the checkbox of a tree node
>
> Thanks for the tip Martin!
>
> -----Original Message-----
> From: Martin Moser [mailto:martin.moser@?.de]
> Sent: Tuesday, June 25, 2013 9:45 AM
> To: 'qftest-list@?.de'
> Cc: Joaquin Rodriguez Guerra
> Subject: Re: [QF-Test] Check the state of the checkbox of a tree node
>
> Hi Joaquin,
>
> checkboxes in tree node are a special thing.
>
> In this case you mostly have to access the java object in an SUT script.
>
> Alternatively you can use ''Node image' check and check for a selected image.
>
> Best Regards,
> Martin
>
> --On Montag, Juni 24, 2013 12:01:43 +0200 Joaquin Rodriguez Guerra <Joaquin.RodriguezGuerra@?.int> wrote:
>
>> Hey everyone,
>>
>> I have a swing tree where very node is composed by a checkbox and a label.
>> I am selecting/deselecting the checkboxes in the swing tree by using
>> the swing.tree.selectNode procedure.  Now I would be interested in
>> knowing if the checkbox of a node is selected or not, before
>> selecting the node again. Is there an easy way to do this? I tried to
>> record the action to get the Checkbox id, but it seems like it only
>> sees a click on a tree node.
>>
>> Thanks in advance!
>> Cheers,
>> Joaquín
>>
>>
>> _______________________________________________
>> qftest-list mailing list
>> qftest-list@?.de
>> http://www.qfs.de/mailman/listinfo/qftest-list

--
Gregor Schmid                                Gregor.Schmid@?.de
Quality First Software GmbH                     http://www.qfs.de
Tulpenstr. 41                               Tel: +49 8171 38648-0
DE-82538 Geretsried                         Fax: +49 8171 3864816
GF: Gregor Schmid, Karlheinz Kellerer          HRB München 140833