Example usage for com.vaadin.ui HorizontalLayout setSpacing

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

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout 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);

    VerticalLayout layout = new VerticalLayout();
    layout.addComponents(newPassword, newPasswordRepeat, buttons);
    layout.setMargin(true);/* ww w . j  av  a2s . c  o  m*/
    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 getExistingConnectionLayout() {
    ComboBox connection = new ComboBox("Existing connection");
    connection.addItem("SQL Server 01");
    connection.addItem("Elasticsearch Server 01");
    connection.setWidth("400");
    connection.setNullSelectionAllowed(false);
    connection.setTextInputAllowed(false);

    Button connect = new Button("Connect");
    connect.addStyleName(ValoTheme.BUTTON_PRIMARY);
    connect.setClickShortcut(KeyCode.ENTER);
    connect.setWidth("120");

    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    layout.addComponents(connection, connect);
    layout.setComponentAlignment(connect, Alignment.BOTTOM_LEFT);
    return layout;
}

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

License:Apache License

private Component getNewConnectionLayout() {
    engine = new ComboBox("New connection");
    engine.setWidth("400");
    engine.setNullSelectionAllowed(false);
    engine.setTextInputAllowed(false);//  w w w  .  j  a v  a  2s  .  c om

    create = new Button("Create");
    create.addStyleName(ValoTheme.BUTTON_PRIMARY);
    create.setClickShortcut(KeyCode.ENTER);
    create.setWidth("120");

    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    layout.addComponents(engine, create);
    layout.setComponentAlignment(create, Alignment.BOTTOM_LEFT);
    return layout;
}

From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java

License:Apache License

private HorizontalLayout createVaadinVersionLayout(String newestVersion, Button changeVersionButton,
        Button updateVaadinVersionButton, ProgressIndicator versionUpgradeProgressIndicator,
        Button detailsButton) {/*  w ww .j  a  v  a 2  s .c  o  m*/
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    layout.setCaption("Vaadin Jar Version");

    Label vaadinVersionLabel = new Label();
    vaadinVersionLabel.setSizeUndefined();
    String version = null;
    try {
        version = ControlPanelPortletUtil.getPortalVaadinServerVersion();
    } catch (FileNotFoundException e) {
        log.warn("vaadin-server.jar couldn't be read. file not found.");
    } catch (IOException e) {
        log.warn("vaadin-server.jar couldn't be read. ", e);
    }

    if (version == null) {
        try {
            version = ControlPanelPortletUtil.getPortalVaadin6Version();
        } catch (IOException e) {
            log.warn("vaadin.jar couldn't be read.");
        }
    }

    if (version == null) {
        version = "could not be determined";
    }
    vaadinVersionLabel.setValue(version);
    layout.addComponent(vaadinVersionLabel);

    if (version.startsWith("7")) {
        layout.addComponent(detailsButton);
    }

    layout.addComponent(changeVersionButton);

    Label newestVaadinVersionLabel = new Label();
    newestVaadinVersionLabel.setSizeUndefined();
    newestVaadinVersionLabel.setValue("(newest stable version: " + newestVersion + ")");
    layout.addComponent(newestVaadinVersionLabel);

    if (!version.equals(newestVersion)) {
        layout.addComponent(updateVaadinVersionButton);
    }
    layout.addComponent(versionUpgradeProgressIndicator);
    return layout;
}

From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java

License:Apache License

private HorizontalLayout createAddonDirectoryLayout() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    layout.setCaption("Add-on Directory");
    addonLibDirLabel = createAddonLibDirLabel();
    layout.addComponent(addonLibDirLabel);
    refreshButton = createRefreshButton();
    layout.addComponent(refreshButton);//from  w ww .  j  a  v a  2 s .  c  o  m
    layout.setComponentAlignment(refreshButton, Alignment.MIDDLE_LEFT);

    return layout;
}

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

License:Apache License

public ChangeVersionWindow() {
    super("Change Vaadin version");
    setModal(true);//  w w  w .  j  a v  a  2  s. co  m
    setSizeUndefined();

    layout.setMargin(true);
    layout.setSizeUndefined();
    layout.setSpacing(true);

    setContent(layout);

    progressIndicator.setCaption("Fetching version list");

    includeVersions.setItemCaptionMode(ComboBox.ItemCaptionMode.ID);

    includeVersions.setMultiSelect(true);
    includeVersions.setValue(Collections.singleton(DownloadInfo.VaadinReleaseType.release));
    includeVersions.setImmediate(true);
    includeVersions.addValueChangeListener(new Property.ValueChangeListener() {
        public void valueChange(Property.ValueChangeEvent event) {
            updateFilter();
        }
    });

    versionSelection.setItemCaptionPropertyId(VERSION_PROPERTY);
    versionSelection.setNullSelectionAllowed(false);
    versionSelection.setRequired(true);

    //versionFetch.start();

    layout.addComponent(includeVersions);
    layout.addComponent(versionSelection);

    HorizontalLayout buttonRow = new HorizontalLayout();
    buttonRow.setSpacing(true);
    buttonRow.addComponent(changeVersionButton);
    buttonRow.addComponent(cancelButton);

    layout.addComponent(buttonRow);

    updateState(false);

    updateFilter();
}

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

