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.purebred.core.view.entityselect.EntitySelectResults.java

License:Open Source License

@PostConstruct
@Override/* w ww.  jav a 2  s  . c  om*/
public void postConstruct() {
    super.postConstruct();
    addSelectionChangedListener(this, "selectionChanged");

    HorizontalLayout crudButtons = new HorizontalLayout();
    crudButtons.setMargin(false);
    crudButtons.setSpacing(true);

    selectButton = new Button(uiMessageSource.getMessage("entityResults.select"));
    selectButton.setDescription(uiMessageSource.getMessage("entityResults.select.description"));
    selectButton.setEnabled(false);
    selectButton.addStyleName("small default");
    crudButtons.addComponent(selectButton);

    getCrudButtons().addComponent(crudButtons, 0);
    getCrudButtons().setComponentAlignment(crudButtons, Alignment.MIDDLE_LEFT);
}

From source file:com.purebred.core.view.Results.java

License:Open Source License

private HorizontalLayout createNavigationLine() {

    HorizontalLayout resultCountDisplay = new HorizontalLayout();
    Label showingLabel = new Label(uiMessageSource.getMessage("entityResults.showing") + " &nbsp ",
            Label.CONTENT_XHTML);
    showingLabel.setSizeUndefined();/*  w  w w.  j  a v  a 2 s  .co m*/
    showingLabel.addStyleName("small");
    resultCountDisplay.addComponent(showingLabel);
    firstResultTextField = createFirstResultTextField();
    firstResultTextField.addStyleName("small");
    firstResultTextField.setSizeUndefined();
    resultCountDisplay.addComponent(firstResultTextField);
    resultCountLabel = new Label("", Label.CONTENT_XHTML);
    resultCountLabel.setSizeUndefined();
    resultCountLabel.addStyleName("small");
    resultCountDisplay.addComponent(resultCountLabel);

    Label spaceLabel = new Label("   ", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    resultCountDisplay.addComponent(spaceLabel);

    Button refreshButton = new Button(null, getResultsTable(), "refresh");
    refreshButton.setDescription(uiMessageSource.getMessage("entityResults.refresh.description"));
    refreshButton.setSizeUndefined();
    refreshButton.addStyleName("borderless");
    refreshButton.setIcon(new ThemeResource("icons/16/refresh-blue.png"));
    resultCountDisplay.addComponent(refreshButton);

    HorizontalLayout navigationButtons = new HorizontalLayout();
    navigationButtons.setMargin(false, true, false, false);
    navigationButtons.setSpacing(true);

    String perPageText = uiMessageSource.getMessage("entityResults.pageSize");
    pageSizeMenu = new Select();
    pageSizeMenu.addStyleName("small");
    pageSizeMenu.addItem(5);
    pageSizeMenu.setItemCaption(5, "5 " + perPageText);
    pageSizeMenu.addItem(10);
    pageSizeMenu.setItemCaption(10, "10 " + perPageText);
    pageSizeMenu.addItem(25);
    pageSizeMenu.setItemCaption(25, "25 " + perPageText);
    pageSizeMenu.addItem(50);
    pageSizeMenu.setItemCaption(50, "50 " + perPageText);
    pageSizeMenu.addItem(100);
    pageSizeMenu.setItemCaption(100, "100 " + perPageText);
    pageSizeMenu.setFilteringMode(Select.FILTERINGMODE_OFF);
    pageSizeMenu.setNewItemsAllowed(false);
    pageSizeMenu.setNullSelectionAllowed(false);
    pageSizeMenu.setImmediate(true);
    pageSizeMenu.setWidth(8, UNITS_EM);
    navigationButtons.addComponent(pageSizeMenu);

    firstButton = new Button(null, getResultsTable(), "firstPage");
    firstButton.setDescription(uiMessageSource.getMessage("entityResults.first.description"));
    firstButton.setSizeUndefined();
    firstButton.addStyleName("borderless");
    firstButton.setIcon(new ThemeResource("icons/16/first.png"));
    navigationButtons.addComponent(firstButton);

    previousButton = new Button(null, getResultsTable(), "previousPage");
    previousButton.setDescription(uiMessageSource.getMessage("entityResults.previous.description"));
    previousButton.setSizeUndefined();
    previousButton.addStyleName("borderless");
    previousButton.setIcon(new ThemeResource("icons/16/previous.png"));
    navigationButtons.addComponent(previousButton);

    nextButton = new Button(null, getResultsTable(), "nextPage");
    nextButton.setDescription(uiMessageSource.getMessage("entityResults.next.description"));
    nextButton.setSizeUndefined();
    nextButton.addStyleName("borderless");
    nextButton.setIcon(new ThemeResource("icons/16/next.png"));
    navigationButtons.addComponent(nextButton);

    lastButton = new Button(null, getResultsTable(), "lastPage");
    lastButton.setDescription(uiMessageSource.getMessage("entityResults.last.description"));
    lastButton.setSizeUndefined();
    lastButton.addStyleName("borderless");
    lastButton.setIcon(new ThemeResource("icons/16/last.png"));
    navigationButtons.addComponent(lastButton);

    HorizontalLayout navigationLine = new HorizontalLayout();
    navigationLine.setWidth("100%");
    navigationLine.setMargin(true, true, true, false);

    navigationLine.addComponent(resultCountDisplay);
    navigationLine.setComponentAlignment(resultCountDisplay, Alignment.BOTTOM_LEFT);

    navigationLine.addComponent(navigationButtons);
    navigationLine.setComponentAlignment(navigationButtons, Alignment.BOTTOM_RIGHT);

    return navigationLine;
}

From source file:com.purebred.core.view.ResultsConnectedEntityForm.java

License:Open Source License

private HorizontalLayout createNavigationFormLayout() {
    HorizontalLayout navigationFormLayout = new HorizontalLayout();
    navigationFormLayout.setSizeUndefined();

    VerticalLayout previousButtonLayout = new VerticalLayout();
    previousButtonLayout.setSizeUndefined();
    previousButtonLayout.setMargin(false);
    previousButtonLayout.setSpacing(false);
    Label spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();//from w  w  w  .j a va2 s  . c  om
    previousButtonLayout.addComponent(spaceLabel);

    previousButton = new Button(null, this, "previousItem");
    previousButton.setDescription(entityForm.uiMessageSource.getMessage("entityForm.previous.description"));
    previousButton.setSizeUndefined();
    previousButton.addStyleName("borderless");
    previousButton.setIcon(new ThemeResource("icons/16/previous.png"));

    if (entityForm.getViewableToManyRelationships().size() == 0) {
        HorizontalLayout previousButtonHorizontalLayout = new HorizontalLayout();
        previousButtonHorizontalLayout.setSizeUndefined();
        Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
        horizontalSpaceLabel.setSizeUndefined();
        previousButtonHorizontalLayout.addComponent(previousButton);
        previousButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
        previousButtonLayout.addComponent(previousButtonHorizontalLayout);
    } else {
        previousButtonLayout.addComponent(previousButton);
    }

    navigationFormLayout.addComponent(previousButtonLayout);
    navigationFormLayout.setComponentAlignment(previousButtonLayout, Alignment.TOP_LEFT);

    navigationFormLayout.addComponent(entityForm);

    VerticalLayout nextButtonLayout = new VerticalLayout();
    nextButtonLayout.setSizeUndefined();
    nextButtonLayout.setMargin(false);
    nextButtonLayout.setSpacing(false);
    spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    previousButtonLayout.addComponent(spaceLabel);
    nextButtonLayout.addComponent(spaceLabel);

    nextButton = new Button(null, this, "nextItem");
    nextButton.setDescription(entityForm.uiMessageSource.getMessage("entityForm.next.description"));
    nextButton.setSizeUndefined();
    nextButton.addStyleName("borderless");
    nextButton.setIcon(new ThemeResource("icons/16/next.png"));

    HorizontalLayout nextButtonHorizontalLayout = new HorizontalLayout();
    nextButtonHorizontalLayout.setSizeUndefined();
    Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
    horizontalSpaceLabel.setSizeUndefined();
    nextButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
    nextButtonHorizontalLayout.addComponent(nextButton);

    nextButtonLayout.addComponent(nextButtonHorizontalLayout);
    navigationFormLayout.addComponent(nextButtonLayout);
    navigationFormLayout.setComponentAlignment(nextButtonLayout, Alignment.TOP_RIGHT);

    navigationFormLayout.setSpacing(false);
    navigationFormLayout.setMargin(false);

    return navigationFormLayout;
}

From source file:com.purebred.core.view.SearchForm.java

License:Open Source License

@Override
protected void createFooterButtons(HorizontalLayout footerLayout) {
    footerLayout.setSpacing(true);
    footerLayout.setMargin(true);//from w  w  w  .ja  v  a2s .  co m

    Button clearButton = new Button(uiMessageSource.getMessage("entitySearchForm.clear"), this, "clear");
    clearButton.setDescription(uiMessageSource.getMessage("entitySearchForm.clear.description"));
    clearButton.setIcon(new ThemeResource("icons/16/clear.png"));
    clearButton.addStyleName("small default");
    footerLayout.addComponent(clearButton);
    // alignment doesn't work
    //        footerLayout.setComponentAlignment(clearButton, Alignment.MIDDLE_RIGHT);

    Button searchButton = new Button(uiMessageSource.getMessage("entitySearchForm.search"), this, "search");
    searchButton.setDescription(uiMessageSource.getMessage("entitySearchForm.search.description"));
    searchButton.setIcon(new ThemeResource("icons/16/search.png"));
    searchButton.addStyleName("small default");
    footerLayout.addComponent(searchButton);
    //        footerLayout.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT);
}

From source file:com.rdonasco.datamanager.view.DataFormWrapper.java

License:Apache License

private void setupFooter() {
    HorizontalLayout footer = new HorizontalLayout();
    footer.setStyleName(DataManagerTheme.STYLE_DATA_ENTRY_FORM_TOOLBAR);
    footer.setSpacing(true);
    footer.addComponent(createNewButton);
    footer.addComponent(editButton);//from  w  w w. jav a2 s . c  o m
    footer.addComponent(deleteButton);
    footer.addComponent(saveButton);
    footer.addComponent(cancelButton);

    getFormDelegate().setFooter(footer);
}

From source file:com.rdonasco.security.application.views.ApplicationEditorView.java

License:Apache License

private void configureApplicationInfoFields() {
    nameField.setWidth(200f, UNITS_PIXELS);
    applicationInfoPanel.addComponent(nameField);
    ((VerticalLayout) applicationInfoPanel.getContent()).setSpacing(true);
    HorizontalLayout tokenFieldLayout = new HorizontalLayout();
    tokenFieldLayout.setSpacing(true);
    tokenField.setWidth(300, UNITS_PIXELS);
    tokenFieldLayout.addComponent(tokenField);
    generateTokenButton.addStyleName(BaseTheme.BUTTON_LINK);
    generateTokenButton.setDescription(I18NResource.localize("Generate token"));
    generateTokenButton.setIcon(new ThemeResource(SecurityDefaultTheme.ICON_32x32_RELOAD));
    tokenFieldLayout.addComponent(generateTokenButton);
    tokenFieldLayout.setComponentAlignment(generateTokenButton, Alignment.BOTTOM_LEFT);
    applicationInfoPanel.addComponent(tokenFieldLayout);
}

From source file:com.rdonasco.security.application.views.ApplicationListPanelView.java

License:Apache License

@Override
public void initWidget() throws WidgetInitalizeException {
    getAddButton().setCaption(I18NResource.localize("Add new"));
    getAddButton().setDescription(I18NResource.localize("Add new application"));
    getAddButton().setIcon(new ThemeResource(SecurityDefaultTheme.ICON_16x16_ADD));
    getAddButton().setWidth(100, UNITS_PERCENTAGE);
    getAddButton().addStyleName(SecurityDefaultTheme.CSS_SMALL);
    getRefreshButton().setCaption(I18NResource.localize("Refresh"));
    getRefreshButton().setIcon(new ThemeResource(SecurityDefaultTheme.ICON_16x16_REFRESH));
    getRefreshButton().addStyleName(SecurityDefaultTheme.CSS_SMALL);
    VerticalLayout content = ((VerticalLayout) getContent());
    content.setMargin(true);//from   www  .  j  a v a 2 s .  c  o m
    content.setHeight(600, UNITS_PIXELS);
    content.removeAllComponents();
    if (null != getDataViewListTable()) {
        getDataViewListTable().setSizeFull();
        HorizontalLayout buttonLayout = new HorizontalLayout();
        buttonLayout.setSpacing(true);
        buttonLayout.setWidth(100F, UNITS_PERCENTAGE);
        buttonLayout.addComponent(getAddButton());
        buttonLayout.addComponent(getRefreshButton());
        buttonLayout.setExpandRatio(getAddButton(), 1);
        content.addComponent(buttonLayout);
        content.addComponent(getDataViewListTable());
        content.setExpandRatio(getDataViewListTable(), 1);
        content.setSpacing(true);
    }
}

From source file:com.rdonasco.security.group.views.GroupListPanelView.java

License:Apache License

@Override
public void initWidget() throws WidgetInitalizeException {
    setCaption(I18NResource.localize("Groups"));
    setStyleName(SecurityDefaultTheme.CSS_PANEL_BUBBLE);
    VerticalLayout content = (VerticalLayout) getContent();
    content.setMargin(true);//from   w w w .  jav  a2 s .c o  m
    content.setHeight(600, UNITS_PIXELS);
    content.removeAllComponents();
    getGroupListTable().setSizeFull();
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setWidth(100F, UNITS_PERCENTAGE);
    buttonLayout.addComponent(getAddGroupButton());
    buttonLayout.addComponent(getRefreshButton());
    buttonLayout.setExpandRatio(getAddGroupButton(), 1);
    content.addComponent(buttonLayout);

    content.addComponent(getGroupListTable());
    content.setExpandRatio(getGroupListTable(), 1);
    content.setSpacing(true);

}

From source file:com.rdonasco.security.role.views.RoleListPanelView.java

License:Apache License

@Override
public void initWidget() throws WidgetInitalizeException {
    setCaption(I18NResource.localize("Roles"));
    setStyleName(SecurityDefaultTheme.CSS_PANEL_BUBBLE);
    VerticalLayout content = (VerticalLayout) getContent();
    content.setMargin(true);/*w w w . ja  va2  s .c o  m*/
    content.setHeight(600, UNITS_PIXELS);
    content.removeAllComponents();
    getRoleListTable().setSizeFull();
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setWidth(100F, UNITS_PERCENTAGE);
    buttonLayout.addComponent(addRoleButton);
    buttonLayout.addComponent(refreshButton);
    buttonLayout.setExpandRatio(addRoleButton, 1);
    content.addComponent(buttonLayout);
    content.addComponent(getRoleListTable());
    content.setExpandRatio(getRoleListTable(), 1);
    content.setSpacing(true);
}

From source file:com.rdonasco.security.user.controllers.UserEditorViewController.java

License:Apache License

private void configureTabContentLayout(HorizontalLayout container, AbstractComponent leftContent,
        AbstractComponent rightContent) {
    container.setSpacing(true);
    container.setMargin(true, true, true, true);

    container.addComponent(leftContent);
    container.addComponent(rightContent);
    leftContent.setWidth(100f, Sizeable.UNITS_PERCENTAGE);
    container.setExpandRatio(leftContent, 1f);
    container.setExpandRatio(rightContent, 0.25f);

    // fix the size of the panels
    float panelHeight = 300;
    leftContent.setHeight(panelHeight, Sizeable.UNITS_PIXELS);
    rightContent.setHeight(panelHeight, Sizeable.UNITS_PIXELS);
}