Using acronyms for variable-name

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

Using acronyms for variable-name

Postby mkornatzki » Tue Mar 24, 2009 2:15 am

What did i have to do if i want that the designer takes the acronyms of a component instead of the "default name"?

Acronyms are defined in "preferences" - "type specific" (sadly it is not described in the online help at http://download.instantiations.com/Desi ... cific.html - or it is not where i excpect it).

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

Re: Using acronyms for variable-name

Postby Eric Clayberg » Tue Mar 24, 2009 6:39 am

mkornatzki wrote:What did i have to do if i want that the designer takes the acronyms of a component instead of the "default name"?
Acronyms are defined in "preferences" - "type specific" (sadly it is not described in the online help at http://download.instantiations.com/Desi ... cific.html - or it is not where i excpect it).

See Code Generation > Variable Names

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: Using acronyms for variable-name

Postby mkornatzki » Tue Mar 24, 2009 7:51 am

thanks for the info.
maybe i missunderstand something wrong.
* in preferences - variable names - create variable using pattern: i select ${class_acronym}${text} i also tried ${class_acronym}
* i test it witch check "Set variable name in widget date" and uncheck
when i place something like a button on a frame i get the variable: button_<number> and not btn_<number> like my acronym for buttons.

Did i have to do some other settings?

i use SwingDesigner 6.9 and Eclipse 3.3

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

Re: Using acronyms for variable-name

Postby Eric Clayberg » Tue Mar 24, 2009 3:25 pm

The pattern is applied when you set the text a widget. For example, if you label a button "Cancel", its variable name will become "btnCancel".

If you want "btn" to be the default variable nme used for each Button, you need to set the Default Name for the component class...

Image

"Set variable name in widget data" just copies the variable name into the widgets setData() for use with record/playback GUI testing tools.
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: Using acronyms for variable-name

Postby mkornatzki » Wed Mar 25, 2009 4:02 am

thanks. now i've got it.
mkornatzki
 
Posts: 121
Joined: Wed Oct 15, 2008 3:57 am

Re: Using acronyms for variable-name

Postby mkornatzki » Wed Mar 25, 2009 4:27 am

but...not complete.

i change all the "Default names" to something like the acronyms.

Now when i add a button the variable is "btn" :)
But when i change the Text like "Test" the variable didn't change to btnTest :(

I have attached my settings.

thanks,
michael
Attachments
result.png
result.png (8.75 KiB) Viewed 555 times
preferences_variable_names.png
preferences_variable_names.png (25.77 KiB) Viewed 553 times
preferences_type_specific.png
preferences_type_specific.png (28.86 KiB) Viewed 555 times
mkornatzki
 
Posts: 121
Joined: Wed Oct 15, 2008 3:57 am

Re: Using acronyms for variable-name

Postby Eric Clayberg » Wed Mar 25, 2009 6:22 am

Try setting "Use text component variable auto rename" to "Always".
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