PDA

View Full Version : [FIXED] Beta2. HtmlEditor does not integrate well with BorderLayout.



Vadim Kirilchuk
30 Jan 2012, 1:55 AM
I tryed to use border layout with splitters and HtmlEditors inside. All looks fine until you try to drag a splitter - HtmlEditors iframes dissapear. (i disabled all splitters, except west, just try to drag it, and editors content will dissapear)

The code is given below:


public class WebMatrixAdmin implements EntryPoint {


@Override
public void onModuleLoad() {
// remove loading image
DOM.getElementById("loadingWrapper").removeFromParent();

RootLayoutPanel rootPanel = RootLayoutPanel.get();
rootPanel.add(createLayout());
rootPanel.forceLayout();
}


private Widget createLayout() {
BorderLayoutContainer superContainer = new BorderLayoutContainer();
com.google.gwt.user.client.Window.enableScrolling(false);


BorderLayoutData northData = new BorderLayoutData(30);
northData.setMargins(new Margins(5));

ContentPanel westPanel = new ContentPanel();
westPanel.setHeaderVisible(false);
BorderLayoutData westData = new BorderLayoutData(200);
westData.setCollapsible(true);
westData.setSplit(true);
westData.setCollapseMini(true);
westData.setMargins(new Margins(0, 5, 0, 5));

ContentPanel centerPanel = new ContentPanel();
centerPanel.setHeaderVisible(false);
MarginData centerData = new MarginData();

ContentPanel southPanel = new ContentPanel();
southPanel.setWidget(createSouth());
BorderLayoutData southData = new BorderLayoutData(200);
southData.setMargins(new Margins(5, 0, 0, 0));

ContentPanel northPanel = new ContentPanel();
northPanel.setHeaderVisible(false);
northPanel.setWidget(createHeader());

superContainer.setNorthWidget(northPanel, northData);
superContainer.setWestWidget(westPanel, westData);
superContainer.setCenterWidget(centerPanel, centerData);
superContainer.setSouthWidget(southPanel, southData);

return superContainer;
}


private Widget createHeader() {
HBoxLayoutContainer container = new HBoxLayoutContainer();
container.setHBoxLayoutAlign(HBoxLayoutAlign.TOP);

Label caption = new Label("WebMatrix");
container.add(caption, new BoxLayoutData(new Margins(5)));

//strut
BoxLayoutData flex = new BoxLayoutData();
flex.setFlex(1);
container.add(new Label(), flex);

BoxLayoutData linkData = new BoxLayoutData(new Margins(5, 10, 0, 0));
Anchor homeLink = new Anchor("Back to Home", GWT.getHostPageBaseURL());
homeLink.setWordWrap(false);
container.add(homeLink, linkData);

ContentPanel lccenter = new ContentPanel();
lccenter.setHeaderVisible(false);
lccenter.add(container);

return lccenter;
}

private Widget createSouth() {
HtmlEditor preconditionsArea = new HtmlEditor();
HtmlEditor actionsArea = new HtmlEditor();
HtmlEditor expectationsArea = new HtmlEditor();


preconditionsArea.setValue("PRECONDITOPNS");
actionsArea.setValue("ACTIONS");
expectationsArea.setValue("EXPECTED");

HBoxLayoutContainer container = new HBoxLayoutContainer();
container.setPadding(new Padding(5));
container.setHBoxLayoutAlign(HBoxLayoutAlign.STRETCH);

BoxLayoutData flex = new BoxLayoutData(new Margins(5));
flex.setFlex(1);
container.add(preconditionsArea, flex);
container.add(actionsArea, flex);
container.add(expectationsArea, flex);

return container;
}
}

Tested on Google Chrome.

