开发者

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. I ask because I have some clients开发者_如何学JAVA that only use some widgets but not others.


The default loading method is 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):

<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. This will use the widgets' loading preference and I believe most of them are DEFERRED.

Custom #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).

Custom #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.

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


You can choose which widgets are loaded on start and which on demand. Default is to load them all on start.


Vaadin 14

This page in the manual seems to say that, if marked as invisible, your component is represented only on the server-side (in Java) and is not included on the client-side, does not appear in the DOM in the web browser. That is true if the component has not yet been rendered.

Once made visible the component is created in the DOM on the client. If turned invisible, the component remains in the DOM.

In all cases, while invisible, traffic ceases for events regarding that component. So while invisible, network usage is efficient.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