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.antonjohansson.lprs.view.ServiceView.java

License:Apache License

private Layout setPasswordLayout() {
    newPassword.setWidth(STANDARD_WIDTH, EM);
    newPassword.setCaption("Password");
    newPasswordRepeat.setWidth(STANDARD_WIDTH, EM);
    newPasswordRepeat.setCaption("Repeat password");
    setPassword.setCaption("Set password");
    backFromSetPassword.setCaption("Back");

    HorizontalLayout buttons = new HorizontalLayout(setPassword, backFromSetPassword);
    buttons.setSpacing(true);//from w  w w . j  a v a  2  s .c  o  m

    VerticalLayout layout = new VerticalLayout();
    layout.addComponents(newPassword, newPasswordRepeat, buttons);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setVisible(false);
    layout.setWidthUndefined();

    return layout;
}

From source file:com.antonjohansson.managementcenter.core.web.welcome.WelcomeView.java

License:Apache License

private Component buildConnectForm() {
    final VerticalLayout panel = new VerticalLayout();
    panel.setSizeUndefined();/*from   ww  w.ja va2  s  . c  om*/
    panel.setSpacing(true);

    panel.addComponent(getHeader());
    panel.addComponent(getExistingConnectionLayout());
    panel.addComponent(getNewConnectionLayout());
    return panel;
}

From source file:com.arcusys.liferay.vaadinplugin.ui.AdditionalDependenciesWindow.java

License:Apache License

public AdditionalDependenciesWindow(List<File> files, List<File> includedDependencies) {
    setCaption("Additional dependencies (WEB-INF/lib)");
    setWidth("350px");
    setHeight("350px");

    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();/*from  w  w w  .j  a  v  a2  s.  c  o m*/
    layout.setMargin(true);
    layout.setSpacing(true);
    setContent(layout);

    dependencyContainer.addContainerProperty("caption", String.class, null);

    filterTextField = createFilterTextField();
    layout.addComponent(filterTextField);

    dependenciesSelector = createDependenciesSelector();
    populateSelector(files, includedDependencies);
    layout.addComponent(dependenciesSelector);
    layout.setExpandRatio(dependenciesSelector, 1);

    layout.addComponent(createCloseButton());
}

From source file:com.bellkenz.modules.PersonalInformation.java

