Example usage for com.vaadin.ui VerticalLayout setSpacing

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

Introduction

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

Prototype

@Override
    public void setSpacing(boolean spacing) 

Source Link

Usage

From source file:com.cavisson.gui.dashboard.components.controls.Panels.java

License:Apache License

Component panelContentScroll() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*  w ww.  j av  a 2  s .  com*/
    layout.setSpacing(true);
    Label content = new Label(
            "Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor posuere. Praesent id metus massa, ut blandit odio. Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor posuere. Praesent id metus massa, ut blandit odio.");
    content.setWidth("10em");
    layout.addComponent(content);
    Button button = new Button("Button");
    layout.addComponent(button);
    return layout;
}

From source file:com.cavisson.gui.dashboard.components.controls.Tabsheets.java

License:Apache License

static TabSheet getTabSheet(boolean caption, String style, boolean closable, boolean scrolling, boolean icon,
        boolean disable) {
    TestIcon testIcon = new TestIcon(60);

    TabSheet ts = new TabSheet();
    ts.addStyleName(style);/*from   w w  w.  jav  a2 s  .c  o  m*/
    StringGenerator sg = new StringGenerator();

    for (int i = 1; i <= (scrolling ? 10 : 3); i++) {
        String tabcaption = caption ? sg.nextString(true) + " " + sg.nextString(false) : null;

        VerticalLayout content = new VerticalLayout();
        content.setMargin(true);
        content.setSpacing(true);
        content.addComponent(new Label("Content for tab " + i));
        if (i == 2) {
            content.addComponent(new Label(
                    "Excepteur sint obcaecat cupiditat non proident culpa. Magna pars studiorum, prodita quaerimus."));
        }
        Tab t = ts.addTab(content, tabcaption);
        t.setClosable(closable);
        t.setEnabled(!disable);

        // First tab is always enabled
        if (i == 1) {
            t.setEnabled(true);
        }

        if (icon) {
            t.setIcon(testIcon.get(false));
        }
    }

    ts.addSelectedTabChangeListener(new SelectedTabChangeListener() {
        @Override
        public void selectedTabChange(SelectedTabChangeEvent event) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    });

    return ts;
}

From source file:com.cms.utils.CommonUtils.java

public static Panel addOg2Panel(OptionGroup og, String caption, String height) {
    og.setWidth("100%");
    og.setHeight("-1px");
    og.setImmediate(true);/*from  w w w .j  a v  a2  s. co m*/
    og.setMultiSelect(true);
    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setHeightUndefined();
    layout.setImmediate(true);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(og);
    layout.setComponentAlignment(og, Alignment.MIDDLE_LEFT);
    Panel panel = new Panel();
    if (!DataUtil.isStringNullOrEmpty(caption)) {
        panel.setCaption(caption);
    }
    panel.setWidth("100%");
    panel.setImmediate(true);
    if (!DataUtil.isStringNullOrEmpty(height)) {
        panel.setHeight(height);
    } else {
        panel.setHeight("200px");
    }
    panel.addStyleName(Runo.PANEL_LIGHT);
    panel.setContent(layout);
    return panel;
}

From source file:com.coatl.pruebas.MyUI.java

@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();

    final TextField name = new TextField();
    name.setCaption("Escribe algo aqu:");

    Button button = new Button("Dime que escrib");

    button.addClickListener(new Button.ClickListener() {
        @Override/*  ww  w.  j  a  va2s .  c  om*/
        public void buttonClick(Button.ClickEvent event) {
            System.out.println("Click!");
            layout.addComponent(new Label("Usted escribi> " + name.getValue()));
        }
    });

    layout.addComponents(name, button);
    layout.setMargin(true);
    layout.setSpacing(true);

    setContent(layout);
}

From source file:com.constellio.app.ui.pages.management.updates.UpdateManagerViewImpl.java

private Component buildAvailableUpdateLayout() {
    Label message = new Label($("UpdateManagerViewImpl.updateAvailable", presenter.getUpdateVersion()));
    message.addStyleName(ValoTheme.LABEL_BOLD);

    Button update = new LinkButton($("UpdateManagerViewImpl.updateButton")) {
        @Override/*  ww  w  .  ja v a2  s  .  c  om*/
        protected void buttonClick(ClickEvent event) {
            UI.getCurrent().access(new Thread(UpdateManagerViewImpl.class.getName() + "-updateFromServer") {
                @Override
                public void run() {
                    presenter.updateFromServer();
                }
            });
        }
    };
    update.setVisible(presenter.isUpdateEnabled());

    HorizontalLayout updater = new HorizontalLayout(message, update);
    updater.setComponentAlignment(message, Alignment.MIDDLE_LEFT);
    updater.setComponentAlignment(update, Alignment.MIDDLE_LEFT);
    updater.setSpacing(true);

    Label changelog = new Label(presenter.getChangelog(), ContentMode.HTML);

    VerticalLayout layout = new VerticalLayout(updater, changelog);
    layout.setSpacing(true);
    layout.setWidth("100%");

    return layout;
}

From source file:com.constellio.app.ui.pages.management.updates.UpdateManagerViewImpl.java

private Component buildUnlicensedLayout() {
    Label message = new Label($("UpdateManagerViewImpl.unlicensed"));
    message.addStyleName(ValoTheme.LABEL_BOLD);

    Link request = new Link($("UpdateManagerViewImpl.requestLicense"),
            new ExternalResource("mailto:sales@constellio.com?Subject=Demande de license Constellio"));

    VerticalLayout layout = new VerticalLayout(message, request);
    layout.setSpacing(true);

    return layout;
}

From source file:com.constellio.app.ui.pages.management.updates.UpdateManagerViewImpl.java

