|
|
|
@ -5,6 +5,8 @@ import java.util.HashSet; |
|
|
|
import java.util.Optional; |
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
|
|
|
|
import com.vaadin.event.selection.SelectionEvent; |
|
|
|
import com.vaadin.event.selection.SelectionEvent; |
|
|
|
|
|
|
|
import com.vaadin.navigator.Navigator; |
|
|
|
|
|
|
|
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; |
|
|
|
import com.vaadin.ui.Button; |
|
|
|
import com.vaadin.ui.Button; |
|
|
|
import com.vaadin.ui.HorizontalLayout; |
|
|
|
import com.vaadin.ui.HorizontalLayout; |
|
|
|
import com.vaadin.ui.VerticalLayout; |
|
|
|
import com.vaadin.ui.VerticalLayout; |
|
|
|
@ -23,7 +25,11 @@ public class PersonEditView extends VerticalLayout implements NamedView { |
|
|
|
private PersonGrid personGrid; |
|
|
|
private PersonGrid personGrid; |
|
|
|
private PersonEditDetails personDetails; |
|
|
|
private PersonEditDetails personDetails; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Navigator navigator; |
|
|
|
|
|
|
|
|
|
|
|
public PersonEditView(GroupDao groupDao, PersonDao personDao) { |
|
|
|
public PersonEditView(GroupDao groupDao, PersonDao personDao) { |
|
|
|
|
|
|
|
setMargin(true); |
|
|
|
|
|
|
|
|
|
|
|
personGrid = new PersonGrid(groupDao, personDao); |
|
|
|
personGrid = new PersonGrid(groupDao, personDao); |
|
|
|
personGrid.setSizeFull(); |
|
|
|
personGrid.setSizeFull(); |
|
|
|
personGrid.onPersonEdit(); |
|
|
|
personGrid.onPersonEdit(); |
|
|
|
@ -39,7 +45,11 @@ public class PersonEditView extends VerticalLayout implements NamedView { |
|
|
|
addComponent(layout); |
|
|
|
addComponent(layout); |
|
|
|
Button addPerson = new Button("Hinzufügen"); |
|
|
|
Button addPerson = new Button("Hinzufügen"); |
|
|
|
addPerson.addClickListener(ev -> addPerson()); |
|
|
|
addPerson.addClickListener(ev -> addPerson()); |
|
|
|
|
|
|
|
|
|
|
|
addComponent(addPerson); |
|
|
|
addComponent(addPerson); |
|
|
|
|
|
|
|
Button backButton = new Button("Zurück"); |
|
|
|
|
|
|
|
backButton.addClickListener(ev -> navigator.navigateTo(MainView.VIEW_NAME)); |
|
|
|
|
|
|
|
addComponent(backButton); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void addPerson() { |
|
|
|
private void addPerson() { |
|
|
|
@ -57,6 +67,12 @@ public class PersonEditView extends VerticalLayout implements NamedView { |
|
|
|
personDetails.setBean(firstSelectedItem.orElse(null)); |
|
|
|
personDetails.setBean(firstSelectedItem.orElse(null)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void enter(ViewChangeEvent event) { |
|
|
|
|
|
|
|
NamedView.super.enter(event); |
|
|
|
|
|
|
|
this.navigator = event.getNavigator(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String getViewName() { |
|
|
|
public String getViewName() { |
|
|
|
return VIEW_NAME; |
|
|
|
return VIEW_NAME; |
|
|
|
|