Package io.jmix.flowui.fragment
Class Fragment<T extends com.vaadin.flow.component.Component>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<T>
io.jmix.flowui.fragment.Fragment<T>
- Type Parameters:
T
- the type of the content
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.component.HasStyle
,FragmentOwner
,Serializable
- Direct Known Subclasses:
FragmentRenderer
public abstract class Fragment<T extends com.vaadin.flow.component.Component>
extends com.vaadin.flow.component.Composite<T>
implements FragmentOwner
A fragment encapsulates a
Component
tree to allow creation of new
components by composing existing components. The main purpose of fragments
is to be used as a part of views and other fragments. By encapsulating the
component, its API can be hidden or presented in a different way for the
user of the fragment.
The encapsulated component tree is available through Composite.getContent()
.
Fragment will by default look at the generic type declaration of its subclass
to find the content type and create an instance using UiComponents
.
You can also override initContent()
to manually create the component
tree or define components tree using XML markup and bind it to a fragment
using FragmentDescriptor
.
Fragment is a way to hide API on the server side. It does not contribute any
element to the Element
tree.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The event that is fired after the fragment and all its declaratively defined inner components are created and fully initialized. -
Field Summary
Modifier and TypeFieldDescriptionprotected FragmentActions
protected FragmentData
protected FragmentOwner
protected UiComponents
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected com.vaadin.flow.shared.Registration
addReadyListener
(com.vaadin.flow.component.ComponentEventListener<Fragment.ReadyEvent> listener) AddsFragment.ReadyEvent
listener.protected <C extends com.vaadin.flow.component.Component>
Optional<C>protected FragmentActions
protected FragmentData
protected <C extends com.vaadin.flow.component.Component>
CReturns the inner component with given id.protected FragmentOwner
protected T
protected void
setFragmentActions
(FragmentActions fragmentActions) protected void
setFragmentData
(FragmentData fragmentData) protected void
setParentController
(FragmentOwner parentController) void
setUiComponents
(UiComponents uiComponents) Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
uiComponents
-
fragmentData
-
fragmentActions
-
parentController
-
-
Constructor Details
-
Fragment
public Fragment()
-
-
Method Details
-
setUiComponents
-
getFragmentData
-
setFragmentData
-
getFragmentActions
-
setFragmentActions
-
getParentController
-
setParentController
-
initContent
- Overrides:
initContent
in classcom.vaadin.flow.component.Composite<T extends com.vaadin.flow.component.Component>
-
getInnerComponent
Returns the inner component with given id.- Type Parameters:
C
- component type- Parameters:
id
- id of the component- Returns:
- the inner component with given id
- Throws:
IllegalArgumentException
- if an inner component with given id is not found
-
findInnerComponent
-
addReadyListener
protected com.vaadin.flow.shared.Registration addReadyListener(com.vaadin.flow.component.ComponentEventListener<Fragment.ReadyEvent> listener) AddsFragment.ReadyEvent
listener.- Parameters:
listener
- the listener to add, notnull
- Returns:
- a registration object that can be used for removing the listener
-