Example usage for com.vaadin.ui Window Window

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

Introduction

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

Prototype

public Window() 

Source Link

Document

Creates a new, empty window.

Usage

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadResultWindow.java

License:Open Source License

private void createLayout() {
    final HorizontalLayout footer = new HorizontalLayout();
    footer.setSizeUndefined();/*from   w ww  . ja  va 2s  .  co  m*/
    footer.addStyleName("confirmation-window-footer");
    footer.setSpacing(true);
    footer.setMargin(false);
    footer.addComponents(closeBtn);
    footer.setComponentAlignment(closeBtn, Alignment.TOP_CENTER);

    final VerticalLayout uploadResultDetails = new VerticalLayout();
    uploadResultDetails.setWidth(SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH + "px");
    uploadResultDetails.addStyleName("confirmation-popup");
    uploadResultDetails.addComponent(uploadResultTable);
    uploadResultDetails.setComponentAlignment(uploadResultTable, Alignment.MIDDLE_CENTER);
    uploadResultDetails.addComponent(footer);
    uploadResultDetails.setComponentAlignment(footer, Alignment.MIDDLE_CENTER);

    uploadResultsWindow = new Window();
    uploadResultsWindow.setContent(uploadResultDetails);
    uploadResultsWindow.setResizable(Boolean.FALSE);
    uploadResultsWindow.setClosable(Boolean.FALSE);
    uploadResultsWindow.setDraggable(Boolean.TRUE);
    uploadResultsWindow.setModal(true);
    uploadResultsWindow.setCaption(SPUILabelDefinitions.UPLOAD_RESULT);
    uploadResultsWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
}

From source file:org.eclipse.hawkbit.ui.components.NotificationUnreadButton.java

License:Open Source License

private void createNotificationWindow() {
    notificationsWindow = new Window();
    notificationsWindow.setWidth(300.0F, Unit.PIXELS);
    notificationsWindow.addStyleName(STYLE_POPUP);
    notificationsWindow.addStyleName(STYLE_NO_CLOSEBOX);
    notificationsWindow.setClosable(true);
    notificationsWindow.setResizable(false);
    notificationsWindow.setDraggable(false);
    notificationsWindow.setId(UIComponentIdProvider.NOTIFICATION_UNREAD_POPUP_ID);
    notificationsWindow.addCloseListener(event -> refreshCaption());
    notificationsWindow.addBlurListener(this::closeWindow);
}

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);//  w  w w  .ja  v  a 2 s  .co m
    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);
}

From source file:org.geant.sat.ui.ImportEntityViewer.java

License:BSD License

@SuppressWarnings("unchecked")
@Override/*from   w w w  .jav a  2  s.  co m*/
public void buttonClick(ClickEvent event) {
    if (event.getButton() == viewBasketButton) {
        if (basketWindow == null) {
            basketWindow = new Window();
            ((Window) basketWindow).setClosable(false);
            ((Window) basketWindow).setCaption(getString("lang.importer.basket"));
            ((Grid<EntityDetails>) basketEntities).setWidth("100%");
            ((Window) basketWindow).setWidth("40%");
            ((Window) basketWindow).setContent(((Grid<EntityDetails>) basketEntities));
            getMainUI().addWindow((Window) basketWindow);
        }
    }
    if (event.getButton() == cancelButton) {
        if (basketWindow != null) {
            ((Window) basketWindow).close();
        }
        ((Window) getParent()).close();
        return;
    }
    if (event.getButton() == importButton) {
        ListEntitiesResponse resp = getMainUI().getSatApiClient()
                .storeEntities(new ArrayList<EntityDetails>(entitiesSelection));
        if (!verifySuccess(resp)) {
            return;
        }
        if (basketWindow != null) {
            ((Window) basketWindow).close();
        }
        ((Window) getParent()).close();
        return;
    }
    if (event.getButton() == fetchContent) {
        String url = metadataUrl.getValue();
        LOG.debug("About to read entities from url " + url);
        ListEntitiesResponse resp = getMainUI().getSatApiClient().previewEntities(samlIdentifier, url, url,
                getMainUI().getUser().getDetails().getPrincipalId());
        if (!verifySuccess(resp)) {
            return;
        }
        availableEntitiesSource = resp.getEntities();
        availableEntities.setItems(availableEntitiesSource);
        availableEntitiesFilter.setEnabled(availableEntitiesSource.size() > 0);
        availableEntitiesFilter.setValue("");
        return;
    }
    if (event.getButton() == addToBasketButton) {
        LOG.debug("Adding items " + availableEntities.getSelectedItems());
        if (availableEntities.getSelectedItems().size() == 0) {
            return;
        }
        entitiesSelection.addAll(availableEntities.getSelectedItems());
        ((Grid<EntityDetails>) basketEntities).setItems(entitiesSelection);
        Notification.show(getString("lang.itemadded"), Notification.Type.HUMANIZED_MESSAGE);
        importButton.setEnabled(true);
        viewBasketButton.setVisible(true);
        viewBasketButton.setCaption(
                String.format(getString("lang.importer.button.viewbasket"), entitiesSelection.size()));
    }
}

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}.
 * //from   w w w . j  a  va  2 s . co m
 * @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.lunifera.runtime.web.ecview.presentation.vaadin.internal.DialogPresentation.java

