List of usage examples for com.vaadin.ui Window setModal
public void setModal(boolean modal)
From source file:com.hivesys.dashboard.view.search.TextualView.java
public void UpdateSearchPane(String searchString) { css.removeAllComponents();//from w w w . j av a 2 s.c om SearchResponse response = ElasticSearchContext.getInstance().searchSimpleQuery(searchString); logResponse(response); SearchHits results = response.getHits(); Label labelResultSummary = new Label("About " + results.getHits().length + " results found <br><br>", ContentMode.HTML); css.addComponent(labelResultSummary); for (SearchHit hit : results) { CssLayout cssResult = new CssLayout(); cssResult.setStyleName("search-result"); try { String filename = DocumentDB.getInstance().getDocumentNameFromHash(hit.getId()); String boxviewID = DocumentDB.getInstance().getBoxViewIDFromHash(hit.getId()); String highlight = ""; HighlightField objhighlight = hit.highlightFields().get("file"); if (objhighlight != null) { for (Text fgmt : objhighlight.getFragments()) { highlight += fgmt.string() + "<br>"; } } Button lblfileName = new Button(filename); lblfileName.addClickListener((Button.ClickEvent event) -> { if (boxviewID != null) { String url = BoxViewDocuments.getInstance().getViewURL(boxviewID); if (url != null || !url.equals("")) { url = BoxViewDocuments.getInstance().getViewURL(boxviewID); BrowserFrame bframe = new BrowserFrame(filename, new ExternalResource(url)); VerticalLayout vlayout = new VerticalLayout(bframe); final Window w = new Window(); w.setSizeFull(); w.setModal(true); w.setWindowMode(WindowMode.MAXIMIZED); w.setContent(vlayout); vlayout.setSizeFull(); vlayout.setMargin(true); w.setResizable(false); w.setDraggable(false); UI.getCurrent().addWindow(w); bframe.setSizeFull(); return; } Notification.show("Preview not available for this document!"); } }); lblfileName.setPrimaryStyleName("filename"); Label lblHighlight = new Label(highlight, ContentMode.HTML); lblHighlight.setStyleName("highlight"); cssResult.addComponent(lblfileName); cssResult.addComponent(lblHighlight); css.addComponent(cssResult); css.addComponent(new Label("<br>", ContentMode.HTML)); } catch (SQLException ex) { } } }
From source file:com.hris.connection.ErrorLoggedNotification.java
public static void showErrorLoggedOnWindow(String error, String className) { VerticalLayout v = new VerticalLayout(); v.setSizeFull();/*from w ww .j a v a 2s .c o m*/ v.setMargin(true); Window sub = new Window("ERROR MESSAGE!", v); sub.setWidth("500px"); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub); } sub.setModal(true); Panel panel = new Panel(); panel.setSizeFull(); panel.setContent(new Label(error + " on \n" + className, ContentMode.HTML)); panel.getContent().setHeightUndefined(); sub.setContent(panel); sub.getContent().setHeightUndefined(); }
From source file:com.iton.gittest.HelloWorld.MyVaadinApplication.java
License:Apache License
@Override public void init() { window = new Window("My Vaadin Application"); setMainWindow(window);//from w ww . j a v a 2s . c o m Button button = new Button("Click Me"); button.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { Window win = new Window("PopUp Form"); win.setModal(true); win.setScrollable(false); win.setDraggable(false); win.setResizable(false); win.center(); win.setWidth("350px"); win.addComponent(new Form()); window.addWindow(win); } }); window.addComponent(button); }
From source file:com.liferay.mail.vaadin.PreferencesView.java
License:Open Source License
private void editAccount(Account account) { String windowTitle = Lang.get(account == null ? "add-mail-account" : "edit-account"); final Window editorWindow = new Window(windowTitle); editorWindow.setSizeUndefined();// w w w . java2s .c om editorWindow.center(); editorWindow.setModal(true); editorWindow.setResizable(false); AccountEditor.AccountEditorListener listener = new SaveAccountListener(editorWindow); // show a pre-filled edit dialog AccountEditor editor = new AccountEditor(account, controller, listener); editorWindow.setContent(editor); controller.getApplication().getMainWindow().addWindow(editorWindow); }
From source file:com.liferay.mail.vaadin.PreferencesView.java
License:Open Source License
private void editGmailAccount(Account account) { String windowTitle = Lang.get(account == null ? "add-gmail-account" : "edit-gmail-account"); final Window editorWindow = new Window(windowTitle); editorWindow.setSizeUndefined();/*from w w w . ja v a 2s .c o m*/ editorWindow.center(); editorWindow.setModal(true); editorWindow.setResizable(false); AccountEditor.AccountEditorListener listener = new SaveAccountListener(editorWindow); // show a pre-filled edit dialog AccountEditor editor = new GMailAccountEditor(account, controller, listener); editorWindow.setContent(editor); controller.getApplication().getMainWindow().addWindow(editorWindow); }
From source file:com.lizardtech.expresszip.ui.SetupMapPresenter.java
License:Apache License
@Override public void shapeFileUploadedEvent(final String filename, final ByteArrayInputStream input) { final Window modal = new Window("Wait"); final Window mainWindow = (ExpressZipWindow) setupMapView.getApplication().getMainWindow(); final SetupMapPresenter presenter = this; Thread spinner = new Thread(new Runnable() { public void run() { ProgressIndicator pi = new ProgressIndicator(); pi.setCaption("Processing Shapefile..."); modal.setModal(true); modal.setClosable(false);//w ww .ja v a2s. c o m modal.setResizable(false); modal.getContent().setSizeUndefined(); // trick to size around content modal.getContent().addComponent(pi); modal.setWidth(modal.getWidth(), modal.getWidthUnits()); mainWindow.addWindow(modal); VectorLayer uploadedShapeFile = setupMapModel.shapeFileUploaded(filename, input); if (uploadedShapeFile != null) { shapeFileLayer = uploadedShapeFile; mapModel.addVectorLayer(shapeFileLayer); setupMapView.updateShapeLayer(shapeFileLayer); mapModel.updateOpenLayersMap(); Bounds shpFileBounds = shapeFileLayer.getBoundsForLayer(mapModel.getCurrentProjection()); resetExtentLayer(shpFileBounds, presenter); map.addLayer(boundingBoxLayer); } mainWindow.removeWindow(modal); } }); spinner.start(); }
From source file:com.lizardtech.expresszip.vaadin.FindLayersViewComponent.java
License:Apache License
public FindLayersViewComponent() { treeTable = new ExpressZipTreeTable(); popupTable = new ExpressZipTreeTable(); configureTable(treeTable);/*from w w w .ja va2 s .com*/ popupSelectionListener = new Property.ValueChangeListener() { private static final long serialVersionUID = 625365970493526725L; @Override public void valueChange(ValueChangeEvent event) { // the current popup selection Set<ExpressZipLayer> popupSelection = (Set<ExpressZipLayer>) event.getProperty().getValue(); // get the tree's current selection HashSet<ExpressZipLayer> treeSelection = new HashSet<ExpressZipLayer>( (Set<ExpressZipLayer>) treeTable.getValue()); // remove all items in common with popup treeSelection.removeAll(popupTable.getItemIds()); // set the treeTable selection to the union Set<ExpressZipLayer> unionSelection = new HashSet<ExpressZipLayer>(); unionSelection.addAll(popupSelection); unionSelection.addAll(treeSelection); treeTable.setValue(unionSelection); } }; popupTable.addListener(popupSelectionListener); treeTable.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 6236114836521221107L; @Override public void valueChange(ValueChangeEvent event) { Set<ExpressZipLayer> highlightedLayers = (Set<ExpressZipLayer>) event.getProperty().getValue(); for (FindLayersViewListener listener : listeners) { listener.layerHighlightedEvent(highlightedLayers); } // reset selection of popup table popupTable.removeListener(popupSelectionListener); // intersection of treeTable's selection and popupTable items Set<ExpressZipLayer> popupSelection = new HashSet<ExpressZipLayer>(); popupSelection.addAll(highlightedLayers); popupSelection.retainAll(popupTable.getItemIds()); popupTable.setValue(popupSelection); popupTable.addListener(popupSelectionListener); } }); configureTable(popupTable); filter = new Filter(this); filterButtonListener = new FilterListeners(); axisSelectedListener = new AxisSelected(); listeners = new ArrayList<FindLayersViewListener>(); btnNext = new ExpressZipButton("Next", Style.STEP); btnBack = new ExpressZipButton("Back", Style.STEP); btnAddFilter = new ExpressZipButton("Add Filter", Style.ACTION); btnAddFilter.addStyleName("filter-flow"); hshFilterButtons = new HashMap<Button, FilterObject>(); cssLayers = new CssLayout(); basemapSelector = new ComboBox(); basemapSelector.setWidth(100.0f, UNITS_PERCENTAGE); basemapSelector.setTextInputAllowed(false); basemapSelector.setImmediate(true); basemapSelector.setNullSelectionAllowed(false); basemapSelector.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -7358667131762099215L; @Override public void valueChange(ValueChangeEvent event) { ProjectedLayer l = (ProjectedLayer) basemapSelector.getValue(); boolean enableCheckbox = false; if (l instanceof WebMapServiceLayer) { for (ExpressZipLayer local : mapModel.getLocalBaseLayers()) { if (l.toString().equals(local.getName())) { enableCheckbox = true; break; } } } includeBasemap.setEnabled(enableCheckbox); if (!enableCheckbox) { includeBasemap.setValue(false); } if (mapModel.getBaseLayerTerms(l) != null && !mapModel.getBaseLayerTermsAccepted(l)) { final Window modal = new Window("Terms of Use"); modal.setModal(true); modal.setClosable(false); modal.setResizable(false); modal.getContent().setSizeUndefined(); // trick to size around content Button bOK = new ExpressZipButton("OK", Style.ACTION, new ClickListener() { private static final long serialVersionUID = -2872178665349848542L; @Override public void buttonClick(ClickEvent event) { ProjectedLayer l = (ProjectedLayer) basemapSelector.getValue(); mapModel.setBaseLayerTermsAccepted(l); for (FindLayersViewListener listener : listeners) listener.baseMapChanged(l); ((ExpressZipWindow) getApplication().getMainWindow()).removeWindow(modal); } }); Button bCancel = new ExpressZipButton("Cancel", Style.ACTION, new ClickListener() { private static final long serialVersionUID = -3044064554876422836L; @Override public void buttonClick(ClickEvent event) { basemapSelector.select(mapModel.getBaseLayers().get(0)); ((ExpressZipWindow) getApplication().getMainWindow()).removeWindow(modal); } }); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponent(bOK); buttons.addComponent(bCancel); Label termsText = new Label(mapModel.getBaseLayerTerms(l)); termsText.setContentMode(Label.CONTENT_XHTML); VerticalLayout vlay = new VerticalLayout(); vlay.addComponent(termsText); vlay.addComponent(buttons); vlay.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT); vlay.setWidth(400, UNITS_PIXELS); modal.getContent().addComponent(vlay); ((ExpressZipWindow) getApplication().getMainWindow()).addWindow(modal); } else { for (FindLayersViewListener listener : listeners) listener.baseMapChanged(l); } } }); includeBasemap = new CheckBox(); includeBasemap.setDescription("Include this basemap in the exported image."); includeBasemap.setWidth(64f, UNITS_PIXELS); HorizontalLayout basemapLayout = new HorizontalLayout(); basemapLayout.setWidth(100f, UNITS_PERCENTAGE); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); setSizeFull(); Label step = new Label("Step 1: Select Layers"); step.addStyleName("step"); layout.addComponent(step); layout.addComponent(treeTable); layout.setSpacing(true); treeTable.setSizeFull(); layout.setExpandRatio(treeTable, 1f); layout.addComponent(new Panel(BASEMAP, basemapLayout)); basemapLayout.addComponent(basemapSelector); basemapLayout.setExpandRatio(basemapSelector, 1f); basemapLayout.addComponent(includeBasemap); layout.addComponent(cssLayers); cssLayers.addComponent(btnAddFilter); HorizontalLayout backSubmitLayout = new HorizontalLayout(); backSubmitLayout.setWidth("100%"); backSubmitLayout.addComponent(btnBack); backSubmitLayout.addComponent(btnNext); backSubmitLayout.setComponentAlignment(btnBack, Alignment.BOTTOM_LEFT); backSubmitLayout.setComponentAlignment(btnNext, Alignment.BOTTOM_RIGHT); VerticalLayout navLayout = new VerticalLayout(); navLayout.addComponent(backSubmitLayout); navLayout.setSpacing(true); ThemeResource banner = new ThemeResource("img/ProgressBar1.png"); navLayout.addComponent(new Embedded(null, banner)); layout.addComponent(navLayout); layout.setComponentAlignment(navLayout, Alignment.BOTTOM_CENTER); btnNext.addListener(this); btnNext.setEnabled(false); btnBack.setEnabled(false); // always disabled btnAddFilter.addListener(this); layout.addStyleName("findlayers"); setCompositionRoot(layout); }
From source file:com.lizardtech.expresszip.vaadin.MapToolbarViewComponent.java
License:Apache License
@Override public void buttonClick(ClickEvent event) { Button b = event.getButton(); if (b == btnJobQueueStatus) { Window subWindow = new Window("Job Manager"); subWindow.setWidth("500px"); subWindow.center();//from w w w. j ava 2s .co m getApplication().getMainWindow().addWindow(subWindow); Panel p = new Panel(new JobsStatusViewComponent(getApplication().getURL())); p.getContent().setWidth("100%"); p.setWidth("100%"); subWindow.addComponent(p); subWindow.setModal(true); } else if (b == help) { String HelpURL = getApplication().getURL().toExternalForm() + "doc"; getApplication().getMainWindow().open(new ExternalResource(HelpURL), "_blank"); } else if (b == restart) { ((ExpressZipWindow) getApplication().getMainWindow()).getApplication().close(); } }
From source file:com.mechanicshop.components.TableLayout.java
public void createCustomMessage() { final TextArea textArea = new TextArea(); textArea.setImmediate(true);/*from w ww. ja va 2s .c om*/ textArea.setColumns(30); textArea.setRows(10); textArea.addStyleName(ValoTheme.TEXTAREA_SMALL); textArea.setRequired(true); final Window subWindow = new Window(); subWindow.setModal(true); subWindow.setHeight("350px"); subWindow.setWidth("500px"); subWindow.setCaption("Insert Message"); subWindow.setStyleName(ValoTheme.WINDOW_TOP_TOOLBAR); subWindow.setClosable(false); subWindow.setResizable(false); HorizontalLayout layoutButtons = new HorizontalLayout(); layoutButtons.setMargin(false); Button sendBtn = new Button("Send"); sendBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { textArea.validate(); String message = textArea.getValue(); smsSenderService.sendMessageMassive(message); subWindow.close(); Notification.show("Message Sent"); } catch (Exception e) { } } }); sendBtn.setImmediate(true); sendBtn.setStyleName(ValoTheme.BUTTON_TINY); sendBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY); Button cancelBtn = new Button("Cancel"); cancelBtn.setStyleName(ValoTheme.BUTTON_TINY); cancelBtn.addStyleName(ValoTheme.BUTTON_DANGER); cancelBtn.setImmediate(true); cancelBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { subWindow.close(); } }); layoutButtons.setSizeUndefined(); layoutButtons.setSpacing(true); layoutButtons.addComponents(cancelBtn, sendBtn); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(textArea); layout.addComponent(layoutButtons); layout.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(layoutButtons, Alignment.MIDDLE_RIGHT); layout.setExpandRatio(textArea, 3); layout.setSizeFull(); subWindow.setContent(layout); subWindow.center(); getUI().addWindow(subWindow); }
From source file:com.mymita.vaadlets.VaadletsBuilder.java
License:Apache License
private static void setWindowAttributes(final com.vaadin.ui.Component vaadinComponent, final com.mymita.vaadlets.core.Component vaadletsComponent) { if (vaadletsComponent instanceof com.mymita.vaadlets.ui.Window) { final com.vaadin.ui.Window vaadinWindow = (com.vaadin.ui.Window) vaadinComponent; final com.mymita.vaadlets.ui.Window vaadletsWindow = (com.mymita.vaadlets.ui.Window) vaadletsComponent; if (vaadletsWindow.isCenter()) { vaadinWindow.center();//from ww w . ja v a2 s . co m } final Short positionX = vaadletsWindow.getPositionX(); if (positionX != null) { vaadinWindow.setPositionX(positionX); } final Short positionY = vaadletsWindow.getPositionY(); if (positionY != null) { vaadinWindow.setPositionY(positionY); } vaadinWindow.setBorder(vaadletsWindow.getBorder().ordinal()); vaadinWindow.setModal(vaadletsWindow.isModal()); vaadinWindow.setClosable(vaadletsWindow.isCloseable()); vaadinWindow.setDraggable(vaadletsWindow.isDraggable()); vaadinWindow.setResizable(vaadletsWindow.isResizeable()); vaadinWindow.setResizeLazy(vaadletsWindow.isResizeLazy()); } }