List of usage examples for com.vaadin.ui Window close
public void close()
From source file:pl.exsio.frameset.vaadin.ui.support.dialog.ConfirmationDialog.java
License:Open Source License
private static HorizontalLayout getControls(final Window window, final Handler positiveHandler, final Handler negativeHandler) { final HorizontalLayout controls = new HorizontalLayout() { {//from ww w . j a v a2 s . c o m Button positive = new Button(t("core.yes"), FontAwesome.CHECK); Button negative = new Button(t("core.no"), FontAwesome.TIMES); positive.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { window.close(); } }); negative.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { window.close(); } }); if (positiveHandler instanceof Handler) { positive.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { positiveHandler.handle(event); } }); } if (negativeHandler instanceof Handler) { negative.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { negativeHandler.handle(event); } }); } positive.setClickShortcut(ShortcutAction.KeyCode.ENTER); negative.setClickShortcut(ShortcutAction.KeyCode.ESCAPE); addComponent(positive); addComponent(negative); } }; controls.setMargin(new MarginInfo(true, true, false, true)); controls.setSpacing(true); return controls; }
From source file:pl.exsio.frameset.vaadin.ui.support.dialog.PromptDialog.java
License:Open Source License
private static HorizontalLayout getControls(final Window window, final Handler handler, final TextField value) { final HorizontalLayout controls = new HorizontalLayout() { {//from ww w . j av a 2s . co m Button confirm = new Button(t("core.ok"), FontAwesome.CHECK); Button cancel = new Button(t("core.cancel"), FontAwesome.TIMES); confirm.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { window.close(); } }); cancel.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { window.close(); } }); if (handler instanceof Handler) { confirm.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { handler.handle(event, value.getValue()); } }); } confirm.setClickShortcut(KeyCode.ENTER); cancel.setClickShortcut(KeyCode.ESCAPE); addComponent(confirm); addComponent(cancel); } }; controls.setMargin(new MarginInfo(true, true, false, true)); controls.setSpacing(true); return controls; }
From source file:roart.client.MyVaadinUI.java
private Window getLoginWindow() { final Window window = new Window("Login"); window.setWidth("30%"); window.setHeight("30%"); window.center();//from w w w. j ava 2 s . c om final TextField login = new TextField("Username"); final PasswordField password = new PasswordField("Password"); Button button = new Button("Login"); button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { tryLogin(login.getValue(), password.getValue()); window.close(); } }); VerticalLayout vert = new VerticalLayout(); vert.addComponent(login); vert.addComponent(password); vert.addComponent(button); window.setContent(vert); return window; }
From source file:ui.button.AddCertificateButton.java
License:Apache License
public AddCertificateButton(final Integer userId, final String language, final Achievement a) { super(Translator.getTranslation("Add Certificate", language), FontAwesome.CERTIFICATE); setDescription(Translator.getTranslation("Add Certificate", language)); addClickListener(new Button.ClickListener() { @Override/*from ww w . ja v a 2 s .c om*/ public void buttonClick(Button.ClickEvent event) { UploadReceiver receiver = new CertificateUploadReceiver(userId, language, a); Upload upload = new Upload(Translator.getTranslation("Add Certificate", language), receiver); upload.addSucceededListener((Upload.SucceededListener) receiver); String wcaption = Translator.getTranslation("Upload", language); final Window window = new Window(wcaption, upload); window.center(); //window.setModal(true); window.setStyleName("window"); receiver.setWindow(window); window.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent e) { window.close(); } }); getUI().addWindow(window); } }); }
From source file:ui.button.AddPhotoButton.java
License:Apache License
public AddPhotoButton(final Integer userId, final String language) { super(Translator.getTranslation("Add professional photo", language), FontAwesome.CAMERA_RETRO); setDescription(Translator.getTranslation("Add professional photo", language)); addClickListener(new Button.ClickListener() { @Override/* w ww . j a v a 2 s .c o m*/ public void buttonClick(Button.ClickEvent event) { UploadReceiver receiver = new PhotoUploadReceiver(userId, language); Upload upload = new Upload(Translator.getTranslation("Choose your best photo", language), receiver); upload.addSucceededListener((Upload.SucceededListener) receiver); String wcaption = Translator.getTranslation("Upload a photo", language); final Window window = new Window(wcaption, upload); window.center(); //window.setModal(true); window.setStyleName("window"); receiver.setWindow(window); window.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent e) { window.close(); } }); getUI().addWindow(window); } }); }
From source file:ui.button.ShowAchievementsButton.java
License:Apache License
private void showOnWindow() { final Window window = new Window(); window.setWidth("95%"); window.setHeight("95%"); window.center();/* www . jav a 2s.c o m*/ window.setResizable(true); window.setModal(true); window.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent e) { window.close(); } }); window.setContent(new UserTabSheet(userId, language)); getUI().addWindow(window); window.setStyleName("window"); }
From source file:ui.form.AchievementFormTranslate.java
protected void closeWindow() { Window w = getWindow(); w.close(); }
From source file:ui.item.QAView.java
License:Apache License
protected void showDeleteConfirm() { ConfirmForm form = new ConfirmForm<T>(item, getList()); final Window window = new LifetimeWindow(userId, language, "Confirm Delete?"); window.setContent(form);//from w w w.j av a 2 s . c o m form.getCancel().addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { window.close(); } }); form.getDelete().addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { deleteDataFormServer(); getList().update(); window.close(); } }); window.setSizeUndefined(); getUI().addWindow(window); }
From source file:uicomponents.MSSampleMultiplicationTable.java
License:Open Source License
protected void createEnzymeSelectionWindow(String row) { Window subWindow = new Window(" Enzyme selection"); subWindow.setWidth("400px"); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);/* www . j ava 2 s . com*/ layout.setMargin(true); EnzymePanel pan = new EnzymePanel(enzymes); Button ok = new Button("Okay."); ok.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { List<String> enzymes = pan.getEnzymes(); ComboBox b = parseBoxRow(row, "Enzyme"); if (enzymes.isEmpty()) { Styles.notification("No enzymes selected", "Please select at least one enzyme!", NotificationType.ERROR); } else if (enzymes.size() == 1) { b.setValue(enzymes.get(0)); subWindow.close(); } else { b.addItem("Custom"); b.setValue("Custom"); enzymeMap.put(row, enzymes); subWindow.close(); } } }); layout.addComponent(pan); layout.addComponent(ok); subWindow.setContent(layout); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setIcon(FontAwesome.FLASK); subWindow.setResizable(false); ProjectwizardUI ui = (ProjectwizardUI) UI.getCurrent(); ui.addWindow(subWindow); }
From source file:views.MetadataUploadView.java
License:Open Source License
private void createNotRightTypeDialogue(String headline, String moreInfo, String barcode) { Window subWindow = new Window(" Wrong data type!"); subWindow.setWidth("400px"); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);//w w w . j ava2 s .co m layout.setMargin(true); Label preInfo = new Label( "Data of barcode " + barcode + " in this column doesn't fit the attribute type. " + moreInfo); layout.addComponent(preInfo); Button ok = new Button("Ignore Column."); Button no = new Button("Select different attribute."); ok.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { getActiveTable().removeContainerProperty(headline); subWindow.close(); } }); no.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { resetAttribute(headline); subWindow.close(); } }); layout.addComponent(ok); layout.addComponent(no); subWindow.setContent(layout); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setIcon(FontAwesome.BOLT); subWindow.setResizable(false); ProjectwizardUI ui = (ProjectwizardUI) UI.getCurrent(); ui.addWindow(subWindow); }