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.toptal.ui.view.LoginView.java

License:Open Source License

/**
 * Adds login form.// w w w  . j a  v  a2 s.c o  m
 */
private void addForm() {
    final VerticalLayout form = new VerticalLayout();
    form.setSizeUndefined();
    form.setSpacing(true);
    form.addComponent(this.header());
    form.addComponent(this.content());
    this.addComponent(form);
    this.setComponentAlignment(form, Alignment.MIDDLE_CENTER);
}

From source file:com.trivago.mail.pigeon.web.components.mail.NewsletterProgressComponent.java

License:Apache License

public NewsletterProgressComponent(final Mail mail) {
    Panel rootPanel = new Panel("Progress for Mail with Suject " + mail.getSubject());

    VerticalLayout vl = new VerticalLayout();
    vl.setSpacing(true);

    DateField df = new DateField("Send Date");
    df.setValue(mail.getSendDate());// ww w.  j  a v  a  2s .c om
    df.setReadOnly(true);
    df.setResolution(DateField.RESOLUTION_MIN);

    indicator = new ProgressIndicator(new Float(0.0));
    indicator.setPollingInterval(500);
    int cnt = 0;
    Iterable<Relationship> recipients = mail.getRecipients();

    for (Relationship rec : recipients) {
        ++cnt;
    }
    final int recpCount = cnt;

    class WorkerThread extends Thread {
        int current = 0;
        public volatile int stop = 0;

        public void run() {
            while (true) {
                if (stop > 0) {
                    break;
                }

                try {
                    QueueNewsletter qn = new QueueNewsletter();
                    int progress = qn.getProgress(mail.getId());
                    current = recpCount - progress;

                    if (current == recpCount) {
                        mail.setDone();
                        break;
                    }

                    double result = (recpCount / 100.00) * current;
                    indicator.setValue(new Float(result / 100.00));

                    sleep(500);
                } catch (InterruptedException e) {
                }
            }
        }
    }

    final WorkerThread workerThread = new WorkerThread();

    final Button startButton = new Button("Poll status");
    final Button stopButton = new Button("Stop polling");

    startButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {

            workerThread.start();
            event.getButton().setVisible(false);
            stopButton.setVisible(true);

        }
    });

    stopButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {

            workerThread.stop = 1;
            workerThread.interrupt();
            event.getButton().setVisible(false);
            startButton.setVisible(true);
        }
    });

    stopButton.setVisible(false);
    vl.addComponent(df);
    vl.addComponent(indicator);
    vl.addComponent(startButton);
    vl.addComponent(stopButton);

    rootPanel.addComponent(vl);
    setCompositionRoot(rootPanel);
}

From source file:com.trivago.mail.pigeon.web.components.mail.PopupActiveNewsletters.java

License:Apache License

public PopupActiveNewsletters() {
    setClosable(false);/*w  w w .  j  a  v  a  2s .  c  o m*/
    setWidth("400px");

    VerticalLayout vl = new VerticalLayout();
    vl.setSpacing(true);

    Button closeButton = new Button("Close");
    vl.addComponent(closeButton);

    IndexHits<Node> all = Mail.getAll();
    for (Node mailNode : all) {
        Mail mail = new Mail(mailNode);
        if (!mail.isDone()) {
            NewsletterProgressComponent pc = new NewsletterProgressComponent(mail);
            vl.addComponent(pc);
        }
    }

    closeButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            event.getButton().getWindow().setVisible(false);
            event.getButton().getWindow().getParent().removeComponent(event.getButton().getWindow());
        }
    });

    addComponent(vl);
}

From source file:com.vaadHL.window.base.BaseWindow.java

License:Apache License

/**
 * Creates the content of the window but does not set (display). The content
 * consists of three vertically placed areas: the upper, middle and bottom
 * area. Create content but don't bind data.
 * /*from  w  w w . ja  va 2s.  c o  m*/
 * @return The just created content of the window.
 */
public Component getCompositeContent() {
    VerticalLayout content = new VerticalLayout();
    Component c;
    c = makeUpperArea();
    if (c != null)
        content.addComponent(c);
    c = makeMiddleArea();
    if (c != null) {
        c.setSizeFull();
        content.addComponent(c);
        content.setExpandRatio(c, 1);
    }
    c = makeBottomArea();
    if (c != null) {
        VerticalLayout v = new VerticalLayout();
        v.addComponent(c);
        v.setComponentAlignment(c, Alignment.BOTTOM_CENTER);
        /*
         * Label gap = new Label(); gap.setHeight("5px");
         * v.addComponent(gap);
         */
        content.addComponent(v);
        content.setComponentAlignment(v, Alignment.BOTTOM_CENTER);
    }
    content.setSpacing(true);
    return (content);
}

