List of usage examples for com.vaadin.ui Window addListener
@Override
public Registration addListener(Component.Listener listener)
From source file:org.lightframe.components.WindowManager.java
License:Apache License
/** * Create a new {@link Window} that is managed by the {@link WindowManager}. * The Window will be immediately attached to the {@link Application}. * /* w w w . ja v a2 s .c om*/ * @return An attached {@link Window}, managed by this {@link WindowManager} * . <code>null</code> if the {@link WindowManager} isn't, itself, * attached to an {@link Application}. */ public Window addWindow() { if (getApplication() != null) { final Window window = new Window(); getApplication().getMainWindow().addWindow(window); window.addListener(closeListener); managedWindows.add(window); requestRepaint(); return window; } else { return null; } }
From source file:org.semanticsoft.vaaclipse.presentation.renderers.WorkbenchWindowRenderer.java
License:Open Source License
@Override public void hookControllerLogic(final MUIElement element) { if (element instanceof MWindow) { final MWindow mWindow = (MWindow) element; if (!element.getTags().contains(Tags.MAIN_WINDOW)) {// only for child windows (main window not need that) final Window window = (Window) mWindow.getWidget(); window.addListener(new Window.ResizeListener() { @Override/*ww w. j a v a 2 s. c o m*/ public void windowResized(ResizeEvent e) { mWindow.setWidth((int) window.getWidth()); mWindow.setHeight((int) window.getHeight()); } }); // TODO: there are no window move listener in vaadin, implement // it later } } }
From source file:org.vaadin.addons.serverpush.samples.chat.ManualPushChatApplication.java
License:Apache License
public void init() { Window mainWindow = new Window("Chat Application"); setMainWindow(mainWindow);/*www . j a va2 s . c om*/ VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); vl.addComponent(this.header); this.comboBox.setWidth("400px"); this.comboBox.addListener(new Container.ItemSetChangeListener() { public void containerItemSetChange(Container.ItemSetChangeEvent event) { push(); } }); this.comboBox.addListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { fireNewTab((User) event.getProperty().getValue(), (User) getUser()); } }); this.comboBox.setItemCaptionPropertyId("username"); this.comboBox.setImmediate(true); vl.addComponent(this.comboBox); this.tabSheet.setSizeFull(); vl.addComponent(this.tabSheet); vl.setExpandRatio(this.tabSheet, 1); mainWindow.setContent(vl); mainWindow.addComponent(this.pusher); mainWindow.addListener(new Window.CloseListener() { public void windowClose(Window.CloseEvent e) { OnlineUsersManager.getInstance().deregisterUser((User) getUser()); } }); fireLoginWindow(); }
From source file:ro.zg.netcell.vaadin.action.user.ResetPasswordHandler.java
License:Apache License
private void displaySuccessfulMessage(Window w, String messageKey, final OpenGroupsApplication app) { VerticalLayout l = new VerticalLayout(); l.setSizeFull();// ww w . j av a2 s . c o m Label message = new Label(getMessage(messageKey)); message.setWidth("60%"); l.addComponent(message); l.setComponentAlignment(message, Alignment.MIDDLE_CENTER); w.setContent(l); w.addListener(new CloseListener() { @Override public void windowClose(CloseEvent e) { app.getActiveWindow() .open(new ExternalResource(OpenGroupsUtil.getUrlForEntity(app.getActiveEntity(), app))); /* unhide the content of the main window */ app.getActiveWindow().setContentVisible(true); } }); }
From source file:ro.zg.open_groups.OpenGroupsApplication.java
License:Apache License
private void addCloseListener(final Window w) { w.addListener(new Window.CloseListener() { @Override/*from www . j a v a 2 s .c om*/ public void windowClose(CloseEvent e) { if (w == getMainWindow()) { return; } removeWindow(w); // String[] args = w.getName().split(MY_WINDOW_SEPARATOR); // windowsManager.removeWindowId(args[0], new Integer(args[1])); System.out.println("removed " + w.getName()); } }); }
From source file:rs.pupin.jpo.esta_ld.EstaLdComponent.java
private void createGUI() { mainLayout = new VerticalLayout(); mainLayout.setSizeFull();/* w ww. j a va 2 s .c om*/ mainLayout.setSpacing(false); mainLayout.setDebugId("l-main"); if (indAnimatorEnabled) { animator = new AnimatorProxy(); mainLayout.addComponent(animator); indSettingsVisible = true; } brandLayout = new HorizontalLayout(); brandLayout.setSpacing(true); brandLayout.setMargin(true); brandLayout.setWidth("100%"); brandLayout.setDebugId("l-brand"); Label brandSpan = new Label("<span id='brand'>ESTA-LD</span>", Label.CONTENT_XHTML); brandLayout.addComponent(brandSpan); brandLayout.setExpandRatio(brandSpan, 2.0f); brandLayout.setComponentAlignment(brandSpan, Alignment.MIDDLE_LEFT); Button btnEndpoint = new Button("Endpoint"); brandLayout.addComponent(btnEndpoint); brandLayout.setComponentAlignment(btnEndpoint, Alignment.MIDDLE_RIGHT); btnEndpoint.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { final EndpointWindow.EndpointState state = new EndpointWindow.EndpointState(); state.endpoint = endpoint; Window w = new EndpointWindow(state); w.addListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent e) { try { if (!endpoint.equals(state.endpoint)) repository.shutDown(); } catch (RepositoryException ex) { Logger.getLogger(EstaLdComponent.class.getName()).log(Level.SEVERE, null, ex); } if (state.repository != null && state.repository.isInitialized()) { repository = state.repository; endpoint = state.endpoint; endpointChanged(); } } }); getWindow().addWindow(w); } }); btnInspect = new Button("Inspect"); if (indShowInspect) { brandLayout.addComponent(btnInspect); brandLayout.setExpandRatio(btnInspect, 0.0f); } Button btnSettings = new Button("Parameters"); brandLayout.addComponent(btnSettings); brandLayout.setComponentAlignment(btnSettings, Alignment.MIDDLE_RIGHT); btnSettings.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { // getWindow().executeJavaScript("$('#l-dataset').parent().parent().slideToggle(function(){ vaadin.forceLayout(); })"); if (!indAnimatorEnabled) { getWindow().executeJavaScript("$('#l-settings').parent().parent().slideToggle()"); settingsLayout.setVisible(!settingsLayout.isVisible()); } else { // if (indSettingsVisible) { // animator.animate(settingsLayout, VAnimatorProxy.AnimType.ROLL_UP_CLOSE); // } else { // animator.animate(settingsLayout, VAnimatorProxy.AnimType.ROLL_DOWN_OPEN_POP); // } // indSettingsVisible = !indSettingsVisible; } // getWindow().executeJavaScript("setTimeout(function(){ vaadin.forceSync(); map.invalidateSize(); }, 0)"); // getWindow().executeJavaScript("setTimeout(function(){ runSparqlDimensionValueChangedVuk(); map.invalidateSize() }, 200)"); // getWindow().executeJavaScript("setTimeout(function(){ currentChart.reflow(); map.invalidateSize() }, 200)"); } }); settingsLayout = new VerticalLayout(); settingsLayout.setDebugId("l-settings"); settingsLayout.setSpacing(true); settingsLayout.setMargin(true); settingsLayout.setWidth("100%"); datasetLayout = new HorizontalLayout(); datasetLayout.setSpacing(true); datasetLayout.setWidth("100%"); datasetLayout.setDebugId("l-dataset"); mainLayout.addComponent(brandLayout); mainLayout.setExpandRatio(brandLayout, 0.0f); settingsLayout.addComponent(datasetLayout); Label lblSettingsSeparator = new Label("<hr/>", Label.CONTENT_XHTML); lblSettingsSeparator.addStyleName("settings-separator"); settingsLayout.addComponent(lblSettingsSeparator); mainLayout.addComponent(settingsLayout); mainLayout.setExpandRatio(settingsLayout, 0.0f); // in place of this divide borders and shadows will be added // Label lblDivider = new Label("<hr/>", Label.CONTENT_XHTML); // mainLayout.addComponent(lblDivider); // mainLayout.setExpandRatio(lblDivider, 0.0f); // contentLayout = new HorizontalLayout(); contentLayout = new HorizontalSplitPanel(); contentLayout.setMargin(true); contentLayout.setSizeFull(); contentLayout.setWidth("100%"); // contentLayout.setSpacing(true); contentLayout.setSplitPosition(50, UNITS_PERCENTAGE); contentLayout.setDebugId("l-content"); mainLayout.addComponent(contentLayout); mainLayout.setExpandRatio(contentLayout, 2.0f); createDataSetLayout(); }
From source file:rs.pupin.jpo.esta_ld.InspectWrapperComponent.java
private void createGUI() { mainLayout = new VerticalLayout(); mainLayout.setSpacing(false);//w w w . j av a2 s.co m mainLayout.setDebugId("l-main"); brandLayout = new HorizontalLayout(); brandLayout.setSpacing(true); brandLayout.setMargin(true); brandLayout.setWidth("100%"); brandLayout.setDebugId("l-brand"); Label brandSpan = new Label("<span id='brand'>ESTA-LD: <i>Inspect and Prepare</i></span>", Label.CONTENT_XHTML); brandLayout.addComponent(brandSpan); brandLayout.setExpandRatio(brandSpan, 2.0f); brandLayout.setComponentAlignment(brandSpan, Alignment.MIDDLE_LEFT); Button btnEndpoint = new Button("Endpoint"); brandLayout.addComponent(btnEndpoint); brandLayout.setComponentAlignment(btnEndpoint, Alignment.MIDDLE_RIGHT); btnEndpoint.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { final EndpointWindow.EndpointState state = new EndpointWindow.EndpointState(); state.endpoint = endpoint; Window w = new EndpointWindow(state); w.addListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent e) { try { if (!endpoint.equals(state.endpoint)) repository.shutDown(); } catch (RepositoryException ex) { Logger.getLogger(EstaLdComponent.class.getName()).log(Level.SEVERE, null, ex); } if (state.repository != null && state.repository.isInitialized()) { repository = state.repository; endpoint = state.endpoint; endpointChanged(); } } }); getWindow().addWindow(w); } }); settingsLayout = new VerticalLayout(); settingsLayout.setDebugId("l-settings"); settingsLayout.setSpacing(true); settingsLayout.setMargin(true); settingsLayout.setWidth("100%"); datasetLayout = new HorizontalLayout(); datasetLayout.setSpacing(true); datasetLayout.setWidth("100%"); datasetLayout.setDebugId("l-dataset"); mainLayout.addComponent(brandLayout); // mainLayout.setExpandRatio(brandLayout, 0.0f); settingsLayout.addComponent(datasetLayout); mainLayout.addComponent(settingsLayout); // mainLayout.setExpandRatio(settingsLayout, 0.0f); // in place of this divide borders and shadows will be added // Label lblDivider = new Label("<hr/>", Label.CONTENT_XHTML); // mainLayout.addComponent(lblDivider); // mainLayout.setExpandRatio(lblDivider, 0.0f); // contentLayout = new HorizontalLayout(); contentLayout = new VerticalLayout(); contentLayout.setMargin(true); // contentLayout.setSizeFull(); contentLayout.setWidth("100%"); // contentLayout.setSpacing(true); contentLayout.addStyleName("l-content-inspect"); mainLayout.addComponent(contentLayout); // mainLayout.setExpandRatio(contentLayout, 2.0f); createDataSetLayout(); }
From source file:ru.codeinside.adm.ui.GroupEditor.java
License:Mozilla Public License
private void showEditor(String nameGroup) { List<Group> groups = AdminServiceProvider.get().findGroupByName(nameGroup); for (final Group g : groups) { Label header = new Label( " : " + g.getTitle() + " (" + nameGroup + ")"); header.setStyleName("h2"); addComponent(header);/*from w ww . j a v a 2s . co m*/ Button delete = new Button("", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String confirmMessage = " , ?"; Window confirmWindow = new ConfirmWindow(confirmMessage); confirmWindow.addListener(new Listener() { @Override public void componentEvent(Event event) { if (event instanceof ConfirmWindow.ConfirmOkEvent) { AdminServiceProvider.get().deleteGroup(g.getId()); table.removeItem(g.getName()); } } }); getWindow().addWindow(confirmWindow); } }); addComponent(delete); } final FilterTable all = new FilterTable(); all.setCaption("? ? " + typeGroup.toLowerCase()); table(all); final FilterTable current = new FilterTable(); current.setCaption(" " + typeGroup.toLowerCase()); table(current); addListener(all, current, current); addListener(current, all, current); addTableContent(all, current); }