List of usage examples for com.vaadin.ui Grid Grid
public Grid()
From source file:dhbw.clippinggorilla.userinterface.views.AboutUsView.java
public AboutUsView() { setMargin(true);/* w ww .j ava 2s . com*/ setWidth("55%"); Label aboutUsHeader = new Label(); Language.set(Word.ABOUT_US, aboutUsHeader); aboutUsHeader.setStyleName(ValoTheme.LABEL_H1); addComponent(aboutUsHeader); Label aboutUsGroupHeadline = new Label(); Language.set(Word.GROUP_PROJECT_OF_GROUP_4, aboutUsGroupHeadline); aboutUsGroupHeadline.setStyleName(ValoTheme.LABEL_H2); addComponent(aboutUsGroupHeadline); Label aboutUsText = new Label(); Language.set(Word.GROUP_PROJECT_BODY, aboutUsText); aboutUsText.setWidth("100%"); aboutUsText.setContentMode(com.vaadin.shared.ui.ContentMode.HTML); addComponent(aboutUsText); Label theTeamHeader = new Label(); Language.set(Word.OUR_TEAM, theTeamHeader); theTeamHeader.setStyleName(ValoTheme.LABEL_H2); addComponent(theTeamHeader); Grid<Person> theTeamGrid = new Grid<>(); List<Person> persons = Arrays.asList(new Person("Dan-Pierre", "Drehlich", Person.Function.TEAMLEADER), new Person("Stefan", "Schmid", Person.Function.RESPONSIBLE_FOR_RESEARCH), new Person("Jan", "Striegel", Person.Function.TECHNICAL_ASSISTANT), new Person("Lisa", "Hartung", Person.Function.RESPONSIBLE_FOR_MODELING_QUALITY_ASSURANCE_AND_DOCUMENTATION), new Person("Tim", "Heinzelmann", Person.Function.RESPONSIBLE_FOR_TESTS), new Person("Josua", "Frank", Person.Function.RESPONSIBLE_FOR_IMPLEMENTATION)); Grid.Column c1 = theTeamGrid.addColumn(p -> p.getFirstName()); Language.setCustom(Word.FIRST_NAME, s -> c1.setCaption(s)); Grid.Column c2 = theTeamGrid.addColumn(p -> p.getLastName()); Language.setCustom(Word.LAST_NAME, s -> c2.setCaption(s)); Grid.Column c3 = theTeamGrid.addColumn(p -> p.getResposibility()); Language.setCustom(Word.RESPONSIBILITY, s -> { c3.setCaption(s); theTeamGrid.getDataProvider().refreshAll(); }); theTeamGrid.setItems(persons); theTeamGrid.setWidth("100%"); theTeamGrid.setHeightByRows(6); addComponent(theTeamGrid); SESSIONS.put(VaadinSession.getCurrent(), this); }
From source file:dhbw.clippinggorilla.userinterface.views.ArchiveView.java
public ArchiveView() { HorizontalLayout optionsLayout = new HorizontalLayout(); optionsLayout.setWidth("100%"); Grid<Clipping> gridClippings = new Grid<>(); Set<Clipping> clippings = ClippingUtils.getUserClippings(UserUtils.getCurrent(), LocalDate.now(ZoneId.of("Europe/Berlin"))); gridClippings.setItems(clippings);/*from w ww .j a v a 2 s . co m*/ InlineDateTimeField datePicker = new InlineDateTimeField(); datePicker.setValue(LocalDateTime.now(ZoneId.of("Europe/Berlin"))); datePicker.setLocale(Locale.GERMANY); datePicker.setResolution(DateTimeResolution.DAY); datePicker.addValueChangeListener(date -> { Set<Clipping> clippingsOfDate = ClippingUtils.getUserClippings(UserUtils.getCurrent(), date.getValue().toLocalDate()); gridClippings.setItems(clippingsOfDate); gridClippings.getDataProvider().refreshAll(); }); DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.MEDIUM); formatter.withZone(ZoneId.of("Europe/Berlin")); Column columnTime = gridClippings.addColumn(c -> { return c.getDate().format(formatter); }); Language.setCustom(Word.TIME, s -> columnTime.setCaption(s)); Column columnAmountArticles = gridClippings.addColumn(c -> { long amountArticles = c.getArticles().values().stream().flatMap(l -> l.stream()).count(); amountArticles += c.getArticlesFromGroup().values().stream().flatMap(l -> l.stream()).count(); if (amountArticles != 1) { return amountArticles + " " + Language.get(Word.ARTICLES); } else { return amountArticles + " " + Language.get(Word.ARTICLE); } }); Language.setCustom(Word.ARTICLES, s -> { columnAmountArticles.setCaption(s); gridClippings.getDataProvider().refreshAll(); }); gridClippings.setHeight("100%"); gridClippings.setSelectionMode(Grid.SelectionMode.SINGLE); gridClippings.addSelectionListener(c -> { if (c.getFirstSelectedItem().isPresent()) { currentClipping = c.getFirstSelectedItem().get(); showClippingBy(currentClipping, currentSort); } }); optionsLayout.addComponents(datePicker, gridClippings); optionsLayout.setComponentAlignment(datePicker, Alignment.BOTTOM_CENTER); optionsLayout.setComponentAlignment(gridClippings, Alignment.BOTTOM_RIGHT); optionsLayout.setExpandRatio(gridClippings, 5); VerticalLayout sortLayout = new VerticalLayout(); comboBoxSortOptions = new ComboBox<>(Language.get(Word.SORT_BY)); Language.setCustom(Word.SORT_BY, s -> { comboBoxSortOptions.setCaption(s); comboBoxSortOptions.getDataProvider().refreshAll(); }); comboBoxSortOptions.setItems(EnumSet.allOf(ClippingView.SortOptions.class)); comboBoxSortOptions.setItemCaptionGenerator(s -> s.getName()); comboBoxSortOptions.setItemIconGenerator(s -> s.getIcon()); comboBoxSortOptions.setValue(currentSort); comboBoxSortOptions.setTextInputAllowed(false); comboBoxSortOptions.setEmptySelectionAllowed(false); comboBoxSortOptions.addStyleName("comboboxsort"); comboBoxSortOptions.addValueChangeListener(e -> { currentSort = e.getValue(); showClippingBy(currentClipping, currentSort); }); comboBoxSortOptions.setVisible(false); sortLayout.setMargin(false); sortLayout.setSpacing(false); sortLayout.addComponent(comboBoxSortOptions); clippingArticlesLayout = new VerticalLayout(); clippingArticlesLayout.setSpacing(true); clippingArticlesLayout.setMargin(false); clippingArticlesLayout.setSizeFull(); addComponents(optionsLayout, sortLayout, clippingArticlesLayout); }
From source file:dhbw.clippinggorilla.userinterface.views.ImpressumView.java
public ImpressumView() { setMargin(true);//from ww w.j a v a 2 s. com setWidth("55%"); Label impressumHeader = new Label(); Language.set(Word.IMPRESSUM, impressumHeader); impressumHeader.setStyleName(ValoTheme.LABEL_H1); addComponent(impressumHeader); Label impressumText = new Label(); Language.set(Word.IMPRESSUM_BODY, impressumText); impressumText.setWidth("100%"); impressumText.setContentMode(com.vaadin.shared.ui.ContentMode.HTML); addComponent(impressumText); Grid<Person> studentsGrid = new Grid<>(); List<Person> persons = Arrays.asList(new Person("Dan-Pierre", "Drehlich", Person.Function.TEAMLEADER), new Person("Stefan", "Schmid", Person.Function.RESPONSIBLE_FOR_RESEARCH), new Person("Jan", "Striegel", Person.Function.TECHNICAL_ASSISTANT), new Person("Lisa", "Hartung", Person.Function.RESPONSIBLE_FOR_MODELING_QUALITY_ASSURANCE_AND_DOCUMENTATION), new Person("Tim", "Heinzelmann", Person.Function.RESPONSIBLE_FOR_TESTS), new Person("Josua", "Frank", Person.Function.RESPONSIBLE_FOR_IMPLEMENTATION)); Column c1 = studentsGrid.addColumn(p -> p.getFirstName()); Language.setCustom(Word.FIRST_NAME, s -> c1.setCaption(s)); Column c2 = studentsGrid.addColumn(p -> p.getLastName()); Language.setCustom(Word.LAST_NAME, s -> c2.setCaption(s)); Column c3 = studentsGrid.addColumn(p -> p.getResposibility()); Language.setCustom(Word.RESPONSIBILITY, s -> { c3.setCaption(s); studentsGrid.getDataProvider().refreshAll(); }); studentsGrid.setItems(persons); studentsGrid.setWidth("100%"); studentsGrid.setHeightByRows(6); addComponent(studentsGrid); Label liabilityHeadline = new Label(); Language.set(Word.LIABILITY, liabilityHeadline); liabilityHeadline.setStyleName(ValoTheme.LABEL_H1); addComponent(liabilityHeadline); Label liabilityContentHeadline = new Label(); Language.set(Word.LIABILITY_CONTENT, liabilityContentHeadline); liabilityContentHeadline.setStyleName(ValoTheme.LABEL_H2); addComponent(liabilityContentHeadline); Label liabilityContentText = new Label(); Language.set(Word.LIABILITY_CONTENT_BODY, liabilityContentText); liabilityContentText.setWidth("100%"); addComponent(liabilityContentText); Label liabilityLinksHeadline = new Label(); Language.set(Word.LIABILITY_LINKS, liabilityLinksHeadline); liabilityLinksHeadline.setStyleName(ValoTheme.LABEL_H2); addComponent(liabilityLinksHeadline); Label liabilityLinksText = new Label(); Language.set(Word.LIABILITY_LINKS_BODY, liabilityLinksText); liabilityLinksText.setWidth("100%"); addComponent(liabilityLinksText); Label copyrightHeadline = new Label(); Language.set(Word.COPYRIGHT, copyrightHeadline); copyrightHeadline.setStyleName(ValoTheme.LABEL_H2); addComponent(copyrightHeadline); Label copyrightText = new Label(); Language.set(Word.COPYRIGHT_BODY, copyrightText); copyrightText.setWidth("100%"); addComponent(copyrightText); Label dataProtectionHeadline = new Label(); Language.set(Word.DATAPROTECTION, dataProtectionHeadline); dataProtectionHeadline.setStyleName(ValoTheme.LABEL_H2); addComponent(dataProtectionHeadline); Label dataProtectionText = new Label(); Language.set(Word.DATAPROTECTION_BODY, dataProtectionText); dataProtectionText.setWidth("100%"); addComponent(dataProtectionText); SESSIONS.put(VaadinSession.getCurrent(), this); }
From source file:ec.com.vipsoft.ce.ui.FacturaView.java
public void construirGui() { HorizontalLayout l1 = new HorizontalLayout(); l1.setSpacing(true);//ww w. j av a 2 s .c o m tipoFactura = new ComboBox(); tipoFactura.addItem("regular"); tipoFactura.setItemCaption("regular", "REGULAR"); tipoFactura.addItem("exportacion"); tipoFactura.setItemCaption("exportacion", "EXPORTACION"); tipoFactura.addItem("reembolso"); tipoFactura.setItemCaption("reembolso", "REEMBOLSO"); tipoFactura.setNullSelectionAllowed(false); tipoFactura.setValue("regular"); tipoIdentificacion = new ComboBox(); tipoIdentificacion.addItem("05"); tipoIdentificacion.setItemCaption("05", "CEDULA"); tipoIdentificacion.addItem("06"); tipoIdentificacion.setItemCaption("06", "PASAPORTE"); tipoIdentificacion.addItem("07"); tipoIdentificacion.setItemCaption("07", "FINAL"); tipoIdentificacion.addItem("08"); tipoIdentificacion.setItemCaption("08", "ID EXTERIOR"); tipoIdentificacion.addItem("04"); tipoIdentificacion.setItemCaption("04", "RUC"); tipoIdentificacion.setNullSelectionAllowed(false); tipoIdentificacion.setValue("04"); l1.addComponent(tipoIdentificacion); rucBeneficiario = new CampoNumeroIdentificacion(); l1.addComponent(rucBeneficiario); Label lrazonSocial = new Label("R. Social"); l1.addComponent(lrazonSocial); razonSocialBeneficiario = new CampoRazonSocial(); l1.addComponent(razonSocialBeneficiario); Label ldireccion = new Label("Dir."); l1.addComponent(ldireccion); direccion = new CampoDireccion(); l1.addComponent(direccion); fechaEmision = new CampoFecha(); l1.addComponent(fechaEmision); ////////////////////////////////////////// HorizontalLayout l2 = new HorizontalLayout(); l2.setSpacing(true); Label lordenCompra = new Label("OC"); setMargin(true); l2.addComponent(lordenCompra); ordenCompra = new TextField(); ordenCompra.setWidth("70px"); l2.addComponent(ordenCompra); Label lvencimiento = new Label("Cond. Pago"); l2.addComponent(lvencimiento); formaPago = new CampoCodigo(); formaPago.setWidth("100px"); l2.addComponent(formaPago); Label lguia = new Label("Gua Remisin"); l2.addComponent(lguia); numeroGuiaRemision = new CampoNumeroComprobante(); l2.addComponent(numeroGuiaRemision); Label lsucursalCliente = new Label("Sucursal cliente"); l2.addComponent(lsucursalCliente); codigoEstablecimientoDestino = new CampoCodigo(); codigoEstablecimientoDestino.setInputPrompt("001"); codigoEstablecimientoDestino.setWidth("70px"); l2.addComponent(codigoEstablecimientoDestino); //////////////////////////////// codigoIVA = new ComboBox(); codigoIVA.addItem("0"); codigoIVA.addItem("2"); codigoIVA.setNullSelectionAllowed(false); codigoIVA.setValue("2"); codigoIVA.setItemCaption("0", "0%"); codigoIVA.setItemCaption("2", "12%"); codigoIVA.setWidth("80px"); HorizontalLayout l3 = new HorizontalLayout(); l3.setSpacing(true); botonBuscarDetalle = new BotonBuscar(); l3.addComponent(botonBuscarDetalle); codigoP = new TextField(); codigoP.setWidth("80px"); l3.addComponent(codigoP); bienSeleccionado = new TextField(); bienSeleccionado.setWidth("150px"); l3.addComponent(bienSeleccionado); l3.addComponent(new Label("IVA")); l3.addComponent(codigoIVA); Label lcantidad = new Label("Cant."); l3.addComponent(lcantidad); cantidad = new CampoCantidad(); l3.addComponent(cantidad); Label lvalorU = new Label("V. Unitario"); l3.addComponent(lvalorU); valorUnitario = new CampoDinero(); l3.addComponent(valorUnitario); Label ldescuento = new Label("Dcto."); l3.addComponent(ldescuento); descuento = new CampoDinero(); l3.addComponent(descuento); Label labelLote = new Label("lote"); l3.addComponent(labelLote); lote = new TextField(); lote.setInputPrompt("lote 323, expira 2016-05-22"); lote.setWidth("165px"); botonAnadirDetalle = new BotonAnadir(); l3.addComponent(lote); l3.addComponent(botonAnadirDetalle); botonEliminarDetalle = new BotonRemoverDetalle(); l3.addComponent(botonEliminarDetalle); botonRegistrar = new BotonRegistrar(); botonCancelar = new BotonCancelar(); //l3.addComponent(botonRegistrar); //l3.addComponent(botonCancelar); //////////////////////////////////////// HorizontalLayout l4 = new HorizontalLayout(); l4.setSizeFull(); tablaDetalles = new Grid(); beanContainerDetalles = new BeanItemContainer<FacturaDetalleBinding>(FacturaDetalleBinding.class); tablaDetalles.setContainerDataSource(beanContainerDetalles); // tablaDetalles.setEditorEnabled(true); // tablaDetalles.setPageLength(5); // tablaDetalles.setSelectable(true); // tablaDetalles.setMultiSelect(false); tablaDetalles.setWidth("100%"); tablaDetalles.setReadOnly(true); tablaDetalles.removeColumn("infoAdicional3"); tablaDetalles.removeColumn("infoAdicional2"); tablaDetalles.removeColumn("codigoAlterno"); tablaDetalles.removeColumn("codigoIVA"); tablaDetalles.removeColumn("ice"); tablaDetalles.setColumnOrder("cantidad", "codigo", "descripcion", "infoAdicional1", "valorUnitario", "descuento", "iva12", "valorTotal"); l4.addComponent(tablaDetalles); l4.setComponentAlignment(tablaDetalles, Alignment.MIDDLE_CENTER); ///////////////////////////////////////////////////////7 HorizontalLayout l5 = new HorizontalLayout(); l5.setSpacing(true); l5.addComponent(tipoFactura); Label lcountry = new Label("PAIS DETINO"); l5.addComponent(lcountry); comboPaisDestino = construirComboPaises(); l5.addComponent(comboPaisDestino); HorizontalLayout l6 = new HorizontalLayout(); l6.setSpacing(true); subtotal = new Label("Subtotal $0.00"); iva12 = new Label("IVA12% $0.00"); ice = new Label("ICE $0.00"); total = new Label("TOTAL $0.00"); l6.addComponent(subtotal); l6.addComponent(iva12); l6.addComponent(ice); l6.addComponent(total); l6.addComponent(botonRegistrar); l6.addComponent(botonCancelar); l5.addComponent(l6); // l5.addComponent(botonRegistrar); // l5.addComponent(botonCancelar); // l5.setSizeFull(); // VerticalLayout v1=new VerticalLayout(); // Label linfo=new Label("Info"); // HorizontalLayout vl1=new HorizontalLayout(); // vl1.setSpacing(true); // vl1.addComponent(linfo); // // v1.addComponent(vl1); // VerticalLayout v2=new VerticalLayout(); // v2.setSizeFull(); // // HorizontalLayout v2l1=new HorizontalLayout(); // v2l1.addComponent(botonRegistrar); // v2l1.addComponent(botonCancelar); // v2.addComponent(v2l1); // v2.setComponentAlignment(v2l1, Alignment.TOP_RIGHT); // l5.addComponent(v1); // l5.addComponent(v2); ////////////////////////////////////////////// setSpacing(true); addComponent(l1); addComponent(l2); addComponent(l3); addComponent(l4); addComponent(l5); setComponentAlignment(l1, Alignment.MIDDLE_CENTER); setComponentAlignment(l2, Alignment.MIDDLE_CENTER); setComponentAlignment(l3, Alignment.MIDDLE_CENTER); setComponentAlignment(l4, Alignment.MIDDLE_CENTER); // setComponentAlignment(l5, Alignment.MIDDLE_CENTER); }
From source file:ec.com.vipsoft.ce.ui.FacturaView.java
@PostConstruct public void postconstructor() { construirGui();//from w w w . j ava 2 s .c o m tipoIdentificacion.addValueChangeListener(event -> { String seleccionado = (String) tipoIdentificacion.getValue(); if (seleccionado.equalsIgnoreCase("07")) { razonSocialBeneficiario.setValue("Consumidor Final"); rucBeneficiario.setValue("9999999999999"); direccion.setValue("Consumidor Final"); razonSocialBeneficiario.setReadOnly(true); rucBeneficiario.setReadOnly(true); direccion.setReadOnly(true); } else { razonSocialBeneficiario.setReadOnly(false); rucBeneficiario.setReadOnly(false); direccion.setReadOnly(false); } }); final SimpleStringFilter filtro; gridBusqueda = new Grid(); beaitem = new BeanItemContainer<BienEconomico>(BienEconomico.class); gridBusqueda.setContainerDataSource(beaitem); gridBusqueda.setSizeFull(); // gridBusqueda.setVisibleColumns(new Object[]{"codigo","descripcion"}); gridBusqueda.removeColumn("id"); gridBusqueda.removeColumn("codigoIva"); gridBusqueda.removeColumn("codigoIce"); gridBusqueda.removeColumn("entidad"); gridBusqueda.setColumnOrder("codigo", "descripcion"); gridBusqueda.setSelectionMode(SelectionMode.SINGLE); // tfiltro.setImmediate(true); botonSeleccionaDesdeVentanar = new Button("seleccionar"); HorizontalLayout lbus = new HorizontalLayout(); lbus.setSpacing(true); lbus.setMargin(true); lbus.addComponent(new Label("cdigo")); lbus.addComponent(campoBusquedaProducto); lbus.addComponent(botonSeleccionaDesdeVentanar); beaitem.addAll(listadorBienes.listarBienesDisponibles(userInfo.getRucEmisor())); VerticalLayout layoutventana = new VerticalLayout(); layoutventana.setSpacing(true); layoutventana.setMargin(true); layoutventana.addComponent(lbus); layoutventana.addComponent(gridBusqueda); ventana.setContent(layoutventana); ventana.center(); iniciarEventos(); this.campoBusquedaProducto .addTextChangeListener((FieldEvents.TextChangeListener) new FieldEvents.TextChangeListener() { private static final long serialVersionUID = 5128049403423426140L; SimpleStringFilter filter; public void textChange(FieldEvents.TextChangeEvent event) { Container.Filterable f = (Container.Filterable) gridBusqueda.getContainerDataSource(); if (this.filter != null) { f.removeContainerFilter((Container.Filter) this.filter); } this.filter = new SimpleStringFilter((Object) "codigo", event.getText(), true, false); f.addContainerFilter((Container.Filter) this.filter); } }); }
From source file:facs.components.UploadBox.java
License:Open Source License
public UploadBox() { this.setCaption(CAPTION); // there has to be a device selected. devices = new NativeSelect("Devices"); devices.setDescription("Select a device in order to upload information for that specific devices."); devices.setNullSelectionAllowed(false); deviceNameToId = new HashMap<String, Integer>(); for (DeviceBean bean : DBManager.getDatabaseInstance().getDevices()) { deviceNameToId.put(bean.getName(), bean.getId()); devices.addItem(bean.getName()); // System.out.println("Bean.getName: " + bean.getName() + " Bean.getId: " + bean.getId()); }/*from w ww.ja v a 2s. com*/ occupationGrid = new Grid(); occupationGrid.setSizeFull(); // Create the upload component and handle all its events final Upload upload = new Upload(); upload.setReceiver(this); upload.addProgressListener(this); upload.addFailedListener(this); upload.addSucceededListener(this); upload.setVisible(false); // one can only upload csvs, if a device was selected. devices.addValueChangeListener(new ValueChangeListener() { /** * */ private static final long serialVersionUID = 7890499571475184208L; @Override public void valueChange(ValueChangeEvent event) { upload.setVisible(event.getProperty().getValue() != null); } }); // Put the upload and image display in a panel // Panel panel = new Panel(UPLOAD_CAPTION); // panel.setWidth("100%"); VerticalLayout panelContent = new VerticalLayout(); panelContent.setSpacing(true); // panel.setContent(panelContent); panelContent.addComponent(devices); panelContent.addComponent(upload); panelContent.addComponent(progress); panelContent.addComponent(occupationGrid); panelContent.setMargin(true); panelContent.setSpacing(true); progress.setVisible(false); setCompositionRoot(panelContent); }
From source file:fi.jasoft.dragdroplayouts.demo.DemoUI.java
License:Apache License
private Grid<DemoView> createViewSelection() { Grid<DemoView> select = new Grid<>(); select.addColumn(view -> view.getCaption()); select.setWidth("200px"); select.setHeight("100%"); select.addSelectionListener((change) -> { navigator.navigateTo(change.getFirstSelectedItem().get().getName()); });//from www . j av a2 s .c o m select.setItems(views); return select; }
From source file:io.pivotal.pde.demo.tracker.gemfire.TrackerUI.java
@Override protected void init(VaadinRequest request) { this.grid = new Grid(); this.filter = new TextField(); this.addNewBtn = new Button("Check In", FontAwesome.PLUS); ApplicationContext ctx = (ApplicationContext) VaadinServlet.getCurrent().getServletContext() .getAttribute("spring-context"); this.repo = ctx.getBean(CheckInRepository.class); this.editor = ctx.getBean(CheckInEditor.class); // build layout HorizontalLayout actions = new HorizontalLayout(filter, addNewBtn); VerticalLayout mainLayout = new VerticalLayout(actions, grid, editor); setContent(mainLayout);/*from w ww.j a va 2 s. c o m*/ // Configure layouts and components actions.setSpacing(true); mainLayout.setMargin(true); mainLayout.setSpacing(true); grid.setHeight(300, Unit.PIXELS); grid.setWidth(550, Unit.PIXELS); grid.setColumns("plate", "city", "timestamp"); grid.setContainerDataSource(new BeanItemContainer<CheckIn>(CheckIn.class)); filter.setInputPrompt("Filter by License Plate"); // Hook logic to components // Replace listing with filtered content when user changes filter filter.addTextChangeListener(e -> refillGrid(e.getText())); // Show the form when new button is clicked addNewBtn.addClickListener(e -> editor.newCheckIn()); // Listen changes made by the editor, refresh data from backend editor.setChangeHandler(new CheckInEditor.ChangeHandler() { @Override public void onChange() { editor.setVisible(false); refillGrid(filter.getValue()); } }); CheckInCacheListener changeListener = ctx.getBean(CheckInCacheListener.class); changeListener.setHandler(this); // this.setPollInterval(5000); // Initialize listing refillGrid(null); }
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.CoordMobileAuthView.java
License:Open Source License
public CoordMobileAuthView(String CoordID) { CtCoordinator ctCoordinator = (CtCoordinator) sys .getCtCoordinator(new DtCoordinatorID(new PtString(CoordID))); ActCoordinator actCoordinator = sys.getActCoordinator(ctCoordinator); actCoordinator.setActorUI(UI.getCurrent()); env.setActCoordinator(actCoordinator.getName(), actCoordinator); IcrashSystem.assCtAuthenticatedActAuthenticated.replace(ctCoordinator, actCoordinator); IcrashSystem.assCtCoordinatorActCoordinator.replace(ctCoordinator, actCoordinator); thisCoordID = CoordID;//from w w w . j a va 2 s. co m setResponsive(true); setWidth("100%"); NavigationBar alertsBar = new NavigationBar(); VerticalComponentGroup alertsContent = new VerticalComponentGroup(); alertsContent.setWidth("100%"); alertsContent.setResponsive(true); HorizontalLayout alertButtons1 = new HorizontalLayout(); HorizontalLayout alertButtons2 = new HorizontalLayout(); //alertButtons.setMargin(true); //alertButtons.setSpacing(true); alertsBar.setCaption("Coordinator " + ctCoordinator.login.toString()); // NavigationButton logoutBtn1 = new NavigationButton("Logout"); Button logoutBtn1 = new Button("Logout"); alertsBar.setRightComponent(logoutBtn1); alertsTable = new Grid(); alertsTable.setContainerDataSource(actCoordinator.getAlertsContainer()); alertsTable.setColumnOrder("ID", "date", "time", "longitude", "latitude", "comment", "status"); alertsTable.setSelectionMode(SelectionMode.SINGLE); alertsTable.setWidth("100%"); alertsTable.setResponsive(true); //alertsTable.setSizeUndefined(); alertsTable.setImmediate(true); Grid inputEventsTable1 = new Grid(); inputEventsTable1.setContainerDataSource(actCoordinator.getMessagesDataSource()); inputEventsTable1.setWidth("100%"); inputEventsTable1.setResponsive(true); alertsContent.addComponents(alertsBar, alertButtons1, alertButtons2, alertsTable, inputEventsTable1); Tab alertsTab = this.addTab(alertsContent); alertsTab.setCaption("Alerts"); alertStatus = new NativeSelect(); alertStatus.setNullSelectionAllowed(false); alertStatus.addItems("Pending", "Valid", "Invalid"); alertStatus.setImmediate(true); alertStatus.select("Pending"); Button validateAlertBtn = new Button("Validate"); Button invalidateAlertBtn = new Button("Invalidate"); Button getAlertsSetBtn = new Button("Get alerts set"); validateAlertBtn.setImmediate(true); invalidateAlertBtn.setImmediate(true); validateAlertBtn.addClickListener(event -> { AlertBean selectedAlertBean = (AlertBean) alertsTable.getSelectedRow(); Integer thisAlertID = new Integer(selectedAlertBean.getID()); PtBoolean res; res = sys.oeValidateAlert(new DtAlertID(new PtString(thisAlertID.toString()))); }); invalidateAlertBtn.addClickListener(event -> { AlertBean selectedAlertBean = (AlertBean) alertsTable.getSelectedRow(); Integer thisAlertID = new Integer(selectedAlertBean.getID()); PtBoolean res; res = sys.oeInvalidateAlert(new DtAlertID(new PtString(thisAlertID.toString()))); }); getAlertsSetBtn.addClickListener(event -> { if (alertStatus.getValue().toString().equals("Pending")) actCoordinator.oeGetAlertsSet(EtAlertStatus.pending); else if (alertStatus.getValue().toString().equals("Valid")) actCoordinator.oeGetAlertsSet(EtAlertStatus.valid); else if (alertStatus.getValue().toString().equals("Invalid")) actCoordinator.oeGetAlertsSet(EtAlertStatus.invalid); }); alertButtons1.addComponents(validateAlertBtn, invalidateAlertBtn); alertButtons2.addComponents(getAlertsSetBtn, alertStatus); ////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////// NavigationBar crisesBar = new NavigationBar(); VerticalComponentGroup crisesContent = new VerticalComponentGroup(); crisesContent.setWidth("100%"); crisesContent.setResponsive(true); HorizontalLayout crisesButtons1 = new HorizontalLayout(); HorizontalLayout crisesButtons2 = new HorizontalLayout(); crisesBar.setCaption("Coordinator " + ctCoordinator.login.toString()); //NavigationButton logoutBtn2 = new NavigationButton("Logout"); Button logoutBtn2 = new Button("Logout"); crisesBar.setRightComponent(logoutBtn2); crisesTable = new Grid(); crisesTable.setContainerDataSource(actCoordinator.getCrisesContainer()); crisesTable.setColumnOrder("ID", "date", "time", "type", "longitude", "latitude", "comment", "status"); crisesTable.setSelectionMode(SelectionMode.SINGLE); crisesTable.setWidth("100%"); //crisesTable.setSizeUndefined(); crisesTable.setImmediate(true); crisesTable.setResponsive(true); Grid inputEventsTable2 = new Grid(); inputEventsTable2.setContainerDataSource(actCoordinator.getMessagesDataSource()); inputEventsTable2.setWidth("100%"); inputEventsTable2.setResponsive(true); crisesContent.addComponents(crisesBar, crisesButtons1, crisesButtons2, crisesTable, inputEventsTable2); Tab crisesTab = this.addTab(crisesContent); crisesTab.setCaption("Crises"); Button handleCrisesBtn = new Button("Handle"); Button reportOnCrisisBtn = new Button("Report"); Button changeCrisisStatusBtn = new Button("Status"); Button closeCrisisBtn = new Button("Close"); Button getCrisesSetBtn = new Button("Get crises set"); crisesStatus = new NativeSelect(); handleCrisesBtn.setImmediate(true); reportOnCrisisBtn.setImmediate(true); changeCrisisStatusBtn.setImmediate(true); closeCrisisBtn.setImmediate(true); getCrisesSetBtn.setImmediate(true); crisesStatus.setImmediate(true); crisesStatus.addItems("Pending", "Handled", "Solved", "Closed"); crisesStatus.setNullSelectionAllowed(false); crisesStatus.select("Pending"); crisesButtons1.addComponents(handleCrisesBtn, reportOnCrisisBtn, changeCrisisStatusBtn); crisesButtons2.addComponents(closeCrisisBtn, getCrisesSetBtn, crisesStatus); //////////////////////////////////////// Window reportCrisisSubWindow = new Window(); reportCrisisSubWindow.setClosable(false); reportCrisisSubWindow.setResizable(false); reportCrisisSubWindow.setResponsive(true); VerticalLayout reportLayout = new VerticalLayout(); reportLayout.setMargin(true); reportLayout.setSpacing(true); reportCrisisSubWindow.setContent(reportLayout); TextField crisisID = new TextField(); TextField reportText = new TextField(); HorizontalLayout buttonsLayout = new HorizontalLayout(); Button reportCrisisBtn = new Button("Report"); reportCrisisBtn.setClickShortcut(KeyCode.ENTER); reportCrisisBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); Button cancelBtn = new Button("Cancel"); buttonsLayout.addComponents(reportCrisisBtn, cancelBtn); buttonsLayout.setSpacing(true); reportLayout.addComponents(crisisID, reportText, buttonsLayout); cancelBtn.addClickListener(event -> { reportCrisisSubWindow.close(); reportText.clear(); }); reportCrisisBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); actCoordinator.oeReportOnCrisis(new DtCrisisID(new PtString(thisCrisisID.toString())), new DtComment(new PtString(reportText.getValue()))); reportCrisisSubWindow.close(); reportText.clear(); }); //////////////////////////////////////// Window changeCrisisStatusSubWindow = new Window(); changeCrisisStatusSubWindow.setClosable(false); changeCrisisStatusSubWindow.setResizable(false); changeCrisisStatusSubWindow.setResponsive(true); VerticalLayout statusLayout = new VerticalLayout(); statusLayout.setMargin(true); statusLayout.setSpacing(true); changeCrisisStatusSubWindow.setContent(statusLayout); TextField crisisID1 = new TextField(); NativeSelect crisisStatus = new NativeSelect("crisis status"); crisisStatus.addItems("Pending", "Handled", "Solved", "Closed"); crisisStatus.setNullSelectionAllowed(false); crisisStatus.select("Pending"); HorizontalLayout buttonsLayout1 = new HorizontalLayout(); Button changeCrisisStatusBtn1 = new Button("Change status"); changeCrisisStatusBtn1.setClickShortcut(KeyCode.ENTER); changeCrisisStatusBtn1.addStyleName(ValoTheme.BUTTON_PRIMARY); Button cancelBtn1 = new Button("Cancel"); buttonsLayout1.addComponents(changeCrisisStatusBtn1, cancelBtn1); buttonsLayout1.setSpacing(true); statusLayout.addComponents(crisisID1, crisisStatus, buttonsLayout1); cancelBtn1.addClickListener(event -> changeCrisisStatusSubWindow.close()); changeCrisisStatusBtn1.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); EtCrisisStatus statusToPut = null; if (crisisStatus.getValue().toString().equals("Pending")) statusToPut = EtCrisisStatus.pending; if (crisisStatus.getValue().toString().equals("Handled")) statusToPut = EtCrisisStatus.handled; if (crisisStatus.getValue().toString().equals("Solved")) statusToPut = EtCrisisStatus.solved; if (crisisStatus.getValue().toString().equals("Closed")) statusToPut = EtCrisisStatus.closed; PtBoolean res = actCoordinator.oeSetCrisisStatus(new DtCrisisID(new PtString(thisCrisisID.toString())), statusToPut); changeCrisisStatusSubWindow.close(); }); //////////////////////////////////////// handleCrisesBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); PtBoolean res = actCoordinator .oeSetCrisisHandler(new DtCrisisID(new PtString(thisCrisisID.toString()))); }); reportOnCrisisBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); reportCrisisSubWindow.center(); crisisID.setValue(thisCrisisID.toString()); crisisID.setEnabled(false); reportText.focus(); UI.getCurrent().addWindow(reportCrisisSubWindow); }); changeCrisisStatusBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); changeCrisisStatusSubWindow.center(); crisisID1.setValue(thisCrisisID.toString()); crisisID1.setEnabled(false); crisisStatus.focus(); UI.getCurrent().addWindow(changeCrisisStatusSubWindow); }); closeCrisisBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); PtBoolean res = actCoordinator.oeCloseCrisis(new DtCrisisID(new PtString(thisCrisisID.toString()))); }); getCrisesSetBtn.addClickListener(event -> { if (crisesStatus.getValue().toString().equals("Closed")) actCoordinator.oeGetCrisisSet(EtCrisisStatus.closed); if (crisesStatus.getValue().toString().equals("Handled")) actCoordinator.oeGetCrisisSet(EtCrisisStatus.handled); if (crisesStatus.getValue().toString().equals("Solved")) actCoordinator.oeGetCrisisSet(EtCrisisStatus.solved); if (crisesStatus.getValue().toString().equals("Pending")) actCoordinator.oeGetCrisisSet(EtCrisisStatus.pending); }); ClickListener logoutAction = event -> { PtBoolean res; try { res = actCoordinator.oeLogout(); if (res.getValue()) { } } catch (Exception e) { e.printStackTrace(); } Page.getCurrent().reload(); }; logoutBtn1.addClickListener(logoutAction); logoutBtn2.addClickListener(logoutAction); }
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.CoordMobileLoginView.java
License:Open Source License
public CoordMobileLoginView(String CoordID) { CtCoordinator ctCoordinator = (CtCoordinator) sys .getCtCoordinator(new DtCoordinatorID(new PtString(CoordID))); ActCoordinator actCoordinator = env.getActCoordinator(ctCoordinator.login); actCoordinator.setActorUI(UI.getCurrent()); env.setActCoordinator(actCoordinator.getName(), actCoordinator); IcrashSystem.assCtAuthenticatedActAuthenticated.replace(ctCoordinator, actCoordinator); IcrashSystem.assCtCoordinatorActCoordinator.replace(ctCoordinator, actCoordinator); setCaption("Login to Coord " + ctCoordinator.login.toString()); VerticalLayout layout = new VerticalLayout(); setContent(layout);//w ww . ja va 2 s.c o m VerticalComponentGroup group = new VerticalComponentGroup(); layout.addComponent(group); VerticalLayout loginExtLayout = new VerticalLayout(); loginExtLayout.setSizeFull(); group.addComponent(loginExtLayout); FormLayout loginIntLayout = new FormLayout(); loginIntLayout.setSizeUndefined(); loginExtLayout.addComponent(loginIntLayout); loginExtLayout.setComponentAlignment(loginIntLayout, Alignment.MIDDLE_CENTER); login.setInputPrompt("Coord login"); pwd.setValue(""); pwd.setNullRepresentation(""); loginBtn.setClickShortcut(KeyCode.ENTER); loginIntLayout.addComponents(login, pwd, loginBtn); /////////////////////////////////////////////////////////////////////////////////// Grid messagesTable = new Grid(); messagesTable.setContainerDataSource(actCoordinator.getMessagesDataSource()); messagesTable.setSizeUndefined(); VerticalLayout tableLayout = new VerticalLayout(); tableLayout.setSizeFull(); group.addComponent(tableLayout); tableLayout.addComponent(messagesTable); tableLayout.setComponentAlignment(messagesTable, Alignment.MIDDLE_CENTER); /////////////////////////////////////////////////////////////////////////////////// loginBtn.addClickListener(event -> { PtBoolean res; try { res = actCoordinator.oeLogin(new DtLogin(new PtString(login.getValue())), new DtPassword(new PtString(pwd.getValue()))); log.info("oeLogin returned " + res.getValue()); if (res.getValue()) { log.debug("After actCoordinator.oeLogin: JUST LOGGED IN, so Coord's vpIsLogged = " + ctCoordinator.vpIsLogged.getValue()); } } catch (Exception e) { e.printStackTrace(); } // refreshing this view forces redirection of the user // to the view, where he should go now, be it CoordLoginView or CoordAuthView Page.getCurrent().reload(); actCoordinator.setActorUI(UI.getCurrent()); env.setActCoordinator(actCoordinator.getName(), actCoordinator); IcrashSystem.assCtAuthenticatedActAuthenticated.replace(ctCoordinator, actCoordinator); IcrashSystem.assCtCoordinatorActCoordinator.replace(ctCoordinator, actCoordinator); }); }