use of com.github.appreciated.card.content.Item in project vaadin-app-layout by appreciated.
the class MainLayout method getLayoutConfiguration.
private AppLayout getLayoutConfiguration(Class<? extends AppLayout> variant) {
this.variant = variant;
dataProvider = new ListDataProvider<>(Arrays.asList(new TestSearchResult("Header1", "Description1"), new TestSearchResult("Header2", "Description2"), new TestSearchResult("Header3", "Description3"), new TestSearchResult("Header4", "Description4"), new TestSearchResult("Header5", "Description5"), new TestSearchResult("Header6", "Description6"), new TestSearchResult("Header7", "Description7"), new TestSearchResult("Header8", "Description8"), new TestSearchResult("Header9", "Description9"), new TestSearchResult("Header10", "Description10")));
button = new SearchOverlayButtonBuilder<TestSearchResult, SerializablePredicate<TestSearchResult>>().withDataProvider(dataProvider).withQueryProvider(s -> new Query<>(testEntity -> !s.equals("") && testEntity.getHeader().startsWith(s))).withDataViewProvider(queryResult -> {
RippleClickableCard card = new RippleClickableCard(new Item(queryResult.getHeader(), queryResult.getDescription()));
card.setWidthFull();
card.setBackground("var(--app-layout-bar-background-base-color)");
return card;
}).withQueryResultListener(testSearchResult -> Notification.show(testSearchResult.getHeader())).build();
if (this.variant != TopLayouts.Top.class && this.variant != TopLayouts.TopLarge.class) {
LeftNavigationItem home = new LeftNavigationItem("Home", VaadinIcon.HOME.create(), View1.class);
LeftNavigationItem menu = new LeftNavigationItem("Menu", VaadinIcon.MENU.create(), View9.class);
notificationHolder.bind(home.getBadge());
badgeHolder.bind(menu.getBadge());
AppLayout build = AppLayoutBuilder.get(this.variant).withTitle("App Layout").withIcon("/frontend/images/logo.png").withAppBar(AppBarBuilder.get().add(button, AppBarProfileButtonBuilder.get().withItem("Profile", event -> Notification.show("Profile clicked")).withItem("Profile", event -> Notification.show("Profile clicked")).withItem("Profile", event -> Notification.show("Profile clicked")).build(), AppBarImageProfileButtonBuilder.get("/frontend/images/logo.png").withItem("Profile", event -> Notification.show("Profile clicked")).withItem("Profile", event -> Notification.show("Profile clicked")).withItem("Profile", event -> Notification.show("Profile clicked")).build(), new SearchButton().withValueChangeListener(event -> Notification.show(event.getValue())), new NotificationButton<>(VaadinIcon.BELL, notificationHolder)).build()).withAppMenu(LeftAppMenuBuilder.get().addToSection(HEADER, new LeftHeaderItem("App-Layout", "Version 4.0.0", "/frontend/images/logo.png"), new LeftClickableItem("Set Behaviour HEADER", VaadinIcon.COG.create(), clickEvent -> openModeSelector(this.variant))).add(home, new LeftNavigationItem("Grid", VaadinIcon.TABLE.create(), GridTest.class), LeftSubMenuBuilder.get("My Submenu 1", VaadinIcon.PLUS.create()).add(LeftSubMenuBuilder.get("My Submenu 2", VaadinIcon.PLUS.create()).add(new LeftNavigationItem("Charts", VaadinIcon.SPLINE_CHART.create(), View2.class), new LeftNavigationItem("Contact", VaadinIcon.CONNECT.create(), View3.class), new LeftNavigationItem("More", VaadinIcon.COG.create(), View4.class)).build(), new LeftNavigationItem("Contact1", VaadinIcon.CONNECT.create(), View5.class), new LeftNavigationItem("More1", VaadinIcon.COG.create(), View6.class)).build(), new LeftSectionItem(), LeftSubMenuBuilder.get("My Submenu 3").add(new LeftNavigationItem("Contact2", VaadinIcon.CONNECT.create(), View7.class), new LeftNavigationItem("More2", VaadinIcon.COG.create(), View8.class)).build(), new LeftSectionItem("Test"), menu).addToSection(FOOTER, new LeftClickableItem("Set Behaviour FOOTER", VaadinIcon.COG.create(), clickEvent -> openModeSelector(this.variant))).build()).withUpNavigation().build();
return build;
} else {
return AppLayoutBuilder.get(this.variant).withTitle("App Layout").withAppBar(AppBarBuilder.get().add(button, AppBarProfileButtonBuilder.get().withItem("Profile", event -> Notification.show("Profile clicked")).withItem("Profile", event -> Notification.show("Profile clicked")).withItem("Profile", event -> Notification.show("Profile clicked")).build(), new NotificationButton<>(VaadinIcon.BELL, notificationHolder)).build()).withAppMenu(TopAppMenuBuilder.get().add(new TopClickableItem("Set Behaviour 1", VaadinIcon.COG.create(), event -> openModeSelector(this.variant)), new TopNavigationItem("Home", VaadinIcon.HOME.create(), View1.class), new TopNavigationItem("Contact", VaadinIcon.SPLINE_CHART.create(), View2.class), new TopClickableItem("Set Behaviour 2", VaadinIcon.COG.create(), event -> openModeSelector(this.variant)), new TopNavigationItem("More", VaadinIcon.CONNECT.create(), View3.class)).build()).withUpNavigation().build();
}
}
use of com.github.appreciated.card.content.Item in project vaadin-app-layout by appreciated.
the class MainAppLayout method initSearchOverlayButton.
private SearchOverlayButton<TestSearchResult, SerializablePredicate<TestSearchResult>> initSearchOverlayButton() {
// The data provider that provides the entities for the search
ListDataProvider<TestSearchResult> listDataProvider = new ListDataProvider<>(Arrays.asList(new TestSearchResult("Header1", "Description1"), new TestSearchResult("Header2", "Description2"), new TestSearchResult("Header3", "Description3"), new TestSearchResult("Header4", "Description4"), new TestSearchResult("Header5", "Description5"), new TestSearchResult("Header6", "Description6"), new TestSearchResult("Header7", "Description7"), new TestSearchResult("Header8", "Description8"), new TestSearchResult("Header9", "Description9"), new TestSearchResult("Header10", "Description10")));
return new SearchOverlayButtonBuilder<TestSearchResult, SerializablePredicate<TestSearchResult>>().withDataProvider(listDataProvider).withQueryProvider(s -> new Query<>(testEntity -> !s.equals("") && testEntity.getHeader().startsWith(s))).withDataViewProvider(queryResult -> {
RippleClickableCard card = new RippleClickableCard(new Item(queryResult.getHeader(), queryResult.getDescription()));
card.setWidthFull();
card.setBackground("var(--lumo-base-color)");
return card;
}).withQueryResultListener(testSearchResult -> Notification.show(testSearchResult.getHeader())).build();
}
use of com.github.appreciated.card.content.Item in project vaadin-app-layout by appreciated.
the class SearchView method furtherConfiguration.
@Override
public void furtherConfiguration(AppLayoutBuilder builder) {
ListDataProvider<TestSearchResult> dataProvider = new ListDataProvider<>(Arrays.asList(new TestSearchResult("Header1", "Description1"), new TestSearchResult("Header2", "Description2"), new TestSearchResult("Header3", "Description3"), new TestSearchResult("Header4", "Description4"), new TestSearchResult("Header5", "Description5"), new TestSearchResult("Header6", "Description6"), new TestSearchResult("Header7", "Description7"), new TestSearchResult("Header8", "Description8"), new TestSearchResult("Header9", "Description9"), new TestSearchResult("Header10", "Description10")));
SearchOverlayButton<TestSearchResult, SerializablePredicate<TestSearchResult>> button = new SearchOverlayButtonBuilder<TestSearchResult, SerializablePredicate<TestSearchResult>>().withDataProvider(dataProvider).withQueryProvider(s -> new Query<TestSearchResult, SerializablePredicate<TestSearchResult>>(testEntity -> !s.equals("") && testEntity.getHeader().startsWith(s))).withDataViewProvider(result -> {
RippleClickableCard card = new RippleClickableCard(new Item(result.getHeader(), result.getDescription()));
card.setWidthFull();
card.setBackground("var(--lumo-base-color)");
return card;
}).withQueryResultListener(testSearchResult -> Notification.show(testSearchResult.header + " clicked")).build();
button.setId("it-test-search-button");
button.getSearchView().getSearchField().setId("it-test-search-field");
button.getSearchView().getCloseButton().setId("it-test-search-close");
builder.withAppBar(button);
}
Aggregations