Exemplo n.º 1
0
 @Override
 protected void init(VaadinRequest request) {
   // TODO: remove test-entry into contet
   context.put(CONTEXT_LOGIN_USER, "sebastian");
   // create
   NavigationManager m = new NavigationManager();
   m.setMaintainBreadcrumb(true);
   TimesheetChangePresenter pres =
       obtainPresenterFactory(request.getContextPath()).createTimesheetChangePresenter(null);
   // Load the july timesheet into the presenter
   CouchDbTimesheetService tsService = new CouchDbTimesheetService();
   List<Timesheet> tsList = tsService.listAllTimesheet(new HashMap<String, Object>(context));
   for (Timesheet ts : tsList) {
     if (ts.getMonth() == 7 && ts.getYear() == 2014) {
       pres.setTimesheet(ts);
       break;
     }
   }
   // TODO: have list presenter before (instead of one)
   m.setCurrentComponent((Component) pres.getView().getComponent());
   setContent(m);
   // and go
   pres.startPresenting();
 }
 private Cookie createLanguageCookie(VaadinRequest request) {
   Cookie langCookie =
       new Cookie(VWebCommonConstants.USER_LANGUAGE_APPCOOKIE, request.getLocale().toString());
   langCookie.setPath(request.getContextPath());
   return langCookie;
 }