Mailing list - Entries of 2006


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

[qftestJUI] Tabs in JTabbedPane with ItemNameResolver


  • Subject: [qftestJUI] Tabs in JTabbedPane with ItemNameResolver
  • From: "Boštjan Praznik" <bostjan.boco@?.si>
  • Date: Tue, 10 Jan 2006 12:06:35 +0100

Hi,

I am new with the qftest and I am trying to recognize single tabs in JTabbedPane
using the ItemNameResolver (see the code bellow). My tabbed pane has three tabs.
I have recorded clicks on each tab before registering the resolver.

After the components (tabs) were recorded I registered my resolver. Now I would
like to get (with resolver) the title or index of the tab which is being
recognized. The source parameter in the getItemName method doesn't give the info
about the tab but the whole JTabbedPane (or am I wrong?).

When item (tab) is being recognized I can see that the getItemName method is
being called as many times as needed to get to the right tab (e.g. if click on
second tab than primary is first 0 and then 1 which is correct) but it loops
twice. Bellow you can find the code and output for the described example.

Thank you in advance,
Bostjan

---------------------------------------------

My resolver:

class ItemResolver(ItemNameResolver):
  def getItemName(self, source, primary, secondary):
    print "source =", source
    print "primary =", primary
    print "secondary =", secondary
    try:
      #I don't know yet what to return so return None
      return None
    except:
      # Error handling: print a Jython stacktrace
      import traceback
      traceback.print_exc()

Output:
source =
JTabbedPane[,0,133,376x197,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=null,alignmentY=null,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
primary = 0
secondary = None

source =
JTabbedPane[,0,133,376x197,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=null,alignmentY=null,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
primary = 1
secondary = None

source =
JTabbedPane[,0,133,376x197,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=null,alignmentY=null,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
primary = 0
secondary = None

source =
JTabbedPane[,0,133,376x197,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=null,alignmentY=null,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
primary = 1
secondary = None

____________________
http://www.email.si/




Videos Downloads Documentation Buy Free Trial