Google app engine GWT代码拆分
我使用MVP,我有移动和桌面的通用视图界面。然后,我为手机和桌面分别实现了一次视图界面。我使用延迟绑定将接口替换为类的实际实现。视图在ClientFactory中实例化Google app engine GWT代码拆分,google-app-engine,gwt,Google App Engine,Gwt,我使用MVP,我有移动和桌面的通用视图界面。然后,我为手机和桌面分别实现了一次视图界面。我使用延迟绑定将接口替换为类的实际实现。视图在ClientFactory中实例化 如何进行代码拆分,使移动设备的所有视图都包含在一个文件中,桌面的所有视图都包含在另一个文件中?这是gwt.xml文件 <?xml version="1.0" encoding="UTF-8"?> <!-- When updating your version of GWT, you should also
如何进行代码拆分,使移动设备的所有视图都包含在一个文件中,桌面的所有视图都包含在另一个文件中?这是gwt.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<!--
When updating your version of GWT, you should also update this DTD reference,
so that your app can take advantage of the latest GWT module capabilities.
-->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.0//EN"
"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='apllo'>
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<inherits name="com.google.gwt.resources.Resources" />
<inherits name="com.google.gwt.user.Debug"/>
<inherits name="com.google.gwt.activity.Activity"/>
<inherits name="com.google.gwt.place.Place"/>
<inherits name="com.google.gwt.http.HTTP"/>
<inherits name="com.google.gwt.i18n.I18N"/>
<inherits name="com.google.gwt.visualization.Visualization"/>
<inherits name='com.apllo.client.FormFactor'/>
<entry-point class='com.apllo.client.Apllo'/>
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
<!-- Specify public paths -->
<public path="files"/>
<!-- Use ClientFactoryImpl by default -->
<replace-with class="com.apllo.client.factory.ClientFactoryImpl">
<when-type-is class="com.apllo.client.factory.ClientFactory"/>
</replace-with>
<!-- Use ClientFactoryImplMobile for mobile form factor. -->
<replace-with class="com.apllo.client.factory.ClientFactoryMobileImpl">
<when-type-is class="com.apllo.client.factory.ClientFactory"/>
<when-property-is name="formfactor" value="mobile"/>
</replace-with>
<!-- 1.Use HeaderViewImpl by default -->
<replace-with class="com.apllo.client.view.computer.HeaderViewImpl">
<when-type-is class="com.apllo.client.view.HeaderView"/>
</replace-with>
<replace-with class="com.apllo.client.view.mobile.HeaderMobileViewImpl">
<when-type-is class="com.apllo.client.view.HeaderView"/>
<when-property-is name="formfactor" value="mobile"/>
</replace-with>
<!-- 2 -->
<replace-with class="com.apllo.client.view.computer.StatusViewImpl">
<when-type-is class="com.apllo.client.view.StatusView"/>
</replace-with>
<replace-with class="com.apllo.client.view.mobile.StatusMobileViewImpl">
<when-type-is class="com.apllo.client.view.StatusView"/>
<when-property-is name="formfactor" value="mobile"/>
</replace-with>
<!-- 3 -->
<replace-with class="com.apllo.client.view.computer.PublicViewImpl">
<when-type-is class="com.apllo.client.view.PublicView"/>
</replace-with>
<replace-with class="com.apllo.client.view.mobile.PublicMobileViewImpl">
<when-type-is class="com.apllo.client.view.PublicView"/>
<when-property-is name="formfactor" value="mobile"/>
</replace-with>
<!-- 4 -->
<replace-with class="com.apllo.client.view.computer.MessageViewImpl">
<when-type-is class="com.apllo.client.view.MessageView"/>
</replace-with>
<replace-with class="com.apllo.client.view.mobile.MessageMobileViewImpl">
<when-type-is class="com.apllo.client.view.MessageView"/>
<when-property-is name="formfactor" value="mobile"/>
</replace-with>
<!-- 5 -->
<replace-with class="com.apllo.client.view.computer.ContactsViewImpl">
<when-type-is class="com.apllo.client.view.ContactsView"/>
</replace-with>
<!-- 6 -->
<replace-with class="com.apllo.client.view.computer.AdvertisementViewImpl">
<when-type-is class="com.apllo.client.view.AdvertisementView"/>
</replace-with>
<!-- 7 -->
<replace-with class="com.apllo.client.view.computer.NewEditAdViewImpl">
<when-type-is class="com.apllo.client.view.NewEditAdView"/>
</replace-with>
<!-- 8 -->
<replace-with class="com.apllo.client.view.computer.AccountViewImpl">
<when-type-is class="com.apllo.client.view.AccountView"/>
</replace-with>
<replace-with class="com.apllo.client.view.mobile.AccountMobileViewImpl">
<when-type-is class="com.apllo.client.view.AccountView"/>
<when-property-is name="formfactor" value="mobile"/>
</replace-with>
<!-- 9 -->
<replace-with class="com.apllo.client.view.computer.UtilityViewImpl">
<when-type-is class="com.apllo.client.view.UtilityView"/>
</replace-with>
</module>
Wait-如果您使用延迟绑定(基于我假设的某些属性值?)来交换移动或桌面的视图,您已经处于不同的排列中-除此之外还需要分割什么?你确定移动排列中有桌面类吗?如果您的设置中存在其他错误,您是否查看了SOYC报告以了解其原因?您是对的,我使用基于属性值的延迟绑定,但SOYC报告表明,仅生成桌面、平板电脑和移动设备的常见排列!一个大文件包含所有代码。排列0('formfactor':'desktop','user.agent':'gecko1_8')('formfactor':'mobile','user.agent':'gecko1_8')('formfactor':'tablet','user.agent':'gecko1_8')我如何更改此设置以及移动和桌面的不同排列?要回答这个问题,您需要发布模块本身——描述如何创建排列并以这种方式折叠排列的详细信息。请为您的应用程序发布.gwt.xml
文件-可能不止一个,但重要的是要查看任何提及formfactor
的内容(尽管查看其他属性也会有所帮助)。下面的Colin可以找到(作为答案)我们使用的.gwt.xml是否有人知道为什么formfactor没有给出不同的排列?解决方案:在formfactor.gwt.xml中,我注释掉了这一行,这迫使编译器对mobile和desktop进行不同的排列。