Example usage for com.vaadin.ui HorizontalLayout setMargin

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

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout setMargin.

Prototype

@Override
    public void setMargin(boolean enabled) 

Source Link

Usage

From source file:com.peergreen.webconsole.scope.system.internal.bundle.BundleTab.java

License:Open Source License

private void init() {

    setMargin(true);//from  ww  w  .j  av a2  s  .  co  m
    setSpacing(true);

    // ----------------------------------------------------
    // Title
    // ----------------------------------------------------

    HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);
    header.setMargin(true);

    Label title = new Label(format("Bundle %d: %s (%s)", bundle.getBundleId(),
            getHeader(bundle, Constants.BUNDLE_NAME), bundle.getVersion()));
    title.addStyleName("h1");
    header.addComponent(title);
    header.setComponentAlignment(title, Alignment.MIDDLE_LEFT);

    addComponent(header);

    // ----------------------------------------------------
    // Action(s) Bar
    // ----------------------------------------------------

    HorizontalLayout actions = new HorizontalLayout();
    if (BundleHelper.isState(bundle, Bundle.INSTALLED) || BundleHelper.isState(bundle, Bundle.RESOLVED)) {
        Button changeState = new Button();
        changeState.addClickListener(new StartBundleClickListener(bundle, notifierService));
        //changeState.addStyleName("no-padding");
        changeState.setCaption("Start");
        changeState.setIcon(new ClassResource(getClass(), "/images/32x32/go-next.png"));
        actions.addComponent(changeState);
    }
    if (BundleHelper.isState(bundle, Bundle.ACTIVE)) {
        Button changeState = new Button();
        changeState.addClickListener(new StopBundleClickListener(bundle, notifierService));
        //changeState.addStyleName("no-padding");
        changeState.setCaption("Stop");
        changeState.setIcon(new ClassResource(getClass(), "/images/32x32/media-record.png"));
        actions.addComponent(changeState);
    }

    // Update
    Button update = new Button();
    update.addClickListener(new UpdateBundleClickListener(bundle, notifierService));
    //update.addStyleName("no-padding");
    update.setCaption("Update");
    update.setIcon(new ClassResource(getClass(), "/images/32x32/view-refresh.png"));
    actions.addComponent(update);

    // Trash
    Button trash = new Button();
    trash.addClickListener(new UninstallBundleClickListener(bundle, notifierService));
    //trash.addStyleName("no-padding");
    trash.setCaption("Remove");
    trash.setIcon(new ClassResource(getClass(), "/images/32x32/user-trash-full.png"));
    actions.addComponent(trash);
    addComponent(actions);
    setComponentAlignment(actions, Alignment.MIDDLE_RIGHT);

    // ----------------------------------------------------
    // Standard Section
    // ----------------------------------------------------

    Table table = new Table();
    table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    table.setWidth("100%");

    Section mainSection = new Section("Standard", table);
    addComponent(mainSection);

    table.addContainerProperty("label", Label.class, null);
    table.addContainerProperty("value", Label.class, null);

    table.addItem(new Object[] { label("Bundle ID"), label(String.valueOf(bundle.getBundleId())) },
            "bundle.id");
    for (Map.Entry<String, String> entry : HEADERS.entrySet()) {
        String value = getHeader(bundle, entry.getKey());
        if (value != null) {
            table.addItem(new Object[] { label(entry.getValue()), label(value) }, entry.getKey());
        }
    }
    table.addItem(new Object[] { label("Location"), label(bundle.getLocation()) }, "bundle.location");
    Date date = new Date(bundle.getLastModified());
    table.addItem(new Object[] { label("Last Modified"), label(date.toString()) }, "last.modified");

    // ----------------------------------------------------
    // Packages Section
    // ----------------------------------------------------

    FilteredPackageTable exported = new FilteredPackageTable("Exported");

    FilteredPackageTable imported = new FilteredPackageTable("Imported");

    GridLayout packages = new GridLayout(2, 1);
    packages.addComponent(exported);
    packages.addComponent(imported);
    packages.setSpacing(true);
    packages.setWidth("100%");

    Section packagesSection = new Section("Packages", packages);
    addComponent(packagesSection);

    BundleWiring wiring = bundle.adapt(BundleWiring.class);
    if (wiring != null) {
        for (BundleCapability capability : wiring.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE)) {
            String name = (String) capability.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE);
            Version version = (Version) capability.getAttributes()
                    .get(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE);
            exported.addPackage(format("%s (%s)", name, version));
        }
        for (BundleRequirement requirement : wiring.getRequirements(PackageNamespace.PACKAGE_NAMESPACE)) {
            String filter = requirement.getDirectives().get(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE);
            imported.addPackage(filter);
        }
    }

    // ----------------------------------------------------
    // Services Section
    // ----------------------------------------------------

    FilteredServiceTable registered = new FilteredServiceTable("Registered");

    FilteredServiceTable used = new FilteredServiceTable("Used Services");

    VerticalLayout services = new VerticalLayout(registered, used);
    services.setSpacing(true);
    services.setWidth("100%");

    ServiceReference<?>[] registeredServices = bundle.getRegisteredServices();
    if (registeredServices != null) {
        for (ServiceReference<?> reference : registeredServices) {
            registered.addService(reference);
        }
    }

    ServiceReference<?>[] inUseServices = bundle.getServicesInUse();
    if (inUseServices != null) {
        for (ServiceReference<?> reference : inUseServices) {
            used.addService(reference);
        }
    }

    if (!registered.isEmpty() || !used.isEmpty()) {
        Section servicesSection = new Section("Services", services);
        addComponent(servicesSection);
    }

    // ----------------------------------------------------
    // Raw Manifest Section
    // ----------------------------------------------------

    Page.Styles styles = Page.getCurrent().getStyles();
    styles.add(".monospaced-font {font-family: monospace !important; }");

    Table manifest = new Table();
    manifest.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    manifest.setWidth("100%");
    manifest.addStyleName("monospaced-font");
    manifest.setPageLength(15);
    manifest.addContainerProperty("name", String.class, null);
    manifest.addContainerProperty("value", String.class, null);

    Dictionary<String, String> headers = bundle.getHeaders();
    for (String key : Collections.list(headers.keys())) {
        manifest.addItem(new Object[] { key, headers.get(key) }, null);
    }

    Section manifestSection = new Section("Manifest", manifest);
    addComponent(manifestSection);

}