From source file:com.wcs.wcslib.vaadin.widget.recaptcha.demo.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    final VerticalLayout layout = new VerticalLayout();
    final ConfigComponent configComponent = new ConfigComponent();

    layout.addComponent(new Label("<h1>Vaadin ReCaptcha Add-on Demo</h1>" + "<p>See "
            + "<a href=\"https://developers.google.com/recaptcha/docs/customization\" target=\"_blank\">"
            + "ReCaptcha API" + "</a>" + " to understand theese settings. Or just Press 'SHOW' :)" + "</p>",
            ContentMode.HTML));//w ww  .j a  v a  2 s  .  com
    layout.addComponent(configComponent);
    layout.setSpacing(true);
    layout.setMargin(true);

    Button showBtn = new Button("SHOW", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            layout.removeAllComponents();
            DummyRegWithReCaptcha dummyRegWithReCaptcha = new DummyRegWithReCaptcha(configComponent);
            layout.addComponent(dummyRegWithReCaptcha);
            layout.setComponentAlignment(dummyRegWithReCaptcha, Alignment.MIDDLE_CENTER);
        }
    });

    layout.addComponent(showBtn);
    setContent(layout);
}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoginView.java

private Component buildLoginForm() {
    final VerticalLayout loginPanel = new VerticalLayout();
    loginPanel.setSizeUndefined();/*from w  w  w.ja  v a 2 s.c  om*/
    loginPanel.setSpacing(true);
    Responsive.makeResponsive(loginPanel);
    loginPanel.addStyleName("login-panel");

    loginPanel.addComponent(buildLabels());
    loginPanel.addComponent(buildFields());
    loginPanel.addComponent(new CheckBox("Remember me", true));
    return loginPanel;
}

From source file:cz.iivos.todo.dialogs.TaskDlg.java

/**
 * Konstruktor.//w  ww.jav a  2  s.c o m
 * 
 * @param caption nadpis okna
 * @param sqlCont sqlcontainer na kterm je postavena tabulka s koly.
 * @param item vybran poloka z SQLcontaineru (dek z tabulky).
 * @param lis Listener na obnovu view.
 */
public TaskDlg(String caption, SQLContainer sqlCont, Item item, RenewTodoListener lis) {
    this.listener = lis;
    this.setCaption(caption);
    setModal(true);
    flInputForm = new InputFormLayout<Task>(Task.class, item, sqlCont, this);

    // obsah dialogu
    VerticalLayout content = new VerticalLayout(flInputForm);
    content.setSpacing(true);
    content.setMargin(true);

    setContent(content);
}

From source file:de.akquinet.engineering.vaadin.javascriptplus.demo.JavaScriptPlusDemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    TimeBox timeBox = new TimeBox();
    timeBox.addValueChangeListener(//  ww  w.  j a v  a 2  s  . com
            (source, from, to) -> Notification.show("Value Changed: from=" + from + ", to=" + to));

    Button button = new Button("Apply");

    VerticalLayout layoutContent = new VerticalLayout();
    layoutContent.setMargin(true);
    layoutContent.setSpacing(true);
    layoutContent.addComponent(timeBox);
    layoutContent.addComponent(button);

    setContent(layoutContent);
}

From source file:de.akquinet.engineering.vaadin.vaangular.demo.VaangularUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    try {/*  w  ww .j  ava2  s. co m*/

        VerticalLayout mainLayout = new VerticalLayout();
        mainLayout.setMargin(true);
        mainLayout.setSpacing(true);
        Accordion accordion = new Accordion();

        weatherInfo = new Weather();
        final int[] times = new int[] { 10, 12, 14, 16 };
        final String[] entries = new String[] { "<strong>10</strong> sunny", "<strong>12</strong> windy",
                "<strong>14</strong> cold", "<strong>20</strong> superb" };
        weatherInfo.setDaten(times, entries);
        weatherInfo.addClickListener(new WeatherClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void click(int time, String entry) {
                showPopup(entry);
            }
        });
        weatherInfo.setButtonCaption("E-Mail (from angular)");
        accordion.addTab(weatherInfo, "Weather-Demo");
        mainLayout.addComponent(accordion);

        javaSend = new Button();
        javaSend.setCaption("E-Mail (from Java)");
        javaSend.addClickListener(new ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                int index = weatherInfo.getSliderPos();
                System.out.println("Button from w/in Java - value: " + index);
                showPopup(entries[index]);
            }
        });
        mainLayout.addComponent(javaSend);

        setContent(mainLayout);
    } catch (Exception e) {
        throw new RuntimeException("some stupid error occured!", e);
    }
}

From source file:de.catma.ui.analyzer.AnalyzerView.java

License:Open Source License

private void initComponents() {
    setSizeFull();//from  ww w.jav a  2 s .  c  o  m

    Component searchPanel = createSearchPanel();

    Component convenienceButtonPanel = createConvenienceButtonPanel();

    VerticalLayout searchAndConveniencePanel = new VerticalLayout();
    searchAndConveniencePanel.setSpacing(true);
    searchAndConveniencePanel.setMargin(true);
    searchAndConveniencePanel.addComponent(searchPanel);
    searchAndConveniencePanel.addComponent(convenienceButtonPanel);

    Component documentsPanel = createDocumentsPanel();

    HorizontalSplitPanel topPanel = new HorizontalSplitPanel();
    topPanel.setSplitPosition(70);
    topPanel.addComponent(searchAndConveniencePanel);
    topPanel.addComponent(documentsPanel);
    addComponent(topPanel);

    setExpandRatio(topPanel, 0.25f);

    Component resultPanel = createResultPanel();
    resultPanel.setSizeFull();

    addComponent(resultPanel);
    setExpandRatio(resultPanel, 0.75f);
}