Example usage for com.vaadin.ui VerticalLayout setMargin

List of usage examples for com.vaadin.ui VerticalLayout setMargin

Introduction

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

Prototype

@Override
    public void setMargin(boolean enabled) 

Source Link

Usage

From source file:de.symeda.sormas.ui.utils.AbstractSubNavigationView.java

License:Open Source License

protected Optional<VerticalLayout> createInfoLayout() {
    VerticalLayout infoLayout = new VerticalLayout();
    infoLayout.setMargin(false);
    infoLayout.setSpacing(false);/*  ww  w .j  a va 2  s . c o  m*/
    infoLayout.setSizeUndefined();
    CssStyles.stylePrimary(infoLayout, CssStyles.CALLOUT);
    infoLabel = new Label("");
    infoLabelSub = new Label("");
    CssStyles.style(infoLabelSub, ValoTheme.LABEL_SMALL);
    infoLayout.addComponent(infoLabel);
    infoLayout.addComponent(infoLabelSub);

    return Optional.of(infoLayout);
}

From source file:de.symeda.sormas.ui.utils.AbstractView.java

License:Open Source License

protected AbstractView(String viewName) {
    this.viewName = viewName;

    setSizeFull();//  w  w  w  .  j av a  2s.  c  o  m
    setMargin(false);
    setSpacing(false);

    viewHeader = new HorizontalLayout();
    viewHeader.setWidth(100, Unit.PERCENTAGE);
    viewHeader.setHeightUndefined();
    viewHeader.setMargin(new MarginInfo(false, true));
    viewHeader.setSpacing(true);
    CssStyles.style(viewHeader, "view-header");

    VerticalLayout viewTitleLayout = new VerticalLayout();
    {
        viewTitleLayout.setSizeUndefined();
        viewTitleLayout.setSpacing(false);
        viewTitleLayout.setMargin(false);

        // note: splitting title and subtitle into labels does not work with the css
        String viewTitle = I18nProperties.getPrefixCaption("View", viewName.replaceAll("/", "."));
        String viewSubTitle = I18nProperties.getPrefixCaption("View", viewName.replaceAll("/", ".") + ".sub",
                "");
        viewTitleLabel = new Label(viewTitle);
        viewTitleLabel.setSizeUndefined();
        CssStyles.style(viewTitleLabel, CssStyles.H1, CssStyles.VSPACE_NONE);
        viewTitleLayout.addComponent(viewTitleLabel);
        Label viewSubTitleLabel = new Label(viewSubTitle);
        viewSubTitleLabel.setSizeUndefined();
        CssStyles.style(viewSubTitleLabel, CssStyles.H4, CssStyles.VSPACE_TOP_NONE);
        viewTitleLayout.addComponent(viewSubTitleLabel);
    }
    viewHeader.addComponent(viewTitleLayout);
    viewHeader.setExpandRatio(viewTitleLayout, 1);

    addComponent(viewHeader);
    setExpandRatio(viewHeader, 0);
}

From source file:de.symeda.sormas.ui.utils.VaadinUiUtil.java

License:Open Source License

public static Window showSimplePopupWindow(String caption, String contentText) {
    Window window = new Window(null);
    window.setModal(true);/*  w w  w  .  j a  v a 2  s .co  m*/
    window.setSizeUndefined();
    window.setResizable(false);
    window.center();

    VerticalLayout popupLayout = new VerticalLayout();
    popupLayout.setMargin(true);
    popupLayout.setSpacing(true);
    popupLayout.setSizeUndefined();
    Label contentLabel = new Label(contentText);
    contentLabel.setWidth(100, Unit.PERCENTAGE);
    popupLayout.addComponent(contentLabel);
    Button okayButton = new Button(I18nProperties.getCaption(Captions.actionOkay));
    okayButton.addClickListener(e -> {
        window.close();
    });
    CssStyles.style(okayButton, ValoTheme.BUTTON_PRIMARY);
    popupLayout.addComponent(okayButton);
    popupLayout.setComponentAlignment(okayButton, Alignment.BOTTOM_RIGHT);

    window.setCaption(caption);
    window.setContent(popupLayout);

    UI.getCurrent().addWindow(window);

    return window;
}

From source file:de.symeda.sormas.ui.utils.VaadinUiUtil.java

License:Open Source License

