Code Generation to a user-defined java operation

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

Code Generation to a user-defined java operation

Postby Luiz Renuncio » Tue Feb 01, 2005 1:53 am

Hi,

is it possible to have the generation of code into a user-defined method (instead of the - default - empty constructor). This would help us using the Swing Designer together with other generators, e.g. for Model-Driven architectures.

Thanks in advance for your help.

Luiz
Luiz Renuncio
 

Re: Code Generation to a user-defined java operation

Postby Eric Clayberg » Sun Feb 06, 2005 5:42 pm

Luiz Renuncio wrote:is it possible to have the generation of code into a user-defined method (instead of the - default - empty constructor). This would help us using the Swing Designer together with other generators, e.g. for Model-Driven architectures.

Using the latest v3.0.1 build, you can generate code into any method you like (just make sure you call it from the constructor).

In fact, you can use any template that you like.
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: Code Generation to a user-defined java operation

Postby Luiz Renuncio » Tue Feb 08, 2005 3:36 am

Hi Eric,

Eric Clayberg wrote:
Luiz Renuncio wrote:is it possible to have the generation of code into a user-defined method (instead of the - default - empty constructor). This would help us using the Swing Designer together with other generators, e.g. for Model-Driven architectures.

Using the latest v3.0.1 build, you can generate code into any method you like (just make sure you call it from the constructor).

In fact, you can use any template that you like.


thanks for your answer. I am very impressed with the flexibility of Swing Designer. However, how do I accomplish this targeted code generation? Where do I inform the code generator that it should use , for instance, initGUI() as target? Is there any documentation about this?

Thanks in advance

Luiz
Luiz Renuncio
 

Re: Code Generation to a user-defined java operation

Postby Eric Clayberg » Tue Feb 08, 2005 8:52 pm

Luiz Renuncio wrote:I am very impressed with the flexibility of Swing Designer. However, how do I accomplish this targeted code generation? Where do I inform the code generator that it should use , for instance, initGUI() as target?

Designer will use whatever template you want to throw at it. To generate code into initGUI(), create a new JFrame, select all of the code after the super() line in the constructor, and use the Extract Method refactoring to move that code to an initGUI() method. Switch to the design view and start adding widgets. They will be placed in the initGUI() method. You can also use the resulting code as a template for any new windows that you create. Note that you can liberally refactor the code at any point, and Designer should still be able to deal with it.
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