Example usage for com.vaadin.ui Window setClosable

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

Introduction

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

Prototype

public void setClosable(boolean closable) 

Source Link

Document

Sets the closable status for the window.

Usage

From source file:org.eclipse.hawkbit.ui.common.builder.WindowBuilder.java

License:Open Source License

private void decorateWindow(final Window window) {
    if (id != null) {
        window.setId(id);//from   w w  w . j a  va2s.c  o m
    }

    if (SPUIDefinitions.CONFIRMATION_WINDOW.equals(type)) {
        window.setDraggable(false);
        window.setClosable(true);
        window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);

    } else if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) {
        window.setDraggable(true);
        window.setClosable(true);
    }
}

From source file:org.eclipse.hawkbit.ui.common.builder.WindowBuilder.java

License:Open Source License

/**
 * Build window based on type./* ww  w. j  a  v a2s . co  m*/
 *
 * @return Window
 */
public Window buildWindow() {
    final Window window = new Window(caption);
    window.setContent(content);
    window.setSizeUndefined();
    window.setModal(true);
    window.setResizable(false);

    decorateWindow(window);

    if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) {
        window.setClosable(false);
    }

    return window;
}

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 www  .  j a  v a2s .c om*/
    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.investovator.ui.main.AdminGameConfigLayout.java

License:Open Source License

private void startDailySummaryAddGameWizard() {
    // Create a sub-window and set the content
    Window subWindow = new Window("Create New Game");
    VerticalLayout subContent = new VerticalLayout();
    subContent.setMargin(true);/*from w w  w  .ja v a 2  s.c  om*/
    subWindow.setContent(subContent);

    // Put some components in it
    subContent.addComponent(new NewDataPlaybackGameWizard(subWindow));

    // set window characteristics
    subWindow.center();
    subWindow.setClosable(false);
    subWindow.setDraggable(false);
    subWindow.setResizable(false);
    subWindow.setModal(true);

    subWindow.addCloseListener(new Window.CloseListener() {
        @Override
        public void windowClose(Window.CloseEvent closeEvent) {
            //getUI().getNavigator().navigateTo(UIConstants.MAINVIEW);
            getUI().getPage().reload();
        }
    });

    // Add it to the root component
    UI.getCurrent().addWindow(subWindow);
}

From source file:org.investovator.ui.main.components.AdminGameCreateView.java

License:Open Source License

private void startDailySummaryAddGameWizard() {
    // Create a sub-window and set the content
    Window subWindow = new Window("Create New Game");
    VerticalLayout subContent = new VerticalLayout();
    subContent.setMargin(true);/*from ww w .  ja v a  2  s.  c om*/
    subWindow.setContent(subContent);

    // Put some components in it
    subContent.addComponent(new NewDataPlaybackGameWizard(subWindow));

    // set window characteristics
    subWindow.center();
    subWindow.setClosable(false);
    subWindow.setDraggable(false);
    subWindow.setResizable(false);
    subWindow.setModal(true);

    subWindow.addCloseListener(new Window.CloseListener() {
        @Override
        public void windowClose(Window.CloseEvent closeEvent) {
            getUI().getNavigator().navigateTo(UIConstants.MAINVIEW);
            //                getUI().getPage().reload();
        }
    });

    // Add it to the root component
    UI.getCurrent().addWindow(subWindow);
}

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  av  a 2 s .com
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.A_CmsUI.java

License:Open Source License

/**
 * Replaces the ui content with a single dialog.<p>
 *
 * @param caption the caption//from w w w  . j av  a2s.co  m
 * @param dialog the dialog content
 */
public void setContentToDialog(String caption, CmsBasicDialog dialog) {

    setContent(new Label());
    Window window = CmsBasicDialog.prepareWindow(DialogWidth.narrow);
    window.setContent(dialog);
    window.setCaption(caption);
    window.setClosable(false);
    addWindow(window);
    window.center();
}

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

License:Open Source License

/**
 * Replaces the ui content with a single dialog.<p>
 *
 * TODO: In the future this should only handle window creation, refactor dialog contents to CmsBasicDialog
 *
 * @param caption the caption/*w  w w. j  av a  2s  . c  o  m*/
 * @param component the dialog content
 */
public void setContentToDialog(String caption, Component component) {

    setContent(new Label());
    Window window = CmsBasicDialog.prepareWindow(DialogWidth.narrow);
    CmsBasicDialog dialog = new CmsBasicDialog();
    VerticalLayout result = new VerticalLayout();
    dialog.setContent(result);
    window.setContent(dialog);
    window.setCaption(caption);
    window.setClosable(false);
    addWindow(window);
    window.center();
    if (component instanceof I_CmsHasButtons) {
        I_CmsHasButtons hasButtons = (I_CmsHasButtons) component;
        for (Button button : hasButtons.getButtons()) {
            dialog.addButton(button);
        }

    }
    result.addComponent(component);

}

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/* w ww  .  j  a  v  a 2s  .  co  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//from ww  w.  ja v  a2  s  .c  o  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;
}