diff --git a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/CalendarComponent.java b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/CalendarComponent.java index 8c02a9a..c2315fa 100644 --- a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/CalendarComponent.java +++ b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/CalendarComponent.java @@ -37,6 +37,7 @@ public class CalendarComponent extends CustomComponent { calendar.setCaption("Events"); calendar.setSizeFull(); calendar.addListener(ev -> calendarEvent(ev)); + head = new HeadComponent(() -> calendar.getStartDate(), () -> calendar.getEndDate(), dataProvider); head.updateMonthText(calendar.getStartDate()); diff --git a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/HeadComponent.java b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/HeadComponent.java index 8c40be4..f171a00 100644 --- a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/HeadComponent.java +++ b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/HeadComponent.java @@ -21,6 +21,7 @@ import com.vaadin.contextmenu.ContextMenu; import com.vaadin.icons.VaadinIcons; import com.vaadin.server.StreamResource; import com.vaadin.ui.AbstractComponent; +import com.vaadin.ui.Alignment; import com.vaadin.ui.BrowserFrame; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -50,18 +51,30 @@ public class HeadComponent extends HorizontalLayout { private ClubEventProvider dataProvider; + private int monthItemId; + public HeadComponent(Supplier startTime, Supplier endTime, ClubEventProvider dataProvider) { monthName = new Label(); monthName.setId("calendar.month"); - monthName.setStyleName("title_label"); + monthName.setStyleName("title_caption"); + monthName.setWidth(null); Button popupButton = new Button(VaadinIcons.MENU); popupButton.setId("calendar.menu"); popupButton.addClickListener(ev -> openPopupMenu(ev)); - this.addComponent(monthName); + popupButton.setWidth(null); + this.addComponent(popupButton); + this.addComponent(monthName); + + setComponentAlignment(popupButton, Alignment.MIDDLE_LEFT); + setComponentAlignment(monthName, Alignment.MIDDLE_CENTER); + setExpandRatio(monthName, 1.0f); + + setSizeFull(); + this.startTime = startTime; this.endTime = endTime; this.dataProvider = dataProvider; @@ -74,32 +87,35 @@ public class HeadComponent extends HorizontalLayout { } private void openPopupMenu(ClickEvent ev) { - ContextMenu contextMenu = new ContextMenu(ev.getButton(), true); - contextMenu.addItem("Export Monat", ev1 -> calendarExport(ev1)); - contextMenu.addItem("Export Jahr", ev1 -> calendarExport(ev1)); - contextMenu.open(210, 40); + Button button = ev.getButton(); + + ContextMenu contextMenu = new ContextMenu(button, true); + monthItemId = contextMenu.addItem("Export Monat", ev1 -> calendarExport(ev1)).getId(); + contextMenu.addItem("Export Jahr", ev1 -> calendarExport(ev1)).getId(); + contextMenu.open(50, 50); } private void calendarExport(MenuItem ev1) { - boolean monthOnly = ev1.getText().contains("Monat"); + boolean monthOnly = ev1.getId() == monthItemId; List items; ZonedDateTime start; + ZonedDateTime end; if (monthOnly) { start = startTime.get(); - ZonedDateTime end = endTime.get(); - log.debug("exporting Calendar from {} to {}", start, end); + end = endTime.get(); items = dataProvider.getItems(start, end); } else { start = startTime.get().withDayOfYear(1); - ZonedDateTime end = start.withMonth(12).withDayOfMonth(31); - log.debug("exporting Calendar from {} to {}", start, end); + end = start.withMonth(12).withDayOfMonth(31); items = dataProvider.getItems(start, end); } Map values = new HashMap<>(); List holidays = CalendarCreator.filterHolidays(items); + log.debug("exporting Calendar from {} to {}, itemCount = {}", start, end, items.size()); + for (ClubEvent ev : items) { ZonedDateTime evStart = ev.getStart(); diff --git a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/PersonGrid.java b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/PersonGrid.java index 75e19a9..dd837be 100644 --- a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/PersonGrid.java +++ b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/PersonGrid.java @@ -55,6 +55,7 @@ public class PersonGrid extends CustomComponent { private List allGroups; private PersonFilter filter; private ClubEvent currentEvent; + private TextField textLocation; public PersonGrid(GroupDao groupDao, PersonDao personDao) { @@ -65,6 +66,13 @@ public class PersonGrid extends CustomComponent { textTitle.setEnabled(false); textTitle.setSizeFull(); + textLocation = new TextField(); + textLocation.setId("event.location"); + textLocation.setStyleName("title_label"); + textLocation.setCaption("Ort"); + textLocation.setEnabled(false); + textLocation.setSizeFull(); + checkIncluded = new CheckBox("Nur gemeldete"); checkIncluded.setId("person.filter.checked"); checkIncluded.addValueChangeListener(ev -> onSelectedOnly(ev)); @@ -106,7 +114,7 @@ public class PersonGrid extends CustomComponent { close.setId("person.close"); VerticalLayout panel = new VerticalLayout(); - panel.addComponents(textTitle, filters, grid, close); + panel.addComponents(textTitle, textLocation, filters, grid, close); setCompositionRoot(panel); } @@ -191,6 +199,13 @@ public class PersonGrid extends CustomComponent { textTitle.setValue(value); } + private void setLocation(String value) { + if (value == null) { + value = ""; + } + textLocation.setValue(value); + } + public interface ClosedFunction { void closed(); } @@ -205,6 +220,7 @@ public class PersonGrid extends CustomComponent { setCaption(ev.getCaption()); setTitle(ev.getCaption()); + setLocation(ev.getLocation()); updateSelection(ev); } else { diff --git a/src/main/webapp/VAADIN/themes/vaadin-clubhelpertheme/styles.css b/src/main/webapp/VAADIN/themes/vaadin-clubhelpertheme/styles.css index 70d217b..d59c82f 100644 --- a/src/main/webapp/VAADIN/themes/vaadin-clubhelpertheme/styles.css +++ b/src/main/webapp/VAADIN/themes/vaadin-clubhelpertheme/styles.css @@ -15603,6 +15603,11 @@ div.v-layout.v-horizontal.v-widget { overflow: hidden; } +.vaadin-clubhelpertheme .title_caption { + font-weight: bold; + font-size: xx-large; +} + .vaadin-clubhelpertheme .title_label { font-weight: bold; font-size: large; diff --git a/src/main/webapp/VAADIN/themes/vaadin-clubhelpertheme/vaadin-clubhelpertheme.scss b/src/main/webapp/VAADIN/themes/vaadin-clubhelpertheme/vaadin-clubhelpertheme.scss index ae00b15..7994011 100644 --- a/src/main/webapp/VAADIN/themes/vaadin-clubhelpertheme/vaadin-clubhelpertheme.scss +++ b/src/main/webapp/VAADIN/themes/vaadin-clubhelpertheme/vaadin-clubhelpertheme.scss @@ -33,6 +33,10 @@ @include valo; // Insert your own theme rules here + .title_caption { + font-weight: bold; + font-size: xx-large; + } .title_label { font-weight: bold; font-size: large;