List of usage examples for com.vaadin.ui Window Window
public Window(String caption)
From source file:com.tapas.evidence.fe.teacher.TeacherPresenter.java
License:Apache License
private void showCreateEditDialog(final TeacherDTO teacherDTO) throws ViewFactoryException { // create view final TeacherDetail view = this.createView(TeacherDetail.class); // configure the form with bean item this.teacherForm = view.getTeacherForm(); final MetaModel metaModel = formService.getMetaModel(teacherDTO); this.teacherForm.setItemDataSource(teacherDTO, metaModel, this.messageSource, "teacher.detail", this.getLocale()); // photo upload setup upload = new EvidenceUpload(this.messageSource, this.getLocale()); upload.setCaption(this.getMessage("teacher.detail.upload", this.getLocale())); this.teacherForm.getLayout().addComponent(upload); this.teacherForm.getFooter().setMargin(true, false, false, false); // create a window using caption from view this.dialog = new Window(this.getMessage("teacher.detail.caption", this.getLocale())); this.dialog.setModal(true); this.dialog.addComponent(view); this.dialog.getContent().setSizeUndefined(); this.eventBus.showDialog(this.dialog); if (teacherDTO.getPhoto() != null) { upload.showImage(teacherDTO.getPhoto()); } else {/* www .ja va 2 s. c om*/ upload.showImage(ApplicationConstants.NO_PHOTO); } }
From source file:com.terralcode.gestion.frontend.view.panel.species.SpeciesPanel.java
private void openElementSelector() { Window window = new Window(this.windowTitle); window.setModal(true);//from w ww .j av a2 s . c om VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setMargin(true); window.setContent(verticalLayout); BeanItem beanItem = new BeanItem<>(customer); fieldGroup = new BeanFieldGroup<>(CustomerCRM.class); fieldGroup.setItemDataSource(beanItem); OptionGroup og = new OptionGroup(); og.setConverter(new SetToListConverter()); og.setContainerDataSource(containerSpecies); og.setNullSelectionAllowed(false); og.setMultiSelect(true); og.setImmediate(true); //tcs.setLeftColumnCaption("Disponibles"); //tcs.setRightColumnCaption("Seleccionados"); fieldGroup.bind(og, "species"); // TwinColSelect tcs = new TwinColSelect(); // tcs.setConverter(new SetToListConverter()); // tcs.setContainerDataSource(containerSpecies); // tcs.setNullSelectionAllowed(false); // tcs.setMultiSelect(true); // tcs.setImmediate(true); // tcs.setLeftColumnCaption("Disponibles"); // tcs.setRightColumnCaption("Seleccionados"); // fieldGroup.bind(tcs, "species"); verticalLayout.addComponent(og); verticalLayout.addComponent(createOkTradesButton(window)); getUI().addWindow(window); }
From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentComplaintsPanel.java
private void openComplaintWindow(Complaint complaint) { WebBrowser webBrowser = Page.getCurrent().getWebBrowser(); Window window = new Window("Registro de Queja"); window.setModal(true);// w w w .j a va2 s . co m if (webBrowser.getScreenWidth() < 1024) { window.setSizeFull(); } else { window.setHeight(90.0f, Unit.PERCENTAGE); window.setWidth(90.0f, Unit.PERCENTAGE); } // TextField nameField = new TextField(); // nameField.setInputPrompt("Introduzca el ttulo de la queja"); // nameField.setWidth("100%"); TextArea notesArea = new TextArea(); notesArea.setInputPrompt("Introduzca el contenido de la queja"); notesArea.setSizeFull(); // CheckBox doneField = new CheckBox("Atendido"); HorizontalLayout horizontal = new HorizontalLayout(); horizontal.setSpacing(true); horizontal.addComponent(createDeleteButton(window)); horizontal.addComponent(createOkButton(window)); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); layout.addComponent(complaintType); layout.addComponent(notesArea); // layout.addComponent(doneField); layout.addComponent(horizontal); layout.setComponentAlignment(horizontal, Alignment.MIDDLE_RIGHT); layout.setExpandRatio(complaintType, 1); layout.setExpandRatio(notesArea, 8); // layout.setExpandRatio(doneField, 1); layout.setExpandRatio(horizontal, 1); BeanItem beanItem = new BeanItem<>(complaint); fieldGroup = new BeanFieldGroup<>(Complaint.class); fieldGroup.setItemDataSource(beanItem); fieldGroup.bind(complaintType, "complaintType"); fieldGroup.bind(notesArea, "notes"); // fieldGroup.bind(doneField, "done"); window.setContent(layout); getUI().addWindow(window); // Window windowComplaint = new Window(complaintView); // WidgetActions actions = new WidgetActions(){ // // @Override // public void saveAction() { // refreshBind(); // windowComplaint.close(); // } // // @Override // public void deleteAction() { // appointment.getComplaints().remove(complaint); // refreshBind(); // windowComplaint.close(); // } // // }; // complaintView.bind(complaint); // complaintView.setActions(actions); // getUI().addWindow(windowComplaint); }
From source file:com.terralcode.gestion.frontend.view.widgets.example.crudtestform.CrudExampleForm.java
private void openProductWindow(Item beanItem, String caption) { Window window = new Window(caption); window.setModal(true);/*www .j av a 2 s . co m*/ FormLayout layout = new FormLayout(); layout.setMargin(true); window.setContent(layout); fieldGroup = new BeanFieldGroup<TestProduct>(TestProduct.class); fieldGroup.setItemDataSource(beanItem); for (Object propertyId : fieldGroup.getUnboundPropertyIds()) { layout.addComponent(fieldGroup.buildAndBind(propertyId)); } layout.addComponent(createOkButton(window)); getUI().addWindow(window); }
From source file:com.test.vaadin.webvaadin.MyVaadinApplication.java
License:Apache License
@Override public void init() { window = new Window("My Vaadin Application"); setMainWindow(window);/*from www. j a v a 2s.c o m*/ Button button = new Button("Click Me 500 Ledion"); button.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { window.addComponent(new Label("Thank you for clicking 5")); } }); window.addComponent(button); }
From source file:com.thingtrack.bustrack.service.web.client.WsClientApplication.java
License:Apache License
@Override public void init() { window = new Window("Bustrack Web Service Client Application"); setMainWindow(window); buildComponents(); }
From source file:com.thingtrack.db4o.web.MainApplication.java
License:Apache License
@Override protected void initSpringApplication(ConfigurableWebApplicationContext context) { window = new Window("db4o User Replication"); setMainWindow(window);/*from www . ja v a 2 s . c om*/ // set full size and none margin for the default window layout mainLayout = (VerticalLayout) window.getContent(); mainLayout.setSizeFull(); mainLayout.setMargin(false); // draw main user component userComponent = new UserComponent(db4oEntityManager); userComponent.setSizeFull(); mainLayout.addComponent(userComponent); }
From source file:com.thingtrack.myToolbar.MyVaadinApplication.java
License:Apache License
@Override public void init() { setTheme("konekti"); mainWindow = new Window("My dynamic toolbar"); mainWindow.setStyleName("background"); toolbarLayout = new CssLayout() { int brickCounter = 0; @Override//from w ww . j a va 2 s. co m protected String getCss(Component c) { // colorize every third rendered brick if (c instanceof Brick) { brickCounter++; if (brickCounter % 3 == 0) { // make every third brick colored and italic return "color: #ff6611; font-style: italic;"; } } return null; } public void removeComponent(Component c) { brickCounter--; super.removeComponent(c); }; }; toolbarLayout.setStyleName("toolbar_layout"); toolbarLayout.setWidth("100%"); mainWindow.addComponent(toolbarLayout); setMainWindow(mainWindow); //Buttons HorizontalLayout buttonLayout = new HorizontalLayout(); mainWindow.addComponent(buttonLayout); Button btnAddToolbar = new Button("Add Toolbar"); btnAddToolbar.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { // toolbarLayout.addComponent(new NavigationToolbar()); // toolbarLayout.addComponent(new Brick()); // toolbarLayout.addComponent(new SimplifiedNavigationToolbar()); CssLayout layout = new CssLayout(); layout.setStyleName("toolbar"); layout.addComponent(new Button("Botn 1")); layout.addComponent(new Button("Botn 2")); layout.addComponent(new Button("Botn 3")); toolbarLayout.addComponent(layout); } }); buttonLayout.addComponent(btnAddToolbar); Button btnBoxToolbar = new Button("Box Toolbar"); btnBoxToolbar.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { //toolbarLayout2.addToolbar(new BoxToolbar()); toolbarLayout.addComponent(new BoxToolbar()); } }); buttonLayout.addComponent(btnBoxToolbar); Button btnRemoveToolbar = new Button("Remove Toolbar"); btnRemoveToolbar.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { // if (toolBarPanel.getToolbarLayout().getToolbars().length == 0) // return; // // Component toolbar = toolBarPanel.getToolbarLayout().getToolbars()[toolBarPanel.getToolbarLayout().getToolbars().length - 1]; // // toolbarLayout.removeComponent((CustomComponent) toolbar); if (toolbarLayout.getComponentCount() == 0) return; toolbarLayout.removeComponent(toolbarLayout.getComponent(toolbarLayout.getComponentCount() - 1)); // } }); buttonLayout.addComponent(btnRemoveToolbar); }
From source file:com.trender.user.component.Header.java
private void initWindowModal(int size, String name, boolean flag) { window = new Window(name); window.setWidth(size, Unit.PIXELS);/* w ww. ja va 2 s . c om*/ window.setResizable(false); if (flag) { window.setContent(new UserForm().loginForm()); } else { window.setContent(new UserForm().regForm()); } window.setModal(true); window.center(); UI.getCurrent().addWindow(window); }
From source file:com.tripoin.util.ui.calendar.BeanItemContainerTestUI.java
License:Apache License
/** * Opens up a modal dialog window where an event can be modified * /*from w ww. j ava2s. c om*/ * @param event * The event to modify */ private void editEvent(final BasicEvent event) { Window modal = new Window("Add event"); modal.setModal(true); modal.setResizable(false); modal.setDraggable(false); modal.setWidth("300px"); final FieldGroup fieldGroup = new FieldGroup(); FormLayout formLayout = new FormLayout(); TextField captionField = new TextField("Caption"); captionField.setImmediate(true); TextField descriptionField = new TextField("Description"); descriptionField.setImmediate(true); DateField startField = new DateField("Start"); startField.setResolution(Resolution.MINUTE); startField.setImmediate(true); DateField endField = new DateField("End"); endField.setImmediate(true); endField.setResolution(Resolution.MINUTE); formLayout.addComponent(captionField); formLayout.addComponent(descriptionField); formLayout.addComponent(startField); formLayout.addComponent(endField); fieldGroup.bind(captionField, ContainerEventProvider.CAPTION_PROPERTY); fieldGroup.bind(descriptionField, ContainerEventProvider.DESCRIPTION_PROPERTY); fieldGroup.bind(startField, ContainerEventProvider.STARTDATE_PROPERTY); fieldGroup.bind(endField, ContainerEventProvider.ENDDATE_PROPERTY); fieldGroup.setItemDataSource(new BeanItem<BasicEvent>(event, Arrays.asList(ContainerEventProvider.CAPTION_PROPERTY, ContainerEventProvider.DESCRIPTION_PROPERTY, ContainerEventProvider.STARTDATE_PROPERTY, ContainerEventProvider.ENDDATE_PROPERTY))); modal.setContent(formLayout); modal.addCloseListener(new Window.CloseListener() { /** * */ private static final long serialVersionUID = -3427881784024691882L; @Override public void windowClose(CloseEvent e) { // Commit changes to bean try { fieldGroup.commit(); } catch (CommitException e1) { e1.printStackTrace(); } if (events.containsId(event)) { /* * BeanItemContainer does not notify container listeners * when the bean changes so we need to trigger a * ItemSetChange event */ BasicEvent dummy = new BasicEvent(); events.addBean(dummy); events.removeItem(dummy); } else { events.addBean(event); } } }); getUI().addWindow(modal); }