Package com.vaadin.shared.annotations
Annotation Type DelegateToWidget
-
@Target({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
ConnectorHierarchyChangeEvent
s but before firing anyStateChangeEvent
.Take for example a state class looking like this:
public class MyComponentState extends AbstractComponentState { @DelegateToWidget public String myProperty; }
WhenevermyProperty
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
-
-
Element Detail
-
value
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 namedmyProperty
will delegate to a method namedsetMyProperty
.- Returns:
- the name of the method to delegate to, or empty string to use the default name
- Default:
- ""
-
-