A first look and a Problem

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

A first look and a Problem

Postby prasanthe1 » Thu Dec 14, 2006 2:36 am

Hi All ,
I have been using GWT for quite some time for complex UI development. I have used Vista Fei Ide for GWT , now started using evaluation version of GWT designer, A first look at the GWT designer better when compared to Vista Fei, Designer has good additional features for development and during the run time.
:lol: 8) :lol:


In GWT its quite common that developers Create Custom Widgets e.g a Vertical Panel having a Text Box and button. This custom widgets are reused where ever required. Vista Fei did not support the custom widget development. i.e one cannot view the design of the custom widgets and work with it in the design view. SO i need to manually position these widgets in trial and error method. and its a cumbersome process. Losing lots of time in arranging these widgets. but I see the same problem int he GWT designer , though designer gives away option of creating Composite , Dialog Box and Popup Panel. but not with custom widget like Customized Tree , Vertical panel etc

I tried to create a custom widget extending Vertical Panel and tried to open in the Design view,[u] i was not able to open in the design view[/u]. :evil:
It is showing "Unknown type" , this is the code

public class MyPanel extends VerticalPanel {
private Button b = null;
private HTML h = null;
public MyPanel() {
b = new Button("Clickie");
h = new HTML("&nbsp;<b>Name</b>&nbsp;");
initialize();
}
private void initialize() {
this.add(this.h);
this.add(this.b);
}
}

[ To reproduce the problem: Have the following code in MyPanel.java in the GWT application and open the application in GWT designer editor and click on the design view tab in the bottom]

I would like to point this problem as a critical problem as most the developers would have their custom widgets , so its highly important the design view is available for custom widgets . so its very easy to position this custom widgets in the UI screens.

I would recommend GWT Designer dev team to work with this feature as it would be great feature for the GWT developers

let me know if any one need more information on the same.
prasanthe1
 
Posts: 1
Joined: Wed Dec 13, 2006 2:29 am

Re: A first look and a Problem

Postby Eric Clayberg » Thu Dec 14, 2006 5:31 am

prasanthe1 wrote:In GWT its quite common that developers Create Custom Widgets e.g a Vertical Panel having a Text Box and button. This custom widgets are reused where ever required. Vista Fei did not support the custom widget development. i.e one cannot view the design of the custom widgets and work with it in the design view. SO i need to manually position these widgets in trial and error method. and its a cumbersome process. Losing lots of time in arranging these widgets. but I see the same problem in the GWT designer , though designer gives away option of creating Composite , Dialog Box and Popup Panel. but not with custom widget like Customized Tree , Vertical panel etc

As explicitly stated in the Google GWT docs on Creating Custom Widgets, the correct approach to creating a custom widget like you describe is to subclass Composite, not VerticalPanel.

Your Composite subclass should contain a VerticalPanel which, in turn, should hold whatever widgets you would like. Thus, you should rewrite your code like this:

Code: Select all
public class MyComposite extends Composite {
   private VerticalPanel vp = null;
   private Button b = null;
   private HTML  h = null;
   public MyComposite() {
      vp = new VerticalPanel();
      initWidget(vp);
      b = new Button("Clickie");
      h = new HTML("&nbsp;<b>Name</b>&nbsp;");
      initialize();
   }
   private void initialize() {
      vp.add(this.h);
      vp.add(this.b);
   }
}

prasanthe1 wrote:I would like to point this problem as a critical problem as most the developers would have their custom widgets

I disagree. This is not a critical problem as all because we already solve this problem quite effectively with our support for creating and editing custom Composites. We don't want to encourage bad design practice and support direct editing of panel subclasses. Widgets and panels are meant to be treated as atomic objects in the GUI builder. You may place them within the design view (as you can with your MyPanel example), but Designer is not a tool for creating them. If you want to create a custom widget composed of multiple atomic widgets, you should create a subclass of Composite as recommended by the GWT docs.

prasanthe1 wrote:so its highly important the design view is available for custom widgets . so its very easy to position this custom widgets in the UI screens.

Designer already provided excellent support for doing this in the form of custom Composites. Not only can you place and edit widgets within a Composite using any panel type, you can also expose any widget or any widget property as a public property of the Composite. Designer also includes excellent support for visual inheritance so that you can create a hierarchy of custom components that inherit various visual elements from one another.

prasanthe1 wrote:I would recommend GWT Designer dev team to work with this feature as it would be great feature for the GWT developers

We do not plan to add support for directly creating or editing Panel subclasses. Just because you can do something does not mean that you should do something. I would strongly encourage you to create custom widgets as Composite subclasses as recommended by the GWT docs.
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