public Window transferEmployee(final String employeeId, final ComboBox div, final ComboBox dept,
        final TextField post) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setMargin(true);//from  ww  w .j a v a2s. c  o  m
    vlayout.setSpacing(true);

    final Window subWindow = new Window("Transfer Employee", vlayout);
    subWindow.setWidth("200px");

    final ComboBox division = new ComboBox("Division: ");
    division.setWidth("100%");
    dropDownBoxList.populateBranchComboBox(division);
    subWindow.addComponent(division);

    final ComboBox department = dropDownBoxList.populateDepartment(new ComboBox());
    department.setWidth("100%");
    division.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (division.getValue() == null) {
            } else {
                divisionId = branchDAO.getBranchId(division.getValue().toString());
            }
        }

    });
    subWindow.addComponent(department);

    final TextField position = createTextField("Position: ");
    position.setWidth("100%");
    subWindow.addComponent(position);

    final PopupDateField entryDate = (PopupDateField) createDateField("Date of Entry: ");
    subWindow.addComponent(entryDate);

    Button updateButton = new Button("UPDATE");
    updateButton.setWidth("100%");
    updateButton.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (division.getValue() == null) {
                getWindow().showNotification("Select Division!", Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            if (department.getValue() == null) {
                getWindow().showNotification("Select Department!", Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            if (position.getValue() == null || position.getValue().toString().trim().isEmpty()) {
                getWindow().showNotification("Enter Position!", Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            if (entryDate.getValue() == null) {
                getWindow().showNotification("Select Entry Date!", Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            List<EmployeePositionHistory> ephList = new ArrayList<EmployeePositionHistory>();
            EmployeePositionHistory eph = new EmployeePositionHistory();
            eph.setBranch(division.getValue().toString());
            eph.setDepartment(department.getValue().toString());
            eph.setPosition(position.getValue().toString().trim().toLowerCase());
            eph.setEntryDate(conUtil.convertDateFormat(entryDate.getValue().toString()));
            ephList.add(eph);
            Integer deptId = departmentDAO.getDepartmentId(divisionId, department.getValue().toString());
            Boolean result = employeeInformationDAO.transferEmployee(ephList, deptId);
            if (result) {
                Object divObjectId = div.addItem();
                div.setItemCaption(divObjectId, division.getValue().toString());
                div.setValue(divObjectId);

                Object deptObjectId = dept.addItem();
                dept.setItemCaption(deptObjectId, department.getValue().toString());
                dept.setValue(deptObjectId);

                post.setValue(position.getValue().toString().trim().toLowerCase());

                (subWindow.getParent()).removeWindow(subWindow);
            } else {
                getWindow().showNotification("Cannot Transfer employee",
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    subWindow.addComponent(updateButton);

    return subWindow;
}

From source file:com.bsb.samples.vaadin.wizard.core.FirstStep.java

License:Apache License

public Component getContent() {
    final VerticalLayout content = new VerticalLayout();
    content.setSpacing(true);
    content.setMargin(true);/* ww  w. ja  va2 s  . c  o m*/

    final Label intro = new Label("A trivial use of the Wizards for Vaadin add-on");
    content.addComponent(intro);

    final Label description = new Label(
            "This demonstrates an application where a custom widgetset has been compiled in a separate JAR "
                    + "project that is not bound to the standard build lifecycle of the project. By making this "
                    + "project optional, the lengthy compilation of the widgetset is only performed on demand. "
                    + "Besides, a full clean of your project in your IDE does not require you to rebuild the "
                    + "widgetset.");
    content.addComponent(description);

    return content;
}

From source file:com.cavisson.gui.dashboard.components.charts.Impl.ResizeInsideVaadinComponent.java

@Override
protected Component getChart() {

    VerticalSplitPanel verticalSplitPanel = new VerticalSplitPanel();
    HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
    horizontalSplitPanel.setSecondComponent(verticalSplitPanel);
    verticalSplitPanel.setFirstComponent(createChart());

    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setMargin(true);//from  www  .  j ava  2 s .com
    verticalLayout.setSpacing(true);
    verticalLayout.addComponent(
            new Label("Relatively sized components resize themselves automatically when in Vaadin component."));

    Button button = new Button("Open in a window");
    button.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            Window window = new Window("Chart windodw");
            window.setContent(createChart());
            window.setWidth("50%");
            window.setHeight("50%");

            getUI().addWindow(window);

        }
    });

    verticalLayout.addComponent(button);
    horizontalSplitPanel.setFirstComponent(verticalLayout);

    return horizontalSplitPanel;
}

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

License:Apache License

public CommonParts() {
    setMargin(true);/*from   www . j ava  2  s  .  c  om*/
    addStyleName("content-common");

    Label h1 = new Label("Common UI Elements");
    h1.addStyleName("h1");
    addComponent(h1);

    VerticalLayout row = new VerticalLayout();
    row.setWidth("100%");
    row.setSpacing(true);
    addComponent(row);

    row.addComponent(loadingIndicators());
    row.addComponent(notifications());
    row.addComponent(windows());
    row.addComponent(tooltips());

}

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

License:Apache License

Panel loadingIndicators() {
    Panel p = new Panel("Loading Indicator");
    final VerticalLayout content = new VerticalLayout();
    p.setContent(content);//from   w w w  . j  a v  a2 s .c  o  m
    content.setSpacing(true);
    content.setMargin(true);
    content.addComponent(new Label("You can test the loading indicator by pressing the buttons."));

    CssLayout group = new CssLayout();
    group.setCaption("Show the loading indicator for");
    group.addStyleName("v-component-group");
    content.addComponent(group);
    Button loading = new Button("0.8");
    loading.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(800);
            } catch (InterruptedException e) {
            }
        }
    });
    group.addComponent(loading);

    Button delay = new Button("3");
    delay.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
            }
        }
    });
    group.addComponent(delay);

    Button wait = new Button("15");
    wait.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(15000);
            } catch (InterruptedException e) {
            }
        }
    });
    wait.addStyleName("last");
    group.addComponent(wait);
    Label label = new Label("&nbsp;&nbsp; seconds", ContentMode.HTML);
    label.setSizeUndefined();
    group.addComponent(label);

    Label spinnerDesc = new Label(
            "The theme also provides a mixin that you can use to include a spinner anywhere in your application. The button below reveals a Label with a custom style name, for which the spinner mixin is added.");
    spinnerDesc.addStyleName("small");
    spinnerDesc.setCaption("Spinner");
    content.addComponent(spinnerDesc);

    if (!ValoThemeUI.isTestMode()) {
        final Label spinner = new Label();
        spinner.addStyleName("spinner");

        Button showSpinnerButton = new Button("Show spinner", new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                content.replaceComponent(event.getComponent(), spinner);
            }
        });
        content.addComponent(showSpinnerButton);
    }

    return p;
}

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

