Package com.storedobject.vaadin
Class ApplicationFrame
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.applayout.AppLayout
com.storedobject.vaadin.ApplicationFrame
- All Implemented Interfaces:
ApplicationLayout,com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,com.vaadin.flow.router.RouterLayout,Serializable
- Direct Known Subclasses:
ApplicationFrame
@CssImport(value="./so/appframe/styles.css",
themeFor="vaadin-app-layout")
public abstract class ApplicationFrame
extends com.vaadin.flow.component.applayout.AppLayout
implements ApplicationLayout
An implementation of
ApplicationLayout using Vaadin's AppLayout. The "drawer" area acts
as the "menu" area of the ApplicationLayout.- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.applayout.AppLayout
com.vaadin.flow.component.applayout.AppLayout.AppLayoutI18n, com.vaadin.flow.component.applayout.AppLayout.Section -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddToDrawer(com.vaadin.flow.component.Component... components) voidClose the side menu ("drawer" part of theAppLayout) programmatically.protected com.vaadin.flow.component.HasTextGet the component to display the "caption" of the application.protected ApplicationMenuCreate the menu.protected com.vaadin.flow.component.HasTextCreate the component to display the "User's name" for the application.Get the caption of the application.final com.vaadin.flow.component.HasTextGet the component to display the "caption" of the application.final com.vaadin.flow.component.ComponentThe component of the "layout".Get the height of the content area.Get the width of the content area.final com.vaadin.flow.component.applayout.DrawerToggleGet the drawer-toggle button.Get the background color of the header area.Get the foreground color of the header area.Get the height of the header area.com.vaadin.flow.component.ComponentgetLogo()Get the Logo (typically anImagecomponent) to be displayed on the "Nav Bar", next to the "drawer menu" icon.final ApplicationMenugetMenu()The "menu" of the layout.Get the "toolbox" to display at the top-right corner of the screen (right most side of the "Nav Bar").final com.vaadin.flow.component.HasTextGet the component to display the "User's name" for the application.protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) voidopenMenu()Open the side menu ("drawer" part of theAppLayout) programmatically.voidResize the "content" portion of the "layout" to the desired size.voidsetCaption(String caption) Set the caption of theApplication.voidsetDrawerOpened(boolean drawerOpened) Workaround for the bug.voidToggle the side menu ("drawer" part of theAppLayout) programmatically.voidviewSelected(View view) Closes the menu if it is displayed as an overlay.Methods inherited from class com.vaadin.flow.component.applayout.AppLayout
addToNavbar, addToNavbar, afterNavigation, getContent, getI18n, getPrimarySection, isDrawerOpened, isOverlay, remove, setContent, setI18n, setPrimarySection, showRouterLayoutContentMethods 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, 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.storedobject.vaadin.ApplicationLayout
drawMenu, getMenuSearcher, loggedin, setContentMethods 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.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.router.RouterLayout
removeRouterLayoutContent
-
Constructor Details
-
ApplicationFrame
public ApplicationFrame()Constructor.
-
-
Method Details
-
createMenu
Create the menu. The component of the menu should be added to the appropriate place within this method. The default implementation adds the menu to the "drawer" area along with the "menu searcher"ApplicationLayout.getMenuSearcher()if one is available.- Returns:
- Menu.
-
addToDrawer
public final void addToDrawer(com.vaadin.flow.component.Component... components) - Overrides:
addToDrawerin classcom.vaadin.flow.component.applayout.AppLayout
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.applayout.AppLayout
-
resizeContent
public void resizeContent()Description copied from interface:ApplicationLayoutResize the "content" portion of the "layout" to the desired size. This default implementation is suitable for almost all the cases. Otherwise, your overridden method should invoke this as part of your implementation because this sets some important style variables for sizing the "content" area.- Specified by:
resizeContentin interfaceApplicationLayout
-
getCaption
Description copied from interface:ApplicationLayoutGet the caption of the application.- Specified by:
getCaptionin interfaceApplicationLayout- Returns:
- The default implementation returns "SO Application">.
-
getHeaderHeight
Get the height of the header area.- Returns:
- Height. Default value is "9vh".
-
getHeaderBackground
Get the background color of the header area.- Returns:
- Background color. Default is "var(--lumo-primary-color)";
-
getHeaderColor
Get the foreground color of the header area.- Returns:
- Color. Default is "var(--lumo-primary-contrast-color)";
-
getContentWidth
Description copied from interface:ApplicationLayoutGet the width of the content area.- Specified by:
getContentWidthin interfaceApplicationLayout- Returns:
- Width.
-
getContentHeight
Description copied from interface:ApplicationLayoutGet the height of the content area.- Specified by:
getContentHeightin interfaceApplicationLayout- Returns:
- Height.
-
setCaption
Set the caption of theApplication.- Specified by:
setCaptionin interfaceApplicationLayout- Parameters:
caption- Caption
-
getLogo
public com.vaadin.flow.component.Component getLogo()Get the Logo (typically anImagecomponent) to be displayed on the "Nav Bar", next to the "drawer menu" icon.- Returns:
- Default implementation returns
nullso that no icon will be displayed.
-
getToolbox
Get the "toolbox" to display at the top-right corner of the screen (right most side of the "Nav Bar").- Returns:
- A default
ButtonLayoutis returned but one can override this too. Otherwise, one may add his/her "tool" buttons or icons into it.
-
getDrawerToggle
public final com.vaadin.flow.component.applayout.DrawerToggle getDrawerToggle()Get the drawer-toggle button.- Returns:
- The drawer-toggle button.
-
createCaptionComponent
protected com.vaadin.flow.component.HasText createCaptionComponent()Get the component to display the "caption" of the application. This will be displayed to the right of the "Logo" on the "Nav Bar" with "touchOptimized" astrue(seeAppLayout.addToNavbar(boolean, Component...)).- Returns:
- The default implementation returns null so that an
H2component is created automatically.
-
getCaptionComponent
public final com.vaadin.flow.component.HasText getCaptionComponent()Get the component to display the "caption" of the application. This will be displayed to the right of the "Logo" on the "Nav Bar" with "touchOptimized" astrue(seeAppLayout.addToNavbar(boolean, Component...)).- Returns:
- The default implementation returns an
H2component ifcreateCaptionComponent()is not overridden.
-
createUserNameComponent
protected com.vaadin.flow.component.HasText createUserNameComponent()Create the component to display the "User's name" for the application. This will be displayed just before the "toolbox" on the "Nav Bar".- Returns:
- The default implementation returns null so that a
Spancomponent is created automatically.
-
getUserNameComponent
public final com.vaadin.flow.component.HasText getUserNameComponent()Get the component to display the "User's name" for the application. This will be displayed just before the "toolbox" on the "Nav Bar".- Returns:
- The default implementation returns a
Spancomponent ifcreateUserNameComponent()is not overridden.
-
getComponent
public final com.vaadin.flow.component.Component getComponent()Description copied from interface:ApplicationLayoutThe component of the "layout".- Specified by:
getComponentin interfaceApplicationLayout- Returns:
- The main layout component.
-
getMenu
Description copied from interface:ApplicationLayoutThe "menu" of the layout.- Specified by:
getMenuin interfaceApplicationLayout- Returns:
- Menu of the layout.
-
openMenu
public void openMenu()Open the side menu ("drawer" part of theAppLayout) programmatically.- Specified by:
openMenuin interfaceApplicationLayout
-
closeMenu
public void closeMenu()Close the side menu ("drawer" part of theAppLayout) programmatically.- Specified by:
closeMenuin interfaceApplicationLayout
-
toggleMenu
public void toggleMenu()Toggle the side menu ("drawer" part of theAppLayout) programmatically.- Specified by:
toggleMenuin interfaceApplicationLayout
-
setDrawerOpened
public void setDrawerOpened(boolean drawerOpened) Workaround for the bug.- Overrides:
setDrawerOpenedin classcom.vaadin.flow.component.applayout.AppLayout- Parameters:
drawerOpened- True or false
-
viewSelected
Closes the menu if it is displayed as an overlay.- Specified by:
viewSelectedin interfaceApplicationLayout- Parameters:
view- Currently selected view
-