List of usage examples for com.vaadin.ui Button addStyleName
@Override public void addStyleName(String style)
From source file:at.peppol.webgui.app.MainWindow.java
License:Mozilla Public License
public void showInitialMainContent(UserFolder<?> userFolder) { // ------ START: Main Content ------- final VerticalLayout mainContentLayout = new VerticalLayout(); mainContentLayout.addStyleName("margin"); final VerticalLayout topmain = new VerticalLayout(); topmain.setSpacing(true);// w w w . j a v a2 s . c o m topmain.setWidth("100%"); final Label bigPAWGLabel = new Label("PEPPOL Post Award Web GUI"); bigPAWGLabel.setStyleName("huge"); topmain.addComponent(bigPAWGLabel); final Label blahContent = new Label( "This is a mockup of the GUI that is going" + " to be the PAWG. It is created by the Greek" + " and Austrian teams as a fine replacement " + " of the Demo Client"); blahContent.setWidth("80%"); blahContent.addStyleName("big"); //topmain.addComponent (blahContent); //HorizontalLayout itemsPanel = new ShowItemsPanel("Items", um, userFolder); final ShowItemsPanel itemsPanel = new ShowItemsPanel("Items", um, userFolder); this.itemsPanel = itemsPanel; topmain.addComponent(itemsPanel); HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSpacing(true); topmain.addComponent(buttonsLayout); Button loadButton = new Button("Load invoice"); //topmain.addComponent(loadButton); buttonsLayout.addComponent(loadButton); loadButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Table table = itemsPanel.getTable(); if (table.getValue() != null) { //InvoiceType inv = (InvoiceType)table.getItem(table.getValue()).getItemProperty("invoice").getValue(); //InvoiceBean invBean = (InvoiceBean)table.getItem(table.getValue()); InvoiceBean invBean = ((InvoiceBeanContainer) table.getContainerDataSource()) .getItem(table.getValue()).getBean(); //System.out.println("Invoice is: "+invBean); showInvoiceForm(invBean); } } }); Button sendButton = new Button("Send invoice"); buttonsLayout.addComponent(sendButton); sendButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { Table table = itemsPanel.getTable(); if (table.getValue() != null) { InvoiceBean invBean = ((InvoiceBeanContainer) table.getContainerDataSource()) .getItem(table.getValue()).getBean(); String path = invBean.getFolderEntryID(); FileSystemResource s = new FileSystemResource(path); SendInvoice.sendDocument(s); //file is sent. move invoice to outbox um.moveInvoice(invBean, um.getDrafts(), um.getOutbox()); //itemsPanel.getTable().requestRepaint(); itemsPanel.init(um.getDrafts()); } } catch (FileNotFoundException e) { getWindow().showNotification("Could not find invoice file", Notification.TYPE_ERROR_MESSAGE); } catch (Exception e) { getWindow().showNotification("Could not send invoice. AP connection error", Notification.TYPE_ERROR_MESSAGE); e.printStackTrace(); } } }); final Button learnMoreBtn = new Button("Learn More >>"); learnMoreBtn.addStyleName("tall default"); //topmain.addComponent (learnMoreBtn); mainContentLayout.addComponent(topmain); // ------ END: Main Content --------- mainContentLayout.setHeight("100%"); mainContentLayout.setSizeFull(); mainContentLayout.setSpacing(true); mainContentLayout.setWidth("100%"); middleContentLayout.setWidth("100%"); middleContentLayout.setHeight("100%"); middleContentLayout.setMargin(true); // -------- addComponent(middleContentLayout); addComponent(footerLayout); if (mainContentComponent != null) { middleContentLayout.replaceComponent(mainContentComponent, mainContentLayout); } else { middleContentLayout.addComponent(mainContentLayout); } middleContentLayout.setExpandRatio(mainContentLayout, 1); mainContentComponent = mainContentLayout; }
From source file:at.peppol.webgui.app.MainWindow.java
License:Mozilla Public License
private HorizontalLayout createTopBarButtons() { final HorizontalLayout topBarBtns = new HorizontalLayout(); final Button homeBtn = new Button("Home"); homeBtn.addStyleName("first"); homeBtn.addStyleName("down"); final Button aboutBtn = new Button("About"); final Button contactBtn = new Button("Contact"); contactBtn.addStyleName("last"); topBarBtns.setStyleName("segment"); topBarBtns.addStyleName("tall"); topBarBtns.addComponent(homeBtn);//w w w . ja v a2 s. co m topBarBtns.addComponent(aboutBtn); topBarBtns.addComponent(contactBtn); return topBarBtns; }
From source file:by.bigvova.ui.LoginUI.java
License:Apache License
private Component buildFields() { final VerticalLayout layout = new VerticalLayout(); HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true);/*from www . j av a 2 s . com*/ fields.addStyleName("fields"); final TextField username = new TextField("Username"); username.setIcon(FontAwesome.USER); username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final PasswordField password = new PasswordField("Password"); password.setIcon(FontAwesome.LOCK); password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final Button signin = new Button("Sign In"); signin.addStyleName(ValoTheme.BUTTON_PRIMARY); signin.setClickShortcut(ShortcutAction.KeyCode.ENTER); signin.focus(); final CheckBox checkBox = new CheckBox("Remember me", true); signin.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { login(username.getValue(), password.getValue(), checkBox.getValue()); } }); fields.addComponents(username, password, signin); fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT); layout.setSpacing(true); layout.addComponent(fields); layout.addComponent(checkBox); return layout; }
From source file:com.adonis.ui.menu.Menu.java
/** * Highlights a view navigation button as the currently active view in the * menu. This method does not perform the actual navigation. * * @param viewName the name of the view to show as active *//*w w w. j av a 2 s . c o m*/ public void setActiveView(String viewName) { for (Button button : viewButtons.values()) { button.removeStyleName("selected"); } Button selected = viewButtons.get(viewName); if (selected != null) { selected.addStyleName("selected"); } menuPart.removeStyleName(VALO_MENU_VISIBLE); }
From source file:com.anphat.customer.controller.CustomerContactController.java
private void addEditButtonForTableCareCust() { panelTblHistory.getMainTable().addGeneratedColumn("btnEdit", new CustomTable.ColumnGenerator() { @Override/*from ww w . j a va 2 s . c o m*/ public Object generateCell(CustomTable source, Object itemId, Object columnId) { final CustomerCareHistoryDTO editDTO = (CustomerCareHistoryDTO) itemId; Button btnEdit = new Button(); btnEdit.addStyleName("v-button-link"); btnEdit.setIcon(FontAwesome.EDIT); // btnEdit.setCaption("Sa"); btnEdit.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { CustomerContactDialog contactDialog = new CustomerContactDialog( BundleUtils.getString("customerCareHistoryForm"), lstCustomerServiceStatus, lstCustContact); contactDialog.fillData2Dialog(editDTO); contactDialog.setIsEdit(Boolean.TRUE); UI.getCurrent().addWindow(contactDialog); addListenerBtnSaveContactWhenEditCare(contactDialog, editDTO); event.getButton().setEnabled(true); } }); return btnEdit; } }); }
From source file:com.anphat.customer.controller.CustomerContactController.java
private void addButtonAddContactOnTblTermInfo(CustomPageTableFilter tbl) { tbl.addGeneratedColumn("btnAddContact", new CustomTable.ColumnGenerator() { @Override//from w w w .j a va 2s . c o m public Object generateCell(CustomTable source, Object itemId, Object columnId) { TermInformationDTO term = (TermInformationDTO) itemId; CustomerContactDTO contactDTO = term.convert2CustomerContact(); StaffDTO staff = (StaffDTO) VaadinSession.getCurrent().getAttribute("staff"); contactDTO.setStaffCode(staff.getCode()); Button btnAdd = new Button(FontAwesome.PHONE); btnAdd.addStyleName(Runo.BUTTON_LINK); addBtnAddContactClickListener(btnAdd, contactDTO); return btnAdd; } }); }
From source file:com.anphat.customer.controller.CustomerContactController.java
private void addButtonOnTblTermInfo(CustomPageTableFilter tbl) { tbl.addGeneratedColumn("btnReport", new CustomTable.ColumnGenerator() { @Override//from ww w. ja v a 2 s .c om public Object generateCell(CustomTable source, Object itemId, Object columnId) { TermInformationDTO term = (TermInformationDTO) itemId; Button btnAdd = new Button(FontAwesome.REGISTERED); btnAdd.addStyleName(Runo.BUTTON_LINK); addBtnReportClickListener(btnAdd, term); return btnAdd; } }); }
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.DialogAddMapStaffCustomerController.java
private void initStaffTable(CommonTableFilterPanel filterPanel, boolean isAddTable) { filterPanel.getToolbar().setVisible(false); if (isAddTable) { containerLeft = new BeanItemContainer(StaffDTO.class); tblLeft = filterPanel.getMainTable(); tableUtils = new TableUtils(); tableUtils.generateColumn(tblLeft); tblLeft.setColumnExpandRatio(Constants.STAFF.NAME, 6); tblLeft.setColumnExpandRatio(Constants.STAFF.CODE, 3); tblLeft.setColumnExpandRatio(Constants.STAFF.STAFF_TYPE, 3); tblLeft.setColumnExpandRatio(Constants.CHECKBOX_COLUMN, 1); CommonFunctionTableFilter.initTable(filterPanel, headerStaffLeft, containerLeft, captionStaffTable, tblSize, langStaff);//w w w.j a va 2 s . c o m tblLeft.setColumnHeader(Constants.CHECKBOX_COLUMN, ""); CommonUtils.convertFieldAppParamTable(tblLeft, Constants.STAFF.STAFF_TYPE, "STAFF_TYPE"); } else { containerRight = new BeanItemContainer(MapStaffCustomerDTO.class); if (!DataUtil.isListNullOrEmpty(lstMapStaffCustomerDTOs)) { containerRight.addAll(lstMapStaffCustomerDTOs); } tblRight = filterPanel.getMainTable(); tblRight.addGeneratedColumn("delete", new CustomTable.ColumnGenerator() { @Override public Object generateCell(final CustomTable source, final Object itemId, Object columnId) { MapStaffCustomerDTO sdto = (MapStaffCustomerDTO) itemId; if (!DataUtil.isStringNullOrEmpty(sdto.getMapId())) { return ""; } Button btnDelete = new Button(new ThemeResource(Constants.ICON.CANCEL)); btnDelete.addStyleName(Constants.ICON.V_LINK); btnDelete.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { source.removeItem(itemId); tblRight.resetPage(); } }); return btnDelete; } }); tblRight.setColumnWidth("delete", 60); tblRight.setColumnExpandRatio("staffName", 3); tblRight.setColumnExpandRatio("staffCode", 1); tblRight.setColumnExpandRatio("staffType", 1); CommonFunctionTableFilter.initTable(filterPanel, headerStaffRight, containerRight, captionStaffCustomerTable, tblSize, langStaff); tblRight.setColumnHeader("delete", Constants.NULL); CommonUtils.convertFieldAppParamTable(tblRight, Constants.STAFF.STAFF_TYPE, "STAFF_TYPE"); } }
From source file:com.anphat.list.controller.DialogAddMapStaffCustomerController.java
private void initCustTable(CommonTableFilterPanel filterPanel, boolean isAddTable) { filterPanel.getToolbar().setVisible(false); if (isAddTable) { containerLeft = new BeanItemContainer(CustomerDTO.class); tblLeft = filterPanel.getMainTable(); tableUtils = new TableUtils(); tableUtils.generateColumn(tblLeft); tblLeft.setColumnExpandRatio(Constants.CUSTOMER.NAME, 3); tblLeft.setColumnExpandRatio(Constants.CUSTOMER.CODE, 1); tblLeft.setColumnWidth(Constants.CHECKBOX_COLUMN, 40); CommonFunctionTableFilter.initTable(filterPanel, headerCustLeft, containerLeft, captionCustTable, tblSize, langCust);//from w w w.j a va2 s . c om tblLeft.setColumnHeader(Constants.CHECKBOX_COLUMN, ""); } else { containerRight = new BeanItemContainer(MapStaffCustomerDTO.class); if (!DataUtil.isListNullOrEmpty(lstMapStaffCustomerDTOs)) { containerRight.addAll(lstMapStaffCustomerDTOs); } tblRight = filterPanel.getMainTable(); tblRight.addGeneratedColumn("delete", new CustomTable.ColumnGenerator() { @Override public Object generateCell(final CustomTable source, final Object itemId, Object columnId) { final MapStaffCustomerDTO sdto = (MapStaffCustomerDTO) itemId; if (DataUtil.isStringNullOrEmpty(sdto.getMapId())) { Button btnCancel = new Button(new ThemeResource(Constants.ICON.CANCEL)); btnCancel.setDescription(BundleUtils.getString("common.button.cancel")); btnCancel.addStyleName(Constants.ICON.V_LINK); btnCancel.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { source.removeItem(itemId); tblRight.resetPage(); } }); return btnCancel; } else { Button btnDelete = new Button(new ThemeResource(Constants.ICON.DELETE)); btnDelete.setDescription(BundleUtils.getString("common.button.delete")); btnDelete.addStyleName(Constants.ICON.V_LINK); btnDelete.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { ConfirmDialog.show(UI.getCurrent(), BundleUtils.getString("delete.item.title"), BundleUtils.getString("delete.item.body"), BundleUtils.getString("yes"), BundleUtils.getString("no"), new ConfirmDialog.Listener() { @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { String returnValue = WSMapStaffCustomer .deleteMapStaffCustomer(sdto.getMapId()); if (returnValue.equalsIgnoreCase(Constants.SUCCESS)) { tblRight.removeItem(itemId); tblRight.resetPage(); Notification.show(BundleUtils.getString("actionSuccess"), Notification.Type.HUMANIZED_MESSAGE); } else { Notification.show(BundleUtils.getString("actionFail"), Notification.Type.ERROR_MESSAGE); } } } }); } }); return btnDelete; } } }); // tblRight.addGeneratedColumn("cancel", new CustomTable.ColumnGenerator() { // // @Override // public Object generateCell(final CustomTable source, final Object itemId, Object columnId) { // MapStaffCustomerDTO sdto = (MapStaffCustomerDTO) itemId; // if (!DataUtil.isStringNullOrEmpty(sdto.getMapId())) { // return ""; // } // Button btnCancel = new Button(new ThemeResource(Constants.ICON.CANCEL)); // btnCancel.setDescription(BundleUtils.getString("common.button.cancel")); // btnCancel.addStyleName(Constants.ICON.V_LINK); // btnCancel.addClickListener(new Button.ClickListener() { // // @Override // public void buttonClick(Button.ClickEvent event) { // source.removeItem(itemId); // tblRight.resetPage(); // } // }); // return btnCancel; // } // }); tblRight.setColumnWidth("delete", 100); // tblRight.setColumnWidth("cancel", 60); tblRight.setColumnExpandRatio("custName", 3); tblRight.setColumnExpandRatio("custCode", 1); CommonFunctionTableFilter.initTable(filterPanel, headerCustRight, containerRight, captionCustTableView, tblSize, langCust); tblRight.setColumnHeader("delete", BundleUtils.getString("common.button.delete") + "/" + BundleUtils.getString("common.button.cancel")); // tblRight.setColumnHeader("cancel", ""); } }