com.holonplatform.vaadin.flow.components

## Interface ViewComponent<V>

- Type Parameters:
    `V` - Value type
  All Superinterfaces:
    HasComponent, com.vaadin.flow.component.HasElement, Serializable, ValueComponent<V>, ValueHolder<V,ValueHolder.ValueChangeEvent<V>>

      public interface ViewComponent<V>
      extends ValueHolder<V,ValueHolder.ValueChangeEvent<V>>, ValueComponent<V>

  A `ValueHolder` component to display a value in UI.
  Since:
    5.2.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `ViewComponent.ViewComponentPropertyRenderer<T>` A `PropertyRenderer` for the `ViewComponent` rendering type.

    - ### Nested classes/interfaces inherited from interface com.holonplatform.vaadin.flow.components.ValueHolder

      `ValueHolder.ValueChangeEvent<V>, ValueHolder.ValueChangeListener<V,E extends ValueHolder.ValueChangeEvent<V>>`

  - ### Method Summary

    All Methods Static Methods Instance Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T,C extends com.vaadin.flow.component.Component> ViewComponentAdapterBuilder<T>` | `adapt(Class<T> type, C content, BiConsumer<C,T> valueConsumer)` Create a new `ViewComponentAdapterBuilder` to configure and create a `ViewComponent` from a custom `Component`.
    `static <T,C extends com.vaadin.flow.component.Component> ViewComponentAdapterBuilder<T>` | `adapt(Class<T> type, Function<T,C> componentProvider)` Create a new `ViewComponentAdapterBuilder` to configure and create a `ViewComponent` from a custom `Component`.
    `static <T> ViewComponentBuilder<T>` | `builder(Class<? extends T> valueType)` Get a `ViewComponentBuilder` to create a `ViewComponent` using given value type.
    `static <T> ViewComponentBuilder<T>` | `builder(Function<T,String> stringValueConverter)` Get a `ViewComponentBuilder` to create a `ViewComponent` using given function to convert the value to a `String` type representation.
    `static <T> ViewComponentBuilder<T>` | `builder(com.holonplatform.core.property.Property<T> property)` Get a `ViewComponentBuilder` to create a `ViewComponent` using given `Property` for label and value presentation through the `Property.present(Object)` method.
    `static <T> ViewComponent<T>` | `create(Class<T> valueType)` Create a `ViewComponent` using given value type.
    `static <T> ViewComponent<T>` | `create(com.holonplatform.core.property.Property<T> property)` Create a `ViewComponent` using given `Property` for label and value presentation through the `Property.present(Object)` method.
    `default Optional<com.vaadin.flow.component.Component>` | `getContentComponent()` Get the component which acts as `ViewComponent` content, if available.
    `default Optional<HasTitle>` | `hasTitle()` Checks whether this component supports a title, which text can be handled using the `HasTitle` interface.

    - ### Methods inherited from interface com.holonplatform.vaadin.flow.components.ValueHolder

      `addValueChangeListener, clear, getEmptyValue, getValue, getValueIfPresent, isEmpty, setValue`

    - ### Methods inherited from interface com.holonplatform.vaadin.flow.components.ValueComponent

      `getValue, hasValueChangeMode`

    - ### Methods inherited from interface com.holonplatform.vaadin.flow.components.HasComponent

      `create, getComponent, getElement, hasEnabled, hasLabel, hasSize, hasStyle, hasValidation, isVisible, setVisible`

- - ### Method Detail

    - #### getContentComponent

          default Optional<com.vaadin.flow.component.Component> getContentComponent()

      Get the component which acts as `ViewComponent` content, if available.
      Returns:
        Optional content component

    - #### hasTitle

          default Optional<HasTitle> hasTitle()

      Checks whether this component supports a title, which text can be handled using the `HasTitle` interface.
      Returns:
        If this component supports a title, return the `HasTitle` reference. An empty Optional is returned otherwise.

    - #### builder

          static <T> ViewComponentBuilder<T> builder(Class<? extends T> valueType)

      Get a `ViewComponentBuilder` to create a `ViewComponent` using given value type.
      Type Parameters:
        `T` - Value type
      Parameters:
        `valueType` - Value type (not null)
      Returns:
        A `ViewComponentBuilder`

    - #### builder

          static <T> ViewComponentBuilder<T> builder(com.holonplatform.core.property.Property<T> property)

      Get a `ViewComponentBuilder` to create a `ViewComponent` using given `Property` for label and value presentation through the `Property.present(Object)` method.
      Type Parameters:
        `T` - Value type
      Parameters:
        `property` - The property to use (not null)
      Returns:
        A `ViewComponentBuilder`

    - #### builder

          static <T> ViewComponentBuilder<T> builder(Function<T,String> stringValueConverter)

      Get a `ViewComponentBuilder` to create a `ViewComponent` using given function to convert the value to a `String` type representation.
      Type Parameters:
        `T` - Value type
      Parameters:
        `stringValueConverter` - Value converter function (not null)
      Returns:
        A `ViewComponentBuilder`

    - #### create

          static <T> ViewComponent<T> create(Class<T> valueType)

      Create a `ViewComponent` using given value type.
      Type Parameters:
        `T` - Value type
      Parameters:
        `valueType` - Value type (not null)
      Returns:
        A `ViewComponent` instance

    - #### create

          static <T> ViewComponent<T> create(com.holonplatform.core.property.Property<T> property)

      Create a `ViewComponent` using given `Property` for label and value presentation through the `Property.present(Object)` method.
      Type Parameters:
        `T` - Value type
      Parameters:
        `property` - The property to use (not null)
      Returns:
        A `ViewComponent` instance

    - #### adapt

          static <T,C extends com.vaadin.flow.component.Component> ViewComponentAdapterBuilder<T> adapt(Class<T> type,
                                                                                                        Function<T,C> componentProvider)

      Create a new `ViewComponentAdapterBuilder` to configure and create a `ViewComponent` from a custom `Component`.

      The `ViewComponent` content will be replaced by the `Component` provided by the given function each time the value changes.

      Type Parameters:
        `T` - Value type
        `C` - View component content type
      Parameters:
        `type` - Value type
        `componentProvider` - The function to provide the `ViewComponent` content component each time the value changes (not null)
      Returns:
        A new `ViewComponentAdapterBuilder`

    - #### adapt

          static <T,C extends com.vaadin.flow.component.Component> ViewComponentAdapterBuilder<T> adapt(Class<T> type,
                                                                                                        C content,
                                                                                                        BiConsumer<C,T> valueConsumer)

      Create a new `ViewComponentAdapterBuilder` to configure and create a `ViewComponent` from a custom `Component`.
      Type Parameters:
        `T` - Value type
        `C` - View component content type
      Parameters:
        `type` - Value type
        `content` - The `ViewComponent` content component to use (not null)
        `valueConsumer` - The consumer to use to configure the content component each time the value changes (not null)
      Returns:
        A new `ViewComponentAdapterBuilder`

Copyright © 2019 The Holon Platform. All rights reserved.