public void show(Attendee attendee) { attendeeBean = new BeanItem<>(attendee); fieldGroup.setItemDataSource(attendeeBean); if (attendee.getPaidAmount() == null) { try { paidAmount.setValue(attendee.getBadge().getCostForAge(attendee.getAge()).toString()); } catch(ServiceException e) { Notification.show(e.getMessage()); } } badge.select(attendee.getBadge()); setMinorFieldsEnabled(attendee.isMinor()); checkedIn.setVisible(attendee.getCheckedIn()); // Hide checked in checkbox if attendee is not checked in parentFormReceived.setVisible(attendee.getCheckedIn()); // Hide parentFormReceived if attendee is not checked in badgeNumber.setEnabled(false); showHistory(attendee.getHistory()); firstName.focus(); }
public Attendee generateYouthAttendee(Badge badge) { Attendee attendee = generateDemoAttendee(badge); attendee.setFirstName("Firstname"); attendee.setFanName("Fan Name"); attendee.setBadgeNumber("TST12341"); attendee.setBirthDate(LocalDate.now().minusYears(13L)); attendee.setParentFullName(attendee.getEmergencyContactFullName()); attendee.setParentPhone(attendee.getEmergencyContactPhone()); attendee.setParentIsEmergencyContact(true); try { attendee.setPaidAmount(attendee.getBadge().getCostForAge(attendee.getAge())); } catch (ServiceException e) { log.error(e.getMessage(), e); } return attendee; }
@Override protected List<RequestHandler> createRequestHandlers() throws ServiceException { List<RequestHandler> handlers = super.createRequestHandlers(); handlers.add(0, new ServletBootstrapHandler()); handlers.add(new ServletUIInitHandler()); if (isAtmosphereAvailable()) { handlers.add((RequestHandler) (session, request, response) -> { if (!ServletPortletHelper.isPushRequest(request)) { return false; } if (request instanceof VertxVaadinRequest) { ((VertxVaadinRequest) request).getRoutingContext().next(); } return true; }); } return handlers; }
@Override protected void servletInitialized() throws ServletException { super.servletInitialized(); getService().addSessionInitListener(new SessionInitListener() { /** * */ private static final long serialVersionUID = -8279023207169735541L; @Override public void sessionInit(SessionInitEvent event) throws ServiceException { event.getSession().addUIProvider(uiProvider); } }); }
@Override protected void portletInitialized() throws PortletException { getService().addSessionInitListener(new SessionInitListener() { private static final long serialVersionUID = -4571879262155039969L; @Override public void sessionInit(SessionInitEvent event) throws ServiceException { try { ApplicationContext context = PortletApplicationContextUtils .getRequiredWebApplicationContext(getPortletContext()); SpringAwareUIProvider uiProvider = new SpringAwareUIProvider(context); event.getSession().addUIProvider(uiProvider); } catch (IllegalStateException e) { throw new ServiceException(e); } } }); }
public TestSpringVaadinServletService(VaadinServlet servlet, WebApplicationContext applicationContext) throws ServiceException { super(servlet, new DefaultDeploymentConfiguration(TestSpringVaadinServletService.class, new Properties()), ""); this.appContext = applicationContext; init(); }
@Override protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration) throws ServiceException { JMeterService service = new JMeterService(this, deploymentConfiguration); service.init(); return service; }
@Override protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration) throws ServiceException { VaadinServletService servletService = super.createServletService(deploymentConfiguration); servletService.addSessionInitListener(e -> e.getSession().addUIProvider(this.uiProvider)); servletService.addSessionInitListener(e -> sessions.add(e.getSession())); servletService.addSessionDestroyListener(e -> sessions.remove(e.getSession())); return servletService; }
@Override protected void servletInitialized() throws ServletException { super.servletInitialized(); HeaderTagHandler.init(getService()); getService().addSessionInitListener(new SessionInitListener() { @Override public void sessionInit(SessionInitEvent event) throws ServiceException { event.getSession().addRequestHandler(new RequestHandler() { @Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { String pathInfo = request.getPathInfo(); InputStream in = null; if (pathInfo.endsWith("sw.js")) { response.setContentType("application/javascript"); in = getClass().getResourceAsStream("/sw.js"); } if (in != null) { OutputStream out = response.getOutputStream(); IOUtils.copy(in, out); in.close(); out.close(); return true; } else { return false; } } }); } }); }
public void showBadges(List<Badge> badges) { for (Badge badge : badges) { try { passTypesTable.addRow(badge.getName(), badge.getCostForAge(35L), badge.getCostForAge(17L), badge.getCostForAge(11L), badge.getCostForAge(4L)); } catch (ServiceException e) { notifyError("Error getting age ranges for badge " + badge.getName()); } } passTypesTable.setHeightByRows(badges.size()); }
public Attendee generateDemoAttendee(Badge badge) { Attendee attendee = new Attendee(); attendee.setFirstName("Firstname"); attendee.setLastName("Lastname"); attendee.setFanName("Fan Name"); attendee.setBadgeNumber("TST12340"); attendee.setBadge(badge); attendee.setCountry("United States of America"); attendee.setZip("97201"); attendee.setPhoneNumber("123-123-1234"); attendee.setCheckedIn(true); attendee.setEmergencyContactFullName("Mom"); attendee.setEmergencyContactPhone("321-321-4321"); attendee.setBirthDate(LocalDate.now().minusYears(30L)); attendee.setPaid(true); attendee.setStaffDepartment("Membership"); List<String> positions = new ArrayList<>(); positions.addAll(Arrays.asList("Position 1", "Position 2", "Position 3")); attendee.setStaffPositions(positions); attendee.setStaffDepartmentColor("#FFDDDD"); try { attendee.setPaidAmount(attendee.getBadge().getCostForAge(attendee.getAge())); } catch (ServiceException e) { log.error(e.getMessage(), e); } return attendee; }
public Attendee generateChildAttendee(Badge badge) { Attendee attendee = generateDemoAttendee(badge); attendee.setFirstName("Firstname"); attendee.setFanName("Fan Name"); attendee.setBirthDate(LocalDate.now().minusYears(7L)); attendee.setBadgeNumber("TST12342"); try { attendee.setPaidAmount(attendee.getBadge().getCostForAge(attendee.getAge())); } catch (ServiceException e) { log.error(e.getMessage(), e); } return attendee; }
public BigDecimal getCostForAge(Long age) throws ServiceException { // No birthdate? Charge for adult badge if (age == null) { return getCostForAge(40L); } for (AgeRange ageRange : ageRanges) { if (ageRange.isValidForAge(age)) { return ageRange.getCost(); } } throw new ServiceException("Error: No valid age range found in badge {} for age {}".format(this.name, age)); }
@Override protected void servletInitialized() throws ServletException { super.servletInitialized(); getService().addSessionInitListener(new SessionInitListener() { @Override public void sessionInit(SessionInitEvent event) throws ServiceException { event.getSession().addBootstrapListener(bootstrapListener); } }); }
@Override protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration) throws ServiceException { VaadinServletService servletService = super.createServletService(deploymentConfiguration); servletService.addSessionInitListener(new SessionInitListener() { @Override public void sessionInit(SessionInitEvent sessionInitEvent) throws ServiceException { sessionInitEvent.getSession().addUIProvider(provider); } }); return servletService; }
@Override protected void servletInitialized() throws ServletException { super.servletInitialized(); getService().addSessionInitListener(new SessionInitListener() { @Override public void sessionInit(SessionInitEvent event) throws ServiceException { event.getSession().addUIProvider(uiProvider); } }); }
public TestVaadinSpringSession(WebApplicationContext applicationContext) throws ServiceException { super(new TestSpringVaadinServletService(new SpringVaadinServlet(), applicationContext)); }
public JMeterService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration) throws ServiceException { super(servlet, deploymentConfiguration,null); }
@Override protected VaadinSession createVaadinSession(VaadinRequest request) throws ServiceException { return new JMeterSession(this); }
@Override protected VaadinSession createVaadinSession(VaadinRequest request) throws ServiceException { return new VertxVaadinSession(this); }
@Override public void sessionInit(SessionInitEvent event) throws ServiceException { event.getSession().addUIProvider(provider); }
@Override public void sessionInit(SessionInitEvent event) throws ServiceException { event.getSession().addUIProvider(uiProvider); }
@Override public void sessionInit(SessionInitEvent event) throws ServiceException { // TODO Auto-generated method stub //System.out.println("Session created"); }
@Override public void sessionInit(SessionInitEvent event) throws ServiceException { event.getSession().addBootstrapListener(this); }
@Override public void sessionInit(SessionInitEvent event) throws ServiceException { }
/** * Create a servlet service instance that allows the use of a custom service * URL. * * @param servlet * @param deploymentConfiguration * @param serviceUrl custom service URL to use (relative to context path, starting * with a slash) or null for default * @throws ServiceException */ public Vaadin4SpringServletService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration, String serviceUrl) throws ServiceException { super(servlet, deploymentConfiguration, serviceUrl); logger.info("Using custom Vaadin4Spring servlet service"); applicationContext = WebApplicationContextUtils.getWebApplicationContext(servlet.getServletContext()); }