Visual Inheritance across modules

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

Visual Inheritance across modules

Postby czuser » Fri Jun 08, 2007 3:30 am

There are many things that make me like GWT Designer. Visual inheritance is on the top of the list. Now I have a problem. I want to pack some of the base composite into a base module and jar them to be used by other module to extend them from. I run into Designer exceptions/errors when the widgets in base composites get exposed. But it seems to be erratic. I can get it 80% of the time. In the following example, I get the error when the menuBar is exposed. Two composites need to be in different modules, the the sub module extends the base module. The sub module runs fine in the host mode. I have GWT Designer 1.7.2. Thanks.

Colin

Base Composite:

public class TestBase extends Composite {

private MenuBar menuBar;
private VerticalPanel verticalPanel_1;
public TestBase() {

{
final VerticalPanel verticalPanel = new VerticalPanel();
initWidget(verticalPanel);
verticalPanel.setWidth("100%");



verticalPanel_1 = new VerticalPanel();
verticalPanel.add(verticalPanel_1);
verticalPanel_1.setStyleName("bps_bordered_panel");
verticalPanel_1.setWidth("100%");

{
menuBar = new MenuBar();
verticalPanel_1.add(menuBar);

final MenuBar menuBar_1 = new MenuBar(true);

menuBar_1.addItem("Menu Item", (Command)null);

menuBar.addItem("Menu Item", menuBar_1);
}
}
}
public VerticalPanel getVerticalPanel_1() {
return verticalPanel_1;
}
public MenuBar getMenuBar() {
return menuBar;
}


}


and the sub composite:

package com.bps.iaproduct.app.client;

import com.bps.baseapp.client.TestBase;
import com.google.gwt.user.client.ui.Composite;

public class ProductComp extends TestBase {

public ProductComp() {
super();

}

}

and the error message from the log:

eclipse.buildId=M20070212-1330
java.version=1.6.0-oem
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -os win32 -ws win32 -arch x86

Error
Fri Jun 08 07:24:05 EDT 2007
Designer internal error [6.3.1.20070607150148]: com.swtdesigner.properties.PropertyException: org.apache.commons.lang.exception.NestableError: java.lang.ClassCastException: org.eclipse.jdt.core.dom.TypeDeclaration cannot be cast to org.eclipse.jdt.core.dom.ClassInstanceCreation

org.apache.commons.lang.exception.NestableError: com.swtdesigner.properties.PropertyException: org.apache.commons.lang.exception.NestableError: java.lang.ClassCastException: org.eclipse.jdt.core.dom.TypeDeclaration cannot be cast to org.eclipse.jdt.core.dom.ClassInstanceCreation
at com.swtdesigner.model.swing.properties.custom.DesignTimeHelper.execute(DesignTimeHelper.java:56)
at com.swtdesigner.model.JavaInfo.notifyPropertyChanged(JavaInfo.java:5567)
at com.swtdesigner.model.JavaInfo.notifyPropertyChanged(JavaInfo.java:5549)
at com.swtdesigner.gef.common.property.DesignerEditorPropertyComposite.handleRootNodeSelected(DesignerEditorPropertyComposite.java:662)
at com.swtdesigner.gef.common.property.DesignerEditorPropertyComposite.updatePropertyComposite(DesignerEditorPropertyComposite.java:865)
at com.swtdesigner.gef.DesignerEditor.parseCompilationUnit(DesignerEditor.java:1153)
at com.swtdesigner.gef.DesignerEditor$21.run(DesignerEditor.java:1565)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3325)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: com.swtdesigner.properties.PropertyException: org.apache.commons.lang.exception.NestableError: java.lang.ClassCastException: org.eclipse.jdt.core.dom.TypeDeclaration cannot be cast to org.eclipse.jdt.core.dom.ClassInstanceCreation
at com.swtdesigner.gwt.model.widgets.panel.ThisCompositeInfo.createGUIComponent(ThisCompositeInfo.java:182)
at com.swtdesigner.model.JavaInfo$19.execute(JavaInfo.java:5572)
at com.swtdesigner.model.swing.properties.custom.DesignTimeHelper.execute(DesignTimeHelper.java:54)
... 28 more
Caused by: org.apache.commons.lang.exception.NestableError: java.lang.ClassCastException: org.eclipse.jdt.core.dom.TypeDeclaration cannot be cast to org.eclipse.jdt.core.dom.ClassInstanceCreation
at com.swtdesigner.gwt.model.widgets.menu.MenuInfo$1.createInstance(MenuInfo.java:69)
at com.swtdesigner.gwt.model.widgets.menu.MenuObjectInfo.createWidget(MenuObjectInfo.java:60)
at com.swtdesigner.gwt.model.widgets.panel.AbstractContainerInfo.createChildrenWidgets(AbstractContainerInfo.java:194)
at com.swtdesigner.gwt.model.widgets.panel.AbstractContainerInfo.createWidget(AbstractContainerInfo.java:175)
at com.swtdesigner.gwt.model.widgets.panel.AbstractContainerInfo.createChildrenWidgets(AbstractContainerInfo.java:194)
at com.swtdesigner.gwt.model.widgets.panel.AbstractContainerInfo.createWidget(AbstractContainerInfo.java:175)
at com.swtdesigner.gwt.model.widgets.panel.ThisCompositeInfo.createWidget(ThisCompositeInfo.java:187)
at com.swtdesigner.gwt.model.widgets.panel.ThisCompositeInfo.createGUIComponent(ThisCompositeInfo.java:179)
... 30 more
Caused by: java.lang.ClassCastException: org.eclipse.jdt.core.dom.TypeDeclaration cannot be cast to org.eclipse.jdt.core.dom.ClassInstanceCreation
at com.swtdesigner.gwt.model.widgets.menu.MenuInfo.createMenu(MenuInfo.java:272)
at com.swtdesigner.gwt.model.widgets.menu.MenuInfo.access$1(MenuInfo.java:270)
at com.swtdesigner.gwt.model.widgets.menu.MenuInfo$1.createInstance(MenuInfo.java:61)
... 37 more
czuser
 
