Setting values for the attribut "name" (SWING)

Swing Designer allows you to quickly create the frames, panels, dialogs, applets and other UI elements that comprise Java Swing applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Setting values for the attribut "name" (SWING)

Postby irents » Mon Mar 30, 2009 5:31 am

Hi all,
we are using QF-Test for testing our SWING GUIs.

The QF-Test requires that all SWING-widgets have different values assigned to the attribute "name"
(at least on the same hierarchy level).

By default, WindowBuilderPro does not set a value for the attribute "name", i.e., if the user has not set a value for the attribute "name" (in the property editor) its value remains unassigned.

It is quite annoying to ensure each time when a widget is added that a value has been assigned to its name attribute.

Is there another way of assigning a value to a name attribute of each widget?

In short, we need that the line
addButton.setName("addButton");
be generated automatically (for example, when the widget containing the button is saved):

private JButton addButton;

protected JButton getAddButton() {
if (addButton == null) {
addButton = new JButton();
...
addButton.setName("addButton");
}
return addButton;
}

Best regards,
Igor Rentts
irents
 
Posts: 4
Joined: Sat Jan 14, 2006 5:07 pm

Re: Setting values for the attribut "name" (SWING)

Postby Eric Clayberg » Mon Mar 30, 2009 8:24 am

I would suggest turning on either the "Remember variable name in component" (Swing Designer v7.0) or the "Set variable name in widget data" (Swing Designer v6.x) preference...

Image Image
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Setting values for the attribut "name" (SWING)

Postby mkornatzki » Tue Mar 31, 2009 5:54 am

hi,
i have the same requirement but if i check "Set variable name in widget dats" in Designer 6.9 the name will not be set :(
in my opinion the online-help is not sufficient. mybe you can give some examples of the effects.

regards,
michael
mkornatzki
 
Posts: 121
Joined: Wed Oct 15, 2008 3:57 am

Re: Setting values for the attribut "name" (SWING)

Postby Eric Clayberg » Thu Apr 02, 2009 4:54 am

Give this a try in the latest v6.9.1 build or in v7.0.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Setting values for the attribut "name" (SWING)

Postby mkornatzki » Thu Apr 02, 2009 9:50 pm

hi, it works in 6.9.1 :)

Are there other changes in 6.9.1?
The changelog is only for 6.9.0.

regards,
michael
mkornatzki
 
Posts: 121
Joined: Wed Oct 15, 2008 3:57 am

Re: Setting values for the attribut "name" (SWING)

Postby Eric Clayberg » Fri Apr 03, 2009 9:30 am

mkornatzki wrote:Are there other changes in 6.9.1?

Minor bug fixes. Major development is being done in v7.0.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to Swing Designer

Who is online

Users browsing this forum: Google [Bot] and 1 guest