@Retention(value=RUNTIME) @Target(value=TYPE) @Inherited @Repeatable(value=Attribute.Container.class) public @interface Attribute
While custom elements can be uniquely identified using their tag name, e.g.
<vaadin-button>
. Flow views and server side composites
cannot be identified this way but typically needs an additional filter which
can be defined using this annotation.
For instance, given public class MyView extends Div
and the
corresponding element class
public class MyViewElement extends DivElement
would match any
<div>
on the page. To uniquely match
MyViewElement
, you could add e.g.setId("myview");
in the view and a corresponding
@Attribute(name="id", value="myview")
for
MyViewElement
.
Modifier and Type | Fields and Description |
---|---|
static String |
DEFAULT_VALUE |
static String |
SIMPLE_CLASS_NAME
Replaced by the simple class name of the element class, with any
Element or PageObject suffix removed, and
converted to dash-separated-format when used with either
contains() or value() , |
public static final String DEFAULT_VALUE
public static final String SIMPLE_CLASS_NAME
Element
or PageObject
suffix removed, and
converted to dash-separated-format when used with either
contains()
or value()
,public abstract String name
Matches the value of the attribute with the value in value()
or
matches a token inside this value with contains()
. If neither
value()
nor contains()
is defined, only ensures that
the attribute is present.
public abstract String value
This will match the given value to the full value of the attribute. To
match only a token, use contains()
.
public abstract String contains
This will match if the given string is one matches one of the space
separated tokens the attribute value consists of. To match the whole
attribute value, use value()
.
Copyright © 2019. All rights reserved.