@Tag(value="div") @Theme(value=com.vaadin.flow.theme.lumo.Lumo.class) @StyleSheet(value="src/css/demo.css") @StyleSheet(value="src/css/prism.css") public abstract class DemoView extends com.vaadin.flow.component.Component implements com.vaadin.flow.component.HasComponents, com.vaadin.flow.router.HasUrlParameter<String>, com.vaadin.flow.component.HasStyle
| Modifier | Constructor and Description |
|---|---|
protected |
DemoView() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(com.vaadin.flow.component.Component... components)
No-op method so that we can use the line
add(Component) in
vaadin.com demos. |
Card |
addCard(String heading,
com.vaadin.flow.component.Component... components)
Creates and adds a new component card to the "Basic usage" tab in the
view.
|
Card |
addCard(String tabName,
String heading,
com.vaadin.flow.component.Component... components)
Creates and adds a new component card to a specific tab in the view.
|
protected <T extends Enum<?>,C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasTheme> |
addVariantsDemo(Supplier<C> componentSupplier,
BiConsumer<C,T> addVariant,
BiConsumer<C,T> removeVariant,
Function<T,String> variantToThemeName,
T... variants)
Adds a demo that shows how the component looks like with specific
variants applied.
|
protected abstract void |
initView()
Builds the content of the view.
|
protected void |
onAttach(com.vaadin.flow.component.AttachEvent attachEvent) |
void |
populateSources()
When called the view should populate the given SourceContainer with
sample source code to be shown.
|
void |
setParameter(com.vaadin.flow.router.BeforeEvent event,
String parameter) |
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, addComponentAsFirst, addComponentAtIndex, remove, removeAllprotected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
onAttach in class com.vaadin.flow.component.Componentprotected abstract void initView()
public void populateSources()
public Card addCard(String heading, com.vaadin.flow.component.Component... components)
heading - the header text of the card, that is added to the layout. If
null or empty, the header is not addedcomponents - components to add on creation. If null or empty,
the card is created without the components insideaddCard(String, String, Component...)public Card addCard(String tabName, String heading, com.vaadin.flow.component.Component... components)
The href of the tab is defined based on the tab name. For example, a tab named "Advanced usage" has the "advanced-tab" as href (all in lower case and with "-" in place of spaces and special characters).
tabName - the name of the tab that will contain the demo, not
nullheading - the header text of the card, that is added to the layout. If
null or empty, the header is not addedcomponents - components to add on creation. If null or empty,
the card is created without the components insidepublic void setParameter(com.vaadin.flow.router.BeforeEvent event,
@OptionalParameter
String parameter)
setParameter in interface com.vaadin.flow.router.HasUrlParameter<String>protected <T extends Enum<?>,C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasTheme> void addVariantsDemo(Supplier<C> componentSupplier, BiConsumer<C,T> addVariant, BiConsumer<C,T> removeVariant, Function<T,String> variantToThemeName, T... variants)
T - variants' typeC - component's typecomponentSupplier - a method that creates the component to which variants will be
applied toaddVariant - a function that adds the new variant to the componentremoveVariant - a function that removes the variant from the componentvariantToThemeName - function that converts variant to an html theme namevariants - list of variants to show in the demospublic void add(com.vaadin.flow.component.Component... components)
add(Component) in
vaadin.com demos.add in interface com.vaadin.flow.component.HasComponentsCopyright © 2000–2026 Vaadin Ltd. All rights reserved.