Example usage for com.vaadin.ui VerticalLayout setMargin

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

Introduction

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

Prototype

@Override
    public void setMargin(boolean enabled) 

Source Link

Usage

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

License:Open Source License

/**
 * Called after Spring constructs this bean. Overriding methods should call super.
 *///from w ww  .ja  v a2 s  . c om
@PostConstruct
public void postConstruct() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    setCompositionRoot(layout);

    setCustomSizeUndefined();
}

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

License:Open Source License

private void initialize() {
    addStyleName("p-entity-form-window");
    addStyleName("opaque");
    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);
    layout.setSpacing(true);/*ww  w  .  j  ava 2s. c o  m*/
    layout.setSizeUndefined();
    setSizeUndefined();
    setModal(true);
    setClosable(true);
    setScrollable(true);
    addListener(CloseEvent.class, this, "onClose");

    MainApplication.getInstance().getMainWindow().addWindow(this);
}

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

License:Open Source License

public void open() {
    popupWindow = new Window(getEntityCaption());
    popupWindow.addStyleName("p-entity-select-window");
    popupWindow.addStyleName("opaque");
    VerticalLayout layout = (VerticalLayout) popupWindow.getContent();
    layout.setMargin(true);
    layout.setSpacing(true);// w  ww .  j  ava 2  s.c o m
    layout.setSizeUndefined();
    popupWindow.setSizeUndefined();
    popupWindow.setModal(true);
    popupWindow.setClosable(true);

    getResults().getEntityQuery().clear();
    getResults().selectPageSize(5);
    getResults().search();
    configurePopupWindow(popupWindow);
    popupWindow.addComponent(this);

    MainApplication.getInstance().getMainWindow().addWindow(popupWindow);
}

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  .  co  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.rdonasco.config.web.ConfigApplication.java

License:Apache License

@Override
public void init() {
    Window mainWindow = new Window("rdonasco Config");
    setMainWindow(mainWindow);//from   ww  w  .  jav  a2  s. c o m
    final ConfigDataView controlledView = getConfigDataViewController().getControlledView();
    //      controlledView.setSizeFull();
    final VerticalLayout mainWindowLayout = (VerticalLayout) mainWindow.getContent();
    Button logoutButton = new Button("Refresh");
    logoutButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                getConfigDataViewController().refreshView();
            } catch (WidgetException ex) {
                LOG.log(Level.WARNING, ex.getMessage(), ex);
            }
        }
    });
    setTheme("config");
    mainWindowLayout.setMargin(true);
    mainWindowLayout.setSpacing(true);
    mainWindowLayout.addStyleName("mainWindow");
    mainWindowLayout.setSizeFull();

    mainWindowLayout.addComponent(logoutButton);
    mainWindowLayout.addComponent(controlledView);
    mainWindowLayout.setExpandRatio(controlledView, 1);
}

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);
    content.setHeight(600, UNITS_PIXELS);
    content.removeAllComponents();//from   www.  jav  a 2s .c o  m
    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);
    content.setHeight(600, UNITS_PIXELS);
    content.removeAllComponents();/*from www.  j  ava 2  s . c  o m*/
    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);
    content.setHeight(600, UNITS_PIXELS);
    content.removeAllComponents();/*from  w ww . j a va2s  .  c  om*/
    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.views.UserListPanelView.java

License:Apache License

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

From source file:com.rex.components.valo.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 av a2 s  . c om*/
    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 (!ReportEngineUI.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;
}