Also take a look at bug in the link. It is for GXT 2.0 but looks like symptoms are same.
(http://www.sencha.com/forum/showthread.php?91025-FNR-12-GXT-2.0-HtmlEditor-does-not-integrate-well-with-other-GXT-components)http://www.sencha.com/forum/showthread.php?91025-FNR-12-GXT-2.0-HtmlEditor-does-not-integrate-well-with-other-GXT-components

Thanks.

Vadim Kirilchuk
7 Feb 2012, 6:20 AM
Can someone at least confirm the bug?
Do you need more information about configuration or environment?

Thx.

rohdef
14 Feb 2012, 6:15 AM
Can someone at least confirm the bug?
Do you need more information about configuration or environment?

Thx.
I just tried and cannot confirm that on my system. What I did see though is that it started throwing exceptions when running your code, without ever interacting with it. If I run the code and wait around 50 seconds I get this:


15:10:29.756 [ERROR] [gxt3bugtest] Uncaught exception escaped

com.google.gwt.dev.shell.HostedModeException: Something other than an int was returned from JSNI method '@com.google.gwt.dom.client.Element::getPropertyInt(Ljava/lang/String;)': JS value of type string, expected int
at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:266)
at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:144)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:247)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:75)
at com.google.gwt.dom.client.Element$.getPropertyInt$(Element.java)
at com.google.gwt.user.client.DOM.getElementPropertyInt(DOM.java:793)
at com.google.gwt.user.client.ui.UIObject.getOffsetWidth(UIObject.java:548)
at com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.getWidgetWidth(HBoxLayoutContainer.java:417)
at com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.onOverflow(HBoxLayoutContainer.java:479)
at com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.doLayout(HBoxLayoutContainer.java:400)
at com.sencha.gxt.widget.core.client.container.ResizeContainer.forceLayout(ResizeContainer.java:46)
at com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer$4.execute(HBoxLayoutContainer.java:519)
at com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
at com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:228)
at com.google.gwt.core.client.impl.SchedulerImpl.flushPostEventPumpCommands(SchedulerImpl.java:388)
at com.google.gwt.core.client.impl.SchedulerImpl$Flusher.execute(SchedulerImpl.java:78)
at com.google.gwt.core.client.impl.SchedulerImpl.execute(SchedulerImpl.java:138)
at sun.reflect.GeneratedMethodAccessor77.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Thread.java:662)


A while later I get this:


15:12:37.082 [ERROR] [gxt3bugtest] Uncaught exception escaped

java.lang.IllegalArgumentException: Something other than a Java object was returned from JSNI method '@com.google.gwt.dom.client.DOMImpl::getParentElement(Lcom/google/gwt/dom/client/Node;)': JS value of type number, expected java.lang.Object
at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:178)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:271)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.dom.client.DOMImpl.getParentElement(DOMImpl.java)
at com.google.gwt.dom.client.Node$.getParentElement$(Node.java:190)
at com.sencha.gxt.core.client.dom.XElement$.isVisible$(XElement.java:1385)
at com.sencha.gxt.widget.core.client.Component.isVisible(Component.java:538)
at com.sencha.gxt.widget.core.client.Component.isVisible(Component.java:519)
at com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.doLayout(HBoxLayoutContainer.java:249)
at com.sencha.gxt.widget.core.client.container.ResizeContainer.forceLayout(ResizeContainer.java:46)
at com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer$4.execute(HBoxLayoutContainer.java:519)
at com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
at com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:228)
at com.google.gwt.core.client.impl.SchedulerImpl.flushPostEventPumpCommands(SchedulerImpl.java:388)
at com.google.gwt.core.client.impl.SchedulerImpl$Flusher.execute(SchedulerImpl.java:78)
at com.google.gwt.core.client.impl.SchedulerImpl.execute(SchedulerImpl.java:138)
at sun.reflect.GeneratedMethodAccessor77.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Thread.java:662)


I've previously successfully ran code that did something similar though, but there the exceptions seemed random, so I suspected that somehow some data was lost and it recovered. Now though it seems like they will come every time. Perhaps they are related to why your system just removes the iframes.

Tested on Chrome.

Colin Alworth
21 Feb 2012, 3:18 PM
As luck would have it, there are two different issues in this post.

First, HtmlEditor + BorderLayoutContainer - this has been fixed in SVN, and will be available in the next release. This is the main issue here so I'm going to tag this post as FNR. The basic problem was an issue with how the Draggable used by the SplitBar was covering other components so it wouldn't have issues with issues with moving the mouse over things that normally prevent mouse events from working correctly, like iframes and flash components. As the HtmlEditor is hosted out of an iframe, that iframe was affected. This will occur in all browsers, and is fixed in SVN.

Next, the error that rohdef got while trying to test the issue: "com.google.gwt.dev.shell.HostedModeException: Something other than an int was returned from JSNI method '@com.google.gwt.dom.client.Element::getPropertyInt(Ljava/lang/String;)': JS value of type string, expected int". This is actually a Chrome/Dev Mode bug, reported at https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/bfIsOwepGso and http://code.google.com/p/google-web-toolkit/issues/detail?id=5778 - while firefox forces a plugin upgrade every new version, chrome seems more lenient, since version 10 or so we've been facing this bug.

WesleyMoy
2 Mar 2012, 4:52 PM
These changes should be reflected in beta 4 (http://www.sencha.com/forum/showthread.php?184556-Ext-GWT-3.0-Beta-4-Now-Available). Try your original test case (not in Chrome when in development mode) and see if your issue has been resolved. If you're still having any problems, post a reply.