List of usage examples for com.vaadin.ui Button Button
public Button()
From source file:com.dungnv.streetfood.ui.InsertImageUI.java
public final void init() { setWidth("100%"); addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); layout = new VerticalLayout(); layout.setSizeFull();//from ww w . ja va 2s . c om layout.setSpacing(true); this.addComponent(layout); btnAdd = new Button(); btnAdd.setIcon(FontAwesome.PLUS_CIRCLE); btnAdd.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnAdd.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnAdd.setWidth("25px"); btnAdd.setHeight("25px"); this.addComponent(btnAdd); }
From source file:com.dungnv.streetfood.ui.RestaurantItemUI.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())); }/*from w w w . j a va 2 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.getAddress()); 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); btnLock = new Button(); if ("1".equals(item.getRestaurantStatus())) { btnLock.setIcon(FontAwesome.LOCK); } else { btnLock.setIcon(FontAwesome.UNLOCK); } btnLock.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnLock.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnLock.setWidth("25px"); btnLock.setHeight("25px"); htToolBar.addComponent(btnLock); htToolBar.setComponentAlignment(btnLock, Alignment.BOTTOM_RIGHT); btnLink = new Button(); btnLink.setIcon(FontAwesome.LINK); btnLink.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnLink.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnLink.setWidth("25px"); btnLink.setHeight("25px"); htToolBar.addComponent(btnLink); htToolBar.setComponentAlignment(btnLink, Alignment.BOTTOM_RIGHT); 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.RichTextWinDowUI.java
public void init() { layoutWindow = new CssLayout(); layoutWindow.setSizeFull();/*from ww w . jav a 2 s .c o m*/ richTextArea = new RichTextArea(); richTextArea.setSizeFull(); layoutWindow.addComponent(richTextArea); btnCloseWindow = new Button(); btnCloseWindow.setCaption(FontAwesome.SAVE.getLabel().setSize3x().spin().getCssHtml()); btnCloseWindow.setCaptionAsHtml(true); btnCloseWindow.addStyleName("float-button"); layoutWindow.addComponent(btnCloseWindow); btnEdit = new Button(FontAwesome.EDIT.getLabel().flipHorizontal().getCssHtml()); btnEdit.setCaptionAsHtml(true); this.addComponent(btnEdit); }
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())); }/*from w w w. j a va2 s .c om*/ 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. ja v a 2s . co 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.ArticleView.java
private void init() { header = new VerticalLayout(); header.addStyleName("viewheader"); header.setSpacing(true);/*from w ww . j a va 2 s . c o m*/ header.setId("hehehe"); titleLabel = new Label(BundleUtils.getLanguage("menu.ARTICLE")); titleLabel.setId(TITLE_ID); titleLabel.setWidth("100%"); titleLabel.addStyleName(ValoTheme.LABEL_BOLD); header.addComponent(titleLabel); btnAdd = new Button(); btnAdd.setCaption(FontAwesome.PLUS_CIRCLE.getLabel().setSize3x().getCssHtml()); btnAdd.setCaptionAsHtml(true); btnAdd.addStyleName("float-button"); // add.addStyleName(ValoTheme.BUTTON_BORDERLESS); // add.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // add.addStyleName(ValoTheme.BUTTON_LARGE); header.addComponent(btnAdd); HorizontalLayout item = new HorizontalLayout(); // item.setSpacing(true); item.setWidth("100%"); header.addComponent(item); txtSearch = new TextField(); txtSearch.setImmediate(true); txtSearch.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.TIMEOUT); txtSearch.setIcon(FontAwesome.SEARCH); txtSearch.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); txtSearch.setInputPrompt(BundleUtils.getLanguage("lbl.article.title.input")); txtSearch.setWidth("100%"); item.addComponent(txtSearch); item.setComponentAlignment(txtSearch, Alignment.TOP_RIGHT); lbAdvanced = new Button(); lbAdvanced.setCaption(BundleUtils.getLanguage("lbl.search.advanced")); lbAdvanced.addStyleName(ValoTheme.BUTTON_LINK); lbAdvanced.addStyleName(ValoTheme.BUTTON_LARGE); item.addComponent(lbAdvanced); item.setComponentAlignment(lbAdvanced, Alignment.BOTTOM_LEFT); uiSearchPaged = new CommonSearchPagedUI(1) { @Override public void cbChanged() { this.getCbPaged().addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { onSearch(false); } } }); this.getCbRecordPerPage().addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { onSearch(true); } } }); } }; header.addComponent(uiSearchPaged); searchLayout = new VerticalLayout(); // searchLayout.setSpacing(true); searchLayout.setSizeFull(); header.addComponent(searchLayout); searchDetail = new ArticleSearchDetail(this); }
From source file:com.dungnv.streetfood.view.CategoryView.java
private void init() { header = new VerticalLayout(); header.addStyleName("viewheader"); header.setSpacing(true);/*from w ww . ja va 2 s .c o m*/ header.setId("hehehe"); titleLabel = new Label(BundleUtils.getLanguage("menu.CATEGORY")); titleLabel.setId(TITLE_ID); titleLabel.setWidth("100%"); titleLabel.addStyleName(ValoTheme.LABEL_BOLD); header.addComponent(titleLabel); btnAdd = new Button(); btnAdd.setCaption(FontAwesome.PLUS_CIRCLE.getLabel().setSize3x().getCssHtml()); btnAdd.setCaptionAsHtml(true); btnAdd.addStyleName("float-button"); // add.addStyleName(ValoTheme.BUTTON_BORDERLESS); // add.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // add.addStyleName(ValoTheme.BUTTON_LARGE); header.addComponent(btnAdd); HorizontalLayout item = new HorizontalLayout(); // item.setSpacing(true); item.setWidth("100%"); header.addComponent(item); txtSearch = new TextField(); txtSearch.setImmediate(true); txtSearch.setTextChangeEventMode(TextChangeEventMode.TIMEOUT); txtSearch.setIcon(FontAwesome.SEARCH); txtSearch.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); txtSearch.setInputPrompt(BundleUtils.getLanguage("lbl.category.name.input")); txtSearch.setWidth("100%"); item.addComponent(txtSearch); item.setComponentAlignment(txtSearch, Alignment.TOP_RIGHT); lbAdvanced = new Button(); lbAdvanced.setCaption(BundleUtils.getLanguage("lbl.search.advanced")); lbAdvanced.addStyleName(ValoTheme.BUTTON_LINK); lbAdvanced.addStyleName(ValoTheme.BUTTON_LARGE); item.addComponent(lbAdvanced); item.setComponentAlignment(lbAdvanced, Alignment.BOTTOM_LEFT); uiSearchPaged = new CommonSearchPagedUI(1) { @Override public void cbChanged() { this.getCbPaged().addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { onSearch(false); } } }); this.getCbRecordPerPage().addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { onSearch(true); } } }); } }; header.addComponent(uiSearchPaged); searchLayout = new VerticalLayout(); // searchLayout.setSpacing(true); searchLayout.setSizeFull(); header.addComponent(searchLayout); searchDetail = new CategorySearchDetail(this); }
From source file:com.dungnv.streetfood.view.DishView.java
private void init() { header = new VerticalLayout(); header.addStyleName("viewheader"); header.setSpacing(true);/* w ww . j ava 2 s .co m*/ header.setId("hehehe"); titleLabel = new Label(BundleUtils.getLanguage("menu.DISH")); titleLabel.setId(TITLE_ID); titleLabel.setWidth("100%"); titleLabel.addStyleName(ValoTheme.LABEL_BOLD); header.addComponent(titleLabel); btnAdd = new Button(); btnAdd.setCaption(FontAwesome.PLUS_CIRCLE.getLabel().setSize3x().getCssHtml()); btnAdd.setCaptionAsHtml(true); btnAdd.addStyleName("float-button"); header.addComponent(btnAdd); HorizontalLayout item = new HorizontalLayout(); // item.setSpacing(true); item.setWidth("100%"); header.addComponent(item); txtSearch = new TextField(); txtSearch.setImmediate(true); txtSearch.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.TIMEOUT); txtSearch.setIcon(FontAwesome.SEARCH); txtSearch.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); txtSearch.setInputPrompt(BundleUtils.getLanguage("lbl.dish.name.input")); txtSearch.setWidth("100%"); item.addComponent(txtSearch); item.setComponentAlignment(txtSearch, Alignment.TOP_RIGHT); lbAdvanced = new Button(); lbAdvanced.setCaption(BundleUtils.getLanguage("lbl.search.advanced")); lbAdvanced.addStyleName(ValoTheme.BUTTON_LINK); lbAdvanced.addStyleName(ValoTheme.BUTTON_LARGE); item.addComponent(lbAdvanced); item.setComponentAlignment(lbAdvanced, Alignment.BOTTOM_LEFT); uiSearchPaged = new CommonSearchPagedUI(1) { @Override public void cbChanged() { this.getCbPaged().addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { onSearch(false); } } }); this.getCbRecordPerPage().addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { onSearch(true); } } }); } }; header.addComponent(uiSearchPaged); searchLayout = new VerticalLayout(); // searchLayout.setSpacing(true); searchLayout.setSizeFull(); header.addComponent(searchLayout); searchDetail = new DishSearchDetail(this); }
From source file:com.dungnv.streetfood.view.RestaurantView.java
private void init() { header = new VerticalLayout(); header.addStyleName("viewheader"); header.setSpacing(true);/* w w w.java2 s . co m*/ header.setId("hehehe"); titleLabel = new Label(BundleUtils.getLanguage("menu.RESTAURANT")); titleLabel.setId(TITLE_ID); titleLabel.setWidth("100%"); titleLabel.addStyleName(ValoTheme.LABEL_BOLD); header.addComponent(titleLabel); btnAdd = new Button(); btnAdd.setCaption(FontAwesome.PLUS_CIRCLE.getLabel().setSize3x().getCssHtml()); btnAdd.setCaptionAsHtml(true); btnAdd.addStyleName("float-button"); // add.addStyleName(ValoTheme.BUTTON_BORDERLESS); // add.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // add.addStyleName(ValoTheme.BUTTON_LARGE); header.addComponent(btnAdd); HorizontalLayout item = new HorizontalLayout(); // item.setSpacing(true); item.setWidth("100%"); header.addComponent(item); txtSearch = new TextField(); txtSearch.setImmediate(true); txtSearch.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.TIMEOUT); txtSearch.setIcon(FontAwesome.SEARCH); txtSearch.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); txtSearch.setInputPrompt(BundleUtils.getLanguage("lbl.restaurant.name.input")); txtSearch.setWidth("100%"); item.addComponent(txtSearch); item.setComponentAlignment(txtSearch, Alignment.TOP_RIGHT); lbAdvanced = new Button(); lbAdvanced.setCaption(BundleUtils.getLanguage("lbl.search.advanced")); lbAdvanced.addStyleName(ValoTheme.BUTTON_LINK); lbAdvanced.addStyleName(ValoTheme.BUTTON_LARGE); item.addComponent(lbAdvanced); item.setComponentAlignment(lbAdvanced, Alignment.BOTTOM_LEFT); uiSearchPaged = new CommonSearchPagedUI(1) { @Override public void cbChanged() { this.getCbPaged().addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { onSearch(false); } } }); this.getCbRecordPerPage().addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { onSearch(true); } } }); } }; header.addComponent(uiSearchPaged); searchLayout = new VerticalLayout(); // searchLayout.setSpacing(true); searchLayout.setSizeFull(); header.addComponent(searchLayout); searchDetail = new RestaurantSearchDetail(this); }
From source file:com.dungnv.streetfood.view.SlideShowView.java
private void init() { header = new VerticalLayout(); header.addStyleName("viewheader"); header.setSpacing(true);/*www . j av a 2s. co m*/ header.setId("hehehe"); titleLabel = new Label(BundleUtils.getLanguage("menu.RESTAURANT")); titleLabel.setId(TITLE_ID); titleLabel.setWidth("100%"); titleLabel.addStyleName(ValoTheme.LABEL_BOLD); header.addComponent(titleLabel); btnAdd = new Button(); btnAdd.setCaption(FontAwesome.PLUS_CIRCLE.getLabel().setSize3x().getCssHtml()); btnAdd.setCaptionAsHtml(true); btnAdd.addStyleName("float-button"); // add.addStyleName(ValoTheme.BUTTON_BORDERLESS); // add.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // add.addStyleName(ValoTheme.BUTTON_LARGE); header.addComponent(btnAdd); HorizontalLayout item = new HorizontalLayout(); // item.setSpacing(true); item.setWidth("100%"); header.addComponent(item); txtSearch = new TextField(); txtSearch.setImmediate(true); txtSearch.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.TIMEOUT); txtSearch.setIcon(FontAwesome.SEARCH); txtSearch.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); txtSearch.setInputPrompt(BundleUtils.getLanguage("lbl.slideShow.name.input")); txtSearch.setWidth("100%"); item.addComponent(txtSearch); item.setComponentAlignment(txtSearch, Alignment.TOP_RIGHT); lbAdvanced = new Button(); lbAdvanced.setCaption(BundleUtils.getLanguage("lbl.search.advanced")); lbAdvanced.addStyleName(ValoTheme.BUTTON_LINK); lbAdvanced.addStyleName(ValoTheme.BUTTON_LARGE); item.addComponent(lbAdvanced); item.setComponentAlignment(lbAdvanced, Alignment.BOTTOM_LEFT); uiSearchPaged = new CommonSearchPagedUI(1) { @Override public void cbChanged() { this.getCbPaged().addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { onSearch(false); } } }); this.getCbRecordPerPage().addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { onSearch(true); } } }); } }; header.addComponent(uiSearchPaged); searchLayout = new VerticalLayout(); // searchLayout.setSpacing(true); searchLayout.setSizeFull(); header.addComponent(searchLayout); searchDetail = new SlideShowSearchDetail(this); }