From source file:com.peergreen.webconsole.scope.system.internal.bundle.BundleView.java

License:Open Source License

@PostConstruct
public void createView() {
    setMargin(true);//from  w  w w . java  2s  .  c  o m
    setSpacing(true);

    /*
    Page.Styles styles = Page.getCurrent().getStyles();
    styles.add(".no-padding {padding: 0em 0em 0em 0em !important; }");
    */

    HorizontalLayout header = new HorizontalLayout();
    //        header.setWidth("100%");
    header.setSpacing(true);
    header.setMargin(true);

    Label title = new Label("OSGi Bundles");
    title.addStyleName("h1");
    //        title.setSizeUndefined();
    header.addComponent(title);
    header.setComponentAlignment(title, Alignment.MIDDLE_LEFT);

    final TextField filter = new TextField();
    filter.addTextChangeListener(new FieldEvents.TextChangeListener() {
        @Override
        public void textChange(final FieldEvents.TextChangeEvent event) {
            data.removeAllContainerFilters();
            String trimmed = event.getText().trim();
            Container.Filter or = new Or(new SimpleStringFilter(BUNDLE_ID_COLUMN, trimmed, true, false),
                    new SimpleStringFilter(BUNDLE_NAME_COLUMN, trimmed, true, false),
                    new SimpleStringFilter(BUNDLE_SYMBOLICNAME_COLUMN, trimmed, true, false),
                    new SimpleStringFilter(VERSION_COLUMN, trimmed, true, false),
                    new SimpleStringFilter(PRETTY_STATE_COLUMN, trimmed, true, false));

            data.addContainerFilter(or);
        }
    });

    filter.setInputPrompt("Filter");
    filter.addShortcutListener(new ShortcutListener("Clear", ShortcutAction.KeyCode.ESCAPE, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            filter.setValue("");
            data.removeAllContainerFilters();
        }
    });
    header.addComponent(filter);
    header.setExpandRatio(filter, 1);
    header.setComponentAlignment(filter, Alignment.MIDDLE_LEFT);

    // Store the header in the vertical layout (this)
    addComponent(header);

    addComponent(tabSheet);

    table = new Table();
    table.setContainerDataSource(data);
    table.setSizeFull();
    table.setSortContainerPropertyId(BUNDLE_ID_COLUMN);
    table.setSortAscending(true);
    table.setImmediate(true);
    table.setColumnHeader(BUNDLE_ID_COLUMN, "Bundle ID");
    table.setColumnHeader(PRETTY_NAME_COLUMN, "Bundle Name");
    table.setColumnHeader(VERSION_COLUMN, "Version");
    table.setColumnHeader(PRETTY_STATE_COLUMN, "State");
    table.setColumnHeader("actions", "Actions");

    table.setColumnWidth(BUNDLE_ID_COLUMN, 100);

    table.setColumnAlignment(BUNDLE_ID_COLUMN, Table.Align.CENTER);
    table.setColumnAlignment(PRETTY_STATE_COLUMN, Table.Align.CENTER);
    table.setColumnAlignment(VERSION_COLUMN, Table.Align.CENTER);

    table.addGeneratedColumn("actions", new Table.ColumnGenerator() {
        @Override
        public Object generateCell(final Table source, final Object itemId, final Object columnId) {
            HorizontalLayout layout = new HorizontalLayout();
            BeanItem<BundleItem> item = (BeanItem<BundleItem>) source.getContainerDataSource().getItem(itemId);
            Bundle bundle = item.getBean().getBundle();
            if (BundleHelper.isState(bundle, Bundle.INSTALLED)
                    || BundleHelper.isState(bundle, Bundle.RESOLVED)) {
                Button changeState = new Button();
                changeState.addClickListener(new StartBundleClickListener(bundle, notifierService));
                //changeState.addStyleName("no-padding");
                changeState.setCaption("Start");
                //changeState.setIcon(new ClassResource(BundleViewer.class, "/images/go-next.png"));
                if (!securityManager.isUserInRole("admin")) {
                    changeState.setDisableOnClick(true);
                }
                layout.addComponent(changeState);
            }
            if (BundleHelper.isState(bundle, Bundle.ACTIVE)) {
                Button changeState = new Button();
                changeState.addClickListener(new StopBundleClickListener(bundle, notifierService));
                //changeState.addStyleName("no-padding");
                changeState.setCaption("Stop");
                if (!securityManager.isUserInRole("admin")) {
                    changeState.setDisableOnClick(true);
                }
                //changeState.setIcon(new ClassResource(BundleViewer.class, "/images/media-record.png"));
                layout.addComponent(changeState);
            }

            // Update
            Button update = new Button();
            update.addClickListener(new UpdateBundleClickListener(bundle, notifierService));
            //update.addStyleName("no-padding");
            update.setCaption("Update");
            if (!securityManager.isUserInRole("admin")) {
                update.setDisableOnClick(true);
            }
            //update.setIcon(new ClassResource(BundleViewer.class, "/images/view-refresh.png"));
            layout.addComponent(update);

            // Trash
            Button trash = new Button();
            trash.addClickListener(new UninstallBundleClickListener(bundle, notifierService));
            //trash.addStyleName("no-padding");
            trash.setCaption("Delete");
            if (!securityManager.isUserInRole("admin")) {
                trash.setDisableOnClick(true);
            }
            //trash.setIcon(new ClassResource(BundleViewer.class, "/images/user-trash-full.png"));
            layout.addComponent(trash);

            return layout;
        }
    });

    table.setVisibleColumns(BUNDLE_ID_COLUMN, PRETTY_NAME_COLUMN, VERSION_COLUMN, PRETTY_STATE_COLUMN,
            "actions");

    table.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(final ItemClickEvent event) {
            if (event.isDoubleClick()) {
                BeanItem<BundleItem> item = (BeanItem<BundleItem>) table.getContainerDataSource()
                        .getItem(event.getItemId());
                Bundle bundle = item.getBean().getBundle();
                showBundle(bundle);
            }
        }
    });

    createBundleTracker();

    tabSheet.setSizeFull();
    selectedTabListener = new SelectedTabListener(uiContext.getViewNavigator());
    selectedTabListener.addLocation(table, uiContext.getViewNavigator().getLocation(this.getClass().getName()));
    tabSheet.addSelectedTabChangeListener(selectedTabListener);
    tabSheet.addTab(table, "Bundles", new ClassResource(BundleView.class, "/images/22x22/user-home.png"));
    setExpandRatio(tabSheet, 1.5f);

    tabSheet.setCloseHandler(new TabSheet.CloseHandler() {
        @Override
        public void onTabClose(TabSheet tabsheet, Component tabContent) {
            for (Map.Entry<Long, Component> tab : openTabs.entrySet()) {
                if (tabContent.equals(tab.getValue())) {
                    openTabs.remove(tab.getKey());
                }
            }
            tabsheet.removeComponent(tabContent);
            selectedTabListener.removeLocation(tabContent);
        }
    });
}

