The mailing list has been closed since July 2022, but continues to serve as an archive of information about QF-Test.
If you want to stay informed about news about QF-Test, you can simply subscribe to our newsletter:
Subscribe to Newsletter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [QF-Test] Problem with cast in Groovy script
It does not work. If I remove the import and the cast it cannot recognize my class: " Script: 16: unable to resolve class Device @ line 16, column 12. Device currentListItem = dgpsList.getModel().getElementAt(i) " All the other tests I made with or without import and cast lead to the class cast exception shown before... -----Original Message----- From: Gregor Schmid [mailto:Gregor.Schmid@?.de] Sent: jeudi 3 janvier 2013 17:18 To: qftest-list@?.de Cc: MEVEL Clement Subject: Re: [QF-Test] Problem with cast in Groovy script Hi Clement, looks like it's the same class, but from a different ClassLoader. In Groovy - as in Jython - there's typically no need to cast, it's all based on reflection anyway. Simply remove the import for the Device class and the cast and you should be fine. Best regards, Greg MEVEL Clement <Clement.MEVEL@?.com> writes: > Hi all, > > In a JList of a GUI there are complex objects and there is a renderer > set to display a readable name. > > I am trying in a Groovy script to retrieve the elements of a combo box > to get their data for using them. > > Here is a part of the script: > > " > > import javax.swing.JComboBox > > import javax.swing.JList > > import sercel.spn.surveycontrol.gui.model.observations.Device > > (.) > > list = rc.getComponent("GenericList") > > nbListItems = list.getModel().getSize() > > for (i in 0..<nbListItems){ > > currentListItem = (Device) list.getModel().getElementAt(i) > > rc.println("Name : "+currentListItem.getName()) > > rc.println("Id : "+currentListItem.getId()) > > } > > " > > And here are the error result of execution: > > " > > Cannot cast object > > 'sercel.spn.surveycontrol.gui.model.observations.Device@9f14c3' > > with class > > 'sercel.spn.surveycontrol.gui.model.observations.Device' > > to class > > 'sercel.spn.surveycontrol.gui.model.observations.Device' > > " > > Any idea? > > Best regards > > Clement Mevel -- 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
|
1. Functional cookies
We use functional cookies to ensure the basic functionality of the website.
2. Performance and statistic cookies
We use Matomo for analyzing and optimizing our website. Cookies permit an anonymous collection of information that help us offering you a clear and user-friendly visit of our web pages.
This cookie contains a unique, pseudonymized visitor ID internal to Matomo for recognizing returning visitors.
This cookie is used to track from which website the anonymized user proceeded to our website.
The Matomo session cookie is used to track the visitor's page requests during the session.
is created and should be then directly deleted (used to check whether the visitor’s browser supports cookies).
short lived cookies used to temporarily store data for the visit.
short lived cookies used to temporarily store data for the visit.