Gui building questions

GWT Designer allows you to quickly create the modules, composites, panels, remote services and other elements that comprise Google Web Tookit applications.

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

Gui building questions

Postby art » Thu Jun 21, 2007 3:45 pm

Hi,

Having played around with Gwt Designer for a couple of days I have a few more questions.

If I have a public (static) widget in another class and add it to the root panel the design view doesn't show it. The preview pane also doesn't show it, but hosted mode does as expected. Always having coded without visual tools I ask whether this is normal behavior?

Does Designer require all Gui initialization to be done in onModuleLoad? If I have another class (than the entry point class) as delegate for adding widgets to the rootpanel, the only way to show it (correct) in design view looks to be having this class implement EntryPoint (although it isn't really) and do the work in a onModuleLoad method. Is there anotherway of telling Designer where to look?

And (less important, but anyway ;-) the following:

Code: Select all
public void onModuleLoad() {
      RootPanel rootPanel = RootPanel.get();
      Button button = getButton();
                rootPanel.add(button, 10, 200);
   }
   
        public Button getButton() {
                 Button button = new Button("test");
                 button.setWidth("80%");
                 return button;
         }


shows alright in design view, but

Code: Select all
public void onModuleLoad() {
      RootPanel rootPanel = RootPanel.get();
      Button button = getButton();
      button.setWidth("80%");
                button.setText("failed");
                rootPanel.add(button, 10, 200);
   }
   
        public Button getButton() {
                 Button button = new Button("test");
                 return button;
         }


doesn't. Shows neither the width nor the new text.
What's going on here?

Art
art
 
Posts: 7
Joined: Mon Jun 18, 2007 2:54 pm
Location: The Netherlands

Re: Gui building questions

Postby Eric Clayberg » Fri Jun 22, 2007 5:16 am

art wrote:If I have a public (static) widget in another class and add it to the root panel the design view doesn't show it. The preview pane also doesn't show it, but hosted mode does as expected. Always having coded without visual tools I ask whether this is normal behavior?

Yes. GWT Designer parses the code for the class you are editing. It looks for the creation of widgets using standard constructors and displays those widgets in the design view. The tool does not support static factories defined with their own arbitrary API (you are in effect, defining your own GUI API that Designer has no way of understanding).

art wrote:Does Designer require all Gui initialization to be done in onModuleLoad? If I have another class (than the entry point class) as delegate for adding widgets to the rootpanel, the only way to show it (correct) in design view looks to be having this class implement EntryPoint (although it isn't really) and do the work in a onModuleLoad method. Is there another way of telling Designer where to look?

GWT Designer supports editing EntryPoints, Composites, DialogBoxes and PopupPanels. EntryPoints define their contents starting in the onModuleLoad() method while the others start in their constructors. Designer does not support widgets added by some arbitrary non-GUI helper class (again that is equivalent to defining your own GUI API). If you want to define your widgets somewhere other than the onModuleLoad() method, place them in a Composite and then place the Composite in your EntryPoint.

art wrote:And (less important, but anyway ;-) the following:

Code: Select all
public void onModuleLoad() {
   RootPanel rootPanel = RootPanel.get();
   Button button = getButton();
                rootPanel.add(button, 10, 200);
}
   
public Button getButton() {
   Button button = new Button("test");
   button.setWidth("80%");
   return button;
}

shows alright in design view, but

Code: Select all
public void onModuleLoad() {
   RootPanel rootPanel = RootPanel.get();
   Button button = getButton();
   button.setWidth("80%");
   button.setText("failed");
   rootPanel.add(button, 10, 200);
}
   
public Button getButton() {
   Button button = new Button("test");
   return button;
}

doesn't. Shows neither the width nor the new text. What's going on here?

In the above case, Designer was only looking for widget property changes in the same scope in which the widget was created. The latest build should also look in the scope where the button is used.
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

Postby art » Fri Jun 22, 2007 6:16 am

Eric,

Thanks for your prompt info.
Is there a place (except for the forum) I can find detailed information about Designer like you are giving? I mean more detailed than the online manual.

Art
art
 
Posts: 7
Joined: Mon Jun 18, 2007 2:54 pm
Location: The Netherlands

Postby Eric Clayberg » Fri Jun 22, 2007 9:50 am

art wrote:Is there a place (except for the forum) I can find detailed information about Designer like you are giving?

Other than the forum? No.
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 GWT Designer

Who is online

Users browsing this forum: No registered users and 3 guests