License:Open Source License

/**
 * {@inheritDoc}/*from  ww  w  . j  a  va 2  s.c o  m*/
 */
@SuppressWarnings("serial")
@Override
public Component createWidget(Object parent) {
    if (window == null) {
        // create component base with grid layout to enable margins
        //
        window = new Window();
        window.addStyleName(IConstants.CSS_CLASS_CONTROL);

        window.addCloseListener(new Window.CloseListener() {
            @Override
            public void windowClose(CloseEvent e) {
                getEditpart().getView().closeDialog(getEditpart());
            }
        });

        if (modelAccess.isCssIdValid()) {
            window.setId(modelAccess.getCssID());
        } else {
            window.setId(editpart.getId());
        }

        if (modelAccess.isCssClassValid()) {
            window.addStyleName(modelAccess.getCssClass());
        }

        // render the content
        //
        renderContent();

        createBindings();

        // register as an locale change listener
        IViewContext context = ModelUtil.getViewContext(modelAccess.yDialog.getView());
        ILocaleChangedService service = context.getService(ILocaleChangedService.ID);
        if (service != null) {
            service.addLocaleListener(this);
        }

        applyCaptions();

    }
    return window;
}

From source file:org.lunifera.vaaclipse.ui.preferences.addon.internal.PreferencesDialog.java

License:Open Source License

public void createWindow() {
    window = new Window();
    window.setCaption("Preferences");
    window.addStyleName("preferences-dialog");
    window.setWidth("800px");
    window.setHeight("600px");

    splitPanel.setSizeFull();/*from   w w  w  . j  a  v a2s  .  c o m*/

    dlgButtonPanel = new CssLayout();
    dlgButtonPanel.setWidth("100%");
    dlgButtonPanel.addStyleName("dlg-button-panel");

    // dlgButtonPanel.addComponent(new Label("<hr/>", ContentMode.HTML));

    cancelButton = new Button("Cancel");
    cancelButton.addStyleName("cancel-button");
    dlgButtonPanel.addComponent(cancelButton);
    okButton = new Button("OK");
    okButton.addStyleName("ok-button");
    dlgButtonPanel.addComponent(okButton);

    root = new VerticalLayout();
    root.setSizeFull();
    window.setContent(root);
    root.addComponent(splitPanel);
    root.addComponent(dlgButtonPanel);
    root.setExpandRatio(splitPanel, 10);
    root.setExpandRatio(dlgButtonPanel, 0);

    treePanel = new Panel();
    treePanel.addStyleName("categories-panel");
    treePanel.addStyleName("borderless");
    treePanel.setSizeFull();

    leftSide = new CssLayout();
    leftSide.addStyleName("categories");
    leftSide.setSizeFull();
    // filterField.setWidth("70%");
    filterField.addStyleName("categories-filter");
    leftSide.addComponent(filterField);

    filterButton.setIcon(BundleResource
            .valueOf("platform:/plugin/org.lunifera.vaaclipse.ui.preferences.addon/img/find.png"));
    filterButton.addStyleName("vaaclipsebutton");
    filterButton.addStyleName("icon-only");
    filterButton.addStyleName("filter-category-button");

    clearFilterButton.setIcon(BundleResource
            .valueOf("platform:/plugin/org.lunifera.vaaclipse.ui.preferences.addon/img/clear.png"));
    clearFilterButton.addStyleName("vaaclipsebutton");
    clearFilterButton.addStyleName("icon-only");
    clearFilterButton.addStyleName("clear-filter-button");

    leftSide.addComponent(clearFilterButton);
    leftSide.addComponent(filterButton);
    leftSide.addComponent(treePanel);

    rightSide = new VerticalLayout();
    rightSide.setSizeFull();
    // rightSide.setMargin(new MarginInfo(true, true, false, true));

    pageHeader = new CssLayout();
    pageHeader.addStyleName("page-header-panel");
    pageHeader.setWidth("100%");
    pageHeaderText = new Label("Page");
    pageHeaderText.addStyleName("page-header-text");
    pageHeader.addComponent(pageHeaderText);
    rightSide.addComponent(pageHeader);

    pageContent = new CssLayout();
    // pageContent.setSizeFull();
    Panel pageContentPanel = new Panel(pageContent);// wrap page content to
    // panel - if content is
    // too large, scrolling
    // needed
    pageContentPanel.setSizeFull();
    rightSide.addComponent(pageContentPanel);

    pageBottom = new CssLayout();
    pageBottom.addStyleName("page-bottom-panel");
    pageBottom.setWidth("100%");
    rightSide.addComponent(pageBottom);

    apply = new Button("Apply");
    apply.addStyleName("apply");
    pageBottom.addComponent(apply);

    restoreDefaults = new Button("RestoreDefaults");
    restoreDefaults.addStyleName("restore-defaults");
    pageBottom.addComponent(restoreDefaults);

    splitPanel.addComponent(leftSide);
    splitPanel.addComponent(rightSide);
    splitPanel.setSplitPosition(30, Sizeable.Unit.PERCENTAGE);

    rightSide.setExpandRatio(pageHeader, 0);
    rightSide.setExpandRatio(pageContentPanel, 1);
    rightSide.setExpandRatio(pageBottom, 0);

    clearFilterButton.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            filterField.setValue("");
            refreshTree();
        }
    });

    filterButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            refreshTree();
        }
    });
}