public static Window showConfirmationPopup(String caption, Component content, String confirmCaption,
        String cancelCaption, Integer width, Consumer<Boolean> resultConsumer) {
    Window popupWindow = VaadinUiUtil.createPopupWindow();
    if (width != null) {
        popupWindow.setWidth(width, Unit.PIXELS);
    } else {/*from w ww. jav  a2s .  c  om*/
        popupWindow.setWidthUndefined();
    }
    popupWindow.setCaption(caption);

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    content.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(content);

    ConfirmationComponent confirmationComponent = new ConfirmationComponent(false) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onConfirm() {
            popupWindow.close();
            resultConsumer.accept(true);
        }

        @Override
        protected void onCancel() {
            popupWindow.close();
            resultConsumer.accept(false);
        }
    };
    confirmationComponent.getConfirmButton().setCaption(confirmCaption);
    confirmationComponent.getCancelButton().setCaption(cancelCaption);

    popupWindow.addCloseListener(new CloseListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void windowClose(CloseEvent e) {
            confirmationComponent.getCancelButton().click();
        }
    });

    layout.addComponent(confirmationComponent);
    layout.setComponentAlignment(confirmationComponent, Alignment.BOTTOM_RIGHT);
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setSpacing(true);
    popupWindow.setContent(layout);

    UI.getCurrent().addWindow(popupWindow);
    return popupWindow;
}

From source file:de.symeda.sormas.ui.utils.VaadinUiUtil.java

License:Open Source License

public static Window showDeleteConfirmationWindow(String content, Runnable callback) {
    Window popupWindow = VaadinUiUtil.createPopupWindow();

    VerticalLayout deleteLayout = new VerticalLayout();
    deleteLayout.setMargin(true);
    deleteLayout.setSizeUndefined();/*from ww  w . j  a  v a2s.  c om*/
    deleteLayout.setSpacing(true);

    Label description = new Label(content);
    description.setWidth(100, Unit.PERCENTAGE);
    deleteLayout.addComponent(description);

    ConfirmationComponent deleteConfirmationComponent = new ConfirmationComponent(false) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onConfirm() {
            popupWindow.close();
            onDone();
            callback.run();
        }

        @Override
        protected void onCancel() {
            popupWindow.close();
        }
    };
    deleteConfirmationComponent.getConfirmButton().setCaption(I18nProperties.getString(Strings.yes));
    deleteConfirmationComponent.getCancelButton().setCaption(I18nProperties.getString(Strings.no));
    deleteLayout.addComponent(deleteConfirmationComponent);
    deleteLayout.setComponentAlignment(deleteConfirmationComponent, Alignment.BOTTOM_RIGHT);

    popupWindow.setCaption(I18nProperties.getString(Strings.headingConfirmDeletion));
    popupWindow.setContent(deleteLayout);
    UI.getCurrent().addWindow(popupWindow);

    return popupWindow;
}

From source file:de.unioninvestment.eai.portal.portlet.crud.export.ExportDialog.java

License:Apache License

@SuppressWarnings("serial")
private void init() {
    setCaption(Context.getMessage("portlet.crud.dialog.export.title"));
    setModal(true);//from ww  w  .  j a v a 2s  . c  o m
    setResizable(false);
    setWidth("400px");
    addCloseListener(new CloseListener() {
        @Override
        public void windowClose(CloseEvent e) {
            handleWindowCloseEvent();
        }
    });

    indicator = new ProgressBar(0.0f);
    indicator.setWidth("100%");
    UI.getCurrent().setPollInterval(1000);

    if (automaticDownload) {
        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        layout.addComponent(indicator);

        setContent(layout);
    } else {
        HorizontalLayout layout = new HorizontalLayout();
        layout.setWidth("100%");
        layout.setMargin(true);
        layout.setSpacing(true);

        downloadLink = new Link();
        downloadLink.setStyleName(LiferayTheme.BUTTON_LINK);
        downloadLink.setCaption(Context.getMessage("portlet.crud.dialog.export.download"));
        downloadLink.setEnabled(false);

        layout.addComponents(indicator, downloadLink);
        layout.setComponentAlignment(indicator, Alignment.MIDDLE_CENTER);
        layout.setComponentAlignment(downloadLink, Alignment.MIDDLE_CENTER);
        layout.setExpandRatio(indicator, 1f);

        setContent(layout);
    }

}

From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.configuration.DefaultPortletConfigurationView.java

License:Apache License

