Class TabbedDemo
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.orderedlayout.VerticalLayout
com.flowingcode.vaadin.addons.demo.TabbedDemo
- All Implemented Interfaces:
AttachNotifier,ClickNotifier<VerticalLayout>,DetachNotifier,HasComponents,HasElement,HasEnabled,HasOrderedComponents,HasSize,HasStyle,FlexComponent,ThemableLayout,RouterLayout,Serializable
@StyleSheet("context://frontend/styles/commons-demo/shared-styles.css")
@CssImport(value="./styles/commons-demo/vaadin-select-overlay.css",
themeFor="vaadin-select")
public class TabbedDemo
extends VerticalLayout
implements RouterLayout
A layout for displaying a tabbed demo with source code integration.
This layout consists of a set of tabs for navigating between different demos, a content area for displaying the current demo, and a footer with controls for toggling the source code visibility, orientation, and theme.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.component.orderedlayout.FlexComponent
FlexComponent.Alignment, FlexComponent.JustifyContentMode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a tab with ademocomponent.voidAdd a tab with a demo component.voidAdds a listener forTabbedDemoSourceEvent.static voidapplyThemeAttribute(Element element, String theme) Deprecated.static voidconfigureSourceUrlResolver(@NonNull SourceUrlResolver resolver) Configures theSourceUrlResolverfor resolving source URLs.static ColorSchemeReturns the current color scheme.Returns the current orientation of the split layout.static StringDeprecated.UsegetColorScheme()static StringlookupGithubBranch(Class<? extends TabbedDemo> clazz) Looks up the GitHub branch name associated with the given TabbedDemo class.protected voidonAttach(AttachEvent attachEvent) voidremoveRouterLayoutContent(HasElement oldContent) voidsetAutoVisibility(boolean autoVisibility) Sets the autovisibility mode.static voidsetColorScheme(Component component, @NonNull ColorScheme colorScheme) Sets the color scheme for the given component.voidsetDemoHelperViewer(DemoHelperViewer demoHelperViewer) Sets theDemoHelperViewerto be used for displaying demo helpers.voidsetOrientation(SplitLayout.Orientation orientation) Sets the orientation of the split layout.voidsetSourceVisible(boolean visible) Sets the visibility of the source code.voidshowRouterLayoutContent(HasElement content) voidToggles the position of the source code relative to the demo content.Methods inherited from class com.vaadin.flow.component.orderedlayout.VerticalLayout
addAndExpand, getAlignItems, getAlignSelf, getDefaultHorizontalComponentAlignment, getHorizontalComponentAlignment, setAlignItems, setAlignSelf, setDefaultHorizontalComponentAlignment, setHorizontalComponentAlignment, setPadding, setSpacingMethods 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.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.ClickNotifier
addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.orderedlayout.FlexComponent
expand, getFlexGrow, getFlexShrink, getJustifyContentMode, replace, setFlexGrow, setFlexShrink, setJustifyContentModeMethods inherited from interface com.vaadin.flow.component.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasOrderedComponents
getChildren, getComponentAt, getComponentCount, indexOfMethods 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, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.orderedlayout.ThemableLayout
getBoxSizing, getThemeList, isMargin, isPadding, isSpacing, setBoxSizing, setMargin
-
Constructor Details
-
TabbedDemo
public TabbedDemo()Constructs a new TabbedDemo instance.
-
-
Method Details
-
addDemo
Add a tab with a demo component.- Parameters:
clazz- the class of routed demo view componentlabel- the demo name (tab label)- Throws:
IllegalArgumentException- if the class is not annotated withRoute
-
setAutoVisibility
public void setAutoVisibility(boolean autoVisibility) Sets the autovisibility mode. When autovisibility is enabled, the tabs component is hidden unless it contains two or more tabs.- Parameters:
autoVisibility-trueto enable autovisibility,falseto disable it
-
addDemo
Add a tab with ademocomponent. The tab label is retrieved from thePageTitleannotations in the demo class.- Parameters:
clazz- the class of routed demo view component
-
showRouterLayoutContent
- Specified by:
showRouterLayoutContentin interfaceRouterLayout
-
configureSourceUrlResolver
Configures theSourceUrlResolverfor resolving source URLs. This method can only be called once; subsequent calls will result in an exception.- Parameters:
resolver- TheSourceUrlResolverto be used. Must not benull.- Throws:
IllegalStateException- if a resolver has already been set.NullPointerException- if the providedresolverisnull.
-
lookupGithubBranch
Looks up the GitHub branch name associated with the given TabbedDemo class.- Parameters:
clazz- the TabbedDemo class to inspect- Returns:
- the GitHub branch name, or "master" if the annotation is not found
-
removeRouterLayoutContent
- Specified by:
removeRouterLayoutContentin interfaceRouterLayout
-
setSourceVisible
public void setSourceVisible(boolean visible) Sets the visibility of the source code.- Parameters:
visible-trueto make the source code visible,falseotherwise
-
toggleSourcePosition
public void toggleSourcePosition()Toggles the position of the source code relative to the demo content. -
getOrientation
Returns the current orientation of the split layout.- Returns:
- the current orientation
-
setOrientation
Sets the orientation of the split layout.- Parameters:
orientation- the new orientation
-
getThemeAttribute
Deprecated.UsegetColorScheme()Returns the theme attribute value.The "theme attribute" is either an empty string (light) or "dark".
- Returns:
- the theme attribute value
-
getColorScheme
Returns the current color scheme.- Returns:
- the current color scheme
-
applyThemeAttribute
Deprecated.Applies the theme attribute to the given element.The "theme attribute" is either an empty string (light) or "dark".
- Parameters:
element- the element to apply the theme totheme- the theme attribute value
-
setColorScheme
Sets the color scheme for the given component.- Parameters:
component- the component to apply the color scheme tocolorScheme- the color scheme to apply
-
addTabbedDemoSourceListener
Adds a listener forTabbedDemoSourceEvent.- Parameters:
listener- the listener to add
-
onAttach
-
setDemoHelperViewer
Sets theDemoHelperViewerto be used for displaying demo helpers.- Parameters:
demoHelperViewer- the viewer to set
-
setColorScheme(Component, ColorScheme)