Example usage for com.vaadin.ui VerticalLayout addComponent

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

Introduction

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

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

Add a component into this container.

Usage

From source file:com.dungnv.streetfood.ui.SlideShowItemUI.java

private void init() {
    this.addStyleName("item-interator");
    this.setSpacing(true);
    this.setWidth("100%");

    CssLayout horizontal = new CssLayout();
    horizontal.setStyleName("padding-5");
    horizontal.setWidth("100%");
    Responsive.makeResponsive(horizontal);
    this.addComponent(horizontal);

    Image imag = new Image();
    if (!StringUtils.isNullOrEmpty(item.getImageUrl())) {
        imag.setSource(new ExternalResource(item.getImageUrl()));
    }/*  ww  w. j  av  a2 s .com*/
    horizontal.addComponent(imag);

    VerticalLayout vlInfo = new VerticalLayout();
    vlInfo.setStyleName("padding-5");
    vlInfo.setWidth("70%");

    horizontal.addComponent(vlInfo);

    lbTitle = new Label(item.getName());
    lbTitle.addStyleName("lb-title");
    vlInfo.addComponent(lbTitle);

    lbIntroduce = new Label(item.getDescription());
    lbIntroduce.setStyleName("lb-description");
    vlInfo.addComponent(lbIntroduce);

    HorizontalLayout htInfo = new HorizontalLayout();
    vlInfo.addComponent(htInfo);

    lbInfo = new Label();
    lbInfo.setCaptionAsHtml(true);
    htInfo.addComponent(lbInfo);

    HorizontalLayout htToolBar = new HorizontalLayout();
    htToolBar.setStyleName("lb-toolbar");
    horizontal.addComponent(htToolBar);

    btnEdit = new Button();
    btnEdit.setIcon(FontAwesome.EDIT);
    btnEdit.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnEdit.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnEdit.setWidth("25px");
    btnEdit.setHeight("25px");
    htToolBar.addComponent(btnEdit);
    htToolBar.setComponentAlignment(btnEdit, Alignment.BOTTOM_RIGHT);

    btnDelete = new Button();
    btnDelete.setIcon(FontAwesome.TIMES);
    btnDelete.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnDelete.setWidth("25px");
    btnDelete.setHeight("25px");
    htToolBar.addComponent(btnDelete);
    htToolBar.setComponentAlignment(btnDelete, Alignment.BOTTOM_RIGHT);
}

From source file:com.dungnv.streetfood.ui.TwinColumnUI.java

public final void init() {
    setMargin(true);/*from w w w  . j  a  v a 2  s .c  o  m*/
    setSpacing(true);
    setWidth(100f, Unit.PERCENTAGE);

    HorizontalLayout hLayout = new HorizontalLayout();
    hLayout.setSpacing(true);
    hLayout.setWidth(100f, Unit.PERCENTAGE);
    addComponent(hLayout);

    msLeft = new MultiSelectUI(searchField);
    msLeft.setWidth(100.0f, Unit.PERCENTAGE);
    hLayout.addComponent(msLeft);
    hLayout.setExpandRatio(msLeft, .45f);

    VerticalLayout vButtonLayout = new VerticalLayout();
    vButtonLayout.setSpacing(true);
    hLayout.addComponent(vButtonLayout);
    hLayout.setExpandRatio(vButtonLayout, .1f);
    hLayout.setComponentAlignment(vButtonLayout, Alignment.BOTTOM_CENTER);

    btnLeftAll = new Button();
    btnLeftAll.setWidth(100f, Unit.PERCENTAGE);
    btnLeftAll.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT);
    vButtonLayout.addComponent(btnLeftAll);

    btnLeft = new Button();
    btnLeft.setWidth(100f, Unit.PERCENTAGE);
    btnLeft.setIcon(FontAwesome.ANGLE_LEFT);
    vButtonLayout.addComponent(btnLeft);

    btnRight = new Button();
    btnRight.setWidth(100f, Unit.PERCENTAGE);
    btnRight.setIcon(FontAwesome.ANGLE_RIGHT);
    vButtonLayout.addComponent(btnRight);

    btnRightAll = new Button();
    btnRightAll.setWidth(100f, Unit.PERCENTAGE);
    btnRightAll.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT);
    vButtonLayout.addComponent(btnRightAll);

    msRight = new MultiSelectUI(searchField);
    msRight.setWidth(100.0f, Unit.PERCENTAGE);
    hLayout.addComponent(msRight);
    hLayout.setExpandRatio(msRight, .45f);

    HorizontalLayout hlButtonFooter = new HorizontalLayout();
    hlButtonFooter.setSpacing(true);
    addComponent(hlButtonFooter);
    setComponentAlignment(hlButtonFooter, Alignment.BOTTOM_RIGHT);

    btnSave = new Button(BundleUtils.getLanguage("lbl.save"), FontAwesome.SAVE);
    hlButtonFooter.addComponent(btnSave);

    btnCancel = new Button(BundleUtils.getLanguage("lbl.cancel"), FontAwesome.BAN);
    hlButtonFooter.addComponent(btnCancel);
}

