UI Components

Additional Binding

Tooltips

For displaying tooltips on UI elements linkki provides the annotation @BindTooltip. This annotation can be added in the PMO binding to the method to which the UI element is bound. In the case of binding using the @Bind annotation, @BindTooltip must be written directly in the field annotated with @Bind.

The @BindTooltip annotation has two properties:

Value

This is the text displayed on TooltipType.STATIC. Its default value is an empty string ("").

TooltipType

The following configuration options are available for TooltipType:

Table 1. TooltipType

STATIC

the text of the tooltip is read from the attribute value (default)

DYNAMIC

the text of the tooltip is determined by the return value of the method String get<PropertyName>Tooltip(). The value is ignored.

Tooltips can only be added to fields and buttons.
    @UITableColumn(width = 50)
    @BindTooltip("Edit")
    @UIButton(position = 30, icon = VaadinIcons.EDIT, showIcon = true)
    public void edit() {
        editAction.accept(contact);
    }

Bind Read-Only State

To change a component’s read-only behavior, linkki provides the annotation @BindReadOnly. This annotation can be used in combination with @Bind or UI-annotations.

The @BindReadOnly annotation must be placed after @Bind or @UI-annotations as the read-only state might have already been affected by these annotations.
This annotation should be used only in exceptional cases, since most of the behavior is better controlled by a PropertyBehavior.

The @BindReadOnly Annotation has only one property, ReadOnlyType. Per default, ReadOnlyType#ALWAYS is selected. Following ReadOnlyTypes are available:

Table 2. ReadOnlyType

ALWAYS

the component is always read-only (default)

DYNAMIC

the read-only behavior of the component is determined by the return value of the method is<PropertyName>ReadOnly()

DERIVED

behavior as it would be without this annotation

Style Names

Vaadin components get rendered as HTML and styled via CSS. Using the @BindStyleNames annotation custom style names can be bound to a component in addition to those provided by Vaadin.

A single style name can be provided as the annotation’s value (@BindStyleNames("foo")) as well as an array of multiple style names (@BindStyleNames({"bar", "baz"})).

The value can also be omitted, leading to dynamic resolution via a get<Property>StyleNames() method that may return a String or any Collection<String>.