PDA

View Full Version : code spliting



taocore
27 Jun 2010, 10:58 PM
I am using gwt-2.0.3.
I try to split my large application, but the result is unexpected. I found one class should not exists in initial fragment.

See the call stack


Call stack: com.desktop.inventory.BeanModel_com_desktop_inventory_Computer
com.extjs.gxt.ui.client.data.BeanModel_com_desktop_inventory_Computer_Factory::newInstance
com.extjs.gxt.ui.client.data.BeanModelFactory::$createModel
com.extjs.gxt.ui.client.data.NestedModelUtil::convertIfNecessary
com.extjs.gxt.ui.client.data.NestedModelUtil::getNestedValue
com.extjs.gxt.ui.client.data.NestedModelUtil::setNestedValue
com.extjs.gxt.ui.client.data.BaseModelData::$set
com.extjs.gxt.ui.client.data.BaseModelData::set
com.extjs.gxt.ui.client.widget.BoxComponent::$makeVisible
com.extjs.gxt.ui.client.widget.BoxComponent::$setSize
com.extjs.gxt.ui.client.widget.BoxComponent::$afterRender
com.extjs.gxt.ui.client.widget.BoxComponent::afterRender
com.extjs.gxt.ui.client.widget.layout.ToolBarLayout::$initMore
com.extjs.gxt.ui.client.widget.layout.ToolBarLayout::$fitToSize
com.extjs.gxt.ui.client.widget.layout.ToolBarLayout::onLayout
com.extjs.gxt.ui.client.widget.Layout::$layout
com.extjs.gxt.ui.client.widget.Layout$3::handleEvent
com.extjs.gxt.ui.client.widget.Layout::$setContainer
com.extjs.gxt.ui.client.widget.Layout::setContainer
com.extjs.gxt.ui.client.widget.toolbar.ToolBar::$ToolBar
com.extjs.gxt.ui.client.widget.button.ButtonBar::$ButtonBar
com.extjs.gxt.ui.client.widget.ContentPanel::$ContentPanel
com.extjs.gxt.ui.client.widget.Window::$Window
com.extjs.gxt.ui.client.widget.Dialog::$Dialog
com.extjs.gxt.ui.client.widget.MessageBox$1::$MessageBox$1
com.extjs.gxt.ui.client.widget.MessageBox::$getDialog
com.extjs.gxt.ui.client.widget.MessageBox::alert
com.desktop.web.client.App$1::onFailure
com.google.gwt.user.client.rpc.AsyncCallback::$clinit
com.desktop.web.client.App::$onModuleLoad


part of call stack source:


ServiceProvider.getInstance().getLoginService().getEditionInfo(new AsyncCallback<Map<String, String>>()
{
@Override
public void onFailure(Throwable throwable) {
MessageBox.alert("Error", throwable.getMessage(), null);
}
...


I don't think there is any relationship between gxt MessageBox and my Computer.
May be there is something wrong with the BeanModelTag?


Computer implements BeanModelTag

Is this a bug?
Any solutions?

Colin Alworth
28 Jun 2010, 11:42 AM
The issue is that the BaseModelData impl uses NestedModelUtil to have a single implementation for reading all model objects. NestedModelUtil anticipates that some objects could need to be converted from BeanModelTag implementers to a model object, and so starts up the BeanModelLookup code. This code has the ability to instantiate your Computer class, and so the Computer class is made available to that code branch.

It looks like you are trying to remove Computer from the initial download - is this the case, and if not, what is your goal in this split point?

Keep in mind that GXT 2 is built off of GXT 1, and so both were designed before GWT 2 and GWT.runAsync were in the picture. Having not yet built generators for GWT 2, I don't know if they grant the ability to easily write code such that it can only be called from the appropriate split point. I think that the only way to do this would be for GXT to rewrite the bean model stuff to rely on interfaces instead of having a single global factory.

sven
28 Jun 2010, 11:49 AM
And that is exactly the problem.

We are going to redesign this for GXT3. There is no way to change this befor GXT3

taocore
2 Sep 2010, 10:28 PM
I found the latest release:


Release 2.2.0 (Released August 31st, 2010)
General Changes & Enhancements
Added bold (ctrl-b), italic (ctrl-i), and underline (ctrl-u) support to HtmlEditor.
Removed ModelData dependency from BoxComponent if ModelData not used.
Added reconfigure method to TreeGrid.


But after try the compile report still prompt me:


Call stack: com.desktop.inventory.BeanModel_com_desktop_inventory_Computer
com.extjs.gxt.ui.client.data.BeanModel_com_desktop_inventory_Computer_Factory::newInstance
com.extjs.gxt.ui.client.data.BeanModelFactory::$createModel
com.extjs.gxt.ui.client.data.NestedModelUtil::convertIfNecessary
com.extjs.gxt.ui.client.data.NestedModelUtil::getNestedValue
com.extjs.gxt.ui.client.data.NestedModelUtil::setNestedValue
com.extjs.gxt.ui.client.data.BaseModelData::$set
com.extjs.gxt.ui.client.util.Theme::$Theme
com.extjs.gxt.ui.client.util.Theme::$clinit
com.extjs.gxt.ui.client.util.ThemeManager::$clinit
com.extjs.gxt.ui.client.util.ThemeManager::findTheme
com.extjs.gxt.ui.client.GXT::init
com.extjs.gxt.ui.client.widget.Component::$clinit
com.extjs.gxt.ui.client.widget.MessageBox$1::$MessageBox$1
com.extjs.gxt.ui.client.widget.MessageBox::$getDialog
com.extjs.gxt.ui.client.widget.MessageBox::alert


I Hope you can remove ModelData dependency from Theme and any others if ModelData not used as well soon.

sven
3 Sep 2010, 1:06 AM
That change is not possible without braking everything. The only version to look at for this would be GXT3