List of usage examples for com.vaadin.ui Window setCaption
@Override public void setCaption(String caption)
From source file:de.symeda.sormas.ui.samples.SampleController.java
License:Open Source License
private void requestSampleCollectionTaskCreation(SampleDto dto, SampleEditForm form) { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);//from ww w .j a v a2 s. c o m ConfirmationComponent requestTaskComponent = VaadinUiUtil.buildYesNoConfirmationComponent(); Label description = new Label(I18nProperties.getString(Strings.messageCreateCollectionTask), ContentMode.HTML); description.setWidth(100, Unit.PERCENTAGE); layout.addComponent(description); layout.addComponent(requestTaskComponent); layout.setComponentAlignment(requestTaskComponent, Alignment.BOTTOM_RIGHT); layout.setSizeUndefined(); layout.setSpacing(true); Window popupWindow = VaadinUiUtil.showPopupWindow(layout); popupWindow.setSizeUndefined(); popupWindow.setCaption(I18nProperties.getString(Strings.headingCreateNewTaskQuestion)); requestTaskComponent.getConfirmButton().addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { popupWindow.close(); ControllerProvider.getTaskController().createSampleCollectionTask(TaskContext.CASE, dto.getAssociatedCase(), dto); } }); requestTaskComponent.getCancelButton().addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { popupWindow.close(); } }); }
From source file:de.symeda.sormas.ui.samples.SampleController.java
License:Open Source License
public void showChangePathogenTestResultWindow(CommitDiscardWrapperComponent<SampleEditForm> editComponent, String sampleUuid, PathogenTestResultType newResult) { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/* w w w.j a v a2s . c om*/ ConfirmationComponent confirmationComponent = VaadinUiUtil.buildYesNoConfirmationComponent(); Label description = new Label(String .format(I18nProperties.getString(Strings.messageChangePathogenTestResult), newResult.toString())); description.setWidth(100, Unit.PERCENTAGE); layout.addComponent(description); layout.addComponent(confirmationComponent); layout.setComponentAlignment(confirmationComponent, Alignment.BOTTOM_RIGHT); layout.setSizeUndefined(); layout.setSpacing(true); Window popupWindow = VaadinUiUtil.showPopupWindow(layout); popupWindow.setSizeUndefined(); popupWindow.setCaption(I18nProperties.getString(Strings.headingChangePathogenTestResult)); confirmationComponent.getConfirmButton().addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { editComponent.commit(); SampleDto sample = FacadeProvider.getSampleFacade().getSampleByUuid(sampleUuid); sample.setPathogenTestResult(newResult); FacadeProvider.getSampleFacade().saveSample(sample); popupWindow.close(); SormasUI.refreshView(); } }); confirmationComponent.getCancelButton().addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { popupWindow.close(); } }); }
From source file:de.symeda.sormas.ui.user.UserController.java
License:Open Source License
public void makeNewPassword(String userUuid) { String newPassword = FacadeProvider.getUserFacade().resetPassword(userUuid); VerticalLayout layout = new VerticalLayout(); layout.addComponent(new Label(I18nProperties.getString(Strings.messageCopyPassword))); Label passwordLabel = new Label(newPassword); passwordLabel.addStyleName(CssStyles.H2); layout.addComponent(passwordLabel);//from www . ja v a 2 s .c o m Window popupWindow = VaadinUiUtil.showPopupWindow(layout); popupWindow.setCaption(I18nProperties.getString(Strings.headingNewPassword)); layout.setMargin(true); }
From source file:de.symeda.sormas.ui.user.UserController.java
License:Open Source License
public Button createResetPasswordButton(String userUuid, CommitDiscardWrapperComponent<UserEditForm> editView) { Button resetPasswordButton = new Button(null, VaadinIcons.UNLOCK); resetPasswordButton.setCaption(I18nProperties.getCaption(Captions.userResetPassword)); resetPasswordButton.addStyleName(ValoTheme.BUTTON_LINK); resetPasswordButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w ww . j a va 2s.c om*/ public void buttonClick(ClickEvent event) { ConfirmationComponent resetPasswordComponent = getResetPasswordConfirmationComponent(userUuid, editView); Window popupWindow = VaadinUiUtil.showPopupWindow(resetPasswordComponent); resetPasswordComponent.addDoneListener(new DoneListener() { public void onDone() { popupWindow.close(); } }); resetPasswordComponent.getCancelButton().addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { popupWindow.close(); } }); popupWindow.setCaption(I18nProperties.getString(Strings.headingUpdatePassword)); } }); return resetPasswordButton; }
From source file:de.symeda.sormas.ui.utils.VaadinUiUtil.java
License:Open Source License
public static Window showSimplePopupWindow(String caption, String contentText) { Window window = new Window(null); window.setModal(true);/*from w ww.j a v a 2 s. c o m*/ window.setSizeUndefined(); window.setResizable(false); window.center(); VerticalLayout popupLayout = new VerticalLayout(); popupLayout.setMargin(true); popupLayout.setSpacing(true); popupLayout.setSizeUndefined(); Label contentLabel = new Label(contentText); contentLabel.setWidth(100, Unit.PERCENTAGE); popupLayout.addComponent(contentLabel); Button okayButton = new Button(I18nProperties.getCaption(Captions.actionOkay)); okayButton.addClickListener(e -> { window.close(); }); CssStyles.style(okayButton, ValoTheme.BUTTON_PRIMARY); popupLayout.addComponent(okayButton); popupLayout.setComponentAlignment(okayButton, Alignment.BOTTOM_RIGHT); window.setCaption(caption); window.setContent(popupLayout); UI.getCurrent().addWindow(window); return window; }
From source file:de.symeda.sormas.ui.utils.VaadinUiUtil.java
License:Open Source License
public static Window showModalPopupWindow(CommitDiscardWrapperComponent<?> content, String caption) { final Window popupWindow = VaadinUiUtil.showPopupWindow(content); popupWindow.setCaption(caption); content.setMargin(true);//from w ww .j a va 2 s .c om content.addDoneListener(new DoneListener() { public void onDone() { popupWindow.close(); } }); return popupWindow; }
From source file:de.symeda.sormas.ui.utils.VaadinUiUtil.java
License:Open Source License
public static Window showConfirmationPopup(String caption, Component content, String confirmCaption, String cancelCaption, Integer width, Consumer<Boolean> resultConsumer) { Window popupWindow = VaadinUiUtil.createPopupWindow(); if (width != null) { popupWindow.setWidth(width, Unit.PIXELS); } else {/*from w ww . j a va 2 s . co m*/ popupWindow.setWidthUndefined(); } popupWindow.setCaption(caption); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); content.setWidth(100, Unit.PERCENTAGE); layout.addComponent(content); ConfirmationComponent confirmationComponent = new ConfirmationComponent(false) { private static final long serialVersionUID = 1L; @Override protected void onConfirm() { popupWindow.close(); resultConsumer.accept(true); } @Override protected void onCancel() { popupWindow.close(); resultConsumer.accept(false); } }; confirmationComponent.getConfirmButton().setCaption(confirmCaption); confirmationComponent.getCancelButton().setCaption(cancelCaption); popupWindow.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent e) { confirmationComponent.getCancelButton().click(); } }); layout.addComponent(confirmationComponent); layout.setComponentAlignment(confirmationComponent, Alignment.BOTTOM_RIGHT); layout.setWidth(100, Unit.PERCENTAGE); layout.setSpacing(true); popupWindow.setContent(layout); UI.getCurrent().addWindow(popupWindow); return popupWindow; }
From source file:de.symeda.sormas.ui.utils.VaadinUiUtil.java
License:Open Source License
public static Window showDeleteConfirmationWindow(String content, Runnable callback) { Window popupWindow = VaadinUiUtil.createPopupWindow(); VerticalLayout deleteLayout = new VerticalLayout(); deleteLayout.setMargin(true);/*from w w w.jav a 2s . com*/ deleteLayout.setSizeUndefined(); deleteLayout.setSpacing(true); Label description = new Label(content); description.setWidth(100, Unit.PERCENTAGE); deleteLayout.addComponent(description); ConfirmationComponent deleteConfirmationComponent = new ConfirmationComponent(false) { private static final long serialVersionUID = 1L; @Override protected void onConfirm() { popupWindow.close(); onDone(); callback.run(); } @Override protected void onCancel() { popupWindow.close(); } }; deleteConfirmationComponent.getConfirmButton().setCaption(I18nProperties.getString(Strings.yes)); deleteConfirmationComponent.getCancelButton().setCaption(I18nProperties.getString(Strings.no)); deleteLayout.addComponent(deleteConfirmationComponent); deleteLayout.setComponentAlignment(deleteConfirmationComponent, Alignment.BOTTOM_RIGHT); popupWindow.setCaption(I18nProperties.getString(Strings.headingConfirmDeletion)); popupWindow.setContent(deleteLayout); UI.getCurrent().addWindow(popupWindow); return popupWindow; }
From source file:dhbw.clippinggorilla.userinterface.windows.ActivateWindow.java
public static Window get() { Window window = new Window(); window.setModal(true);//from w w w .ja va2s . c om window.setResizable(false); window.setDraggable(false); window.setCaption(Language.get(Word.ACTIVATION_CODE)); window.addCloseShortcut(ShortcutAction.KeyCode.ENTER, null); VerticalLayout windowLayout = new VerticalLayout(); windowLayout.setMargin(false); windowLayout.setSizeUndefined(); FormLayout forms = new FormLayout(); forms.setMargin(true); forms.setSizeUndefined(); Button save = new Button(Language.get(Word.ACTIVATE)); TextField activationCode = new TextField(Language.get(Word.ACTIVATION_CODE)); activationCode.setMaxLength(6); activationCode.focus(); activationCode.addValueChangeListener(e -> { if (activationCode.getValue().length() > 5) { save.setEnabled(true); activationCode.setComponentError(null); } else { save.setEnabled(false); activationCode.setComponentError(new UserError(Language.get(Word.ACTIVATION_CODE_SIX_CHARS), AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(Language.get(Word.ACTIVATION_CODE_SIX_CHARS)); } }); forms.addComponent(activationCode); Button resendMail = new Button(Language.get(Word.RESEND_ACTIVATION_CODE)); resendMail.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); resendMail.addClickListener(ce -> { try { UserUtils.resendActivationMail(UserUtils.getCurrent()); VaadinUtils.infoNotification(Language.get(Word.RESEND_ACTIVATION_CODE_SUCCESSFUL)); } catch (EmailException ex) { VaadinUtils.errorNotification(Language.get(Word.RESEND_ACTIVATION_CODE_FAILED)); } }); forms.addComponent(resendMail); GridLayout footer = new GridLayout(3, 1); footer.setSpacing(true); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.setWidth(100.0f, Sizeable.Unit.PERCENTAGE); Label placeholder = new Label(); Button cancel = new Button(Language.get(Word.CANCEL)); cancel.setIcon(VaadinIcons.CLOSE); cancel.addClickListener(ce -> { window.close(); }); cancel.setClickShortcut(ShortcutAction.KeyCode.ESCAPE, null); save.setEnabled(false); save.setIcon(VaadinIcons.CHECK); save.addStyleName(ValoTheme.BUTTON_PRIMARY); save.addClickListener(ce -> { try { String code = activationCode.getValue(); User user = UserUtils.getCurrent(); if (UserUtils.activateUser(user, code)) { VaadinUtils.infoNotification(Language.get(Word.ACTIVATION_SUCCESSFUL)); window.close(); } else { activationCode.setValue(""); VaadinUtils.errorNotification(Language.get(Word.ACTIVATION_FAILED)); } } catch (NumberFormatException e) { } }); save.setClickShortcut(ShortcutAction.KeyCode.ENTER, null); footer.setSizeUndefined(); footer.setWidth("100%"); footer.addComponents(placeholder, cancel, save); footer.setColumnExpandRatio(0, 1);//ExpandRatio(placeholder, 1); footer.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER); footer.setComponentAlignment(save, Alignment.MIDDLE_CENTER); windowLayout.addComponent(forms); windowLayout.addComponent(footer); window.setContent(windowLayout); return window; }
From source file:eu.maxschuster.vaadin.autocompletetextfield.demo.DemoUI.java
License:Apache License
private void openTestWindow() { Window testWindow = new Window(); DemoOverlayTest test = new DemoOverlayTest(); test.setSuggestionProvider(languageProvider); testWindow.setContent(test);//from w w w .ja va 2s . co m testWindow.setCaption("Window Demo"); testWindow.center(); getUI().addWindow(testWindow); }