2017 up to now  | 2016 | 2015 | 2014 | 2013 | 2012 | 2011 | 2010 | 2009 | 2008 | 2007

(older archive entries before 2007 are not shown here, but included in the onsite-search)

Mailing List - Entries of 2011


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

Re: [QF-Test] [qftestJUI] header checkbox in a JTable


  • Subject: Re: [QF-Test] [qftestJUI] header checkbox in a JTable
  • From: "Robert Lahmer, QFS support" <support@?.de>
  • Date: Thu, 22 Dec 2011 11:32:59 +0100


Hello Sylvain,

most likely, a JCheckBox resides somewhere in the header's renderer. Please try out the following 'SUT script' to find out programmatically whether it is selected or not:


from javax.swing import JCheckBox

# Adapt the table's Component Id
# and the column's index
table = rc.getComponent("mytable")
colidx = 0
column = table.getColumnModel().getColumn(colidx)
renderer = column.getHeaderRenderer()
value = column.getHeaderValue()
com = renderer.getTableCellRendererComponent(table, value, false, false, -1, colidx)
if isinstance(com, JCheckBox):
   print com.isSelected()
else:
   for c in com.getComponents():
       if isinstance(c, JCheckBox):
           print c.isSelected()
           break


Best regards,
   Robert



--On Mittwoch, Dezember 21, 2011 08:26:12 +0100 RIDOUX Sylvain <sylvain.ridoux@?.com> wrote:

Hi,

I want to check, if a checkbox(in the header of a Jtable)  is selected.
i try "check text" node, it 's ok for a cell, but it does not work for a
checkbox in a header. i can not recover the checkbox with a script in
order to test it state.

do you have any idea ?

Thanks

Sylvain

[@@THALES GROUP RESTRICTED@@]




--
QFS Support - Robert Lahmer
Quality First Software GmbH                http://www.qfs.de
Tulpenstr. 41                         Tel: +49 8171 38648-20
DE-82538 Geretsried                   Fax: +49 8171 38648-16
GF: Gregor Schmid, Karlheinz Kellerer     HRB München 140833