Example usage for com.vaadin.ui Window setWindowMode

List of usage examples for com.vaadin.ui Window setWindowMode

Introduction

In this page you can find the example usage for com.vaadin.ui Window setWindowMode.

Prototype

public void setWindowMode(WindowMode windowMode) 

Source Link

Document

Sets the mode for the window.

Usage

From source file:com.hivesys.dashboard.view.search.TextualView.java

public void UpdateSearchPane(String searchString) {
    css.removeAllComponents();//  www  .j  av  a 2 s  . com

    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:org.eclipse.hawkbit.ui.distributions.smtable.SwModuleDetails.java

License:Open Source License

private void showArtifactDetailsWindow(final SoftwareModule softwareModule) {
    final Window artifactDtlsWindow = new Window();
    artifactDtlsWindow.setCaption(HawkbitCommonUtil.getArtifactoryDetailsLabelId(
            softwareModule.getName() + "." + softwareModule.getVersion(), getI18n()));
    artifactDtlsWindow.setCaptionAsHtml(true);
    artifactDtlsWindow.setClosable(true);
    artifactDtlsWindow.setResizable(true);
    artifactDtlsWindow.setImmediate(true);
    artifactDtlsWindow.setWindowMode(WindowMode.NORMAL);
    artifactDtlsWindow.setModal(true);/*from w  ww .  jav  a2s .  com*/
    artifactDtlsWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);

    artifactDetailsLayout.setFullWindowMode(false);
    artifactDetailsLayout.populateArtifactDetails(softwareModule);
    artifactDetailsLayout.getArtifactDetailsTable().setWidth(700, Unit.PIXELS);
    artifactDetailsLayout.getArtifactDetailsTable().setHeight(500, Unit.PIXELS);
    artifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable());

    artifactDtlsWindow.addWindowModeChangeListener(event -> {
        if (event.getWindowMode() == WindowMode.MAXIMIZED) {
            artifactDtlsWindow.setSizeFull();
            artifactDetailsLayout.setFullWindowMode(true);
            artifactDetailsLayout.createMaxArtifactDetailsTable();
            artifactDetailsLayout.getMaxArtifactDetailsTable().setWidth(100, Unit.PERCENTAGE);
            artifactDetailsLayout.getMaxArtifactDetailsTable().setHeight(100, Unit.PERCENTAGE);
            artifactDtlsWindow.setContent(artifactDetailsLayout.getMaxArtifactDetailsTable());
        } else {
            artifactDtlsWindow.setSizeUndefined();
            artifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable());
        }
    });
    UI.getCurrent().addWindow(artifactDtlsWindow);
}