From source file:com.dungnv.streetfood.view.ArticleLink.java

private void init() {

    setLocale(VaadinSession.getCurrent().getLocale());

    VerticalLayout vLayout = new VerticalLayout();

    tabSheet = new TabSheet();
    tabSheet.setStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS);
    tabSheet.setSizeFull();//from ww w.j  ava 2s  .c o m
    vLayout.addComponent(tabSheet);

    // DishArticle
    tuiDish = new TwinColumnUI("name");
    tuiDish.setLeftLabelCaption(BundleUtils.getLanguage("lbl.dish.avaiable.list"));
    tuiDish.setRightLabelCaption(BundleUtils.getLanguage("lbl.dish.selected.list"));
    tabSheet.addTab(tuiDish, BundleUtils.getLanguage("lbl.article.dishArticle.tab"));

    // RestaurantArticle
    tuiRestaurant = new TwinColumnUI("name");
    tuiRestaurant.setLeftLabelCaption(BundleUtils.getLanguage("lbl.restaurant.avaiable.list"));
    tuiRestaurant.setRightLabelCaption(BundleUtils.getLanguage("lbl.restaurant.selected.list"));
    tabSheet.addTab(tuiRestaurant, BundleUtils.getLanguage("lbl.article.restaurantArticle.tab"));

    setContent(tabSheet);
}

From source file:com.dungnv.streetfood.view.CategoryLink.java

private void init() {

    setLocale(VaadinSession.getCurrent().getLocale());
    tabSheet = new TabSheet();
    tabSheet.setStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS);
    tabSheet.setSizeFull();/*w w w. j a v  a  2  s .  c om*/

    VerticalLayout vLayout = new VerticalLayout();

    tuiDish = new TwinColumnUI("name");
    tuiDish.setLeftLabelCaption(BundleUtils.getLanguage("lbl.dish.avaiable.list"));
    tuiDish.setRightLabelCaption(BundleUtils.getLanguage("lbl.dish.selected.list"));
    vLayout.addComponent(tuiDish);

    lsDishLeft = tuiDish.getMsLeft().getLsItem();
    lsDishRight = tuiDish.getMsRight().getLsItem();
    HorizontalLayout hlButtonFooter = new HorizontalLayout();
    hlButtonFooter.setSpacing(true);
    hlButtonFooter.setMargin(true);
    vLayout.addComponent(hlButtonFooter);
    vLayout.setComponentAlignment(hlButtonFooter, Alignment.BOTTOM_RIGHT);

    btnCancel = new Button(BundleUtils.getLanguage("lbl.cancel"), FontAwesome.BAN);
    hlButtonFooter.addComponent(btnCancel);

    tabSheet.addTab(vLayout, BundleUtils.getLanguage("lbl.category.categoryDish.tab"));
    setContent(tabSheet);
}

From source file:com.dungnv.streetfood.view.DishLink.java

private void init() {

    setLocale(VaadinSession.getCurrent().getLocale());

    VerticalLayout vLayout = new VerticalLayout();

    tabSheet = new TabSheet();
    tabSheet.setStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS);
    tabSheet.setSizeFull();//from w w w. j a  v a  2 s  .c  o  m
    vLayout.addComponent(tabSheet);

    // CategoryDish
    tuiCategory = new TwinColumnUI("name");
    tuiCategory.setLeftLabelCaption(BundleUtils.getLanguage("lbl.category.avaiable.list"));
    tuiCategory.setRightLabelCaption(BundleUtils.getLanguage("lbl.category.selected.list"));
    tabSheet.addTab(tuiCategory, BundleUtils.getLanguage("lbl.dish.categoryDish.tab"));

    // RestaurantDish
    tuiRestaurant = new TwinColumnUI("name");
    tuiRestaurant.setLeftLabelCaption(BundleUtils.getLanguage("lbl.restaurant.avaiable.list"));
    tuiRestaurant.setRightLabelCaption(BundleUtils.getLanguage("lbl.restaurant.selected.list"));
    tabSheet.addTab(tuiRestaurant, BundleUtils.getLanguage("lbl.dish.restaurantDish.tab"));

    // DishArticle
    tuiArticle = new TwinColumnUI("title");
    tuiArticle.setLeftLabelCaption(BundleUtils.getLanguage("lbl.article.avaiable.list"));
    tuiArticle.setRightLabelCaption(BundleUtils.getLanguage("lbl.article.selected.list"));
    tabSheet.addTab(tuiArticle, BundleUtils.getLanguage("lbl.dish.dishArticle.tab"));

    setContent(tabSheet);
}

From source file:com.dungnv.streetfood.view.RestaurantLink.java

