Added Event-Grid, person grid invisible.

master
Markus Kreth 7 years ago
parent 42727d01d5
commit ae507e7dee
  1. 11
      .project
  2. 2
      .settings/org.springframework.ide.eclipse.prefs
  3. 6
      src/main/java/de/kreth/clubhelperbackend/google/calendar/ClubEvent.java
  4. 16
      src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/MainUi.java
  5. 17
      src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/EventGrid.java

@ -30,13 +30,24 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.core.springbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.springframework.ide.eclipse.core.springnature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>

@ -0,0 +1,2 @@
boot.validation.initialized=true
eclipse.preferences.version=1

@ -15,10 +15,15 @@ import com.google.api.services.calendar.model.EventDateTime;
public class ClubEvent extends BasicItem {
private static final long serialVersionUID = -3600971939167437577L;
private String location;
ClubEvent() {
}
public String getLocation() {
return location;
}
public static ClubEvent parse(Event ev) {
ClubEvent clubEvent = new ClubEvent();
clubEvent.setCaption(ev.getSummary());
@ -29,6 +34,7 @@ public class ClubEvent extends BasicItem {
}
clubEvent.setEnd(toZoned(adjustExcludedEndDate(ev)));
clubEvent.setDescription(ev.getDescription());
clubEvent.location = ev.getLocation();
return clubEvent;
}

@ -23,6 +23,7 @@ import de.kreth.clubhelperbackend.google.calendar.ClubEvent;
import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.EventBusiness;
import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.PersonDao;
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person;
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.EventGrid;
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.PersonGrid;
@SpringUI
@ -32,6 +33,8 @@ public class MainUi extends UI {
@Autowired
PersonDao dao;
private ClubEventProvider dataProvider;
private PersonGrid personGrid;
private EventGrid eventGrid;
@Override
protected void init(VaadinRequest request) {
@ -40,9 +43,13 @@ public class MainUi extends UI {
layout.addComponent(new Label("Persons found:"));
List<Person> persons = dao.list();
PersonGrid grid = new PersonGrid();
grid.setItems(persons);
grid.setCaption("Person Grid");
personGrid = new PersonGrid();
personGrid.setItems(persons);
personGrid.setCaption("Personen");
personGrid.setVisible(false);
eventGrid = new EventGrid();
eventGrid.setCaption("Termine");
dataProvider = new ClubEventProvider();
Calendar<ClubEvent> calendar = new Calendar<>(dataProvider)
@ -50,7 +57,7 @@ public class MainUi extends UI {
calendar.setCaption("Events");
calendar.setHandler(this::onItemClick);
layout.addComponents(grid, calendar);
layout.addComponents(calendar, personGrid, eventGrid);
setContent(layout);
ExecutorService exec = Executors.newSingleThreadExecutor();
exec.execute(() -> {
@ -58,6 +65,7 @@ public class MainUi extends UI {
EventBusiness business = new EventBusiness();
List<ClubEvent> events = business.loadEvents(request);
dataProvider.setItems(events);
eventGrid.setItems(events);
System.out.println("Updated data: " + events);
});
exec.shutdown();

@ -0,0 +1,17 @@
package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components;
import com.vaadin.ui.Grid;
import de.kreth.clubhelperbackend.google.calendar.ClubEvent;
public class EventGrid extends Grid<ClubEvent> {
private static final long serialVersionUID = -5435770187868470290L;
public EventGrid() {
addColumn(ClubEvent::getStart).setCaption("Start");
addColumn(ClubEvent::getCaption).setCaption("Bezeichnung");
addColumn(ClubEvent::getLocation).setCaption("Ort");
}
}
Loading…
Cancel
Save