From source file:com.peergreen.webconsole.scope.system.internal.service.ServiceViewer.java

License:Open Source License

private void initHeader() {
    HorizontalLayout header = new HorizontalLayout();
    header.setWidth("100%");
    header.setSpacing(true);//from   ww  w .j  a va 2 s. co  m
    header.setMargin(true);

    Label title = new Label("OSGi Services");
    title.addStyleName("h1");
    title.setSizeUndefined();
    header.addComponent(title);
    header.setComponentAlignment(title, Alignment.MIDDLE_LEFT);

    final TextField filter = new TextField();
    filter.addTextChangeListener(new FieldEvents.TextChangeListener() {
        @Override
        public void textChange(final FieldEvents.TextChangeEvent event) {
            data.removeAllContainerFilters();
            String trimmed = event.getText().trim();
            Container.Filter or = new Or(new SimpleStringFilter(SERVICE_ID_COLUMN, trimmed, true, false),
                    new InterfacesFilter(trimmed), new BundleFilter(trimmed),
                    new ServicePropertiesFilter(trimmed));

            data.addContainerFilter(or);
        }
    });

    filter.setInputPrompt("Filter");
    filter.addShortcutListener(new ShortcutListener("Clear", ShortcutAction.KeyCode.ESCAPE, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            filter.setValue("");
            data.removeAllContainerFilters();
        }
    });
    header.addComponent(filter);
    header.setExpandRatio(filter, 1);
    header.setComponentAlignment(filter, Alignment.MIDDLE_LEFT);

    // Store the header in the vertical layout (this)
    addComponent(header);
}