Posts: 5
Joined: Thu Jun 07, 2007 4:24 pm

Re: Visual Inheritance across modules

Postby Eric Clayberg » Fri Jun 08, 2007 11:18 am

This has nothing to do with different modules. It was just a simple problem with menubars.

Please try it again in the latest build.
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: Visual Inheritance across modules

Postby czuser » Thu Jun 28, 2007 4:14 am

Eric:

Although the 6/8/07 build fixed the simple example above, it still has problems with the menubars in code with a bit more layout structure.

Base composite:


public class BaseAppComp extends Composite {
private MenuBar menuBar;
private VerticalPanel headerVerticalPanel;
private FlexTable bannerTable;
private VerticalPanel mainVerticalPanel;
private Composite displayingComp;
private String loginMessage;

public BaseAppComp() {

mainVerticalPanel = new VerticalPanel();
initWidget(mainVerticalPanel);
mainVerticalPanel.setWidth("100%");


headerVerticalPanel = new VerticalPanel();
mainVerticalPanel.add(headerVerticalPanel);
headerVerticalPanel.setWidth("100%");
headerVerticalPanel.setStyleName("bps_bordered_panel");

bannerTable = new FlexTable();
headerVerticalPanel.add(bannerTable);
bannerTable.setStyleName("bps-banner");
bannerTable.setWidth("100%");

final HTML bpsHTML = new HTML("New <i>HTML</i> panel");
bannerTable.setWidget(0, 0, bpsHTML);
bpsHTML.setStyleName("bps-large-banner-title");
bannerTable.getCellFormatter().setWidth(0, 0, "100%");
bpsHTML.setText("My Application");

{
menuBar = new MenuBar();
mainVerticalPanel.add(menuBar);
}


}
}

and Sub composite:

import com.bps.baseapp.client.BaseAppComp;

public class AppMainComp extends BaseAppComp {

public AppMainComp() {
super();
}

}

and the exception log when I switch to the designer view:


!ENTRY com.swtdesigner 4 4 2007-06-28 08:18:15.111
!MESSAGE Designer internal error [6.3.1.20070608102658]: org.eclipse.jdt.core.dom.TypeDeclaration cannot be cast to org.eclipse.jdt.core.dom.Expression
!STACK 0
java.lang.ClassCastException: org.eclipse.jdt.core.dom.TypeDeclaration cannot be cast to org.eclipse.jdt.core.dom.Expression
at com.swtdesigner.gwt.model.widgets.menu.MenuObjectInfo.findParentAssociation(MenuObjectInfo.java:77)
at com.swtdesigner.model.JavaInfo.findParentAssociation(JavaInfo.java:4694)
at com.swtdesigner.model.parser.JavaInfoParser$2.compare(JavaInfoParser.java:654)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)
at java.util.Collections.sort(Unknown Source)
at com.swtdesigner.model.parser.JavaInfoParser.fixOrderOfChildrenAfterParse(JavaInfoParser.java:638)
at com.swtdesigner.model.parser.JavaInfoParser.fixOrderOfChildrenAfterParse(JavaInfoParser.java:694)
at com.swtdesigner.model.parser.JavaInfoParser.getRootNodes(JavaInfoParser.java:591)
at com.swtdesigner.gef.DesignerEditor.parseCompilationUnit(DesignerEditor.java:1129)
at com.swtdesigner.gef.DesignerEditor$17.execute(DesignerEditor.java:1062)
at com.swtdesigner.model.swing.properties.custom.DesignTimeHelper.execute(DesignTimeHelper.java:54)
at com.swtdesigner.gef.DesignerEditor.handleActivate(DesignerEditor.java:1056)
at com.swtdesigner.gef.DesignerEditor.handleActivate(DesignerEditor.java:1050)
at com.swtdesigner.editors.MultiPageEditor.showDesignEditor(MultiPageEditor.java:413)
at com.swtdesigner.editors.MultiPageEditor$2.widgetSelected(MultiPageEditor.java:183)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:709)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3171)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1953)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:288)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)


