List of usage examples for com.vaadin.ui Button setStyleName
@Override public void setStyleName(String style)
From source file:com.anphat.customer.controller.ListCustomerControllerForOnePage.java
private void initTable(int pageLength) { tblCustomer = panel.getMainTable();//w w w .j a va 2s .com tblContainer = new BeanItemContainer<>(CustomerDTO.class); tblCustomer.setMultiSelect(false); tblCustomer.addGeneratedColumn("mineNameCode", new CustomTable.ColumnGenerator() { @Override public Object generateCell(CustomTable source, Object itemId, Object columnId) { CustomerDTO cust = (CustomerDTO) itemId; if (!DataUtil.isStringNullOrEmpty(cust.getMineName())) { return mapMineName.get(cust.getMineName()); } else { return ""; } } }); tblCustomer.addGeneratedColumn("taxCodeLink", new CustomTable.ColumnGenerator() { @Override public Object generateCell(CustomTable source, Object itemId, Object columnId) { final CustomerDTO cust = (CustomerDTO) itemId; Button btn = new Button(cust.getTaxCode()); btn.setStyleName("v-button-link"); // btn.setStyleName("v-button-link-left"); btn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { CustomerManagementDetailDialog detailDialog = new CustomerManagementDetailDialog(); CustomerManagementDetailController controller = new CustomerManagementDetailController( detailDialog, tblCustomer); controller.fillData(cust); UI.getCurrent().addWindow(detailDialog); } }); return btn; } }); tblCustomer.addGeneratedColumn("taxAuthorityName", new CustomTable.ColumnGenerator() { @Override public Object generateCell(CustomTable source, Object itemId, Object columnId) { CustomerDTO cust = (CustomerDTO) itemId; if (!DataUtil.isStringNullOrEmpty(cust.getTaxAuthority())) { String a = mapTaxAuthority.get(cust.getTaxAuthority()); if (a == null) { return cust.getTaxAuthority(); } else { return mapTaxAuthority.get(cust.getTaxAuthority()); } } else { return ""; } } }); CommonFunctionTableFilter.initTable(panel, HEADER, tblContainer, CAPTION, pageLength, LANG); tblCustomer.setColumnExpandRatio("taxCode", 1); tblCustomer.setColumnExpandRatio("name", 2); tblCustomer.setColumnExpandRatio("notes", 2); tblCustomer.setColumnExpandRatio("createDate", 1); tblCustomer.setColumnExpandRatio("status", 0.75f); tblCustomer.setColumnExpandRatio("mineNameCode", 1.5f); tblCustomer.setColumnExpandRatio("taxAuthorityName", 1); CommonUtils.convertFieldAppParamTable(tblCustomer, "status", Constants.APP_PARAMS.CUSTOMER_SERVICE_STATUS, mapCustomerStatus); tblCustomer.setMultiSelect(false); tblCustomer.setColumnWidth(Constants.STT, 65); }
From source file:com.anphat.list.controller.CategoryListController.java
public void initTable() { beanItemContainerCategoryList = new BeanItemContainer<>(CategoryListDTO.class); tblCategoryList.addGeneratedColumn(lblDelete, new CustomTable.ColumnGenerator() { @Override/*from w w w. j a v a 2 s. c o m*/ public Object generateCell(CustomTable source, final Object itemId, Object columnId) { final CategoryListDTO categoryListDTO = (CategoryListDTO) itemId; ThemeResource iconVi = new ThemeResource("img/icon_delete.png"); Image image = new Image(null, iconVi); image.addClickListener(new MouseEvents.ClickListener() { @Override public void click(MouseEvents.ClickEvent event) { ConfirmDialog.show(UI.getCurrent(), BundleUtils.getString("titleMessage"), BundleUtils.getString("bodyMessage"), BundleUtils.getString("yes"), BundleUtils.getString("no"), new ConfirmDialog.Listener() { @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { categoryListDTO.setEndDate(DateUtil.date2ddMMyyyyHHMMss(new Date())); String message = serviceCategoryList .updateCategoryList(categoryListDTO); if (message.equals(Constants.SUCCESS)) { Notification.show(BundleUtils.getString("delete.success")); tblCategoryList.removeItem(itemId); } else { Notification.show(BundleUtils.getString("delete.fail")); } } else { // User did not confirm } } }); } }); return image; } }); tblCategoryList.addGeneratedColumn("custQuantityDetail", new CustomTable.ColumnGenerator() { @Override public Object generateCell(CustomTable source, final Object itemId, Object columnId) { final CategoryListDTO categoryListDTO = (CategoryListDTO) itemId; if (DataUtil.isStringNullOrEmpty(categoryListDTO.getCustQuantity())) { return ""; } Button btnDetail = new Button(categoryListDTO.getCustQuantity()); btnDetail.setStyleName(Constants.ICON.V_LINK); btnDetail.addStyleName("v-link-button-left"); btnDetail.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { LinkedHashMap<String, CustomTable.Align> headerCustomerTable = BundleUtils .getHeadersFilter("customer.status.detail"); String captionCustomerTable = BundleUtils.getString("customer.table.detail.caption"); String lang = "customer"; CustomerDialog customerDialog = new CustomerDialog(headerCustomerTable, captionCustomerTable, lang); customerDialog.initDialog(mapServices, mapCustServiceStatus, CustomerDTO.class); List<CustomerDTO> lstCustomerOfMineName = WSCustomer .getListCustomerOfMineName(categoryListDTO.getId()); customerDialog.setCustomerList2Table(lstCustomerOfMineName); UI.getCurrent().addWindow(customerDialog); event.getButton().setEnabled(true); } }); return btnDetail; } }); tblCategoryList.addGeneratedColumn("devidedQuantityDetail", new CustomTable.ColumnGenerator() { @Override public Object generateCell(CustomTable source, final Object itemId, Object columnId) { final CategoryListDTO categoryListDTO = (CategoryListDTO) itemId; if (DataUtil.isStringNullOrEmpty(categoryListDTO.getDividedQuantity())) { return ""; } Button btnDetail = new Button(categoryListDTO.getDividedQuantity()); btnDetail.setStyleName(Constants.ICON.V_LINK); btnDetail.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { LinkedHashMap<String, CustomTable.Align> headerCustomerTable = BundleUtils .getHeadersFilter("devided.customer.status.detail"); String captionCustomerTable = BundleUtils .getString("customer.devided.table.detail.caption"); String lang = "customer"; CustomerDialog customerDialog = new CustomerDialog(headerCustomerTable, captionCustomerTable, lang); customerDialog.initDialog(mapServices, mapCustServiceStatus, CustomerDTO.class); List<CustomerDTO> lstCustomerOfMineName = WSCustomer .getListDevidedCustomerOfMineName(categoryListDTO.getId()); customerDialog.setCustomerList2Table(lstCustomerOfMineName); UI.getCurrent().addWindow(customerDialog); event.getButton().setEnabled(true); } }); return btnDetail; } }); tblCategoryList.addGeneratedColumn(lblEdit, new CustomTable.ColumnGenerator() { @Override public Object generateCell(CustomTable source, final Object itemId, Object columnId) { final CategoryListDTO categoryListDTO = (CategoryListDTO) itemId; ThemeResource iconVi = new ThemeResource("img/icon_edit.png"); Image image = new Image(null, iconVi); image.addClickListener(new MouseEvents.ClickListener() { @Override public void click(MouseEvents.ClickEvent event) { InsertOrUpdate(categoryListDTO, false); } }); return image; } }); // tableUtils.generateColumn(tblCategoryList); CommonUtils.setVisibleBtnTablePanel(panelCategoryList, true, false, true, true); CommonFunctionTableFilter.initTable(panelCategoryList, headerData, beanItemContainerCategoryList, BundleUtils.getString("table.list.categoryList"), 10, "categoryList.header", true, true, false, false, false); tblCategoryList.setColumnExpandRatio("description", 2); tblCategoryList.setColumnExpandRatio("receivedDate", 1); tblCategoryList.setColumnExpandRatio("endDate", 1); tblCategoryList.setColumnExpandRatio("code", 1); tblCategoryList.setColumnExpandRatio("name", 1); }
From source file:com.anphat.list.controller.ListStaffController.java
private void initTable() { itemContainer = new BeanItemContainer<>(StaffDTO.class); //add detail link into tblstaff tblStaffs.addGeneratedColumn("resetPassword", new CustomTable.ColumnGenerator() { @Override//from www . j ava2s .c o m public Object generateCell(CustomTable source, final Object itemId, Object columnId) { final Button linkDetails = new Button(); linkDetails.setIcon(FontAwesome.KEY); linkDetails.setStyleName(Runo.BUTTON_LINK); linkDetails.addStyleName("v-button-link-left"); linkDetails.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { final StaffDTO staffDTO = (StaffDTO) itemId; ConfirmDialog.show(UI.getCurrent(), "Reset mt khu", "?t li mt khu mc nh cho ti khon " + staffDTO.getName(), "?ng ", "Hu b?", new ConfirmDialog.Listener() { @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { staffDTO.setPassword( DataUtil.md5(BundleUtils.getStringCas("password_default"))); // Confirmed to continue String result = WSStaff.updateStaff(staffDTO); if (Constants.SUCCESS.equalsIgnoreCase(result)) { CommonMessages.showMessageUpdateSuccess("pass"); } } } }); } }); linkDetails.setDescription(BundleUtils.getString("resetPassword")); return linkDetails; } }); tblStaffs.addGeneratedColumn("detailRole", new CustomTable.ColumnGenerator() { @Override public Object generateCell(CustomTable source, final Object itemId, Object columnId) { final Button btnAddRole = new Button(BundleUtils.getString("detail.roles")); btnAddRole.setStyleName(Runo.BUTTON_LINK); btnAddRole.addStyleName("v-button-link-left"); btnAddRole.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { StaffDTO staffDTO = (StaffDTO) itemId; MapStaffRolesDiaglog diaglog = new MapStaffRolesDiaglog( BundleUtils.getString("map.staff.roles.view")); diaglog.setTblRolesVisiableOnly(); MapStaffRolesController controller = new MapStaffRolesController(diaglog); controller.initOnlyView(staffDTO); UI.getCurrent().addWindow(diaglog); } }); btnAddRole.setDescription(BundleUtils.getString("lb.header.staff.addCustomer.decr")); return btnAddRole; } }); //160316 NgocND6 them chuc nang hang hoa quan ly cua tung nhan vien tblStaffs.addGeneratedColumn("goodsManage", new CustomTable.ColumnGenerator() { @Override public Object generateCell(CustomTable source, final Object itemId, Object columnId) { final Button linkDetails = new Button(BundleUtils.getString("lb.header.staff.goodsManage")); linkDetails.setStyleName(Runo.BUTTON_LINK); linkDetails.addStyleName("v-button-link-left"); linkDetails.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { // StaffDTO staffDTO = (StaffDTO) itemId; // if (staffDTO.getStatus().equalsIgnoreCase("1")) { // getListMapStaffCustomer(staffDTO); // if (listMapStaffCustomer != null) { // DialogGoodsManagement dialogGoodsManagement = new DialogGoodsManagement(BundleUtils.getString("transfer.goods.manage.managoodsassignstaff")); // dialogGoodsManagement.initDialog(); // DialogGoodsManagementController dgmc = new DialogGoodsManagementController(staffDTO, dialogGoodsManagement); // UI.getCurrent().addWindow(dialogGoodsManagement); // }else{ // Notification.show(BundleUtils.getString("transfer.goods.manage.staffdontassigncust"), Notification.Type.WARNING_MESSAGE); // } // } else { // Notification.show(BundleUtils.getString("dept.staff.alert.message.notActive")); // } } }); linkDetails.setDescription(BundleUtils.getString("lb.header.staff.addCustomer.decr")); return linkDetails; } }); tableUtils = new TableUtils(); tableUtils.generateColumn(tblStaffs); CommonFunctionTableFilter.initTable(staffTablePanel, headerData, itemContainer, captionfieldsetListStaff, 5, "lb.header.staff"); CommonUtils.convertFieldAppParamTable(tblStaffs, Constants.STAFF.STATUS, Constants.APP_PARAMS.COMMON_STATUS); CommonUtils.convertFieldAppParamTable(tblStaffs, Constants.STAFF.STAFF_TYPE, Constants.APP_PARAMS.STAFF_TYPE); // tblStaffs.setColumnHeader("addStock", BundleUtils.getString("add.staff.for.stock")); }
From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java
License:Apache License
private Button createChangeVersionButton() { Button button = new Button("Change version"); button.setStyleName(BaseTheme.BUTTON_LINK); button.addClickListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { ChangeVersionWindow window = new ChangeVersionWindow(); addWindow(window);/*from w ww. ja va2 s.co m*/ window.initialize(); } }); return button; }
From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java
License:Apache License
private Button createDetailsButton() { Button button = new Button("Details"); button.setStyleName(BaseTheme.BUTTON_LINK); button.addClickListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { addWindow(new DetailsWindow()); }//from w ww. ja va2 s . co m }); return button; }
From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java
License:Apache License
private Button createUpdateVaadinVersionButton() { Button button = new Button("Upgrade"); button.setImmediate(true);/* w w w . j a v a 2 s .c o m*/ button.setStyleName(BaseTheme.BUTTON_LINK); button.addClickListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { if (!newestDownloadInfo.isExists()) { Notification.show(WARNING_UPGRADE_VAADIN_VERSION_NOT_FOUND, Notification.Type.ERROR_MESSAGE); return; } outputLog.log("Location for download: " + newestDownloadInfo.getDownloadUrl()); try { addWindow(new WarningWindow(newestDownloadInfo)); } catch (Exception ex) { outputLog.log(ex.getMessage()); } } }); return button; }
From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java
License:Apache License
private Button createRefreshButton() { Button button = new Button("[re-scan]", new Button.ClickListener() { @SuppressWarnings("unchecked") public void buttonClick(Button.ClickEvent event) { selectedAddons = (Set<VaadinAddonInfo>) includeAddonsOptionGroup.getValue(); refreshAddons();/*w w w . j a v a2 s . c o m*/ } }); button.setStyleName(BaseTheme.BUTTON_LINK); return button; }
From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java
License:Apache License
private Button createAdditionalDependenciesButton() { Button button = new Button("Manage Additional Dependencies", new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { showAdditionalDependenciesWindow(); }/*from ww w . j a v a 2 s .c o m*/ }); button.setStyleName(BaseTheme.BUTTON_LINK); return button; }
From source file:com.bsb.common.vaadin.embed.component.DevApplicationHeader.java
License:Apache License
/** * Creates an new instance with the specified {@link EmbedVaadinServer} * to manage.//from w ww . j a v a 2s .com * * @param server the server to manage */ public DevApplicationHeader(final EmbedVaadinServer server) { final Button shutdown = new Button("shutdown"); shutdown.setStyleName(BaseTheme.BUTTON_LINK); shutdown.setDescription("Shutdown the embed server and close this tab"); addComponent(shutdown); setComponentAlignment(shutdown, Alignment.MIDDLE_CENTER); shutdown.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { // Stop the server in a separate thread. final Thread thread = new Thread(new Runnable() { public void run() { server.stop(); } }); // avoid that catalina's WebappClassLoader.clearReferencesThreads warns about the thread because it is // part of the web application being stopped. thread.setContextClassLoader(null); thread.start(); // Close the browser tab getWindow().executeJavaScript("close();"); } }); }
From source file:com.cms.component.CustomPageTable.java
public HorizontalLayout createControls(String pageSizeDefault) { this.pageSizeDefault = pageSizeDefault; separatorTotal.setImmediate(true);//from ww w. j av a 2 s . c o m Label itemsPerPageLabel = new Label(BundleUtils.getString("common.table.numberRecord")); for (String numberSize : Constants.PAGE_SIZE_LIST) { itemsPerPageSelect.addItem(numberSize); } itemsPerPageSelect.setImmediate(true); itemsPerPageSelect.setNullSelectionAllowed(false); itemsPerPageSelect.setWidth("50px"); itemsPerPageSelect.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -2255853716069800092L; @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { setPageLength(Integer.valueOf(String.valueOf(event.getProperty().getValue()))); firePagedChangedEvent(); } }); itemsPerPageSelect.select(pageSizeDefault); Label pageLabel = new Label(BundleUtils.getString("common.table.page"), ContentMode.HTML); final TextField currentPageTextField = new TextField(); currentPageTextField.setValue(String.valueOf(getCurrentPage())); currentPageTextField.setConverter(Integer.class); currentPageTextField .addValidator(new IntegerRangeValidator("Wrong page number", 1, getTotalAmountOfPages())); Label separatorLabel = new Label(" / ", ContentMode.HTML); final Label totalPagesLabel = new Label(String.valueOf(getTotalAmountOfPages()), ContentMode.HTML); currentPageTextField.setStyleName(Reindeer.TEXTFIELD_SMALL); currentPageTextField.setImmediate(true); currentPageTextField.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -2255853716069800092L; @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { currentPageTextField.removeAllValidators(); currentPageTextField .addValidator(new IntegerRangeValidator("Wrong page number", 1, getTotalAmountOfPages())); if (Integer.valueOf(String.valueOf(currentPageTextField.getValue())) <= getTotalAmountOfPages()) { int page = Integer.valueOf(String.valueOf(currentPageTextField.getValue())); setCurrentPage(page); } } }); pageLabel.setWidth(null); currentPageTextField.setWidth("30px"); separatorLabel.setWidth(null); totalPagesLabel.setWidth(null); HorizontalLayout controlBar = new HorizontalLayout(); HorizontalLayout pageSize = new HorizontalLayout(); HorizontalLayout pageManagement = new HorizontalLayout(); final Button first = new Button("<<", new Button.ClickListener() { private static final long serialVersionUID = -355520120491283992L; @Override public void buttonClick(Button.ClickEvent event) { setCurrentPage(0); } }); previous = new Button("<", new Button.ClickListener() { private static final long serialVersionUID = -355520120491283992L; @Override public void buttonClick(Button.ClickEvent event) { previousPage(); } }); final Button next = new Button(">", new Button.ClickListener() { private static final long serialVersionUID = -1927138212640638452L; @Override public void buttonClick(Button.ClickEvent event) { nextPage(); } }); final Button last = new Button(">>", new Button.ClickListener() { private static final long serialVersionUID = -355520120491283992L; @Override public void buttonClick(Button.ClickEvent event) { setCurrentPage(getTotalAmountOfPages()); } }); first.setStyleName(Reindeer.BUTTON_LINK); previous.setStyleName(Reindeer.BUTTON_LINK); next.setStyleName(Reindeer.BUTTON_LINK); last.setStyleName(Reindeer.BUTTON_LINK); itemsPerPageLabel.addStyleName("pagedtable-itemsperpagecaption"); itemsPerPageSelect.addStyleName("pagedtable-itemsperpagecombobox"); pageLabel.addStyleName("pagedtable-pagecaption"); currentPageTextField.addStyleName("pagedtable-pagefield"); separatorLabel.addStyleName("pagedtable-separator"); separatorTotal.addStyleName("pagedtable-separator"); totalPagesLabel.addStyleName("pagedtable-total"); first.addStyleName("pagedtable-first"); previous.addStyleName("pagedtable-previous"); next.addStyleName("pagedtable-next"); last.addStyleName("pagedtable-last"); itemsPerPageLabel.addStyleName("pagedtable-label"); itemsPerPageSelect.addStyleName("pagedtable-combobox"); pageLabel.addStyleName("pagedtable-label"); currentPageTextField.addStyleName("pagedtable-label"); separatorLabel.addStyleName("pagedtable-label"); separatorTotal.addStyleName("pagedtable-label"); totalPagesLabel.addStyleName("pagedtable-label"); first.addStyleName("pagedtable-button"); previous.addStyleName("pagedtable-button"); next.addStyleName("pagedtable-button"); last.addStyleName("pagedtable-button"); pageSize.addComponent(itemsPerPageLabel); pageSize.addComponent(itemsPerPageSelect); Label separator = new Label(" / ", ContentMode.HTML); pageSize.addComponent(separator); pageSize.addComponent(separatorTotal); pageSize.setComponentAlignment(itemsPerPageLabel, Alignment.MIDDLE_LEFT); pageSize.setComponentAlignment(itemsPerPageSelect, Alignment.MIDDLE_LEFT); pageSize.setComponentAlignment(separator, Alignment.MIDDLE_LEFT); pageSize.setComponentAlignment(separatorTotal, Alignment.MIDDLE_LEFT); pageSize.setSpacing(true); pageManagement.addComponent(first); pageManagement.addComponent(previous); pageManagement.addComponent(pageLabel); pageManagement.addComponent(currentPageTextField); pageManagement.addComponent(separatorLabel); pageManagement.addComponent(totalPagesLabel); pageManagement.addComponent(next); pageManagement.addComponent(last); pageManagement.setComponentAlignment(first, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(previous, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(pageLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(currentPageTextField, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(separatorLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(totalPagesLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(next, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(last, Alignment.MIDDLE_LEFT); pageManagement.setWidth(null); pageManagement.setSpacing(true); controlBar.addComponent(pageSize); controlBar.addComponent(pageManagement); controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_CENTER); controlBar.setWidth("100%"); controlBar.setExpandRatio(pageSize, 1); addListener(new PageChangeListener() { @Override public void pageChanged(PagedTableChangeEvent event) { int abc = event.getCurrentPage(); first.setEnabled(container.getStartIndex() > 0); previous.setEnabled(container.getStartIndex() > 0); next.setEnabled(container.getStartIndex() < container.getRealSize() - getPageLength()); last.setEnabled(container.getStartIndex() < container.getRealSize() - getPageLength()); currentPageTextField.setValue(String.valueOf(getCurrentPage())); totalPagesLabel.setValue(String.valueOf(getTotalAmountOfPages())); if (resizePage) { int lenght = getPageLength(); int a = lenght % 5; int b = lenght / 5; if (a != 0) { int pageLenght = 5 * (b + 1); itemsPerPageSelect.setValue(pageLenght); } } separatorTotal.setValue(String.valueOf(container.getRealSize())); } }); return controlBar; }