blob: 0848309b3107b555fd75acf0aa40d7a32a3ec586 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/*
@ITMillApache2LicenseForJavaFiles@
*/
/**
*
*/
package com.vaadin.ui;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.widgetsetutils.WidgetMapGenerator;
/**
* Annotation defining the default client side counterpart in GWT terminal for
* {@link Component}.
* <p>
* With this annotation server side Vaadin component is marked to have a client
* side counterpart. The value of the annotation is the class of client side
* implementation.
*
* <p>
* Note, even though client side implementation is needed during development,
* one may safely remove them from classpath of the production server.
*
* @since 6.2
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface ClientWidget {
/**
* @return the client side counterpart for the annotated component
*/
Class<? extends Paintable> value();
/**
* TODO rewrite for EAGER, DEFERRED, LAZY
*
* The lazy loading of a widget implementation means the client side
* component is not included in the initial JavaScript application loaded
* when the application starts. Instead the implementation is loaded to the
* client when it is first needed.
* <p>
* Lazy loaded widgets don't stress the size and startup time of the client
* side as much as eagerly loaded widgets. On the other hand there is a
* slight latency when lazy loaded widgets are first used as the client side
* needs to visit the server to fetch the client side implementation.
* <p>
* In common situations the default value should be fine. If the widget
* implementation commonly used and often on first view it is better set
* lazy loading off for it. Also if the component implementation is really
* thing, it may by justified to make the widget implementation eagerly
* loaded.
* <p>
* Tunings to widget loading can also be made by overriding
* {@link WidgetMapGenerator} in GWT module. Tunings might be helpful if the
* end users have slow connections and especially if they have high latency
* in their network.
*
* @return if true (default), the GWT code generator will make the client
* side implementation lazy loaded. Displaying it first time on the
* screen slightly increases, but widgets implementation does not
* stress the initialization of the client side engine.
*/
LoadStyle loadStyle() default LoadStyle.DEFERRED;
public enum LoadStyle {
/**
* The widget is included in the initial JS sent to the client.
*/
EAGER,
/**
* Not included in the initial set of widgets, but added to queue from
* which it will be loaded when network is not busy or the
* implementation is required.
*/
DEFERRED,
/**
* Loaded to the client only if needed.
*/
LAZY
}
}
|