Mailingliste - Einträge 2006

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

RE: [qftestJUI] Handling ComboBoxes

  • Subject: RE: [qftestJUI] Handling ComboBoxes
  • From: "Michaelis, Mark" <mark.michaelis@?.com>
  • Date: Tue, 24 Jan 2006 13:54:43 +0100

Hello again,

ok, I found a hack which at least solves my problem for now. But I still
think it is ugly and it should work better. I wrote a module which
currently contains this:

import re
from javax.swing import JList

class ComboBoxProxy:
	"""Proxy for access to JComboBoxes.
    __qftestRc = None
    __component = None
    __dummyJList = JList()
    def __init__(self, qftestRc, component):
        self.__qftestRc = qftestRc
        self.__component = qftestRc.getComponent(component)
    def selectRegexItem(self, item):
        itemCount = self.__component.getItemCount()
        renderer = self.__component.getRenderer()
        for i in range(itemCount):
            comboItem = self.__component.getItemAt(i)
            comboItemComponent =
renderer.getListCellRendererComponent(self.__dummyJList, comboItem, i,
false, false)
            comboItemText = comboItemComponent.getText()
            self.__qftestRc.logMessage("Found combobox-item \"%s\" at index
%d." % (comboItemText, i))
            if (re.match(item, comboItemText)):
        raise UserException("Component matching \"%s\" not found." % (item))

    def selectNumericItem(self, item):
    def selectTextItem(self, item):
        # item = "^%s$" % (item)

    def selectItem(self, item):
        if (item.startswith("@")):
        elif (item.startswith("%")):
        elif (item.startswith("&")):

and then I have a SUT script in combobox.selectItem(comboBox,item):

import swing

proxy = ComboBoxProxy(rc, "$(comboBox)")


> -----Original Message-----
> From: qftestjui-list-bounces@?.de 
> [mailto:qftestjui-list-bounces@?.de] On Behalf Of Michaelis, Mark
> Sent: Tuesday, January 24, 2006 10:21 AM
> To: qftestJUI-list@?.de
> Subject: [qftestJUI] Handling ComboBoxes
> Hello,
> I want to write a procedure to access generic ComboBoxes. Of 
> course one way
> might be to use scripting and access the combobox-component 
> directly. But I
> want to use as much of qftestJUI's default nodes as possible.
> How far I got:
> I have a procedure:
> combobox.selectItem(comboBox,item):
> 	MPRC (1,1) [$(comboBox)=>$(client)]
> 	MPRC (0,0) [$["combo.list%s" % (rc.lookup("item"))]=>$(client)]
> Where combo.list is:
> BasicComboPopup
>  `- JScrollPane
>      `- JList combo.list
> and item is specified as @text or &index.
> For the first try the BasicComboPopup and the ComboBox 
> resided in the same
> window-component. This worked fine. Then I wanted to move the
> combobox.selectItem-procedure to a more generic suite-file. 
> But what to do
> with the BasicComboPopup which still was very 
> window-specific. My idea was
> to have a generic window like a java.awt.Window with nothing 
> else specified
> which contains this BasicComboPopup. I had to extend 
> combobox.selectItem to
> wait for this window...
> May be this would have worked if there won't be two windows 
> open (the one
> where the combobox is in is a modal dialog). But it seems the 
> generic window
> matches the window behind the modal dialog. Thus the 
> BasicComboPopup and
> therefore the combo.list cannot be found.
> Any ideas how I may continue from here? Or nice solitions how 
> to access
> comboboxes?
> Thanks in advance.
> Regards,
> 	Mark

Attachment: smime.p7s
Description: S/MIME cryptographic signature