License:Apache License

public Labels() {
    setMargin(true);//from w w  w  . ja va  2s .  c o  m
    addStyleName("content-labels");

    Label h1 = new Label("Labels");
    h1.addStyleName("h1");
    addComponent(h1);

    VerticalLayout left = new VerticalLayout();
    left.setMargin(new MarginInfo(false, true, false, false));
    addComponent(left);

    Label huge = new Label("Huge type for display text.");
    huge.addStyleName("huge");
    left.addComponent(huge);

    Label large = new Label(
            "Large type for introductory text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    large.addStyleName("large");
    left.addComponent(large);

    Label h2 = new Label("Subtitle");
    h2.addStyleName("h2");
    left.addComponent(h2);

    Label normal = new Label(
            "Normal type for plain text, with a <a href=\"https://vaadin.com\">regular link</a>. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.",
            ContentMode.HTML);
    left.addComponent(normal);

    Label h3 = new Label("Small Title");
    h3.addStyleName("h3");
    left.addComponent(h3);

    Label small = new Label(
            "Small type for additional text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    small.addStyleName("small");
    left.addComponent(small);

    Label tiny = new Label("Tiny type for minor text.");
    tiny.addStyleName("tiny");
    left.addComponent(tiny);

    Label h4 = new Label("Section Title");
    h4.addStyleName("h4");
    left.addComponent(h4);

    normal = new Label(
            "Normal type for plain text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    left.addComponent(normal);

    Panel p = new Panel("Additional Label Styles");
    addComponent(p);

    VerticalLayout right = new VerticalLayout();
    right.setSpacing(true);
    right.setMargin(true);
    p.setContent(right);

    Label label = new Label(
            "Bold type for prominent text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    label.addStyleName("bold");
    right.addComponent(label);

    label = new Label(
            "Light type for subtle text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    label.addStyleName("light");
    right.addComponent(label);

    label = new Label(
            "Colored type for highlighted text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    label.addStyleName("colored");
    right.addComponent(label);

    label = new Label("A label for success");
    label.addStyleName("success");
    right.addComponent(label);

    label = new Label("A label for failure");
    label.addStyleName("failure");
    right.addComponent(label);

}

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

License:Apache License

Component panelContent() {
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();//from w  w w.  j  av  a2 s  .co m
    layout.setMargin(true);
    layout.setSpacing(true);
    Label content = new Label(
            "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");
    button.setSizeFull();
    layout.addComponent(button);
    return layout;
}