Eric Clayberg wrote:This has nothing to do with different modules. It was just a simple problem with menubars.

Please try it again in the latest build.
czuser
 
Posts: 5
Joined: Thu Jun 07, 2007 4:24 pm

Re: Visual Inheritance across modules

Postby Eric Clayberg » Thu Jun 28, 2007 12:13 pm

czuser wrote:Although the 6/8/07 build fixed the simple example above, it still has problems with the menubars in code with a bit more layout structure.

Why not try the latest build?

We tried your example and it seemed to work fine on our end.
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: Visual Inheritance across modules

Postby czuser » Fri Jun 29, 2007 3:17 am

Sorry, the menuBar needs to be exposed to get this error. I forget to include the following in the base class:



public MenuBar getMenuBar() {
return menuBar;
}

It happens with the latest build. Here is the new error log:


!ENTRY com.swtdesigner 4 4 2007-06-29 07:22:24.605
!MESSAGE Designer internal error [6.3.1.20070628234415]: org.eclipse.jdt.core.dom.TypeDeclaration cannot be cast to org.eclipse.jdt.core.dom.Expression
!STACK 0
java.lang.ClassCastException: org.eclipse.jdt.core.dom.TypeDeclaration cannot be cast to org.eclipse.jdt.core.dom.Expression
at com.swtdesigner.gwt.model.widgets.menu.MenuObjectInfo.findParentAssociation(MenuObjectInfo.java:77)
at com.swtdesigner.model.JavaInfo.findParentAssociation(JavaInfo.java:4694)
at com.swtdesigner.model.parser.JavaInfoParser$2.compare(JavaInfoParser.java:654)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)
at java.util.Collections.sort(Unknown Source)
at com.swtdesigner.model.parser.JavaInfoParser.fixOrderOfChildrenAfterParse(JavaInfoParser.java:638)
at com.swtdesigner.model.parser.JavaInfoParser.fixOrderOfChildrenAfterParse(JavaInfoParser.java:694)
at com.swtdesigner.model.parser.JavaInfoParser.getRootNodes(JavaInfoParser.java:591)
at com.swtdesigner.gef.DesignerEditor.parseCompilationUnit(DesignerEditor.java:1133)
at com.swtdesigner.gef.DesignerEditor$17.execute(DesignerEditor.java:1066)
at com.swtdesigner.model.swing.properties.custom.DesignTimeHelper.execute(DesignTimeHelper.java:54)
at com.swtdesigner.gef.DesignerEditor.handleActivate(DesignerEditor.java:1060)
at com.swtdesigner.gef.DesignerEditor.handleActivate(DesignerEditor.java:1054)
at com.swtdesigner.editors.MultiPageEditor.showDesignEditor(MultiPageEditor.java:413)
at com.swtdesigner.editors.MultiPageEditor$2.widgetSelected(MultiPageEditor.java:183)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:709)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3171)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1953)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:288)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)


Eric Clayberg wrote:
czuser wrote:Although the 6/8/07 build fixed the simple example above, it still has problems with the menubars in code with a bit more layout structure.

Why not try the latest build?

We tried your example and it seemed to work fine on our end.
czuser
 
Posts: 5
Joined: Thu Jun 07, 2007 4:24 pm

Re: Visual Inheritance across modules

Postby Eric Clayberg » Sat Jun 30, 2007 8:55 am

We have tried your example as presented above on a couple of different machines and it has worked fine on all of them. Based on that, I assume that something more subtle is going on.

Please send your test project to wb-support@instantiations.com so that we can try to reproduce the issue using your exact code.
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