Class AbstractPage
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.orderedlayout.VerticalLayout
-
- org.linkki.core.vaadin.component.page.AbstractPage
-
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.orderedlayout.VerticalLayout>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasOrderedComponents,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.orderedlayout.FlexComponent,com.vaadin.flow.component.orderedlayout.ThemableLayout,Serializable,Page
@CssImport("./styles/linkki-page.css") public abstract class AbstractPage extends com.vaadin.flow.component.orderedlayout.VerticalLayout implements PageA page allows displaying and editing data in a vertical layout. It usually consists of so called sections but can also contain arbitrary UI components. Sections (or other components) can be added to take up either the whole width or 50% of the page. If the page is created via injection framework, theinit()method is called automatically and ensures that thePage.createContent()method is called. Additionally, margins are added to the page. Note: If the page is not injected you need to callinit()manually!- See Also:
LinkkiSection, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractPage()Creates a page without top margin and with margins on left, right and bottom.AbstractPage(PmoBasedSectionFactory sectionFactory)Creates a page without top margin and with margins on left, right and bottom.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddHorizontally(com.vaadin.flow.component.Component... sections)Adds the components / sections horizontally, each section taking up an equal part of the page width.protected LinkkiSectionaddSection(Object pmo)Creates a section based on the given PMO and adds it to the page taking 100% of the page width.protected voidaddSections(Object... pmos)Creates sections based on the given PMOs and adds them horizontally, each taking up equal part of the page width.protected BindingContextgetBindingContext()Returns the binding context for this page.protected abstract BindingManagergetBindingManager()Returns the binding manager used to obtain or create binding contexts.PmoBasedSectionFactorygetPmoBasedSectionFactory()Returns the factory used to create PMO based sections.voidinit()Creates the actual UI.voidreloadBindings()Refreshes the content displayed on this page.-
Methods inherited from class com.vaadin.flow.component.orderedlayout.VerticalLayout
addAndExpand, getAlignItems, getAlignSelf, getDefaultHorizontalComponentAlignment, getHorizontalComponentAlignment, setAlignItems, setAlignSelf, setDefaultHorizontalComponentAlignment, setHorizontalComponentAlignment, setPadding, setSpacing
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, 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.ClickNotifier
addClickListener, addClickShortcut
-
Methods inherited from interface com.vaadin.flow.component.orderedlayout.FlexComponent
expand, getFlexGrow, getJustifyContentMode, replace, setFlexGrow, setJustifyContentMode
-
Methods inherited from interface com.vaadin.flow.component.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAll
-
Methods inherited from interface com.vaadin.flow.component.HasOrderedComponents
getChildren, getComponentAt, getComponentCount, indexOf
-
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
-
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Methods inherited from interface org.linkki.core.vaadin.component.page.Page
createContent
-
-
-
-
Constructor Detail
-
AbstractPage
public AbstractPage()
Creates a page without top margin and with margins on left, right and bottom. Uses thePmoBasedSectionFactoryto create sections based on given PMOs.
-
AbstractPage
public AbstractPage(PmoBasedSectionFactory sectionFactory)
Creates a page without top margin and with margins on left, right and bottom.- Parameters:
sectionFactory- Factory used to create sections based on given PMOs.
-
-
Method Detail
-
init
@OverrideMustInvoke @PostConstruct public final void init()
Creates the actual UI. This cannot be done in the constructor, because clients can provide subclasses with specialized BindingManagers and/or section-factories that are not available in this super-class. In order to be able to create a UI, the initialization must be performed after constructors, subclass constructors and dependency injection (constructor and field injection). Hence a separate init-method. It is annotated as post-construct so the DI framework can call it automatically.Must be called manually if no dependency injection framework is used.
-
getPmoBasedSectionFactory
public PmoBasedSectionFactory getPmoBasedSectionFactory()
Returns the factory used to create PMO based sections.
-
addSection
protected LinkkiSection addSection(Object pmo)
Creates a section based on the given PMO and adds it to the page taking 100% of the page width. If the PMO is aContainerPmoa table section is created.- Returns:
- The new section created based on the given PMO.
-
addSections
protected void addSections(@NonNull Object... pmos)Creates sections based on the given PMOs and adds them horizontally, each taking up equal part of the page width. If a PMO is aContainerPmoa table section is created.To add sections vertically, call
addSection(Object)for each PMO instead.- Throws:
NullPointerException- if one of the given PMOs isnull.
-
addHorizontally
public void addHorizontally(com.vaadin.flow.component.Component... sections)
Adds the components / sections horizontally, each section taking up an equal part of the page width.To add components vertically, call
HasComponents.add(Component...)for each component instead.
-
reloadBindings
@OverrideMustInvoke public void reloadBindings()
Refreshes the content displayed on this page. Data bindings are reloaded, but no sections are removed/added.This method should be overridden if the page contains components that do not use data binding and have to be refreshed manually.
- Specified by:
reloadBindingsin interfacePage
-
getBindingManager
protected abstract BindingManager getBindingManager()
Returns the binding manager used to obtain or create binding contexts.- See Also:
getBindingContext()
-
getBindingContext
protected BindingContext getBindingContext()
Returns the binding context for this page.- Implementation Note:
- the default binding context is identified by the
current class
-
-