|
|
|
@ -26,19 +26,15 @@ import de.kreth.vaadin.clubhelper.vaadinclubhelper.security.SecurityVerifier; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.commands.ClubCommand; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.commands.ClubCommand; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.commands.CreateMeldungCommand; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.commands.CreateMeldungCommand; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.commands.DeleteEventCommand; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.commands.DeleteEventCommand; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.commands.ExportCalendarMonthCommand; |
|
|
|
|
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.commands.ExportCalendarYearCommand; |
|
|
|
|
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.commands.ExportCsvCommand; |
|
|
|
|
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.commands.LogoutCommand; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.commands.LogoutCommand; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.commands.SwitchViewCommand; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.commands.SwitchViewCommand; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.ClubEventProvider; |
|
|
|
|
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.ConfirmDialog; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.ConfirmDialog; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.navigation.ClubhelperNavigation; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.navigation.ClubhelperNavigation; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.navigation.ClubhelperNavigation.ClubNavigator; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.navigation.ClubhelperNavigation.ClubNavigator; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.navigation.ClubhelperViews; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.navigation.ClubhelperViews; |
|
|
|
import net.sf.jasperreports.engine.JasperPrint; |
|
|
|
import net.sf.jasperreports.engine.JasperPrint; |
|
|
|
|
|
|
|
|
|
|
|
class LoggedinMenuitemState implements MenuItemState { |
|
|
|
class LoggedinMenuitemState extends LoggedOffState { |
|
|
|
|
|
|
|
|
|
|
|
private ClubNavigator navigator2; |
|
|
|
private ClubNavigator navigator2; |
|
|
|
|
|
|
|
|
|
|
|
@ -48,14 +44,6 @@ class LoggedinMenuitemState implements MenuItemState { |
|
|
|
|
|
|
|
|
|
|
|
private ApplicationContext context; |
|
|
|
private ApplicationContext context; |
|
|
|
|
|
|
|
|
|
|
|
private ClubEventProvider dataProvider; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Supplier<ZonedDateTime> startProvider; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Supplier<ZonedDateTime> endProvider; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private BiConsumer<String, JasperPrint> printConsumer; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MenuItem openPersonMenuItem; |
|
|
|
private MenuItem openPersonMenuItem; |
|
|
|
|
|
|
|
|
|
|
|
private MenuItem calendarMenuItem; |
|
|
|
private MenuItem calendarMenuItem; |
|
|
|
@ -72,14 +60,10 @@ class LoggedinMenuitemState implements MenuItemState { |
|
|
|
|
|
|
|
|
|
|
|
public LoggedinMenuitemState(ApplicationContext context, UI ui, Supplier<ZonedDateTime> startProvider, |
|
|
|
public LoggedinMenuitemState(ApplicationContext context, UI ui, Supplier<ZonedDateTime> startProvider, |
|
|
|
Supplier<ZonedDateTime> endProvider, BiConsumer<String, JasperPrint> printConsumer) { |
|
|
|
Supplier<ZonedDateTime> endProvider, BiConsumer<String, JasperPrint> printConsumer) { |
|
|
|
super(); |
|
|
|
super(context, startProvider, endProvider, printConsumer); |
|
|
|
this.ui = ui; |
|
|
|
this.ui = ui; |
|
|
|
this.context = context; |
|
|
|
this.context = context; |
|
|
|
this.startProvider = startProvider; |
|
|
|
|
|
|
|
this.endProvider = endProvider; |
|
|
|
|
|
|
|
this.printConsumer = printConsumer; |
|
|
|
|
|
|
|
this.navigator = context.getBean(ClubhelperNavigation.class); |
|
|
|
this.navigator = context.getBean(ClubhelperNavigation.class); |
|
|
|
this.dataProvider = context.getBean(ClubEventProvider.class); |
|
|
|
|
|
|
|
this.eventBusiness = context.getBean(EventBusiness.class); |
|
|
|
this.eventBusiness = context.getBean(EventBusiness.class); |
|
|
|
navigator.add(ev -> setSelectedMenuItem(ev.getNewView())); |
|
|
|
navigator.add(ev -> setSelectedMenuItem(ev.getNewView())); |
|
|
|
|
|
|
|
|
|
|
|
@ -91,13 +75,7 @@ class LoggedinMenuitemState implements MenuItemState { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void applyMenuStates(ClubhelperMenuBar menuBar) { |
|
|
|
public void applyMenuStates(ClubhelperMenuBar menuBar) { |
|
|
|
|
|
|
|
super.applyMenuStates(menuBar); |
|
|
|
menuBar.getAllMainMenus().forEach(m -> m.setVisible(false)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MenuItem fileMenuItem = menuBar.getFileMenuItem(); |
|
|
|
|
|
|
|
fileMenuItem.setVisible(true); |
|
|
|
|
|
|
|
CommandWrapper logout = new CommandWrapper(new LogoutCommand(navigator2, securityVerifier)); |
|
|
|
|
|
|
|
fileMenuItem.addItem(logout.getLabel(), logout); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prepareEditMenu(menuBar); |
|
|
|
prepareEditMenu(menuBar); |
|
|
|
|
|
|
|
|
|
|
|
@ -110,6 +88,11 @@ class LoggedinMenuitemState implements MenuItemState { |
|
|
|
setSelectedMenuItem(view); |
|
|
|
setSelectedMenuItem(view); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected ClubCommand loginOutCommand() { |
|
|
|
|
|
|
|
return new LogoutCommand(navigator2, securityVerifier); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void prepareViewMenu(ClubhelperMenuBar menuBar) { |
|
|
|
private void prepareViewMenu(ClubhelperMenuBar menuBar) { |
|
|
|
MenuItem viewMenu = menuBar.getViewMenuItem(); |
|
|
|
MenuItem viewMenu = menuBar.getViewMenuItem(); |
|
|
|
viewMenu.setVisible(true); |
|
|
|
viewMenu.setVisible(true); |
|
|
|
@ -134,15 +117,6 @@ class LoggedinMenuitemState implements MenuItemState { |
|
|
|
MenuItem editMenu = menuBar.getEditMenuItem(); |
|
|
|
MenuItem editMenu = menuBar.getEditMenuItem(); |
|
|
|
editMenu.setVisible(true); |
|
|
|
editMenu.setVisible(true); |
|
|
|
|
|
|
|
|
|
|
|
CommandWrapper exportCalendarMonthCommand = new CommandWrapper( |
|
|
|
|
|
|
|
new ExportCalendarMonthCommand(startProvider, endProvider, dataProvider, printConsumer)); |
|
|
|
|
|
|
|
editMenu.addItem(exportCalendarMonthCommand.getLabel(), exportCalendarMonthCommand); |
|
|
|
|
|
|
|
ClubCommand exportCalendarYearCommand = new ExportCalendarYearCommand(startProvider, endProvider, dataProvider, |
|
|
|
|
|
|
|
printConsumer); |
|
|
|
|
|
|
|
editMenu.addItem(exportCalendarYearCommand.getLabel(), new CommandWrapper(exportCalendarYearCommand)); |
|
|
|
|
|
|
|
ClubCommand exportCsvCommand = new ExportCsvCommand(menuBar, context); |
|
|
|
|
|
|
|
editMenu.addItem(exportCsvCommand.getLabel(), ev -> exportCsvCommand.execute()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CreateMeldungCommand createMeldungCommand = new CreateMeldungCommand(context, this::show); |
|
|
|
CreateMeldungCommand createMeldungCommand = new CreateMeldungCommand(context, this::show); |
|
|
|
createMeldungMenuItem = editMenu.addItem(createMeldungCommand.getLabel(), |
|
|
|
createMeldungMenuItem = editMenu.addItem(createMeldungCommand.getLabel(), |
|
|
|
new CommandWrapper(createMeldungCommand)); |
|
|
|
new CommandWrapper(createMeldungCommand)); |
|
|
|
|