summaryrefslogtreecommitdiffstats
path: root/shared/src/com
diff options
context:
space:
mode:
authorBuild Agent <build@vaadin.com>2014-03-05 16:43:08 +0200
committerBuild Agent <build@vaadin.com>2014-03-05 16:43:08 +0200
commitf18a47438f6b2e8de0a94852d6ae0e63b3d2d8fb (patch)
treee2ca0f1bfe6713993f08784fced64f3b4d9f9032 /shared/src/com
parentb80f345a616eae1e9662016792d58f99c7188f6f (diff)
parent024692835d1e2af1a4053821959f03f8d5eb4fcb (diff)
downloadvaadin-framework-f18a47438f6b2e8de0a94852d6ae0e63b3d2d8fb.tar.gz
vaadin-framework-f18a47438f6b2e8de0a94852d6ae0e63b3d2d8fb.zip
Merge changes from origin/7.1
372b64b Add javadoc for @DelegateToWidget (#10980) db79438 Refactored TB3 test ip address whitelisting. bc80f83 Refactored VerifyJreVersion test to TB3. 4667566 Fix displaced TabSheet caption icon in Chrome 0246928 Fixes a memory leak on IE8 in LayoutManagerIE8 (#12688) Change-Id: I697900c560266cdb422ae536fe32c267e29adba8
Diffstat (limited to 'shared/src/com')
-rw-r--r--shared/src/com/vaadin/shared/annotations/DelegateToWidget.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/shared/src/com/vaadin/shared/annotations/DelegateToWidget.java b/shared/src/com/vaadin/shared/annotations/DelegateToWidget.java
index ba661e3f32..9109162a31 100644
--- a/shared/src/com/vaadin/shared/annotations/DelegateToWidget.java
+++ b/shared/src/com/vaadin/shared/annotations/DelegateToWidget.java
@@ -19,11 +19,70 @@ import java.io.Serializable;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
+/**
+ * Signals that the property value from a state class should be forwarded to the
+ * Widget of the corresponding connector instance.
+ * <p>
+ * When this annotation is present on a field or on a setter method, the
+ * framework will call the corresponding setter in the Connector's Widget
+ * instance with the current state property value whenever it has been changed.
+ * This is happens after firing
+ * {@link com.vaadin.client.ConnectorHierarchyChangeEvent}s but before firing
+ * any {@link com.vaadin.client.communication.StateChangeEvent}.
+ * <p>
+ * Take for example a state class looking like this:
+ *
+ * <pre>
+ * public class MyComponentState extends AbstractComponentState {
+ * &#064;DelegateToWidget
+ * public String myProperty;
+ * }
+ * </pre>
+ *
+ * Whenever <code>myProperty</code> is changed, the framework will call code
+ * like this:
+ *
+ * <pre>
+ * connector.getWidget().setMyProperty(connector.getState().myProperty);
+ * </pre>
+ *
+ * <p>
+ * By default, the Widget method to call is derived from the property name, but
+ * {@link #value()} in the annotation can be used to provide a custom method
+ * name, e.g. {@code @DelegateToWidget("someSpecialName")}.
+ *
+ * @since 7.0.0
+ * @author Vaadin Ltd
+ */
@Target({ ElementType.METHOD, ElementType.FIELD })
public @interface DelegateToWidget {
+ /**
+ * Defines the name of the Widget method to call when the annotated state
+ * property has changed. If no value is defined, the method name will be
+ * derived from the property name, so e.g. a field named
+ * <code>myProperty</code> will delegate to a method named
+ * <code>setMyProperty</code>.
+ *
+ * @return the name of the method to delegate to, or empty string to use the
+ * default name
+ */
public String value() default "";
+ /**
+ * Internal helper for handling default values in a uniform way both at
+ * runtime and during widgetset compilation.
+ */
public static class Helper implements Serializable {
+ /**
+ * Gets the name of the method to delegate to for a given property name
+ * and annotation value.
+ *
+ * @param propertyName
+ * the name of the delegated property
+ * @param annotationValue
+ * the {@link DelegateToWidget#value()} of the annotation
+ * @return the name of the method to delegate to
+ */
public static String getDelegateTarget(String propertyName,
String annotationValue) {
String name = annotationValue;