Erweiterungen

This commit is contained in:
2025-09-19 12:02:57 +02:00
parent 79169cf9fd
commit 892ff83124
4 changed files with 26 additions and 11 deletions

View File

@@ -11,16 +11,25 @@ import com.vaadin.flow.theme.lumo.LumoUtility.*;
public final class ViewToolbar extends Composite<Header> { public final class ViewToolbar extends Composite<Header> {
public ViewToolbar(String viewTitle, Component... components) { public ViewToolbar(String viewTitle, Component... components) {
this(viewTitle, true, components);
}
public ViewToolbar(String viewTitle, boolean showDrawerToggle, Component... components) {
addClassNames(Display.FLEX, FlexDirection.COLUMN, JustifyContent.BETWEEN, AlignItems.STRETCH, Gap.MEDIUM, addClassNames(Display.FLEX, FlexDirection.COLUMN, JustifyContent.BETWEEN, AlignItems.STRETCH, Gap.MEDIUM,
FlexDirection.Breakpoint.Medium.ROW, AlignItems.Breakpoint.Medium.CENTER); FlexDirection.Breakpoint.Medium.ROW, AlignItems.Breakpoint.Medium.CENTER);
var drawerToggle = new DrawerToggle(); Div toggleAndTitle;
drawerToggle.addClassNames(Margin.NONE); if (showDrawerToggle) {
var drawerToggle = new DrawerToggle();
var title = new H1(viewTitle); drawerToggle.addClassNames(Margin.NONE);
title.addClassNames(FontSize.XLARGE, Margin.NONE, FontWeight.LIGHT); var title = new H1(viewTitle);
title.addClassNames(FontSize.XLARGE, Margin.NONE, FontWeight.LIGHT);
var toggleAndTitle = new Div(drawerToggle, title); toggleAndTitle = new Div(drawerToggle, title);
} else {
var title = new H1(viewTitle);
title.addClassNames(FontSize.XLARGE, Margin.NONE, FontWeight.LIGHT);
toggleAndTitle = new Div(title);
}
toggleAndTitle.addClassNames(Display.FLEX, AlignItems.CENTER); toggleAndTitle.addClassNames(Display.FLEX, AlignItems.CENTER);
getContent().add(toggleAndTitle); getContent().add(toggleAndTitle);

View File

@@ -6,6 +6,7 @@ import com.vaadin.flow.component.checkbox.Checkbox;
import com.vaadin.flow.component.combobox.ComboBox; import com.vaadin.flow.component.combobox.ComboBox;
import com.vaadin.flow.component.datepicker.DatePicker; import com.vaadin.flow.component.datepicker.DatePicker;
import com.vaadin.flow.component.html.H2;
import com.vaadin.flow.component.timepicker.TimePicker; import com.vaadin.flow.component.timepicker.TimePicker;
import com.vaadin.flow.component.html.H3; import com.vaadin.flow.component.html.H3;
import com.vaadin.flow.component.html.Main; import com.vaadin.flow.component.html.Main;
@@ -364,7 +365,8 @@ public class AddJobView extends Main {
addClassNames(LumoUtility.BoxSizing.BORDER, LumoUtility.Display.FLEX, LumoUtility.FlexDirection.COLUMN, addClassNames(LumoUtility.BoxSizing.BORDER, LumoUtility.Display.FLEX, LumoUtility.FlexDirection.COLUMN,
LumoUtility.Padding.MEDIUM, LumoUtility.Gap.SMALL); LumoUtility.Padding.MEDIUM, LumoUtility.Gap.SMALL);
add(new ViewToolbar("Neuen Auftrag anlegen")); H2 title = new H2("Neuen Auftrag anlegen");
add(title);
// Create TabSheet for organizing the form // Create TabSheet for organizing the form
// TabSheet and Tab references for dynamic label updates // TabSheet and Tab references for dynamic label updates

View File

@@ -4,6 +4,7 @@ import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.button.Button; import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant; import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.grid.Grid; import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.html.H2;
import com.vaadin.flow.component.html.Main; import com.vaadin.flow.component.html.Main;
import com.vaadin.flow.component.textfield.TextField; import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.router.Menu; import com.vaadin.flow.router.Menu;
@@ -44,7 +45,9 @@ public class CustomersView extends Main {
addClassNames(LumoUtility.BoxSizing.BORDER, LumoUtility.Display.FLEX, LumoUtility.FlexDirection.COLUMN, addClassNames(LumoUtility.BoxSizing.BORDER, LumoUtility.Display.FLEX, LumoUtility.FlexDirection.COLUMN,
LumoUtility.Padding.MEDIUM, LumoUtility.Gap.SMALL); LumoUtility.Padding.MEDIUM, LumoUtility.Gap.SMALL);
add(new ViewToolbar("Kunden", ViewToolbar.group(description, createBtn))); H2 title = new H2("Aufträge");
add(title);
add(todoGrid); add(todoGrid);
} }

View File

@@ -40,6 +40,9 @@ public class ShowJobsView extends VerticalLayout {
setPadding(true); setPadding(true);
setSpacing(true); setSpacing(true);
H2 title = new H2("Aufträge");
add(title);
// Configure status filter // Configure status filter
statusFilter.setItems("Alle", "Offen", "Erledigt"); statusFilter.setItems("Alle", "Offen", "Erledigt");
statusFilter.setValue("Offen"); statusFilter.setValue("Offen");
@@ -64,8 +67,6 @@ public class ShowJobsView extends VerticalLayout {
filterBar.setAlignItems(Alignment.END); filterBar.setAlignItems(Alignment.END);
add(filterBar); add(filterBar);
H2 title = new H2("Aufträge");
add(title);
// Init default period: last 30 days // Init default period: last 30 days
java.time.LocalDate today = java.time.LocalDate.now(); java.time.LocalDate today = java.time.LocalDate.now();
startDate.setValue(today.minusDays(30)); startDate.setValue(today.minusDays(30));