com.vaadin.shared.annotations
Annotation Type DelegateToWidget


@Target(value={METHOD,FIELD})
public @interface DelegateToWidget

Signals that the property value from a state class should be forwarded to the Widget of the corresponding connector instance.

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 com.vaadin.client.ConnectorHierarchyChangeEvents but before firing any com.vaadin.client.communication.StateChangeEvent.

Take for example a state class looking like this:

 public class MyComponentState extends AbstractComponentState {
     @DelegateToWidget
     public String myProperty;
 }
 
Whenever myProperty is changed, the framework will call code like this:
 connector.getWidget().setMyProperty(connector.getState().myProperty);
 

By default, the Widget method to call is derived from the property name, but value() in the annotation can be used to provide a custom method name, e.g. @DelegateToWidget("someSpecialName").

Since:
7.0.0
Author:
Vaadin Ltd

Optional Element Summary
 java.lang.String value
          Defines the name of the Widget method to call when the annotated state property has changed.
 

value

public abstract java.lang.String value
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 myProperty will delegate to a method named setMyProperty.

Returns:
the name of the method to delegate to, or empty string to use the default name
Default:
""


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.