Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
410 views
in Technique[技术] by (71.8m points)

vaadin - Vaadin是否将所有gui小部件都下载到客户端?(Does Vaadin download all gui widgets to the client?)

When I have a Vaadin application does it download all the gui widgets to the client or does it download them on demand.

(当我拥有Vaadin应用程序时,它会将所有gui小部件下载到客户端,还是按需下载它们。)

I ask because I have some clients that only use some widgets but not others.

(我问是因为我有一些仅使用某些小部件而不使用其他小部件的客户端。)

  ask by Zubair translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The default loading method is eager ( EagerWidgetMapGenerator ).

(默认的加载方法是eager( EagerWidgetMapGenerator )。)

You have a few choices for loading the widgets.

(您有几种选择来加载小部件。)

Here are some of them:

(这里是其中的一些:)

Lazy

()

You can choose to use the LazyWidgetMapGenerator by adding this to your widgetset (.gwt.xml):

(您可以通过将其添加到小部件集中(.gwt.xml)来选择使用LazyWidgetMapGenerator :)

<generate-with class="com.vaadin.terminal.gwt.widgetsetutils.LazyWidgetMapGenerator">
    <when-type-is class="com.vaadin.terminal.gwt.client.WidgetMap" />
</generate-with>

This will load the widgets only when requested.

(仅在请求时才加载小部件。)

Widget-defined

(小部件定义)

Same as above, but replace LazyWidgetMapGenerator with WidgetMapGenerator .

(与上面相同,但是用WidgetMapGenerator替换LazyWidgetMapGenerator 。)

This will use the widgets' loading preference and I believe most of them are DEFERRED.

(这将使用小部件的加载首选项,并且我相信大多数都被推迟了。)

Custom #1

(自定义#1)

Create a custom widget map generator by subclassing CustomWidgetMapGenerator and defining it in your widgetset (same as above but replace LazyWidgetMapGenerator with your class).

(通过子类化CustomWidgetMapGenerator并在您的小部件集中定义它来创建一个自定义小部件地图生成器(与上面相同,但是用您的类替换LazyWidgetMapGenerator)。)

Custom #2

(自定义#2)

Create a custom widget map generator by subclassing WidgetMapGenerator (mostly deferred, defined by widgets) or EagerWidgetMapGenerator (every widget loaded EAGERly), setting only some of the widgets LAZY (or DEFERRED, or EAGER) and defining it in your widgetset.

(通过子类化WidgetMapGenerator (大部分是延迟的,由窗口小部件定义)或EagerWidgetMapGenerator (每个加载了EAGERly的窗口小部件),仅设置一些窗口小部件LAZY(或DEFERRED,或EAGER)并在您的窗口小部件集中定义来创建自定义窗口小部件地图生成器。)

For more info, check the API doc and this out: http://dev.vaadin.com/wiki/WidgetSet

(有关更多信息,请查看API文档以及相关内容: http : //dev.vaadin.com/wiki/WidgetSet)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...