List of usage examples for com.vaadin.ui Window setResizable
public void setResizable(boolean resizable)
From source file:org.opennms.features.vaadin.dashboard.config.ui.HelpClickListener.java
License:Open Source License
@Override public void buttonClick(Button.ClickEvent clickEvent) { final Window window = new Window("Help"); window.setModal(true);// w ww. j a v a 2 s. co m window.setClosable(false); window.setResizable(false); window.setWidth("55%"); window.setHeight("80%"); m_component.getUI().addWindow(window); window.setContent(new VerticalLayout() { { setMargin(true); setSpacing(true); setSizeFull(); HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSizeFull(); horizontalLayout.setSpacing(true); Tree tree = new Tree(); tree.setNullSelectionAllowed(false); tree.setMultiSelect(false); tree.setImmediate(true); tree.addItem("Overview"); tree.setChildrenAllowed("Overview", false); tree.addItem("Installed Dashlets"); tree.setChildrenAllowed("Installed Dashlets", true); final List<DashletFactory> factories = m_dashletSelector.getDashletFactoryList(); for (DashletFactory dashletFactory : factories) { tree.addItem(dashletFactory.getName()); tree.setParent(dashletFactory.getName(), "Installed Dashlets"); tree.setChildrenAllowed(dashletFactory.getName(), false); } horizontalLayout.addComponent(tree); for (final Object id : tree.rootItemIds()) { tree.expandItemsRecursively(id); } final Panel panel = new Panel(); panel.setSizeFull(); horizontalLayout.addComponent(panel); horizontalLayout.setExpandRatio(panel, 1.0f); addComponent(horizontalLayout); setExpandRatio(horizontalLayout, 1.0f); tree.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { String itemId = String.valueOf(valueChangeEvent.getProperty().getValue()); if ("Installed Dashlets".equals(itemId)) { return; } if ("Overview".equals(itemId)) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSpacing(true); verticalLayout.setMargin(true); verticalLayout.addComponent(new Label(getOverviewHelpHTML(), ContentMode.HTML)); panel.setContent(verticalLayout); } else { DashletFactory dashletFactory = m_dashletSelector.getDashletFactoryForName(itemId); if (dashletFactory != null) { if (dashletFactory.providesHelpComponent()) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSpacing(true); verticalLayout.setMargin(true); Label helpTitle = new Label( "Help for Dashlet '" + dashletFactory.getName() + "'"); helpTitle.addStyleName("help-title"); verticalLayout.addComponent(helpTitle); verticalLayout.addComponent(dashletFactory.getHelpComponent()); panel.setContent(verticalLayout); } } } } }); tree.select("Overview"); addComponent(new HorizontalLayout() { { setMargin(true); setSpacing(true); setWidth("100%"); Button closeButton = new Button("Close"); addComponent(closeButton); setComponentAlignment(closeButton, Alignment.MIDDLE_RIGHT); closeButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { window.close(); } }); } }); } }); }
From source file:org.opennms.features.vaadin.dashboard.config.ui.PreviewClickListener.java
License:Open Source License
@Override public void buttonClick(Button.ClickEvent clickEvent) { final Window window = new Window("Preview"); window.setModal(true);/* ww w . j a v a 2 s . c o m*/ window.setClosable(false); window.setResizable(false); window.setWidth("80%"); window.setHeight("90%"); m_component.getUI().addWindow(window); final WallboardBody wallboardBody = new WallboardBody(); window.setContent(new VerticalLayout() { { setMargin(true); setSpacing(true); setSizeFull(); addComponent(wallboardBody); setExpandRatio(wallboardBody, 1.0f); addComponent(new HorizontalLayout() { { setMargin(true); setSpacing(true); setWidth("100%"); Button closeButton = new Button("Close"); addComponent(closeButton); setComponentAlignment(closeButton, Alignment.MIDDLE_RIGHT); closeButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { window.close(); } }); } }); } }); wallboardBody.setDashletSpecs(m_wallboard.getDashletSpecs()); }
From source file:org.opennms.features.vaadin.dashboard.config.ui.WallboardConfigView.java
License:Open Source License
/** * This method is used to add a new {@link TabSheet.Tab} component. It creates a new window querying the user for the name of the new {@link Wallboard}. *///from w w w .j a va 2 s . com protected void addNewTabComponent() { final Window window = new Window("New Ops Board"); window.setModal(true); window.setClosable(false); window.setResizable(false); window.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent e) { m_dashboardOverview.refreshTable(); } }); getUI().addWindow(window); window.setContent(new VerticalLayout() { TextField name = new TextField("Ops Board Name"); { addComponent(new FormLayout() { { setSizeUndefined(); setMargin(true); String newName = "Untitled"; int i = 1; if (WallboardProvider.getInstance().containsWallboard(newName)) { do { i++; newName = "Untitled #" + i; } while (WallboardProvider.getInstance().containsWallboard(newName)); } name.setValue(newName); addComponent(name); name.focus(); name.selectAll(); name.addValidator(new AbstractStringValidator("Title must be unique") { @Override protected boolean isValidValue(String s) { return (!WallboardProvider.getInstance().containsWallboard(s) && !"".equals(s)); } }); } }); addComponent(new HorizontalLayout() { { setMargin(true); setSpacing(true); setWidth("100%"); Button cancel = new Button("Cancel"); cancel.setDescription("Cancel editing"); cancel.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { // NMS-7560: Toggle the tab in order to allow us to click it again m_tabSheet.togglePlusTab(); window.close(); } }); cancel.setClickShortcut(ShortcutAction.KeyCode.ESCAPE, null); addComponent(cancel); setExpandRatio(cancel, 1); setComponentAlignment(cancel, Alignment.TOP_RIGHT); Button ok = new Button("Save"); ok.setDescription("Save configuration"); ok.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (name.isValid()) { Wallboard wallboard = new Wallboard(); wallboard.setTitle(name.getValue()); WallboardProvider.getInstance().addWallboard(wallboard); WallboardProvider.getInstance().save(); WallboardEditor wallboardEditor = new WallboardEditor(m_dashletSelector, wallboard); TabSheet.Tab tab = m_tabSheet.addTab(wallboardEditor, wallboard.getTitle()); wallboardEditor.setTab(tab); m_wallboardEditorMap.put(wallboard, tab); tab.setClosable(true); m_tabSheet.setSelectedTab(tab); window.close(); } } }); ok.setClickShortcut(ShortcutAction.KeyCode.ENTER, null); addComponent(ok); } }); } }); }
From source file:org.opennms.features.vaadin.surveillanceviews.ui.PreviewClickListener.java
License:Open Source License
/** * {@inheritDoc}//from w ww .j ava 2 s .c o m */ @Override public void buttonClick(Button.ClickEvent clickEvent) { final Window window = new Window("Preview"); window.setModal(true); window.setClosable(true); window.setResizable(false); window.setWidth("80%"); window.setHeight("90%"); m_component.getUI().addWindow(window); window.setContent(new VerticalLayout() { { addComponent(new VerticalLayout() { { setMargin(true); setSpacing(true); setSizeFull(); addComponent(new SurveillanceView(m_view, m_surveillanceViewService, false, false)); } }); } }); }
From source file:org.processbase.ui.servlet.MainWindow.java
License:Open Source License
void openLogoutWindow() { Window logout = new Window(((PbApplication) getApplication()).getPbMessages().getString("btnLogout")); logout.setModal(true);// w w w .j av a2 s .co m // logout.setStyleName(Reindeer.WINDOW_BLACK); logout.setWidth("260px"); logout.setResizable(false); logout.setClosable(false); logout.setDraggable(false); logout.setCloseShortcut(KeyCode.ESCAPE, null); Label helpText = new Label("Are you sure you want to log out?", Label.CONTENT_XHTML); logout.addComponent(helpText); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); Button yes = new Button(((PbApplication) getApplication()).getPbMessages().getString("btnLogout"), new Button.ClickListener() { public void buttonClick(ClickEvent event) { WebApplicationContext applicationContext = (WebApplicationContext) getApplication() .getContext(); getApplication().close(); applicationContext.getHttpSession().invalidate(); } }); yes.setStyleName(Reindeer.BUTTON_DEFAULT); yes.focus(); buttons.addComponent(yes); Button no = new Button(((PbApplication) getApplication()).getPbMessages().getString("btnCancel"), new Button.ClickListener() { public void buttonClick(ClickEvent event) { removeWindow(event.getButton().getWindow()); } }); buttons.addComponent(no); logout.addComponent(buttons); ((VerticalLayout) logout.getContent()).setComponentAlignment(buttons, Alignment.MIDDLE_CENTER); ((VerticalLayout) logout.getContent()).setSpacing(true); addWindow(logout); }
From source file:org.tltv.gantt.demo.DemoUI.java
License:Apache License
private void openStepEditor(AbstractStep step) { final Window win = new Window("Step Editor"); win.setResizable(false); win.center();// w w w . j ava 2 s . c om final Collection<Component> hidden = new ArrayList<Component>(); BeanItem<AbstractStep> item = new BeanItem<AbstractStep>(step); final FieldGroup group = new FieldGroup(item); group.setBuffered(true); TextField captionField = new TextField("Caption"); captionField.setNullRepresentation(""); group.bind(captionField, "caption"); TextField descriptionField = new TextField("Description"); descriptionField.setNullRepresentation(""); group.bind(descriptionField, "description"); descriptionField.setVisible(false); hidden.add(descriptionField); NativeSelect captionMode = new NativeSelect("Caption Mode"); captionMode.addItem(Step.CaptionMode.TEXT); captionMode.addItem(Step.CaptionMode.HTML); group.bind(captionMode, "captionMode"); captionMode.setVisible(false); hidden.add(captionMode); CheckBox showProgress = new CheckBox("Show progress"); group.bind(showProgress, "showProgress"); showProgress.setVisible(false); hidden.add(showProgress); Slider progress = new Slider("Progress"); progress.setWidth(100, Unit.PERCENTAGE); group.bind(progress, "progress"); progress.setVisible(false); hidden.add(progress); NativeSelect predecessorSelect = new NativeSelect("Predecessor Step"); predecessorSelect.setWidth(100, Unit.PERCENTAGE); fillPredecessorCanditatesToSelect(step, predecessorSelect); predecessorSelect.setEnabled(step instanceof Step); if (step instanceof Step) { group.bind(predecessorSelect, "predecessor"); } predecessorSelect.setVisible(false); hidden.add(predecessorSelect); final NativeSelect parentStepSelect = new NativeSelect("Parent Step"); parentStepSelect.setWidth(100, Unit.PERCENTAGE); parentStepSelect.setEnabled(false); fillParentStepCanditatesToSelect(step, parentStepSelect); parentStepSelect.setVisible(false); hidden.add(parentStepSelect); HorizontalLayout colorLayout = new HorizontalLayout(); colorLayout.setWidth(100, Unit.PERCENTAGE); colorLayout.setVisible(false); hidden.add(colorLayout); final TextField bgField = new TextField("Background color"); bgField.setNullRepresentation(""); group.bind(bgField, "backgroundColor"); bgField.setEnabled(false); final ColorPicker bgColorPicker = new ColorPicker(); bgColorPicker.setPosition(300, 100); bgColorPicker.setColor(new CssColorToColorPickerConverter().convertToModel(step.getBackgroundColor())); bgColorPicker.addColorChangeListener(new ColorChangeListener() { @Override public void colorChanged(ColorChangeEvent event) { bgField.setValue(event.getColor().getCSS()); } }); colorLayout.addComponent(bgField); colorLayout.addComponent(bgColorPicker); colorLayout.setExpandRatio(bgField, 1); colorLayout.setComponentAlignment(bgColorPicker, Alignment.BOTTOM_LEFT); DateField startDate = new DateField("Start date"); startDate.setLocale(gantt.getLocale()); startDate.setTimeZone(gantt.getTimeZone()); startDate.setResolution(Resolution.SECOND); startDate.setConverter(new DateToLongConverter()); group.bind(startDate, "startDate"); DateField endDate = new DateField("End date"); endDate.setLocale(gantt.getLocale()); endDate.setTimeZone(gantt.getTimeZone()); endDate.setResolution(Resolution.SECOND); endDate.setConverter(new DateToLongConverter()); group.bind(endDate, "endDate"); CheckBox showMore = new CheckBox("Show all settings"); showMore.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { for (Component c : hidden) { c.setVisible((Boolean) event.getProperty().getValue()); } win.center(); } }); VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); win.setContent(content); content.addComponent(captionField); content.addComponent(captionMode); content.addComponent(descriptionField); content.addComponent(showProgress); content.addComponent(progress); content.addComponent(predecessorSelect); content.addComponent(parentStepSelect); content.addComponent(colorLayout); content.addComponent(startDate); content.addComponent(endDate); content.addComponent(showMore); HorizontalLayout buttons = new HorizontalLayout(); content.addComponent(buttons); Button ok = new Button("Ok", new ClickListener() { @Override public void buttonClick(ClickEvent event) { commit(win, group, parentStepSelect); } }); Button cancel = new Button("Cancel", new ClickListener() { @Override public void buttonClick(ClickEvent event) { cancel(win, group); } }); Button delete = new Button("Delete", new ClickListener() { @Override public void buttonClick(ClickEvent event) { delete(win, group); } }); buttons.addComponent(ok); buttons.addComponent(cancel); buttons.addComponent(delete); win.setClosable(true); getUI().addWindow(win); }
From source file:org.vaadin.addon.ewopener.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { EnhancedBrowserWindowOpener opener1 = new EnhancedBrowserWindowOpener().popupBlockerWorkaround(true); Button button1 = new Button("Click me"); button1.addClickListener(e -> {//w ww.j a v a 2 s. c o m opener1.open(generateResource()); }); opener1.extend(button1); EnhancedBrowserWindowOpener opener4 = new EnhancedBrowserWindowOpener().popupBlockerWorkaround(true); Button button4 = new Button("Nothing to open here"); button4.addClickListener(e -> { opener4.open((Resource) null); }); opener4.extend(button4); Button button2 = new Button("Click me"); button2.addClickListener(e -> { EnhancedBrowserWindowOpener.extendOnce(button2).open(generateResource()); }); Button button3 = new Button("Click me"); EnhancedBrowserWindowOpener opener3 = new EnhancedBrowserWindowOpener().popupBlockerWorkaround(true) .withGeneratedContent("myFileName.txt", this::generateContent).doExtend(button3); button3.addClickListener(opener3::open); Link link = new Link("Click me", null); new EnhancedBrowserWindowOpener().clientSide(true) .withGeneratedContent("myFileName.txt", this::generateContent).doExtend(link); Link link2 = new Link("Click me", null); new EnhancedBrowserWindowOpener().clientSide(true) .withGeneratedContent("myFileName.txt", this::generateContent, resource -> { resource.setCacheTime(0); resource.setFilename("runtimeFileName-" + Instant.now().getEpochSecond() + ".txt"); }).doExtend(link2); EnhancedBrowserWindowOpener opener5 = new EnhancedBrowserWindowOpener( new ClassResource(DemoUI.class, "static.txt")); CssLayout hiddenComponent = new MCssLayout().withWidth("0").withHeight("0"); opener5.extend(hiddenComponent); CompletableFuture.runAsync(this::doSomeLongProcessing).thenRun(() -> getUI().access(opener5::open)); table = new Table("Select items to download", new BeanItemContainer<>(DummyService.Person.class, DummyService.data())); table.setImmediate(true); table.setVisibleColumns("name", "age"); table.setColumnHeaders("Name", "Age"); table.setWidth("100%"); table.setPageLength(20); table.setMultiSelectMode(MultiSelectMode.DEFAULT); table.setMultiSelect(true); table.setSelectable(true); final MyPopupContent popupContent = new MyPopupContent(); Button popupButton = new Button("Open modal", event -> { Window window = new Window("Test", popupContent); window.setWidth(40, Sizeable.Unit.PERCENTAGE); window.setHeight(200, Sizeable.Unit.PIXELS); window.setModal(true); window.setDraggable(false); window.setResizable(false); window.center(); getUI().addWindow(window); }); MenuBar.Command cmd = selectedItem -> Notification.show("Item clicked", "Item is " + selectedItem.getDescription(), Notification.Type.TRAY_NOTIFICATION); MenuBar menuBar = new MenuBar(); menuBar.setSizeFull(); EnhancedBrowserWindowOpener opener6 = new EnhancedBrowserWindowOpener() .withGeneratedContent("menu-item-serverside.txt", this::generateContent) .popupBlockerWorkaround(true); EnhancedBrowserWindowOpener opener7 = new EnhancedBrowserWindowOpener() .withGeneratedContent("menu-item-clientside-1.txt", this::generateContent).clientSide(true); EnhancedBrowserWindowOpener opener8 = new EnhancedBrowserWindowOpener() .withGeneratedContent("menu-item-clientside-2.txt", this::generateContent).clientSide(true); MenuBar.MenuItem menuItem = menuBar.addItem("Download from Menu (Client side)", selectedItem -> { System.out.println("OK, Invoked"); }); MenuBar.MenuItem subMenu = menuBar.addItem("Sub menu", null); subMenu.addItem("Item 1", cmd); subMenu.addItem("Item 2", cmd); MenuBar.MenuItem subItem = subMenu.addItem("Download (client side)", cmd); MenuBar.MenuItem subItem2 = subMenu.addItem("Download (server side)", selectedItem -> opener6.open()); opener7.doExtend(menuBar, menuItem); opener6.doExtend(menuBar, subItem2); opener8.doExtend(menuBar, subItem); // Show it in the middle of the screen final Layout layout = new MVerticalLayout( new MLabel("Enhanced Window Opener Demo").withStyleName(ValoTheme.LABEL_COLORED, ValoTheme.LABEL_H1), new MHorizontalLayout().add(table, 1) .add(new MCssLayout(menuBar, readMarkdown("code_menu.md").withFullWidth(), new MVerticalLayout(readMarkdown("code1.md"), button1) .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false), new MVerticalLayout(readMarkdown("code2.md"), button2) .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false), new MVerticalLayout(readMarkdown("code7.md"), button3) .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false), new MVerticalLayout(readMarkdown("code5.md"), link) .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false), new MVerticalLayout(readMarkdown("code6.md"), link2) .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false), new MVerticalLayout(readMarkdown("code3.md"), button4) .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false), new MVerticalLayout(readMarkdown("code8.md"), popupButton) .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false), new MVerticalLayout(readMarkdown("code4.md"), hiddenComponent) .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false)) .withFullWidth().withStyleName("demo-samples"), 5) .withFullWidth()).withFullWidth().withMargin(true); setContent(layout); }
From source file:org.vaadin.addons.forms.LocationApplication.java
License:Apache License
public void init() { Window mainWindow = new Window("Location Form Sample"); Button button = new Button("Open Location Form"); button.setWidth("150px"); button.setHeight("30px"); button.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { Window window = new Window("Update Location"); window.addComponent(new LocationForm()); window.setModal(true);//w w w . j a v a 2 s . co m window.setResizable(false); window.setWidth("510px"); window.setHeight("370px"); getMainWindow().addWindow(window); window.center(); } }); mainWindow.addComponent(button); setMainWindow(mainWindow); }
From source file:pl.exsio.frameset.vaadin.ui.support.component.data.common.DataComponent.java
License:Open Source License
protected Window createFormWindow(String title) { final Window formWindow = new Window(title); formWindow.center();//from w w w .ja v a2s . c o m formWindow.setSizeUndefined(); formWindow.setModal(true); formWindow.setResizable(false); formWindow.setDraggable(false); formWindow.setResizeLazy(false); formWindow.setStyleName("frameset-dc-window"); return formWindow; }
From source file:pl.exsio.frameset.vaadin.ui.support.dialog.ConfirmationDialog.java
License:Open Source License
public static void show(final String msg, final Handler positiveHandler, final Handler negativeHandler) { final Window window = new Window(t("confirmation.title")); window.center();// w ww. j av a 2 s .c om window.setWidth("450px"); window.setModal(true); window.setResizable(false); window.setDraggable(false); VerticalLayout vlayout = new VerticalLayout() { { addComponent(new Label(msg)); addComponent(getControls(window, positiveHandler, negativeHandler)); } }; vlayout.setMargin(true); window.setContent(vlayout); UI.getCurrent().addWindow(window); window.focus(); }