@Override public Window getWindow(String name) { // See if the window already exists in the application Window window = super.getWindow(name); // If a dynamically created window is requested, but // it does not exist yet, create it. if (window == null) { // Create the new window object window = new Window("Book Examples Window " + ++windowCount); // As the window did not exist, the name parameter is // an automatically generated name for a new window. window.setName(name); // Add it to the application as a regular // application-level window. This must be done before // calling open, which requires that the window // is attached to the application. addWindow(window); // Open it with the proper URL that includes the // automatically generated window name window.open(new ExternalResource(window.getURL())); // Fill the window with stuff init(window); } return window; }
@Override public void init() { setMainWindow(mainWindow); setTheme("bluesmoke"); helper = new SpringContextHelper(this); feed = (OHLCFeed) helper.getBean("feed"); correlatorPool = (CorrelatorPool) helper.getBean("correlatorPool"); correlatorBuilderManager = (CorrelatorBuilderManager) helper.getBean("correlatorBuilderManager"); emulator = (PassageOfTimeEmulationWorker) helper.getBean("emulator"); buildMainLayout(); mainWindow.setContent(mainLayout); mainLayout.setSizeFull(); mainWindow.addListener( new Window.CloseListener() { public void windowClose(Window.CloseEvent e) { analytics.terminate(); } }); mainWindow.addListener( new Window.ResizeListener() { public void windowResized(Window.ResizeEvent e) { analytics.resize(); } }); mainWindow.addComponent(pusher); }
private void closeDialog() { // dismiss the dialog Window applicationWindow = (Window) this.dialog.getParent(); applicationWindow.removeWindow(this.dialog); this.dialog = null; this.userForm = null; }
public ConfirmDialog( String caption, String message, String okButtonText, String cancelButtonText) { super(caption); super.setModal(true); super.setClosable(false); super.setResizable(false); VerticalLayout windowLayout = new VerticalLayout(); windowLayout.setMargin(true); // confirmation message windowLayout.addComponent(new Label(message, ContentMode.HTML)); windowLayout.setSpacing(true); // buttons HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setWidth(100.0f, Unit.PERCENTAGE); windowLayout.addComponent(buttonsLayout); okButton = new Button(okButtonText); buttonsLayout.addComponent(okButton); okButton.setTabIndex(1); okButton.addClickListener(this); buttonsLayout.setComponentAlignment(okButton, Alignment.MIDDLE_CENTER); cancelButton = new Button(cancelButtonText); buttonsLayout.addComponent(cancelButton); cancelButton.setTabIndex(0); cancelButton.setClickShortcut(KeyCode.ESCAPE, null); cancelButton.addClickListener(this); buttonsLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER); super.setContent(windowLayout); }
@Override protected void setup(VaadinRequest request) { Window window = new Window("Non-draggable window", new Label()); window.setDraggable(false); addWindow(window); }
void confirmDelete() { // Create the window... subwindow = new Window("Xoa ??"); // ...and make it modal subwindow.setModal(true); // Configure the windws layout; by default a VerticalLayout VerticalLayout layout = (VerticalLayout) subwindow.getContent(); layout.setMargin(true); layout.setSpacing(true); // Add some content; a label and a close-button Label message = new Label("Ban co chac chan muon xoa ?"); subwindow.addComponent(message); Button close = new Button( "Co", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { (subwindow.getParent()).removeWindow(subwindow); } }); // The components added to the window are actually added to the window's // layout; you can use either. Alignments are set using the layout layout.addComponent(close); layout.setComponentAlignment(close, Alignment.TOP_RIGHT); } // end of confirmDelete
@Override protected void setup(VaadinRequest request) { final VerticalLayout uiLayout = new VerticalLayout(); uiLayout.setMargin(true); setContent(uiLayout); final VerticalLayout windowLayout = new VerticalLayout(); final Window testWindow = new Window("WebKitFail", windowLayout); testWindow.setWidth(300, Unit.PIXELS); GridLayout gl = new GridLayout(); gl.setHeight(null); gl.setWidth(100, Unit.PERCENTAGE); windowLayout.addComponent(gl); ListSelect listSelect = new ListSelect(); listSelect.setWidth(100, Unit.PERCENTAGE); gl.addComponent(listSelect); gl.setMargin(true); final Button testButton = new Button( "Open Window", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().addWindow(testWindow); } }); uiLayout.addComponent(testButton); }
private void showComponent(final Component component, final String name) { final VerticalLayout layout = new VerticalLayout(); layout.setSizeUndefined(); layout.setMargin(true); final Window window = new Window(name, layout); window.setSizeUndefined(); component.setSizeUndefined(); window.addComponent(component); getWindow().addWindow(window); }
@Override public void init() { window = new Window("Vaadin DB Tester"); window.setSizeFull(); setMainWindow(window); setTheme("runo"); Panel panel = new MainPanel(); window.addComponent(panel); }
@Override public Window getWindow(String name) { Window window = super.getWindow(name); if (window == null) { window = new MainDifferWindow(); window.setSizeUndefined(); window.setName(name); addWindow(window); window.open(new ExternalResource(window.getURL())); } return window; }
private void tambahUserYayasanbaru(UserOprYayasan i) { final Window win = new Window("Tambah User Baru"); Component c = new TambahUserYayasan(i, win); VerticalLayout vl = new VerticalLayout(); vl.setMargin(true); vl.addComponent(c); win.setContent(vl); win.setModal(true); win.setWidth("600px"); win.center(); UI.getCurrent().addWindow(win); }
public void setComponentValue(final String name, final Object object) { super.setComponentValue(name, object); if (name.equals("title")) { dialog.setCaption((String) object); } if ("icon".equals(name)) { dialog.setIcon(getResource(object)); } if ("h".equals(name)) { dialog.setHeight("" + object + "px"); } if ("w".equals(name)) { dialog.setWidth("" + object + "px"); } if ("x".equals(name)) { dialog.setPositionX((Integer) object); } if ("y".equals(name)) { dialog.setPositionY((Integer) object); } if ("closable".equals(name)) { dialog.setClosable((Boolean) object); } if ("resizable".equals(name)) { dialog.setResizable((Boolean) object); } }
private void updateCalendarEventPopup(boolean newEvent) { if (scheduleEventPopup == null) { createCalendarEventPopup(); } if (newEvent) { scheduleEventPopup.setCaption("New event"); } else { scheduleEventPopup.setCaption("Edit event"); } deleteEventButton.setVisible(!newEvent); deleteEventButton.setEnabled(!calendarComponent.isReadOnly()); applyEventButton.setEnabled(!calendarComponent.isReadOnly()); }
/** {@inheritdoc} */ @Override public void init() { // Add a horizontal SplitPanel to the lower area final HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel(); horizontalSplitPanel.setSplitPosition(150, Sizeable.UNITS_PIXELS); horizontalSplitPanel.setSizeFull(); final Window mainWindow = new Window("NodeGraph Widget Application"); final Button openWindow = new Button("Open diagram"); openWindow.addListener( new Button.ClickListener() { /** */ private static final long serialVersionUID = -1522261898787739587L; /** {@inheritdoc} */ @Override public void buttonClick(ClickEvent event) { final Window subwindow = new Window("Node Graph Widget"); subwindow.setWidth("850px"); subwindow.setHeight("500px"); subwindow.setModal(true); final VerticalLayout layout = (VerticalLayout) subwindow.getContent(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); final GraphComponent nodeGraphWidget = getNodeGraph(); layout.addComponent(nodeGraphWidget); mainWindow.addWindow(subwindow); } }); final HorizontalLayout hl = new HorizontalLayout(); hl.setSizeFull(); horizontalSplitPanel.setFirstComponent(openWindow); horizontalSplitPanel.setSecondComponent(hl); mainWindow.setContent(horizontalSplitPanel); mainWindow.setSizeFull(); this.setMainWindow(mainWindow); }
@Override protected void setup(VaadinRequest request) { htmlWindow = new Window("", new Label("HTML caption")); htmlWindow.setId("htmlWindow"); htmlWindow.setCaptionAsHtml(true); htmlWindow.setPositionX(300); htmlWindow.setPositionY(200); textWindow = new Window("", new Label("Text caption")); textWindow.setId("textWindow"); textWindow.setCaptionAsHtml(false); textWindow.setPositionX(300); textWindow.setPositionY(400); addWindow(htmlWindow); addWindow(textWindow); Button red = new Button( "Red", new ClickListener() { @Override public void buttonClick(ClickEvent event) { setWindowCaption("<font style='color: red;'>This may or may not be red</font>"); } }); Button plainText = new Button( "Plain text", new ClickListener() { @Override public void buttonClick(ClickEvent event) { setWindowCaption("This is just text"); } }); Button nullCaption = new Button( "Null", new ClickListener() { @Override public void buttonClick(ClickEvent event) { setWindowCaption(null); } }); Button empty = new Button( "Empty", new ClickListener() { @Override public void buttonClick(ClickEvent event) { setWindowCaption(""); } }); addComponents(red, plainText, nullCaption, empty); red.click(); }
@Override public void init() { final Window main = new Window("Book Examples"); main.setImmediate(true); setMainWindow(main); setTheme("book-examples"); // Set session timeout to 10 seconds // ((WebApplicationContext)getContext()).getHttpSession().setMaxInactiveInterval(10); System.out.println( "Session timeout: " + ((WebApplicationContext) getContext()).getHttpSession().getMaxInactiveInterval() + " seconds"); init(main); }
@Override public Undoer execute(List<VertexRef> targets, OperationContext operationContext) { UI mainWindow = operationContext.getMainWindow(); CommandManager commandManager = m_commandManager; Window window = new Window(); window.setModal(true); VerticalLayout layout = new VerticalLayout(); for (Command command : commandManager.getHistoryList()) { layout.addComponent(new Label(command.toString())); } window.setContent(layout); mainWindow.addWindow(window); return null; }
@Override public void close() { super.close(); orginalValues.clear(); removeListeners(); allComponents.clear(); this.saveButton.setEnabled(false); }
public void showWindowForm() { itemDetilModel = new PerubahanHargaItemModel(); itemDetilView = new PerubahanHargaItemView(itemDetilModel); itemDetilPresenter = new PerubahanHargaItemPresenter(itemDetilModel, itemDetilView); itemDetilView.setSizeFull(); panelFormDetil.setContent(itemDetilView); windowForm = new Window(); windowForm.setModal(true); windowForm.center(); windowForm.setWidth("650px"); windowForm.setHeight("300px"); windowForm.setClosable(true); windowForm.setResizable(false); VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSizeFull(); content.addComponent(panelFormDetil); windowForm.setContent(content); getUI().addWindow(windowForm); }
public Window getWindow() { if (!isFloatingWindow) { return null; } if (keyboardWindow == null) { keyboardWindow = new Window(); keyboardWindow.setCaption("Virtual Keyboard"); // keyboardWindow.setPositionX(200); // keyboardWindow.setPositionY(100); // keyboardWindow.setWidth("600"); // keyboardWindow.setHeight("300"); keyboardWindow.setVisible(false); keyboardWindow.setContent(this); keyboardWindow.setResizable(false); } return keyboardWindow; }
@Override public void showThreadMovePopup( final long threadId, final Long threadCategoryId, final List<Category> allCategories) { final Window window = new ThreadMoveComponent( threadId, threadCategoryId, allCategories, new ThreadMoveComponentListener() { @Override public void commit(final long threadId, final Long newCategoryId) { threadListing.removeThreadRow(threadId); getPresenter().move(threadId, newCategoryId); } }); window.center(); getUI().addWindow(window); }
private void buildMainWindow() { root = new FormLayout(); root.addComponent(buildTopMenu()); super.setContent(root); content = new LoginPanel(); root.addComponent(content); root.addComponent(buildBottomMenu()); }
public Login() { // TODO Auto-generated constructor stub VaadinSession.getCurrent().setAttribute("municipaldata", null); VaadinSession.getCurrent().setAttribute("barangaydata", null); VaadinSession.getCurrent().setAttribute("id", null); setSizeFull(); dialog = new Window("Login"); dialog.setClosable(false); dialog.setResizable(false); dialog.center(); // new CreateAccount(); VerticalLayout content = new VerticalLayout(); content.setSpacing(true); content.setMargin(new MarginInfo(false, true, true, true)); dialog.setContent(content); Label title = new Label("Login"); title.addStyleName(ValoTheme.LABEL_H2); title.addStyleName(ValoTheme.LABEL_COLORED); HorizontalLayout form = new HorizontalLayout(); form.setSpacing(true); form.addStyleName("wrapping"); content.addComponent(form); username.setIcon(FontAwesome.USER); username.focus(); form.addComponent(username); password.setIcon(FontAwesome.LOCK); form.addComponent(password); Button submit = new Button("Login"); submit.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_RIGHT); submit.addStyleName(ValoTheme.BUTTON_PRIMARY); submit.setIcon(FontAwesome.ARROW_RIGHT); submit.setWidth("100%"); submit.addListener(ClickEvent.class, this, "gotoMain"); content.addComponent(submit); }
public void showWindow() { subwindow = new Window("Change Category Type"); subwindow.setModal(true); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); final TextField txtField = new TextField("Change Category Type"); txtField.setValue(categoryType); subwindow.addComponent(txtField); Button close = new Button( "Close", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { (subwindow.getParent()).removeWindow(subwindow); } }); Button save = new Button( "Save", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { String newCatType = txtField.getValue().toString(); controller.updateComponentCategory(componentId, newCatType, itemId); (subwindow.getParent()).removeWindow(subwindow); } }); HorizontalLayout hl = new HorizontalLayout(); hl.addComponent(save); hl.addComponent(close); layout.addComponent(hl); subwindow.setWidth("350px"); subwindow.addComponent(layout); router.getMainWindow().addWindow(subwindow); }
public void init() { Window window = new Window(); setMainWindow(window); final HorizontalLayout hp = new HorizontalLayout(); final Label label1 = new Label("Avec une tempature de "); label1.setWidth("150px"); hp.addComponent(label1); final TextField temp = new TextField(); temp.setWidth("20px"); hp.addComponent(temp); final Label label2 = new Label("¡ et un vent ˆ "); label2.setWidth("100px"); hp.addComponent(label2); final TextField wind = new TextField(); wind.setWidth("20px"); hp.addComponent(wind); final Label label3 = new Label(" km/h produit une tempŽrateure ressentie "); label3.setWidth("200px"); hp.addComponent(label3); final Label resultLabel = new Label(); final Button submit = new Button( "de", new ClickListener() { @Override public void buttonClick(ClickEvent event) { Double result = getTemperatureRessentie( Double.valueOf((String) temp.getValue()), Double.valueOf((String) wind.getValue())); resultLabel.setValue(result); hp.addComponent(resultLabel); } }); hp.addComponent(submit); window.addComponent(hp); }
/* second version, using popup */ public void onCreateUser() throws ViewFactoryException { // create view UserView view = this.createView(UserView.class); // configure the form with bean item this.userForm = view.getUserForm(); User u = new User(); u.setUserName("newuser"); u.setFirstName("First name"); u.setLastName("Last name"); BeanItem<User> beanItem = new BeanItem<User>(u); this.userForm.setItemDataSource(beanItem); // create a window using caption from view this.dialog = new Window(view.getCaption()); view.setCaption(null); this.dialog.setModal(true); dialog.addComponent(view); dialog.setWidth("300px"); this.eventBus.showDialog(this.dialog); }
@Override public void init() { this.setTheme("wmhd"); this.getContext().addTransactionListener(this); this.mainWindow = new Window("My Vaadin Application"); this.setMainWindow(mainWindow); mainWindow.setContent(new LoginScreen(this)); }
@Override public void init() { setTheme("mocha"); Window window = new Window(); window.setCaption(applicationTitle()); window.setSizeFull(); window.addStyleName("mocha-window"); setMainWindow(window); boolean needLogin = true; // check user if (getUser() != null) { needLogin = false; } else { if (isDevelopMode()) { setUser(loadTestUser()); needLogin = false; } } if (!needLogin) { AbstractMainPage homepage = SpringContextUtils.getBean("homepage", AbstractMainPage.class); homepage.setResponse(response); window.setContent(homepage); } else { LoginScreen loginScreen = new LoginScreen(cookieUsername); loginScreen.setResponse(response); window.setContent(loginScreen); } }
/** * @param caption * @param primaryStyleName - the style defined styleName * @param styleName - the user defined styleName * @return */ private void createWindowWith(String caption, String primaryStyleName, String styleName) { Window window = new Window(); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); window.setContent(layout); layout.addComponent(new Label("Some content")); if (caption != null) { window.setCaption(caption); } if (primaryStyleName != null) { window.addStyleName(primaryStyleName); } if (styleName != null) { window.addStyleName(styleName); } parent.getUI().addWindow(window); }
@Override public void init() { window = new Window("My Vaadin Application"); setMainWindow(window); Button button = new Button("Click M e"); button.addListener( new Button.ClickListener() { public void buttonClick(ClickEvent event) { window.addComponent(new Label("Thank you for clicking")); } }); window.addComponent(button); }