summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/vaadin/ui')
-rw-r--r--src/com/vaadin/ui/Button.java4
-rw-r--r--src/com/vaadin/ui/ClientWidget.java31
-rw-r--r--src/com/vaadin/ui/CustomComponent.java2
-rw-r--r--src/com/vaadin/ui/HorizontalLayout.java2
-rw-r--r--src/com/vaadin/ui/Label.java2
-rw-r--r--src/com/vaadin/ui/OrderedLayout.java2
-rw-r--r--src/com/vaadin/ui/SplitPanel.java2
-rw-r--r--src/com/vaadin/ui/TextField.java2
-rw-r--r--src/com/vaadin/ui/UriFragmentUtility.java2
-rw-r--r--src/com/vaadin/ui/VerticalLayout.java2
10 files changed, 41 insertions, 10 deletions
diff --git a/src/com/vaadin/ui/Button.java b/src/com/vaadin/ui/Button.java
index 2a38348105..99daf2b34c 100644
--- a/src/com/vaadin/ui/Button.java
+++ b/src/com/vaadin/ui/Button.java
@@ -33,7 +33,7 @@ import com.vaadin.ui.themes.BaseTheme;
* @since 3.0
*/
@SuppressWarnings("serial")
-@ClientWidget(VButton.class)
+@ClientWidget(value = VButton.class, lazyLoad = false)
public class Button extends AbstractField implements FieldEvents.BlurNotifier,
FieldEvents.FocusNotifier {
@@ -472,7 +472,7 @@ public class Button extends AbstractField implements FieldEvents.BlurNotifier,
@Override
public void handleAction(Object sender, Object target) {
- this.button.fireClick();
+ button.fireClick();
}
}
diff --git a/src/com/vaadin/ui/ClientWidget.java b/src/com/vaadin/ui/ClientWidget.java
index 989f70ce55..39aecf1f86 100644
--- a/src/com/vaadin/ui/ClientWidget.java
+++ b/src/com/vaadin/ui/ClientWidget.java
@@ -12,6 +12,7 @@ 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
@@ -35,4 +36,34 @@ public @interface ClientWidget {
* @return the client side counterpart for the annotated component
*/
Class<? extends Paintable> value();
+
+ /**
+ * 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.
+ */
+ boolean lazyLoad() default true;
+
}
diff --git a/src/com/vaadin/ui/CustomComponent.java b/src/com/vaadin/ui/CustomComponent.java
index 661c72b951..46e92384f8 100644
--- a/src/com/vaadin/ui/CustomComponent.java
+++ b/src/com/vaadin/ui/CustomComponent.java
@@ -26,7 +26,7 @@ import com.vaadin.terminal.gwt.client.ui.VCustomComponent;
* @since 3.0
*/
@SuppressWarnings("serial")
-@ClientWidget(VCustomComponent.class)
+@ClientWidget(value = VCustomComponent.class, lazyLoad = false)
public class CustomComponent extends AbstractComponentContainer {
/**
diff --git a/src/com/vaadin/ui/HorizontalLayout.java b/src/com/vaadin/ui/HorizontalLayout.java
index b3ae1aadfa..3308b5764e 100644
--- a/src/com/vaadin/ui/HorizontalLayout.java
+++ b/src/com/vaadin/ui/HorizontalLayout.java
@@ -17,7 +17,7 @@ import com.vaadin.terminal.gwt.client.ui.VHorizontalLayout;
* @since 5.3
*/
@SuppressWarnings("serial")
-@ClientWidget(VHorizontalLayout.class)
+@ClientWidget(value = VHorizontalLayout.class, lazyLoad = false)
public class HorizontalLayout extends AbstractOrderedLayout {
public HorizontalLayout() {
diff --git a/src/com/vaadin/ui/Label.java b/src/com/vaadin/ui/Label.java
index 22aa0514e1..288692a365 100644
--- a/src/com/vaadin/ui/Label.java
+++ b/src/com/vaadin/ui/Label.java
@@ -38,7 +38,7 @@ import com.vaadin.terminal.gwt.client.ui.VLabel;
* @since 3.0
*/
@SuppressWarnings("serial")
-@ClientWidget(VLabel.class)
+@ClientWidget(value = VLabel.class, lazyLoad = false)
public class Label extends AbstractComponent implements Property,
Property.Viewer, Property.ValueChangeListener,
Property.ValueChangeNotifier, Comparable {
diff --git a/src/com/vaadin/ui/OrderedLayout.java b/src/com/vaadin/ui/OrderedLayout.java
index 9e2825c519..dafaf54e8e 100644
--- a/src/com/vaadin/ui/OrderedLayout.java
+++ b/src/com/vaadin/ui/OrderedLayout.java
@@ -24,7 +24,7 @@ import com.vaadin.terminal.gwt.client.ui.VOrderedLayout;
*/
@SuppressWarnings("serial")
@Deprecated
-@ClientWidget(VOrderedLayout.class)
+@ClientWidget(value = VOrderedLayout.class, lazyLoad = false)
public class OrderedLayout extends AbstractOrderedLayout {
/* Predefined orientations */
diff --git a/src/com/vaadin/ui/SplitPanel.java b/src/com/vaadin/ui/SplitPanel.java
index fe2da5d370..fc443052e8 100644
--- a/src/com/vaadin/ui/SplitPanel.java
+++ b/src/com/vaadin/ui/SplitPanel.java
@@ -30,7 +30,7 @@ import com.vaadin.tools.ReflectTools;
* @since 5.0
*/
@SuppressWarnings("serial")
-@ClientWidget(VSplitPanelHorizontal.class)
+@ClientWidget(value = VSplitPanelHorizontal.class, lazyLoad = false)
public class SplitPanel extends AbstractLayout {
/* Predefined orientations */
diff --git a/src/com/vaadin/ui/TextField.java b/src/com/vaadin/ui/TextField.java
index 88451717ce..9baeea744b 100644
--- a/src/com/vaadin/ui/TextField.java
+++ b/src/com/vaadin/ui/TextField.java
@@ -38,7 +38,7 @@ import com.vaadin.terminal.gwt.client.ui.VTextField;
* @since 3.0
*/
@SuppressWarnings("serial")
-@ClientWidget(VTextField.class)
+@ClientWidget(value = VTextField.class, lazyLoad = false)
public class TextField extends AbstractField implements
FieldEvents.BlurNotifier, FieldEvents.FocusNotifier {
diff --git a/src/com/vaadin/ui/UriFragmentUtility.java b/src/com/vaadin/ui/UriFragmentUtility.java
index 4b4eee36c2..a99b2803ca 100644
--- a/src/com/vaadin/ui/UriFragmentUtility.java
+++ b/src/com/vaadin/ui/UriFragmentUtility.java
@@ -20,7 +20,7 @@ import com.vaadin.terminal.gwt.client.ui.VUriFragmentUtility;
*
*/
@SuppressWarnings("serial")
-@ClientWidget(VUriFragmentUtility.class)
+@ClientWidget(value = VUriFragmentUtility.class, lazyLoad = false)
public class UriFragmentUtility extends AbstractComponent {
/**
diff --git a/src/com/vaadin/ui/VerticalLayout.java b/src/com/vaadin/ui/VerticalLayout.java
index de6f294ffe..52b928ed82 100644
--- a/src/com/vaadin/ui/VerticalLayout.java
+++ b/src/com/vaadin/ui/VerticalLayout.java
@@ -18,7 +18,7 @@ import com.vaadin.terminal.gwt.client.ui.VVerticalLayout;
* @since 5.3
*/
@SuppressWarnings("serial")
-@ClientWidget(VVerticalLayout.class)
+@ClientWidget(value = VVerticalLayout.class, lazyLoad = false)
public class VerticalLayout extends AbstractOrderedLayout {
public VerticalLayout() {