composite - GWT: Exception: This widget's parent does not implement HasWidgets, but it does -
i trying create structure have larger ui small parts can swap in , out , more detailed areas. in essence making top level panels hold smaller panels other composites. right getting exception:
13:50:51.479 [error] [managementconsole] uncaught exception escaped com.google.gwt.event.shared.umbrellaexception: exception caught: widget's parent not implement haswidgets @ com.google.gwt.event.shared.handlermanager.fireevent(handlermanager.java:129) @ com.google.gwt.user.client.ui.widget.fireevent(widget.java:129) @ com.google.gwt.event.dom.client.domevent.firenativeevent(domevent.java:116) @ com.google.gwt.user.client.ui.widget.onbrowserevent(widget.java:177) @ com.google.gwt.user.client.dom.dispatcheventimpl(dom.java:1351) @ com.google.gwt.user.client.dom.dispatchevent(dom.java:1307) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ com.google.gwt.dev.shell.methodadaptor.invoke(methodadaptor.java:103) @ com.google.gwt.dev.shell.methoddispatch.invoke(methoddispatch.java:71) @ com.google.gwt.dev.shell.oophmsessionhandler.invoke(oophmsessionhandler.java:172) @ com.google.gwt.dev.shell.browserchannelserver.reacttomessageswhilewaitingforreturn(browserchannelserver.java:338) @ com.google.gwt.dev.shell.browserchannelserver.invokejavascript(browserchannelserver.java:219) @ com.google.gwt.dev.shell.modulespaceoophm.doinvoke(modulespaceoophm.java:136) @ com.google.gwt.dev.shell.modulespace.invokenative(modulespace.java:571) @ com.google.gwt.dev.shell.modulespace.invokenativeobject(modulespace.java:279) @ com.google.gwt.dev.shell.javascripthost.invokenativeobject(javascripthost.java:91) @ com.google.gwt.core.client.impl.impl.apply(impl.java) @ com.google.gwt.core.client.impl.impl.entry0(impl.java:242) @ sun.reflect.generatedmethodaccessor37.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ com.google.gwt.dev.shell.methodadaptor.invoke(methodadaptor.java:103) @ com.google.gwt.dev.shell.methoddispatch.invoke(methoddispatch.java:71) @ com.google.gwt.dev.shell.oophmsessionhandler.invoke(oophmsessionhandler.java:172) @ com.google.gwt.dev.shell.browserchannelserver.reacttomessages(browserchannelserver.java:293) @ com.google.gwt.dev.shell.browserchannelserver.processconnection(browserchannelserver.java:547) @ com.google.gwt.dev.shell.browserchannelserver.run(browserchannelserver.java:364) @ java.lang.thread.run(unknown source) caused by: java.lang.illegalstateexception: widget's parent not implement haswidgets @ com.google.gwt.user.client.ui.widget.removefromparent(widget.java:204) @ com.google.gwt.user.client.ui.layoutpanel.insert(layoutpanel.java:188) @ com.google.gwt.user.client.ui.layoutpanel.add(layoutpanel.java:134) @ com.impulse.mc.client.pm.policymanager.init(policymanager.java:58) @ com.impulse.mc.client.managementconsole$1.onclick(managementconsole.java:83) @ com.google.gwt.event.dom.client.clickevent.dispatch(clickevent.java:56) @ com.google.gwt.event.dom.client.clickevent.dispatch(clickevent.java:1) @ com.google.gwt.event.shared.gwtevent.dispatch(gwtevent.java:1) @ com.google.web.bindery.event.shared.eventbus.dispatchevent(eventbus.java:40) @ com.google.web.bindery.event.shared.simpleeventbus.dofire(simpleeventbus.java:193) @ com.google.web.bindery.event.shared.simpleeventbus.fireevent(simpleeventbus.java:88) @ com.google.gwt.event.shared.handlermanager.fireevent(handlermanager.java:127) @ com.google.gwt.user.client.ui.widget.fireevent(widget.java:129) @ com.google.gwt.event.dom.client.domevent.firenativeevent(domevent.java:116) @ com.google.gwt.user.client.ui.widget.onbrowserevent(widget.java:177) @ com.google.gwt.user.client.dom.dispatcheventimpl(dom.java:1351) @ com.google.gwt.user.client.dom.dispatchevent(dom.java:1307) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ com.google.gwt.dev.shell.methodadaptor.invoke(methodadaptor.java:103) @ com.google.gwt.dev.shell.methoddispatch.invoke(methoddispatch.java:71) @ com.google.gwt.dev.shell.oophmsessionhandler.invoke(oophmsessionhandler.java:172) @ com.google.gwt.dev.shell.browserchannelserver.reacttomessageswhilewaitingforreturn(browserchannelserver.java:338) @ com.google.gwt.dev.shell.browserchannelserver.invokejavascript(browserchannelserver.java:219) @ com.google.gwt.dev.shell.modulespaceoophm.doinvoke(modulespaceoophm.java:136) @ com.google.gwt.dev.shell.modulespace.invokenative(modulespace.java:571) @ com.google.gwt.dev.shell.modulespace.invokenativeobject(modulespace.java:279) @ com.google.gwt.dev.shell.javascripthost.invokenativeobject(javascripthost.java:91) @ com.google.gwt.core.client.impl.impl.apply(impl.java) @ com.google.gwt.core.client.impl.impl.entry0(impl.java:242) @ sun.reflect.generatedmethodaccessor37.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ com.google.gwt.dev.shell.methodadaptor.invoke(methodadaptor.java:103) @ com.google.gwt.dev.shell.methoddispatch.invoke(methoddispatch.java:71) @ com.google.gwt.dev.shell.oophmsessionhandler.invoke(oophmsessionhandler.java:172) @ com.google.gwt.dev.shell.browserchannelserver.reacttomessages(browserchannelserver.java:293) @ com.google.gwt.dev.shell.browserchannelserver.processconnection(browserchannelserver.java:547) @ com.google.gwt.dev.shell.browserchannelserver.run(browserchannelserver.java:364) @ java.lang.thread.run(unknown source)
my top level class:
public class managementconsole implements entrypoint { private mcconstants constants = gwt.create(mcconstants.class); private final docklayoutpanel docklayoutpanel = new docklayoutpanel(unit.em); private final verticalpanel verticalpanel = new verticalpanel(); private final horizontalpanel menubar1 = new horizontalpanel(); public final horizontalpanel menubar2 = new horizontalpanel(); public final horizontalpanel menubar3 = new horizontalpanel(); private final button btnpolicymanager = new button("#policy manager"); public final layoutpanel mainpanel = new layoutpanel(); private final absolutepanel absolutepanel = new absolutepanel(); private final textarea txtrsplashscreenput = new textarea(); private policymanager pm = null; private final managementconsole mc = this; /** * entry point method. */ public void onmoduleload() { abmanager.setfactory( (myabfactory) gwt.create( myabfactory.class ) ); serverutil.initserver(); rootlayoutpanel root = rootlayoutpanel.get(); root.add(docklayoutpanel); root.setwidgetleftright(docklayoutpanel, 0.0, unit.px, 0.0, unit.px); root.setwidgettopheight(docklayoutpanel, 0.0, unit.px, 512.0, unit.px); verticalpanel.setborderwidth(1); docklayoutpanel.addnorth(verticalpanel, 7.7); verticalpanel.setwidth("100%"); menubar1.setstylename("menubarstyle"); menubar1.setborderwidth(1); verticalpanel.add(menubar1); menubar1.setwidth("0px"); menubar1.setspacing( 10 ); btnpolicymanager.addclickhandler( new clickhandler() { public void onclick( clickevent event ) { if ( null == pm ) { pm = new policymanager(); } pm.init( mc ); } } ); btnpolicymanager.settext( constants.policymanagerbutton() ); menubar1.add( btnpolicymanager ); verticalpanel.add( menubar2); menubar2.setwidth("0px"); verticalpanel.add(menubar3); menubar3.setwidth("0px"); docklayoutpanel.add(mainpanel); mainpanel.add(absolutepanel); mainpanel.setwidgetleftwidth(absolutepanel, 276.0, unit.px, 383.0, unit.px); mainpanel.setwidgettopheight(absolutepanel, 95.0, unit.px, 186.0, unit.px); txtrsplashscreenput.setreadonly(true); txtrsplashscreenput.settextalignment(textboxbase.align_center); txtrsplashscreenput.settext("splash screen\r\nput graphic or other text here"); absolutepanel.add(txtrsplashscreenput, 113, 57); } }
and class causing exception, in init method:
public class policymanager extends composite { managementconsole mc = null; private final docklayoutpanel myrootpanel = new docklayoutpanel(unit.em); private final docklayoutpanel sidepanel = new docklayoutpanel(unit.em); private final docklayoutpanel mainpanel = new docklayoutpanel(unit.em); private final label lblwelcometothe = new label("welcome policy manager"); // put in basic things not need mc in constructor public policymanager() { initwidget(myrootpanel); setsize("961px", "412px"); myrootpanel.setsize("100%", "412px"); myrootpanel.addwest(sidepanel, 17.3); myrootpanel.add(mainpanel); mainpanel.add(lblwelcometothe); } public void init( managementconsole mc ) { mc = mc; mc.menubar2.clear(); mc.menubar3.clear(); mc.mainpanel.clear(); // line causes exception mc.mainpanel.add( myrootpanel ); } }
i not understand because clear method specified in haswidgets.
it hard follow code use same names in different class , reference field of other class..
you initwidget of composite , insert docklp(myrootpanel) , insert docklp in child. insert myrootpanel inside of layoutpanel has been added composite policymanager via initwidget.
i imagine if cleaned bit stack trace better point problem. looks policymanager doesn't need composite , doesn't need initwidget. manipulate existing panels. however, clean organization further.
java.lang.illegalstateexception - if widget's parent not support removal (e.g. composite)
------------old---------
might problem standards mode
layoutpanel - "this widget work in standards mode, requires html page in run have explicit declaration."?
http://google-web-toolkit.googlecode.com/svn/javadoc/latest/index.html
if not, can provide full trace?
Comments
Post a Comment