From source file:org.opencms.ui.actions.CmsUserInfoDialogAction.java

License:Open Source License

/**
 * @see org.opencms.ui.actions.I_CmsWorkplaceAction#executeAction(org.opencms.ui.I_CmsDialogContext)
 */// w w  w .j  a  v a2 s  . c  om
public void executeAction(final I_CmsDialogContext context) {

    CmsUserInfo dialog = new CmsUserInfo(new I_UploadListener() {

        public void onUploadFinished(List<String> uploadedFiles) {

            handleUpload(uploadedFiles, context);
        }
    }, context);
    Multimap<String, String> params = A_CmsUI.get().getParameters();
    int top = 55;
    int left = 0;
    if (params.containsKey("left")) {
        String buttonLeft = params.get("left").iterator().next();
        left = Integer.parseInt(buttonLeft) - 290;
    }
    final Window window = new Window();
    window.setModal(false);
    window.setClosable(true);
    window.setResizable(false);
    window.setContent(dialog);
    context.setWindow(window);
    window.addStyleName(OpenCmsTheme.DROPDOWN);
    UI.getCurrent().addWindow(window);
    window.setPosition(left, top);
}

From source file:org.opencms.ui.CmsVaadinUtils.java

License:Open Source License

/**
 * Shows an alert box to the user with the given information, which will perform the given action after the user clicks on OK.<p>
 *
 * @param title the title//from w w  w .j  a  va 2s .  c  o  m
 * @param message the message
 *
 * @param callback the callback to execute after clicking OK
 */
public static void showAlert(String title, String message, final Runnable callback) {

    final Window window = new Window();
    window.setModal(true);
    Panel panel = new Panel();
    panel.setCaption(title);
    panel.setWidth("500px");
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    panel.setContent(layout);
    layout.addComponent(new Label(message));
    Button okButton = new Button();
    okButton.addClickListener(new ClickListener() {

        /** The serial version id. */
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {

            window.close();
            if (callback != null) {
                callback.run();
            }
        }
    });
    layout.addComponent(okButton);
    layout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT);
    okButton.setCaption(org.opencms.workplace.Messages.get().getBundle(A_CmsUI.get().getLocale())
            .key(org.opencms.workplace.Messages.GUI_DIALOG_BUTTON_OK_0));
    window.setContent(panel);
    window.setClosable(false);
    window.setResizable(false);
    A_CmsUI.get().addWindow(window);

}

From source file:org.opencms.ui.components.CmsBasicDialog.java

License:Open Source License

/**
 * Initializes the dialog window.<p>
 *
 * @param width the dialog width// w  ww .  ja v a2 s.  co m
 *
 * @return the window to be used by dialogs
 */
public static Window prepareWindow(DialogWidth width) {

    Window window = new Window();
    window.setModal(true);
    window.setClosable(true);
    int pageWidth = Page.getCurrent().getBrowserWindowWidth();
    if (((width == DialogWidth.wide) && (pageWidth < 810))
            || ((width == DialogWidth.narrow) && (pageWidth < 610))) {
        // in case the available page width does not allow the desired width, use max
        width = DialogWidth.max;
    }
    if (width == DialogWidth.max) {
        // in case max width would result in a width very close to wide or narrow, use their static width instead of relative width
        if ((pageWidth >= 610) && (pageWidth < 670)) {
            width = DialogWidth.narrow;
        } else if ((pageWidth >= 810) && (pageWidth < 890)) {
            width = DialogWidth.wide;
        }
    }
    switch (width) {
    case content:
        // do nothing
        break;
    case wide:
        window.setWidth("800px");
        break;
    case max:
        window.setWidth("90%");
        break;
    case narrow:
    default:
        window.setWidth("600px");
        break;
    }
    window.center();
    return window;
}