From source file:com.peergreen.webconsole.scope.system.internal.shell.ShellConsoleView.java

License:Open Source License

private void initHeader() {
    HorizontalLayout header = new HorizontalLayout();
    header.setWidth("100%");
    header.setSpacing(true);// w ww .j  av a  2  s . co  m
    header.setMargin(true);

    Label title = new Label("Shell Console");
    title.addStyleName("h1");
    title.setSizeUndefined();
    header.addComponent(title);
    header.setComponentAlignment(title, Alignment.MIDDLE_LEFT);

    // Store the header in the vertical layout (this)
    addComponent(header);
}

From source file:com.peergreen.webconsole.vaadin.DefaultWindow.java

License:Open Source License

/**
 * Create a default window/*  w w w .jav a  2 s .  c o m*/
 * @param caption window caption
 * @param content window content. Vaadin component
 * @param footerButtons list of buttons in footer
 */
public DefaultWindow(String caption, Component content, Button... footerButtons) {
    setCaption(caption);
    setClosable(false);
    setResizable(false);
    addStyleName("edit-dashboard");

    VerticalLayout main = new VerticalLayout();
    main.setSpacing(true);
    main.setMargin(true);
    main.setStyleName("default-window");

    content.addStyleName("default-window-content");
    main.addComponent(content);

    HorizontalLayout footer = new HorizontalLayout();
    footer.setStyleName("footer");
    footer.setWidth("100%");
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(true);

    for (Button button : footerButtons) {
        buttons.addComponent(button);
    }
    footer.addComponent(buttons);
    footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT);

    main.addComponent(footer);
    setContent(main);
}

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

License:Open Source License

