Login working, some styling.

master
Markus Kreth 7 years ago
parent 9da96db4d4
commit 5395430640
  1. 1
      src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/CalendarComponent.java
  2. 38
      src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/HeadComponent.java
  3. 18
      src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/PersonGrid.java
  4. 5
      src/main/webapp/VAADIN/themes/vaadin-clubhelpertheme/styles.css
  5. 4
      src/main/webapp/VAADIN/themes/vaadin-clubhelpertheme/vaadin-clubhelpertheme.scss

@ -37,6 +37,7 @@ public class CalendarComponent extends CustomComponent {
calendar.setCaption("Events"); calendar.setCaption("Events");
calendar.setSizeFull(); calendar.setSizeFull();
calendar.addListener(ev -> calendarEvent(ev)); calendar.addListener(ev -> calendarEvent(ev));
head = new HeadComponent(() -> calendar.getStartDate(), () -> calendar.getEndDate(), dataProvider); head = new HeadComponent(() -> calendar.getStartDate(), () -> calendar.getEndDate(), dataProvider);
head.updateMonthText(calendar.getStartDate()); head.updateMonthText(calendar.getStartDate());

@ -21,6 +21,7 @@ import com.vaadin.contextmenu.ContextMenu;
import com.vaadin.icons.VaadinIcons; import com.vaadin.icons.VaadinIcons;
import com.vaadin.server.StreamResource; import com.vaadin.server.StreamResource;
import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.BrowserFrame; import com.vaadin.ui.BrowserFrame;
import com.vaadin.ui.Button; import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickEvent;
@ -50,18 +51,30 @@ public class HeadComponent extends HorizontalLayout {
private ClubEventProvider dataProvider; private ClubEventProvider dataProvider;
private int monthItemId;
public HeadComponent(Supplier<ZonedDateTime> startTime, Supplier<ZonedDateTime> endTime, public HeadComponent(Supplier<ZonedDateTime> startTime, Supplier<ZonedDateTime> endTime,
ClubEventProvider dataProvider) { ClubEventProvider dataProvider) {
monthName = new Label(); monthName = new Label();
monthName.setId("calendar.month"); monthName.setId("calendar.month");
monthName.setStyleName("title_label"); monthName.setStyleName("title_caption");
monthName.setWidth(null);
Button popupButton = new Button(VaadinIcons.MENU); Button popupButton = new Button(VaadinIcons.MENU);
popupButton.setId("calendar.menu"); popupButton.setId("calendar.menu");
popupButton.addClickListener(ev -> openPopupMenu(ev)); popupButton.addClickListener(ev -> openPopupMenu(ev));
this.addComponent(monthName); popupButton.setWidth(null);
this.addComponent(popupButton); 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.startTime = startTime;
this.endTime = endTime; this.endTime = endTime;
this.dataProvider = dataProvider; this.dataProvider = dataProvider;
@ -74,32 +87,35 @@ public class HeadComponent extends HorizontalLayout {
} }
private void openPopupMenu(ClickEvent ev) { private void openPopupMenu(ClickEvent ev) {
ContextMenu contextMenu = new ContextMenu(ev.getButton(), true); Button button = ev.getButton();
contextMenu.addItem("Export Monat", ev1 -> calendarExport(ev1));
contextMenu.addItem("Export Jahr", ev1 -> calendarExport(ev1)); ContextMenu contextMenu = new ContextMenu(button, true);
contextMenu.open(210, 40); 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) { private void calendarExport(MenuItem ev1) {
boolean monthOnly = ev1.getText().contains("Monat"); boolean monthOnly = ev1.getId() == monthItemId;
List<ClubEvent> items; List<ClubEvent> items;
ZonedDateTime start; ZonedDateTime start;
ZonedDateTime end;
if (monthOnly) { if (monthOnly) {
start = startTime.get(); start = startTime.get();
ZonedDateTime end = endTime.get(); end = endTime.get();
log.debug("exporting Calendar from {} to {}", start, end);
items = dataProvider.getItems(start, end); items = dataProvider.getItems(start, end);
} else { } else {
start = startTime.get().withDayOfYear(1); start = startTime.get().withDayOfYear(1);
ZonedDateTime end = start.withMonth(12).withDayOfMonth(31); end = start.withMonth(12).withDayOfMonth(31);
log.debug("exporting Calendar from {} to {}", start, end);
items = dataProvider.getItems(start, end); items = dataProvider.getItems(start, end);
} }
Map<LocalDate, StringBuilder> values = new HashMap<>(); Map<LocalDate, StringBuilder> values = new HashMap<>();
List<LocalDate> holidays = CalendarCreator.filterHolidays(items); List<LocalDate> holidays = CalendarCreator.filterHolidays(items);
log.debug("exporting Calendar from {} to {}, itemCount = {}", start, end, items.size());
for (ClubEvent ev : items) { for (ClubEvent ev : items) {
ZonedDateTime evStart = ev.getStart(); ZonedDateTime evStart = ev.getStart();

@ -55,6 +55,7 @@ public class PersonGrid extends CustomComponent {
private List<GroupDef> allGroups; private List<GroupDef> allGroups;
private PersonFilter filter; private PersonFilter filter;
private ClubEvent currentEvent; private ClubEvent currentEvent;
private TextField textLocation;
public PersonGrid(GroupDao groupDao, PersonDao personDao) { public PersonGrid(GroupDao groupDao, PersonDao personDao) {
@ -65,6 +66,13 @@ public class PersonGrid extends CustomComponent {
textTitle.setEnabled(false); textTitle.setEnabled(false);
textTitle.setSizeFull(); 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 = new CheckBox("Nur gemeldete");
checkIncluded.setId("person.filter.checked"); checkIncluded.setId("person.filter.checked");
checkIncluded.addValueChangeListener(ev -> onSelectedOnly(ev)); checkIncluded.addValueChangeListener(ev -> onSelectedOnly(ev));
@ -106,7 +114,7 @@ public class PersonGrid extends CustomComponent {
close.setId("person.close"); close.setId("person.close");
VerticalLayout panel = new VerticalLayout(); VerticalLayout panel = new VerticalLayout();
panel.addComponents(textTitle, filters, grid, close); panel.addComponents(textTitle, textLocation, filters, grid, close);
setCompositionRoot(panel); setCompositionRoot(panel);
} }
@ -191,6 +199,13 @@ public class PersonGrid extends CustomComponent {
textTitle.setValue(value); textTitle.setValue(value);
} }
private void setLocation(String value) {
if (value == null) {
value = "";
}
textLocation.setValue(value);
}
public interface ClosedFunction { public interface ClosedFunction {
void closed(); void closed();
} }
@ -205,6 +220,7 @@ public class PersonGrid extends CustomComponent {
setCaption(ev.getCaption()); setCaption(ev.getCaption());
setTitle(ev.getCaption()); setTitle(ev.getCaption());
setLocation(ev.getLocation());
updateSelection(ev); updateSelection(ev);
} else { } else {

@ -15603,6 +15603,11 @@ div.v-layout.v-horizontal.v-widget {
overflow: hidden; overflow: hidden;
} }
.vaadin-clubhelpertheme .title_caption {
font-weight: bold;
font-size: xx-large;
}
.vaadin-clubhelpertheme .title_label { .vaadin-clubhelpertheme .title_label {
font-weight: bold; font-weight: bold;
font-size: large; font-size: large;

@ -33,6 +33,10 @@
@include valo; @include valo;
// Insert your own theme rules here // Insert your own theme rules here
.title_caption {
font-weight: bold;
font-size: xx-large;
}
.title_label { .title_label {
font-weight: bold; font-weight: bold;
font-size: large; font-size: large;

Loading…
Cancel
Save