List of usage examples for com.vaadin.ui Button Button
public Button()
From source file:com.anphat.list.ui.DialogAddMapStaffCustomer.java
public void initDialog(boolean isCustInfo) { buildInfoLayout(isCustInfo);//from w w w .j a v a2 s.c om mainLayout.addComponent(infoLayout); // searchLayout buildSearchLayout(isCustInfo); mainLayout.addComponent(searchLayout); // btnSearch btnSearch = new Button(); btnSearch.setCaption(BundleUtils.getString("common.button.search")); btnSearch.setIcon(new ThemeResource(Constants.ICON.SEARCH)); btnSearch.setImmediate(true); btnSearch.setWidth("-1px"); btnSearch.setHeight("-1px"); mainLayout.addComponent(btnSearch); mainLayout.setComponentAlignment(btnSearch, new Alignment(48)); buildMainLayout(); mainLayout.addComponent(horizontalLayout); //Nut luu va huy bo GridManyButton gridManyButton = new GridManyButton( new String[] { Constants.BUTTON_SAVE, Constants.BUTTON_CANCEL }); btnSave = gridManyButton.getBtnCommon().get(0); btnCancel = gridManyButton.getBtnCommon().get(1); mainLayout.addComponent(gridManyButton); }
From source file:com.anphat.list.ui.DialogAddMapStaffCustomer.java
private void buildCenterLayout() { // common part: create layout centerLayout = new VerticalLayout(); centerLayout.setImmediate(true);//from w ww.ja v a 2 s . com centerLayout.setWidth("30px"); centerLayout.setHeight("-1px"); centerLayout.setMargin(false); // btnAdd btnAdd = new Button(); btnAdd.setIcon(new ThemeResource(Constants.ICON.FORWARD)); btnAdd.setImmediate(true); btnAdd.setWidth("-1px"); btnAdd.setHeight("-1px"); centerLayout.addComponent(btnAdd); centerLayout.setComponentAlignment(btnAdd, new Alignment(48)); }
From source file:com.anphat.list.ui.DialogCreateDepartment.java
@AutoGenerated private HorizontalLayout buildHorizontalLayoutButton() { // common part: create layout horizontalLayoutButton = new HorizontalLayout(); horizontalLayoutButton.setImmediate(true); horizontalLayoutButton.setWidth("100.0%"); horizontalLayoutButton.setHeight("-1px"); horizontalLayoutButton.setMargin(true); horizontalLayoutButton.setSpacing(true); // btnSave//from ww w. j ava2s . c o m btnSave = new Button(); btnSave.setCaption(BundleUtils.getString("common.button.save")); btnSave.setImmediate(true); btnSave.setWidth("-1px"); btnSave.setHeight("-1px"); btnSave.setIcon(new ThemeResource("img/save_icon.png")); horizontalLayoutButton.addComponent(btnSave); horizontalLayoutButton.setComponentAlignment(btnSave, new Alignment(34)); // btnCancel btnCancel = new Button(); btnCancel.setCaption(BundleUtils.getString("common.button.cancel")); btnCancel.setImmediate(true); btnCancel.setWidth("-1px"); btnCancel.setHeight("-1px"); btnCancel.setIcon(new ThemeResource("img/cancel_icon.png")); horizontalLayoutButton.addComponent(btnCancel); horizontalLayoutButton.setComponentAlignment(btnCancel, new Alignment(33)); return horizontalLayoutButton; }
From source file:com.anphat.list.ui.DialogCreateStaff.java
@AutoGenerated private HorizontalLayout buildHorizontalLayoutButton() { // common part: create layout horizontalLayoutButton = new HorizontalLayout(); horizontalLayoutButton.setImmediate(false); horizontalLayoutButton.setWidth("100.0%"); horizontalLayoutButton.setHeight("-1px"); horizontalLayoutButton.setMargin(true); horizontalLayoutButton.setSpacing(true); // btnSave//from w ww. j a v a 2 s .c o m btnSave = new Button(); btnSave.setCaption(BundleUtils.getString("common.button.save")); btnSave.setImmediate(true); btnSave.setWidth("-1px"); btnSave.setHeight("-1px"); btnSave.setIcon(new ThemeResource(Constants.ICON.SAVE)); horizontalLayoutButton.addComponent(btnSave); horizontalLayoutButton.setComponentAlignment(btnSave, new Alignment(34)); // btnCancel btnCancel = new Button(); btnCancel.setCaption(BundleUtils.getString("common.button.cancel")); btnCancel.setImmediate(true); btnCancel.setWidth("-1px"); btnCancel.setHeight("-1px"); btnCancel.setIcon(new ThemeResource(Constants.ICON.CANCEL)); horizontalLayoutButton.addComponent(btnCancel); horizontalLayoutButton.setComponentAlignment(btnCancel, new Alignment(33)); return horizontalLayoutButton; }
From source file:com.cavisson.gui.dashboard.components.controls.Panels.java
License:Apache License
public Panels() { setMargin(true);/*from w w w . j a v a 2 s.c o m*/ Label h1 = new Label("Panels & Layout panels"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); TestIcon testIcon = new TestIcon(60); Panel panel = new Panel("Normal"); panel.setIcon(testIcon.get()); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Sized"); panel.setIcon(testIcon.get()); panel.setWidth("10em"); panel.setHeight("250px"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Custom Caption"); panel.setIcon(testIcon.get()); panel.addStyleName("color1"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Custom Caption"); panel.setIcon(testIcon.get()); panel.addStyleName("color2"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Custom Caption"); panel.setIcon(testIcon.get()); panel.addStyleName("color3"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Borderless style"); panel.setIcon(testIcon.get()); panel.addStyleName("borderless"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Borderless + scroll divider"); panel.setIcon(testIcon.get()); panel.addStyleName("borderless"); panel.addStyleName("scroll-divider"); panel.setContent(panelContentScroll()); panel.setHeight("17em"); row.addComponent(panel); panel = new Panel("Well style"); panel.setIcon(testIcon.get()); panel.addStyleName("well"); panel.setContent(panelContent()); row.addComponent(panel); CssLayout layout = new CssLayout(); layout.setIcon(testIcon.get()); layout.setCaption("Panel style layout"); layout.addStyleName("card"); layout.addComponent(panelContent()); row.addComponent(layout); layout = new CssLayout(); layout.addStyleName("card"); row.addComponent(layout); HorizontalLayout panelCaption = new HorizontalLayout(); panelCaption.addStyleName("v-panel-caption"); panelCaption.setWidth("100%"); // panelCaption.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label label = new Label("Panel style layout"); panelCaption.addComponent(label); panelCaption.setExpandRatio(label, 1); Button action = new Button(); action.setIcon(FontAwesome.PENCIL); action.addStyleName("borderless-colored"); action.addStyleName("small"); action.addStyleName("icon-only"); panelCaption.addComponent(action); MenuBar dropdown = new MenuBar(); dropdown.addStyleName("borderless"); dropdown.addStyleName("small"); MenuItem addItem = dropdown.addItem("", FontAwesome.CHEVRON_DOWN, null); addItem.setStyleName("icon-only"); addItem.addItem("Settings", null); addItem.addItem("Preferences", null); addItem.addSeparator(); addItem.addItem("Sign Out", null); panelCaption.addComponent(dropdown); layout.addComponent(panelCaption); layout.addComponent(panelContent()); layout.setWidth("14em"); layout = new CssLayout(); layout.setIcon(testIcon.get()); layout.setCaption("Well style layout"); layout.addStyleName("well"); layout.addComponent(panelContent()); row.addComponent(layout); }
From source file:com.dungnv.common.ui.OptionGroupUI.java
private void init() { og = new OptionGroup(); og.addItem(BundleUtils.getLanguage("lbl.yes")); og.addItem(BundleUtils.getLanguage("lbl.no")); og.addStyleName("horizontal"); addComponent(og);/*from w w w . j a v a2 s.c o m*/ btnClear = new Button(); btnClear.setCaption(FontAwesome.TIMES.getLabel().getCssHtml()); btnClear.setCaptionAsHtml(true); btnClear.addStyleName("icon-button"); btnClear.setWidth("16px"); btnClear.setHeight("16px"); addComponent(btnClear); }
From source file:com.dungnv.streetfood.ui.ArticleItemUI.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())); }/* w w w . j av a 2s. c o m*/ horizontal.addComponent(imag); VerticalLayout vlInfo = new VerticalLayout(); vlInfo.setStyleName("padding-5"); vlInfo.setWidth("70%"); horizontal.addComponent(vlInfo); lbTitle = new Label(item.getTitle()); lbTitle.addStyleName("lb-title"); vlInfo.addComponent(lbTitle); lbIntroduce = new Label(item.getShortContent()); 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); 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.CategoryItemUI.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 www.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"); if ("1".equals(item.getCategoryStatus())) { lbTitle.addStyleName("lb-status-active"); } else { lbTitle.addStyleName("lb-status-inActive"); } vlInfo.addComponent(lbTitle); lbDesc = new Label(item.getDescription()); lbDesc.setStyleName("lb-description"); vlInfo.addComponent(lbDesc); 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.getCategoryStatus())) { 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.CommonSearchPagedUI.java
private final void init() { setWidth("100%"); setStyleName("item-search-box"); HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);/*w w w . j ava 2 s.co m*/ this.addComponent(layout); FormLayout form = new FormLayout(); // form.setWidth("100%"); form.setMargin(false); layout.addComponent(form); layout.setComponentAlignment(form, Alignment.MIDDLE_CENTER); cbRecordPerPage = new ComboBox(); cbRecordPerPage.setWidth("65px"); cbRecordPerPage.setStyleName(ValoTheme.COMBOBOX_TINY); cbRecordPerPage.setCaption(BundleUtils.getLanguage("lbl.recordsPerPage")); cbRecordPerPage.setTextInputAllowed(false); cbRecordPerPage.addItem(10); cbRecordPerPage.addItem(20); cbRecordPerPage.addItem(30); cbRecordPerPage.addItem(50); cbRecordPerPage.addItem(100); cbRecordPerPage.addItem(200); cbRecordPerPage.select(10); form.addComponent(cbRecordPerPage); cbRecordPerPage.setNullSelectionAllowed(false); btnFastBackward = new Button(); btnFastBackward.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnFastBackward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnFastBackward.setIcon(FontAwesome.FAST_BACKWARD); layout.addComponent(btnFastBackward); layout.setComponentAlignment(btnFastBackward, Alignment.MIDDLE_CENTER); btnBackward = new Button(); btnBackward.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnBackward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnBackward.setIcon(FontAwesome.BACKWARD); layout.addComponent(btnBackward); layout.setComponentAlignment(btnBackward, Alignment.MIDDLE_CENTER); cbPaged = new ComboBox(); cbPaged.setTextInputAllowed(false); for (int i = 1; i <= pageCount; i++) { cbPaged.addItem(i); } cbPaged.setNullSelectionAllowed(false); cbPaged.select(1); cbPaged.addStyleName(ValoTheme.COMBOBOX_TINY); cbPaged.setWidth("60px"); layout.addComponent(cbPaged); layout.setComponentAlignment(cbPaged, Alignment.MIDDLE_CENTER); btnFoward = new Button(); btnFoward.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnFoward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnFoward.setIcon(FontAwesome.FORWARD); layout.addComponent(btnFoward); layout.setComponentAlignment(btnFoward, Alignment.MIDDLE_CENTER); btnFastFoward = new Button(); btnFastFoward.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnFastFoward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnFastFoward.setIcon(FontAwesome.FAST_FORWARD); layout.addComponent(btnFastFoward); layout.setComponentAlignment(btnFastFoward, Alignment.MIDDLE_CENTER); enableComponent(); }
From source file:com.dungnv.streetfood.ui.DishItemUI.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 ww . ja v a 2s . c o m*/ 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); lbDesc = new Label(item.getShortDescription()); lbDesc.setStyleName("lb-description"); vlInfo.addComponent(lbDesc); 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.getDishStatus())) { 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); }