@PostConstruct
@Override/*  w  w  w .jav a2 s  . co m*/
public void postConstruct() {
    super.postConstruct();

    getResultsTable().setMultiSelect(true);

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

    newButton = new Button(uiMessageSource.getMessage("entityResults.new"), this, "create");
    newButton.setDescription(uiMessageSource.getMessage("entityResults.new.description"));
    newButton.setIcon(new ThemeResource("icons/16/add.png"));
    newButton.addStyleName("small default");
    crudButtons.addComponent(newButton);

    viewButton = new Button(uiMessageSource.getMessage("entityResults.view"), this, "view");
    viewButton.setDescription(uiMessageSource.getMessage("entityResults.view.description"));
    viewButton.setIcon(new ThemeResource("icons/16/view.png"));
    viewButton.setEnabled(false);
    viewButton.addStyleName("small default");
    crudButtons.addComponent(viewButton);

    editButton = new Button(uiMessageSource.getMessage("entityResults.edit"), this, "edit");
    editButton.setDescription(uiMessageSource.getMessage("entityResults.edit.description"));
    editButton.setIcon(new ThemeResource("icons/16/edit.png"));
    editButton.setEnabled(false);
    editButton.addStyleName("small default");
    crudButtons.addComponent(editButton);

    deleteButton = new Button(uiMessageSource.getMessage("entityResults.delete"), this, "delete");
    deleteButton.setDescription(uiMessageSource.getMessage("entityResults.delete.description"));
    deleteButton.setIcon(new ThemeResource("icons/16/delete.png"));
    deleteButton.setEnabled(false);
    deleteButton.addStyleName("small default");
    crudButtons.addComponent(deleteButton);

    getResultsTable().addListener(Property.ValueChangeEvent.class, this, "selectionChanged");
    //        addSelectionChangedListener(this, "selectionChanged");
    actionContextMenu.addAction("entityResults.view", this, "view");
    actionContextMenu.addAction("entityResults.edit", this, "edit");
    actionContextMenu.addAction("entityResults.delete", this, "delete");

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

    getResultsTable().addListener(new DoubleClickListener());
    getEntityForm().addCancelListener(this, "search");
    getEntityForm().addCloseListener(this, "search");
}

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

License:Open Source License

/**
 * Created the footer buttons: cancel, refresh, save
 *
 * @param footerLayout horizontal layout containing buttons
 *///  ww w .  j  a v  a2s . c o  m
@Override
protected void createFooterButtons(HorizontalLayout footerLayout) {
    footerLayout.setSpacing(true);
    footerLayout.setMargin(true);

    Button cancelButton = new Button(uiMessageSource.getMessage("entityForm.cancel"), this, "cancel");
    cancelButton.setDescription(uiMessageSource.getMessage("entityForm.cancel.description"));
    cancelButton.setIcon(new ThemeResource("icons/16/cancel.png"));
    cancelButton.addStyleName("small default");
    footerLayout.addComponent(cancelButton);

    refreshButton = new Button(uiMessageSource.getMessage("entityForm.refresh"), this, "refresh");
    refreshButton.setDescription(uiMessageSource.getMessage("entityForm.refresh.description"));
    refreshButton.setIcon(new ThemeResource("icons/16/refresh.png"));
    refreshButton.addStyleName("small default");
    footerLayout.addComponent(refreshButton);

    saveAndStayOpenButton = new Button(uiMessageSource.getMessage("entityForm.saveAndStayOpen"), this,
            "saveAndStayOpen");
    saveAndStayOpenButton.setDescription(uiMessageSource.getMessage("entityForm.save.description"));
    saveAndStayOpenButton.setIcon(new ThemeResource("icons/16/save.png"));
    saveAndStayOpenButton.addStyleName("small default");
    footerLayout.addComponent(saveAndStayOpenButton);

    saveAndCloseButton = new Button(uiMessageSource.getMessage("entityForm.saveAndClose"), this,
            "saveAndClose");
    saveAndCloseButton.setDescription(uiMessageSource.getMessage("entityForm.save.description"));
    saveAndCloseButton.setIcon(new ThemeResource("icons/16/save.png"));
    saveAndCloseButton.addStyleName("small default");
    footerLayout.addComponent(saveAndCloseButton);
}

From source file:com.purebred.core.view.entityselect.EntitySelectResults.java

License:Open Source License

@PostConstruct
@Override/*from www. j av  a2  s  .co  m*/
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.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 ww  w  .ja  v a2 s  . c  o  m*/
    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);/*from w  w w .j a va  2s .co  m*/
    footerLayout.setMargin(true);

    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);
}