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
Nested ClassesModifier and TypeClassDescriptionstatic classThe event that is fired after the fragment and all its declaratively defined inner components are created and fully initialized. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FragmentActionsprotected FragmentDataprotected FragmentOwnerprotected UiComponents -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.vaadin.flow.shared.RegistrationaddReadyListener(com.vaadin.flow.component.ComponentEventListener<Fragment.ReadyEvent> listener) AddsFragment.ReadyEventlistener.protected <C extends com.vaadin.flow.component.Component>
Optional<C>protected FragmentActionsprotected FragmentDataprotected <C extends com.vaadin.flow.component.Component>
CReturns the inner component with given id.protected FragmentOwnerprotected Tprotected voidsetFragmentActions(FragmentActions fragmentActions) protected voidsetFragmentData(FragmentData fragmentData) protected voidsetParentController(FragmentOwner parentController) voidsetUiComponents(UiComponents uiComponents) Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElementMethods 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, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods 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:
initContentin 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.ReadyEventlistener.- Parameters:
listener- the listener to add, notnull- Returns:
- a registration object that can be used for removing the listener
-