private VerticalLayout createStatusLayout() {

    status = new Label();
    status.setContentMode(ContentMode.HTML);

    upload = new Upload();
    upload.setImmediate(true);/*from   w w w.ja va 2s. c o  m*/
    upload.setButtonCaption(getMessage("portlet.crud.page.upload.button"));

    uploadVcsUri = new TextField();
    uploadVcsUri.setWidth(400, Unit.PIXELS);
    uploadVcsButton = new Button();
    uploadVcsButton.setCaption(getMessage("portlet.crud.page.upload.vcs.button"));

    uploadVcsLayout.addComponent(uploadVcsButton);
    uploadVcsLayout.addComponent(uploadVcsUri);
    uploadVcsLayout.setSpacing(true);

    VerticalLayout statusLayout = new VerticalLayout();
    statusLayout.setCaption(getMessage("portlet.crud.page.edit.statusHeader"));
    statusLayout.setSpacing(true);
    statusLayout.setMargin(true);

    statusLayout.addComponent(status);
    statusLayout.addComponent(uploadVcsLayout);
    statusLayout.addComponent(upload);
    return statusLayout;
}

From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.configuration.DefaultPreferencesView.java

License:Apache License

public DefaultPreferencesView(String caption) {

    setCaption(caption);/*from  w ww. jav  a2 s  .c  o  m*/

    this.form = createForm();

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.addComponent(form);

    setCompositionRoot(layout);
}

From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.ui.Popup.java

License:Apache License

private void init() {
    this.setModal(true);
    this.setHeight(325, Unit.PIXELS);
    this.setWidth(500, Unit.PIXELS);

    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();//  ww  w . ja v  a 2s . c o  m
    layout.setSpacing(true);
    layout.setMargin(true);
    setContent(layout);

    Panel panel = new Panel();
    panel.setHeight(100, Unit.PERCENTAGE);
    panel.addStyleName(Runo.PANEL_LIGHT);
    layout.addComponent(panel);
    layout.setExpandRatio(panel, 1);

    messageLabel = new Label();
    panel.setContent(messageLabel);

    Button close = new Button("Beenden", new Button.ClickListener() {
        private static final long serialVersionUID = -8385641161488292715L;

        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(Popup.this);
        }
    });

    layout.addComponent(close);
    layout.setComponentAlignment(close, Alignment.BOTTOM_RIGHT);
}

From source file:de.uni_leipzig.informatik.pcai042.boa.gui.evaluation.EvaluationView.java

License:Open Source License

/**
 * Build content 'annotation process' of tab 2.
 * /*  ww w.j  a  v a2s  .c  o  m*/
 * @return content of second tab
 */
private Layout buildTab2Content() {
    VerticalLayout tab2Content = new VerticalLayout();
    tab2Content.setSpacing(true);
    tab2Content.setMargin(true);
    tab2Content.setSizeFull();

    this.textAreaSentence = new TextArea("Sentence:");
    textAreaSentence.setImmediate(true);
    textAreaSentence.setRows(7);
    textAreaSentence.setWidth("100%");
    tab2Content.addComponent(textAreaSentence);

    HorizontalLayout hlay1 = new HorizontalLayout();
    this.buttonNew = new Button("New");
    buttonNew.setImmediate(true);
    buttonNew.setDescription("Type in new sentences");
    this.buttonAnnotate = new Button("Annotate");
    buttonAnnotate.setImmediate(true);
    buttonAnnotate.setDescription("Annotate the sentences above");
    hlay1.setSpacing(true);
    hlay1.setMargin(false);
    hlay1.addComponent(buttonNew);
    hlay1.addComponent(buttonAnnotate);
    tab2Content.addComponent(hlay1);

    this.listSelectAnnotation = new ListSelect("Annotations:");
    listSelectAnnotation.setImmediate(true);
    listSelectAnnotation.setHeight("150px");
    listSelectAnnotation.setWidth("100%");
    listSelectAnnotation.setNullSelectionAllowed(false);
    tab2Content.addComponent(listSelectAnnotation);

    this.textAreaAnnotation = new TextArea("Further annotations with other surface forms:");
    textAreaAnnotation.setImmediate(false);
    textAreaAnnotation.setRows(4);
    textAreaAnnotation.setReadOnly(true);
    textAreaAnnotation.setWidth("100%");
    tab2Content.addComponent(textAreaAnnotation);

    //this.buttonNext = new Button("Next");
    //buttonNext.setImmediate(true);
    //buttonNext.setDescription("Get next annotation");
    //tab2Content.addComponent(buttonNext);

    return tab2Content;
}