License:Apache License

public Accordions() {
    setMargin(true);//from   w w w . j  a v a  2s  .  com

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

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

    row.addComponent(getAccordion("Normal"));

    Accordion ac = getAccordion("Borderless");
    ac.addStyleName("borderless");
    row.addComponent(ac);

}

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

License:Apache License

/**
* 
*//*from w ww. ja v  a2  s.co  m*/
public ButtonsAndLinks() {
    setMargin(true);

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

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    Button button = new Button("Normal");
    row.addComponent(button);

    button = new Button("Disabled");
    button.setEnabled(false);
    row.addComponent(button);

    button = new Button("Primary");
    button.addStyleName("primary");
    row.addComponent(button);

    button = new Button("Friendly");
    button.addStyleName("friendly");
    row.addComponent(button);

    button = new Button("Danger");
    button.addStyleName("danger");
    row.addComponent(button);

    TestIcon testIcon = new TestIcon(10);
    button = new Button("Small");
    button.addStyleName("small");
    button.setIcon(testIcon.get());
    row.addComponent(button);

    button = new Button("Large");
    button.addStyleName("large");
    button.setIcon(testIcon.get());
    row.addComponent(button);

    button = new Button("Top");
    button.addStyleName("icon-align-top");
    button.setIcon(testIcon.get());
    row.addComponent(button);

    button = new Button("Image icon");
    button.setIcon(testIcon.get(true, 16));
    row.addComponent(button);

    button = new Button("Image icon");
    button.addStyleName("icon-align-right");
    button.setIcon(testIcon.get(true));
    row.addComponent(button);

    button = new Button("Photos");
    button.setIcon(testIcon.get());
    row.addComponent(button);

    button = new Button();
    button.setIcon(testIcon.get());
    button.addStyleName("icon-only");
    row.addComponent(button);

    button = new Button("Borderless");
    button.setIcon(testIcon.get());
    button.addStyleName("borderless");
    row.addComponent(button);

    button = new Button("Borderless, colored");
    button.setIcon(testIcon.get());
    button.addStyleName("borderless-colored");
    row.addComponent(button);

    button = new Button("Quiet");
    button.setIcon(testIcon.get());
    button.addStyleName("quiet");
    row.addComponent(button);

    button = new Button("Link style");
    button.setIcon(testIcon.get());
    button.addStyleName("link");
    row.addComponent(button);

    button = new Button("Icon on right");
    button.setIcon(testIcon.get());
    button.addStyleName("icon-align-right");
    row.addComponent(button);

    CssLayout group = new CssLayout();
    group.addStyleName("v-component-group");
    row.addComponent(group);

    button = new Button("One");
    group.addComponent(button);
    button = new Button("Two");
    group.addComponent(button);
    button = new Button("Three");
    group.addComponent(button);

    button = new Button("Tiny");
    button.addStyleName("tiny");
    row.addComponent(button);

    button = new Button("Huge");
    button.addStyleName("huge");
    row.addComponent(button);

    NativeButton nbutton = new NativeButton("Native");
    row.addComponent(nbutton);

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

    row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    Link link = new Link("vaadin.com", new ExternalResource("https://vaadin.com"));
    row.addComponent(link);

    link = new Link("Link with icon", new ExternalResource("https://vaadin.com"));
    link.addStyleName("color3");
    link.setIcon(testIcon.get());
    row.addComponent(link);

    link = new Link("Small", new ExternalResource("https://vaadin.com"));
    link.addStyleName("small");
    row.addComponent(link);

    link = new Link("Large", new ExternalResource("https://vaadin.com"));
    link.addStyleName("large");
    row.addComponent(link);

    link = new Link(null, new ExternalResource("https://vaadin.com"));
    link.setIcon(testIcon.get());
    link.addStyleName("large");
    row.addComponent(link);
}

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

License:Apache License

