Class CustomComponent

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.html.Div>
com.vaadin.featurepack.ui.CustomComponent
All Implemented Interfaces:
ClientConnector, FAbstractClientConnector, FSizeable, HasSizeable, FAbstractComponent, HasComponents, com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, Serializable, Iterable<com.vaadin.flow.component.Component>

public class CustomComponent extends com.vaadin.flow.component.Composite<com.vaadin.flow.component.html.Div> implements HasComponents, FAbstractComponent, HasSizeable
Legacy version of CustomComponent that resembles Vaadin 7/8's CustomComponent API as closely as possible in order to facilitate migration to newer versions of Vaadin.
Author:
Vaadin Ltd
See Also:
  • Constructor Details

    • CustomComponent

      public CustomComponent()
      Constructs a new custom component.

      Note that you must set the composition root before the component can be used, preferably in the constructor.

    • CustomComponent

      public CustomComponent(com.vaadin.flow.component.Component compositionRoot)
      Constructs a new custom component.
      Parameters:
      compositionRoot - the root of the composition component tree. It must not be null.
  • Method Details

    • getCompositionRoot

      protected com.vaadin.flow.component.Component getCompositionRoot()
      Returns the composition root.
      Returns:
      the Component Composition root.
    • setCompositionRoot

      protected void setCompositionRoot(com.vaadin.flow.component.Component compositionRoot)
      Sets the composition root for the component.

      You must set the composition root to a non-null value before the component can be used. You can change it later.

      Parameters:
      compositionRoot - the root of the composition component tree.
    • iterator

      public Iterator<com.vaadin.flow.component.Component> iterator()
      Description copied from interface: HasComponents
      Gets an iterator to the collection of contained components. Using this iterator it is possible to step through all components contained in this container.

      The iterator is typically unmodifiable, and calls to Iterator.remove() throw an exception.

      Specified by:
      iterator in interface HasComponents
      Specified by:
      iterator in interface Iterable<com.vaadin.flow.component.Component>
      Returns:
      the component iterator.
    • getComponentCount

      public int getComponentCount()
      Gets the number of contained components.
      Returns:
      the number of contained components (zero or one)
    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component
    • onDetach

      protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
      Overrides:
      onDetach in class com.vaadin.flow.component.Component
    • setLabelComponent

      public void setLabelComponent(com.vaadin.flow.component.Component labelComponent)
      Description copied from interface: FAbstractComponent
      Sets the component's label component. Flow components that support caption component usually overrides this.
      Specified by:
      setLabelComponent in interface FAbstractComponent
      Parameters:
      labelComponent - the new label component for the component.
    • fireEvent

      protected void fireEvent(com.vaadin.flow.component.ComponentEvent<?> componentEvent)
      Overrides:
      fireEvent in class com.vaadin.flow.component.Component