private Component buildLicenseUploadPanel() {
    Upload upload = new Upload($("UpdateManagerViewImpl.uploadLicenseCaption"), new Receiver() {
        @Override/*from   w  w  w. j  ava 2 s .  c  o m*/
        public OutputStream receiveUpload(String filename, String mimeType) {
            return presenter.getLicenseOutputStream();
        }
    });
    upload.addSucceededListener(new SucceededListener() {
        @Override
        public void uploadSucceeded(SucceededEvent event) {
            presenter.licenseUploadSucceeded();
        }
    });
    upload.setButtonCaption($("UpdateManagerViewImpl.uploadLicense"));

    Button cancel = new LinkButton($("cancel")) {
        @Override
        protected void buttonClick(ClickEvent event) {
            presenter.licenseUploadCancelled();
        }
    };

    VerticalLayout layout = new VerticalLayout(upload, cancel);
    layout.setWidth("100%");
    layout.setSpacing(true);

    return layout;
}

From source file:com.cxplonka.feature.ui.vaadin.VaadinUI.java

private void initLayout() {
    final VerticalLayout root = new VerticalLayout();
    root.setSizeFull();/*  w  w w.j  a v a2 s  .c o  m*/
    root.setMargin(true);
    root.setSpacing(true);
    setContent(root);

    final CssLayout navigationBar = new CssLayout();
    navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

    navigationBar.addComponent(createNavigationButton("Default View", DefaultView.VIEW_NAME));
    navigationBar.addComponent(createNavigationButton("Data View", DataTableView.VIEW_NAME));

    root.addComponent(navigationBar);

    final Panel viewContainer = new Panel();
    viewContainer.setSizeFull();
    root.addComponent(viewContainer);
    root.setExpandRatio(viewContainer, 1.0f);

    Navigator navigator = new Navigator(this, viewContainer);
    navigator.addProvider(viewProvider);
}

From source file:com.digitallabs.demos.Vaadin6BootstrapThemeDemo.java

License:Apache License

private void forms(ComponentContainer container) {
    VerticalLayout form = new VerticalLayout();
    form.addStyleName(Bootstrap.Forms.FORM.styleName());
    form.setSpacing(true);
    form.setCaption("Legend");

    TextField email = new TextField("Email address");
    email.setInputPrompt("Enter email");
    form.addComponent(email);/*from  w ww  .  jav  a  2s  .c om*/

    PasswordField password = new PasswordField("Password");
    password.setInputPrompt("Password");
    form.addComponent(password);

    Upload upload = new Upload("File input", null);
    form.addComponent(upload);

    Label help = new Label("Example block-level help text here.");
    help.addStyleName("help-block");
    form.addComponent(help);

    CheckBox check = new CheckBox("Check me out");
    form.addComponent(check);

    Button submit = new Button("Submit");
    submit.addStyleName(Bootstrap.Buttons.DEFAULT.styleName());
    form.addComponent(submit);

    container.addComponent(form);
}

From source file:com.dungnv.streetfood.ui.TwinColumnUI.java

public final void init() {
    setMargin(true);//from  w w w . java 2  s  .  c  o  m
    setSpacing(true);
    setWidth(100f, Unit.PERCENTAGE);

    HorizontalLayout hLayout = new HorizontalLayout();
    hLayout.setSpacing(true);
    hLayout.setWidth(100f, Unit.PERCENTAGE);
    addComponent(hLayout);

    msLeft = new MultiSelectUI(searchField);
    msLeft.setWidth(100.0f, Unit.PERCENTAGE);
    hLayout.addComponent(msLeft);
    hLayout.setExpandRatio(msLeft, .45f);

    VerticalLayout vButtonLayout = new VerticalLayout();
    vButtonLayout.setSpacing(true);
    hLayout.addComponent(vButtonLayout);
    hLayout.setExpandRatio(vButtonLayout, .1f);
    hLayout.setComponentAlignment(vButtonLayout, Alignment.BOTTOM_CENTER);

    btnLeftAll = new Button();
    btnLeftAll.setWidth(100f, Unit.PERCENTAGE);
    btnLeftAll.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT);
    vButtonLayout.addComponent(btnLeftAll);

    btnLeft = new Button();
    btnLeft.setWidth(100f, Unit.PERCENTAGE);
    btnLeft.setIcon(FontAwesome.ANGLE_LEFT);
    vButtonLayout.addComponent(btnLeft);

    btnRight = new Button();
    btnRight.setWidth(100f, Unit.PERCENTAGE);
    btnRight.setIcon(FontAwesome.ANGLE_RIGHT);
    vButtonLayout.addComponent(btnRight);

    btnRightAll = new Button();
    btnRightAll.setWidth(100f, Unit.PERCENTAGE);
    btnRightAll.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT);
    vButtonLayout.addComponent(btnRightAll);

    msRight = new MultiSelectUI(searchField);
    msRight.setWidth(100.0f, Unit.PERCENTAGE);
    hLayout.addComponent(msRight);
    hLayout.setExpandRatio(msRight, .45f);

    HorizontalLayout hlButtonFooter = new HorizontalLayout();
    hlButtonFooter.setSpacing(true);
    addComponent(hlButtonFooter);
    setComponentAlignment(hlButtonFooter, Alignment.BOTTOM_RIGHT);

    btnSave = new Button(BundleUtils.getLanguage("lbl.save"), FontAwesome.SAVE);
    hlButtonFooter.addComponent(btnSave);

    btnCancel = new Button(BundleUtils.getLanguage("lbl.cancel"), FontAwesome.BAN);
    hlButtonFooter.addComponent(btnCancel);
}