public CheckBoxes() {
    setMargin(true);//from  w  w w.  ja  v a2s  .c o m

    Label h1 = new Label("Check Boxes");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    CheckBox check = new CheckBox("Checked", true);
    row.addComponent(check);

    check = new CheckBox("Checked, explicit width, so that the caption should wrap", true);
    row.addComponent(check);
    check.setWidth("150px");

    check = new CheckBox("Not checked");
    row.addComponent(check);

    check = new CheckBox(null, true);
    check.setDescription("No caption");
    row.addComponent(check);

    check = new CheckBox("Custom color", true);
    check.addStyleName("color1");
    row.addComponent(check);

    TestIcon testIcon = new TestIcon(30);
    check = new CheckBox("Custom color", true);
    check.addStyleName("color2");
    check.setIcon(testIcon.get());
    row.addComponent(check);

    check = new CheckBox("With Icon", true);
    check.setIcon(testIcon.get());
    row.addComponent(check);

    check = new CheckBox();
    check.setIcon(testIcon.get(true));
    row.addComponent(check);

    check = new CheckBox("Small", true);
    check.addStyleName("small");
    row.addComponent(check);

    check = new CheckBox("Large", true);
    check.addStyleName("large");
    row.addComponent(check);

    h1 = new Label("Option Groups");
    h1.addStyleName("h1");
    addComponent(h1);

    row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    OptionGroup options = new OptionGroup("Choose one, explicit width");
    options.setWidth("200px");
    options.addItem("Option One");
    Item two = options.addItem(
            "Option Two, with a longer caption that should wrap when the components width is explicitly set.");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon(two, testIcon.get());
    options.setItemIcon("Option Three", testIcon.get(true));
    row.addComponent(options);

    options = new OptionGroup("Choose many, explicit width");
    options.setMultiSelect(true);
    options.setWidth("200px");
    options.addItem("Option One");
    two = options.addItem(
            "Option Two, with a longer caption that should wrap when the components width is explicitly set.");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon(two, testIcon.get());
    options.setItemIcon("Option Three", testIcon.get(true));
    row.addComponent(options);

    options = new OptionGroup("Choose one, small");
    options.addStyleName("small");
    options.setMultiSelect(false);
    options.addItem("Option One");
    options.addItem("Option Two");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon("Option Two", testIcon.get());
    options.setItemIcon("Option Three", testIcon.get(true));
    row.addComponent(options);

    options = new OptionGroup("Choose many, small");
    options.addStyleName("small");
    options.setMultiSelect(true);
    options.addItem("Option One");
    options.addItem("Option Two");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon("Option Two", testIcon.get());
    options.setItemIcon("Option Three", testIcon.get(true));
    row.addComponent(options);

    options = new OptionGroup("Choose one, large");
    options.addStyleName("large");
    options.setMultiSelect(false);
    options.addItem("Option One");
    options.addItem("Option Two");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon("Option Two", testIcon.get());
    options.setItemIcon("Option Three", testIcon.get(true));
    row.addComponent(options);

    options = new OptionGroup("Choose many, large");
    options.addStyleName("large");
    options.setMultiSelect(true);
    options.addItem("Option One");
    options.addItem("Option Two");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon("Option Two", testIcon.get());
    options.setItemIcon("Option Three", testIcon.get(true));
    row.addComponent(options);

    options = new OptionGroup("Horizontal items");
    options.addStyleName("horizontal");
    options.addItem("Option One");
    two = options.addItem("Option Two, with a longer caption");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon(two, testIcon.get());
    options.setItemIcon("Option Three", testIcon.get());
    row.addComponent(options);

    options = new OptionGroup("Horizontal items, explicit width");
    options.setMultiSelect(true);
    options.setWidth("500px");
    options.addStyleName("horizontal");
    options.addItem("Option One");
    two = options.addItem("Option Two, with a longer caption");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon(two, testIcon.get());
    options.setItemIcon("Option Three", testIcon.get());
    row.addComponent(options);
}

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

License:Apache License

public ColorPickers() {
    setMargin(true);/*from  w w  w. ja va 2 s .c o m*/

    Label h1 = new Label("Color Pickers");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    TestIcon testIcon = new TestIcon(40);

    ColorPicker cp = new ColorPicker();
    cp.setDefaultCaptionEnabled(true);
    cp.setIcon(testIcon.get());
    cp.setColor(new Color(138, 73, 115));
    row.addComponent(cp);

    cp = new ColorPicker();
    cp.setPopupStyle(PopupStyle.POPUP_SIMPLE);
    cp.setTextfieldVisibility(true);
    row.addComponent(cp);
}