源文转自:How to reduce startup time with gwt-presenter
I’ve finally figured out a way to trim down the initial load time for my app. I’m not quite ready for GWT 2, runAsync(), or the new Place API in gwt-presenter, but I’ve been able to cut my initial load time significantly (from 14s to 2s) by doing some lazy loading within my presenters and views. In a nutshell, here’s how it works:
I now do nothing in the constructor and bind() methods of each presenter and view.
Instead, I’ve created a new method onFirstRequest() in my base presenter. It gets called on the first invocation of onPlaceRequest(), which simply increments a counter in a class field to keep track.
I’ve added an init() method to the base presenter’s Display interface. It gets called by onFirstRequest(). I moved all widget creation in my views from the constructor and onBind() methods into this init() method instead, thus delaying all widget creation until the first time the view is accessed.
Following a suggestion from Per Wiklander in a recent comment to this blog, I noop’d the addWidget() method in my WidgetContainerDisplay class. This method gets called for each presenter that you add to a WidgetContainerPresenter, which doesn’t make sense for the way I’m using the container (I show only one view at a time). The addWidget() method is not used for anything else.
Since this particular scheme utilizes onPlaceRequest() to keep track of the first invocation, it will only work if you first reveal a view by firing the corresponding PlaceRequentEvent, either in code or by visiting the place URL.
分享到:
相关推荐
5. **异步通信(Ajax)**:GWT内置了异步通信机制,通过GWT的RequestBuilder或GWT-RPC(Remote Procedure Call)实现与服务器的无缝交互,实现页面的无刷新更新。 6. **本地化支持**:GWT支持多语言环境,开发者...
gwt-maven-plugin 该插件旨在通过提供两种特定的打包方式: gwt-lib和gwt-app ,使使用Maven构建GWT项目更加容易。 基本用法 将插件添加到您的POM并启用扩展: < groupId>net.ltgt.gwt.maven</ groupId> ...
GWT整合Spring时需要这个包,在官网上没有最新的jar包,这是自己用jar命令生成的,并测试可以使用。
1. **GWT入门教程**:对于初学者,资料可能涵盖GWT的基本概念、开发环境搭建(如Eclipse插件配置)、Hello World示例、MVP(Model-View-Presenter)设计模式的介绍,以及如何创建和运行第一个GWT项目。 2. **GWT...
3. **UI构建**:GWT提供了丰富的Widget库,允许开发者构建复杂的用户界面,同时支持MVP(Model-View-Presenter)和MVVM(Model-View-ViewModel)设计模式。 4. **国际化和本地化**:GWT支持多语言应用,可以轻松地...
现在,该插件被认为是legacy GWT maven plugin (又名mojo GWT maven插件),而新插件被认为是new generation GWT maven plugin (又名tbroyer GWT maven插件)。 仍然支持旧版maven插件,但强烈建议将新插件用于新...
2. **GWT MVP模式**:Model-View-Presenter模式是一种常见的GWT应用架构,有助于分离视图、模型和逻辑,提升代码可维护性。 3. **GWT RAPID-UI**:GWT的Rapid-UI技术,如Cell Widgets,使开发者能快速构建动态表格...
This book is designed to give developers all the information they need to develop their own GAE+GWT applications, with a particular focus on some of the technologies useful for building scalable ...
4. **GWT MVP模式**: Model-View-Presenter (MVP) 是GWT推荐的架构模式,它有助于分离视图逻辑、业务逻辑和数据模型,使得代码更易于维护和测试。 5. **异步通信(GWT RPC)**: GWT提供了Remote Procedure Call (RPC)...
GWT-2.8.2是该SDK的一个版本,提供了最新的特性和改进,旨在简化Web应用的开发流程,提高开发效率。 GWT的核心理念是"Write Once, Run Everywhere",它将Java代码编译成优化过的JavaScript,确保在各种浏览器上都能...
2. **gwt-dev-plugin-x86.msi**:这是一个Windows安装程序包,用于32位系统。MSI是Microsoft Installer的文件格式,用户可以通过双击此文件进行标准的Windows安装过程。 3. **gwt-dev-plugin.xpi**:这是Firefox...
This chapter introduces readers to GWT-RPC and demonstrates how to implement it in their applications. #### Chapter 11: Examining Client-Side RPC Architecture Expanding on the concepts covered in ...
### GWT快速开发知识点详解 #### 一、GWT简介 **Google Web Toolkit (GWT)** 是由Google推出的一款开源的Java开发框架,主要用于构建高度交互式的Web应用程序,特别是那些类似Google Maps和Gmail这样的AJAX应用。...
**Tutorial-hellomvp-2.1.zip** MVP(Model-View-Presenter)是GWT中推荐的一种设计模式,用于组织和分离业务逻辑和用户界面。这个教程可能专注于介绍如何在GWT中实现MVP模式,帮助开发者理解如何划分模型、视图和...
GWT-Servlet是GWT框架的一部分,主要负责处理服务器端的交互。`gwt-servlet-2.3.0.jar`是GWT 2.3.0版本的Servlet库,这个库包含了运行GWT应用所需的服务器端组件。 在GWT的应用程序中,客户端部分通常由JavaScript...
解压后的目录中包含了如 `gwt-dev-windows.jar` 和 `gwt-servlet.jar` 等库文件,它们是 GWT 开发和运行所必需的。`gwt-dev-windows.jar` 包含了 GWT 的开发工具,而 `gwt-servlet.jar` 用于服务器端支持。 9. **...
8. **GWT MVP**:Model-View-Presenter模式是GWT推荐的架构模式,帮助分离业务逻辑、视图和呈现逻辑,提高代码复用和测试性。 9. **GWT EventBus**:EventBus是GWT中的一种事件总线,用于组件间的通信,让组件间...