private void init() {

    setLocale(VaadinSession.getCurrent().getLocale());

    VerticalLayout vLayout = new VerticalLayout();

    tabSheet = new TabSheet();
    tabSheet.setStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS);
    tabSheet.setSizeFull();//w w  w.  ja v  a2s .  c o m
    vLayout.addComponent(tabSheet);

    // RestaurantDish
    tuiDish = new TwinColumnUI("name");
    tuiDish.setLeftLabelCaption(BundleUtils.getLanguage("lbl.dish.avaiable.list"));
    tuiDish.setRightLabelCaption(BundleUtils.getLanguage("lbl.dish.selected.list"));
    tabSheet.addTab(tuiDish, BundleUtils.getLanguage("lbl.restaurant.restaurantDish.tab"));

    // RestaurantArticle
    tuiArticle = new TwinColumnUI("title");
    tuiArticle.setLeftLabelCaption(BundleUtils.getLanguage("lbl.article.avaiable.list"));
    tuiArticle.setRightLabelCaption(BundleUtils.getLanguage("lbl.article.selected.list"));
    tabSheet.addTab(tuiArticle, BundleUtils.getLanguage("lbl.restaurant.RestaurantArticle.tab"));

    setContent(tabSheet);
}

From source file:com.ejt.vaadin.loginform.DefaultVerticalLoginForm.java

License:Apache License

@Override
protected Component createContent(TextField userNameField, PasswordField passwordField, Button loginButton) {
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);//from   w  ww.  j a  v  a  2s.  co  m
    layout.setMargin(true);

    layout.addComponent(userNameField);
    layout.addComponent(passwordField);
    layout.addComponent(loginButton);
    return layout;
}

From source file:com.esofthead.mycollab.community.view.NotPresentedView.java

License:Open Source License

public NotPresentedView() {
    this.setHeight("370px");
    this.setWidth("100%");
    VerticalLayout layoutWapper = new VerticalLayout();
    layoutWapper.setWidth("100%");

    VerticalLayout layout = new VerticalLayout();
    final Embedded titleIcon = new Embedded();
    titleIcon.setSource(MyCollabResource.newResource("icons/not_present.png"));
    layout.addComponent(titleIcon);
    layout.setComponentAlignment(titleIcon, Alignment.MIDDLE_CENTER);

    Label label = new Label("Module is not presented for community edition");
    label.setStyleName("h2_community");
    layout.addComponent(label);/*ww  w.j a v a  2s .  co  m*/
    layout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);

    layoutWapper.addComponent(layout);
    layoutWapper.setComponentAlignment(layout, Alignment.MIDDLE_CENTER);
    this.addComponent(layoutWapper);
    this.setComponentAlignment(layoutWapper, Alignment.MIDDLE_CENTER);
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.account.AccountRelatedContactView.java

License:Open Source License

@Override
protected Component createRightComponent() {
    final NavigationBarQuickMenu addContact = new NavigationBarQuickMenu();
    addContact.setStyleName("add-btn");

    VerticalLayout addButtons = new VerticalLayout();
    addButtons.setSpacing(true);//from   w w w.  j a v a2s. c  o  m
    addButtons.setWidth("100%");
    addButtons.setMargin(true);
    addButtons.addStyleName("edit-btn-layout");

    Button newContact = new Button(AppContext.getMessage(ContactI18nEnum.VIEW_NEW_TITLE));
    newContact.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent arg0) {
            fireNewRelatedItem("");
        }
    });
    addButtons.addComponent(newContact);

    Button selectContact = new Button(AppContext.getMessage(ContactI18nEnum.M_TITLE_SELECT_CONTACTS));
    selectContact.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 243969948418203441L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            AccountContactSelectionView contactSelectionView = new AccountContactSelectionView(
                    AccountRelatedContactView.this);
            final ContactSearchCriteria criteria = new ContactSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            contactSelectionView.setSearchCriteria(criteria);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.PushView(AccountRelatedContactView.this, contactSelectionView));

        }
    });
    addButtons.addComponent(selectContact);

    addContact.setContent(addButtons);

    return addContact;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.account.AccountRelatedLeadView.java

License:Open Source License

@Override
protected Component createRightComponent() {
    final NavigationBarQuickMenu addLead = new NavigationBarQuickMenu();
    addLead.setStyleName("add-btn");

    VerticalLayout addButtons = new VerticalLayout();
    addButtons.setSpacing(true);/*from   w w w  .ja  va 2 s.  c o  m*/
    addButtons.setWidth("100%");
    addButtons.setMargin(true);
    addButtons.addStyleName("edit-btn-layout");

    Button newLead = new Button(AppContext.getMessage(LeadI18nEnum.VIEW_NEW_TITLE));
    newLead.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 8228954365650824438L;

        @Override
        public void buttonClick(Button.ClickEvent arg0) {
            fireNewRelatedItem("");
        }
    });
    addButtons.addComponent(newLead);

    Button selectLead = new Button(AppContext.getMessage(LeadI18nEnum.M_TITLE_SELECT_LEADS));
    selectLead.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 9076596614526838523L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            AccountLeadSelectionView leadSelectionView = new AccountLeadSelectionView(
                    AccountRelatedLeadView.this);
            final LeadSearchCriteria criteria = new LeadSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            leadSelectionView.setSearchCriteria(criteria);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.PushView(AccountRelatedLeadView.this, leadSelectionView));

        }
    });
    addButtons.addComponent(selectLead);

    addLead.setContent(addButtons);

    return addLead;
}