List of usage examples for com.vaadin.ui Window.CloseListener Window.CloseListener
Window.CloseListener
From source file:dev.DevUI.java
License:Open Source License
@Override protected void init(VaadinRequest request) { final VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSpacing(true);//from w w w. ja va 2 s . c o m mainLayout.setMargin(true); PluploadManager mgr = createUploadManager("Manager 1"); PluploadManager mgr2 = createUploadManager("Manager 2"); PluploadManager mgr3 = createChunkingUploadManager("Manager 3"); mgr.getUploader().addFilter(new PluploadFilter("music", "mp3,flac")); VerticalLayout dropZone = new VerticalLayout() { { addComponent(new Label("Additional drop zone for music files")); setId("music-drop-zone"); } }; mgr.getUploader().addDropZone(dropZone); mgr2.getUploader().addFilter(new PluploadFilter("images", "jpg, jpeg, png")); mgr2.getUploader().setImageResize( new PluploadImageResize().setEnabled(true).setCrop(true).setHeight(200).setWidth(400)); mainLayout.addComponent(mgr); mainLayout.addComponent(dropZone); mainLayout.addComponent(mgr2); mainLayout.addComponent(mgr3); PluploadField<File> field = createUploadField(); final Form form = new Form(); form.addField("file", field); field.addValidator(new NullValidator("file must not be null", false)); Button submit = new Button("commit form"); submit.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { form.commit(); } }); mainLayout.addComponent(form); mainLayout.addComponent(submit); PluploadField<byte[]> byteField = createByteUploadField(); mainLayout.addComponent(byteField); final Plupload uploader = createSimpleUploader(); uploader.setEnabled(false); Button b = new Button("toggle Enabled!", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { uploader.setEnabled(!uploader.isEnabled()); } }); mainLayout.addComponent(b); mainLayout.addComponent(uploader); final Counter c = new Counter(); final Button.ClickListener l = new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Window w = new Window("win"); if (c.get() < 5) { w.setContent(new Button("win", this)); c.increment(); } else { Field f = createUploadField(); w.setContent(f); c.reset(); } w.setWidth("400px"); w.setHeight("200px"); getUI().addWindow(w); } }; Button win = new Button("Win"); win.addClickListener(l); mainLayout.addComponent(win); Button modal = new Button("modal"); modal.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Window w = new Window("modal"); final PluploadField f = createUploadField(); w.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent e) { Notification.show("closed modal"); f.getUploader().destroy(); } }); VerticalLayout lay = new VerticalLayout(); lay.addComponent(f); lay.addComponent(new Button("destroy", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { f.getUploader().destroy(); } })); w.setContent(lay); w.setModal(true); getUI().addWindow(w); } }); Accordion acc = new Accordion(); acc.addTab(this.createUploadManager("mgr3"), "uploader"); acc.addTab(new HorizontalLayout(), "Stub"); mainLayout.addComponent(acc); mainLayout.addComponent(modal); this.setContent(mainLayout); }
From source file:org.investovator.ui.main.AdminGameConfigLayout.java
License:Open Source License
private void startDailySummaryAddGameWizard() { // Create a sub-window and set the content Window subWindow = new Window("Create New Game"); VerticalLayout subContent = new VerticalLayout(); subContent.setMargin(true);/* w w w. ja va 2s .com*/ subWindow.setContent(subContent); // Put some components in it subContent.addComponent(new NewDataPlaybackGameWizard(subWindow)); // set window characteristics subWindow.center(); subWindow.setClosable(false); subWindow.setDraggable(false); subWindow.setResizable(false); subWindow.setModal(true); subWindow.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent closeEvent) { //getUI().getNavigator().navigateTo(UIConstants.MAINVIEW); getUI().getPage().reload(); } }); // Add it to the root component UI.getCurrent().addWindow(subWindow); }
From source file:org.investovator.ui.main.AdminGameConfigLayout.java
License:Open Source License
private void startAgentCreateWizard() { // Create a sub-window and set the content AgentGamingView subWindow = new AgentGamingView(); subWindow.update();//from w w w . j a va 2 s .c om // set window characteristics subWindow.setHeight("60%"); subWindow.setWidth("50%"); subWindow.center(); subWindow.setClosable(false); subWindow.setDraggable(false); subWindow.setResizable(false); subWindow.setModal(true); subWindow.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent closeEvent) { //getUI().getNavigator().navigateTo(UIConstants.MAINVIEW); getUI().getPage().reload(); } }); // Add it to the root component UI.getCurrent().addWindow(subWindow); }
From source file:org.investovator.ui.main.AdminGameConfigLayout.java
License:Open Source License
private void startNNCreateWizard() { NNGamingView subWindow = new NNGamingView("Create New Game"); // set window characteristics subWindow.setHeight("50%"); subWindow.setWidth("40%"); subWindow.center();//from ww w. j av a 2s .c o m subWindow.setClosable(false); subWindow.setDraggable(false); subWindow.setResizable(false); subWindow.setModal(true); subWindow.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent closeEvent) { getUI().getPage().reload(); } }); // Add it to the root component UI.getCurrent().addWindow(subWindow); }
From source file:org.investovator.ui.main.DataImportPanel.java
License:Open Source License
private void bindEvents() { dataInsertButton.addClickListener(new Button.ClickListener() { @Override/*from ww w. java 2 s. co m*/ public void buttonClick(Button.ClickEvent clickEvent) { uploadWindow = new DataUploadWindow(); uploadWindow.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent closeEvent) { setEntryData(); } }); getUI().addWindow(uploadWindow); } }); }
From source file:org.tylproject.vaadin.addon.fields.search.SearchWindow.java
License:Apache License
/** * Set to automatically invoke navigation.find() when the apply() button is clicked *///from www . jav a 2 s.c o m public SearchWindow callFindEventOnWindowClosed(final DataNavigation navigation) { // if same as previous, prevent enqueueing twice if (closeListenerNavigation == navigation) return this; // if not the first time, remove old listener if (closeListenerNavigation != null) { this.removeCloseListener(this.closeListener); } this.closeListenerNavigation = navigation; this.closeListener = new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent e) { navigation.find(); } }; this.addCloseListener(closeListener); return this; }