public interface ViewContextStrategy extends Serializable
By default the views are using the Dependent scope, which can be used
but is not recommended. Any View with a ViewContextStrategy
should use one of the scopes provided in the Vaadin CDI integration.
Separate annotations annotated by ViewContextStrategyQualifier have
to exist for each of the implementations.
Example of a custom implementation:
A separate annotation.
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@ViewContextStrategyQualifier
public @interface MyStrategyAnnotation {
}
An implementation class.
@NormalUIScoped
@MyStrategyAnnotation
public class MyStrategy implements ViewContextStrategy {
public boolean contains(String viewName, String parameters) {
...
}
}
Use annotation on the view.
@CDIView("myView")
@MyStrategyAnnotation
public MyView implements View {
...
}
| Modifier and Type | Method and Description |
|---|---|
boolean |
inCurrentContext(String viewName,
String parameters)
Returns whether the active context contains target navigation state.
|
boolean inCurrentContext(String viewName, String parameters)
viewName - target navigation view nameparameters - target navigation parameterstrue to hold context open; false to release itCopyright © 2018 Vaadin Ltd. All Rights Reserved.