@Override protected void resetSearchDetails() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Resetting search fields and reloading the result"); hlUserInputLayout.removeAllComponents(); // reset the field valued to default cbproduct.setValue(null); cbproduct.setComponentError(null); lblNotification.setIcon(null); dfemailStartdate.setValue(null); dfemailEndDate.setValue(null); lblNotification.setCaption(""); tfemailid.setValue(""); // reload the search using the defaults loadSrchRslt(); }
private void loadProductList() { try { List<ProductDM> productlist = servicebeanproduct.getProductList(companyid, null, null, null, null, null, null, "F"); BeanContainer<Long, ProductDM> prodList = new BeanContainer<Long, ProductDM>(ProductDM.class); prodList.setBeanIdProperty("prodid"); prodList.addAll(productlist); cbproduct.setContainerDataSource(prodList); } catch (Exception e) { e.printStackTrace(); logger.error("fn_loadProductList_Exception Caught->" + e); } }
@Override protected void resetFields() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Resetting the UI controls"); dfemailStartdate.setValue(null); tfemailid.setValue(""); cbproduct.setValue(null); dfemailStartdate.setValue(null); }
// get the search result from DB based on the search parameters public void loadSrchRslt() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Loading Search..."); tblMstScrSrchRslt.removeAllItems(); Long prodname = null; if (cbproduct.getValue() != null) { prodname = ((Long) cbproduct.getValue()); } String stdate = null; if (dfemailStartdate.getValue() != null) { stdate = (DateUtils.datetostring(dfemailStartdate.getValue())); } String enddate = null; if (dfemailEndDate.getValue() != null) { enddate = (DateUtils.datetostring(dfemailEndDate.getValue())); } emailList = serviceemailLogger.getEmailLoggerList( companyid, userId, prodname, tfemailid.getValue(), stdate, enddate); recordCnt = emailList.size(); if (cockeckall.getValue().equals(true)) { List<EmailLoggerDM> mylist = new ArrayList<EmailLoggerDM>(); for (EmailLoggerDM obj : emailList) { obj.setSelected(true); mylist.add(obj); } beanEmailLoggerDM = new BeanItemContainer<EmailLoggerDM>(EmailLoggerDM.class); beanEmailLoggerDM.addAll(mylist); } else { List<EmailLoggerDM> mylist = new ArrayList<EmailLoggerDM>(); for (EmailLoggerDM obj : emailList) { obj.setSelected(false); mylist.add(obj); } beanEmailLoggerDM = new BeanItemContainer<EmailLoggerDM>(EmailLoggerDM.class); beanEmailLoggerDM.addAll(mylist); } tblMstScrSrchRslt.setContainerDataSource(beanEmailLoggerDM); tblMstScrSrchRslt.setSelectable(true); logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Got the UserFav result set"); tblMstScrSrchRslt.setContainerDataSource(beanEmailLoggerDM); tblMstScrSrchRslt.setVisibleColumns( new Object[] { "emaillogId", "productName", "clintnam", "emailid", "emailDate", "emailSubject", "quoteRef", }); tblMstScrSrchRslt.setColumnHeaders( new String[] { "Ref.Id", "Product Name", "Client Name", "Email Id", "Email Date", "Email Subject", "Quote Ref.No" }); tblMstScrSrchRslt.setColumnAlignment("emailid", Align.LEFT); tblMstScrSrchRslt.setColumnFooter("quoteRef", "No.of Records : " + recordCnt); }
// Build the UI components private void buildview() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Painting Email logger UI"); btnAdd.setVisible(false); btnDownload.setVisible(false); btnEdit.setVisible(false); btnAuditRecords.setVisible(false); // Email-id text box tfemailid = new TextField("Email Id"); // product combo box cbproduct = new GERPComboBox("Product Name"); cbproduct.setItemCaptionPropertyId("prodname"); loadProductList(); // Email start date dfemailStartdate = new GERPPopupDateField("Log Start Dt"); dfemailStartdate.setInputPrompt("Select Date"); // Email End date dfemailEndDate = new GERPPopupDateField("Log End Dt"); dfemailEndDate.setInputPrompt("Select Date"); btndelete = new Button("Delete"); btndelete.addStyleName("delete"); btndelete.setEnabled(true); btndelete.setVisible(true); btndelete.addClickListener( new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { btndelete.setEnabled(true); if (cockeckall.getValue().equals(true)) { for (EmailLoggerDM obj : emailList) { serviceemailLogger.delete(obj.getEmaillogId()); } } else { delete(); } loadSrchRslt(); /* btndelete.setEnabled(false); cockeckall.setValue(false);*/ } }); cockeckall = new CheckBox("Select All"); cockeckall.addStyleName("delete"); cockeckall.setEnabled(true); cockeckall.setVisible(true); setCheckBoxTable(); cockeckall.setImmediate(true); cockeckall.addValueChangeListener( new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue().equals(true)) { loadSrchRslt(); btndelete.setEnabled(true); } else { loadSrchRslt(); btndelete.setEnabled(false); } } }); hlCmdBtnLayout.addComponent(cockeckall); hlCmdBtnLayout.setSpacing(true); hlCmdBtnLayout.setComponentAlignment(cockeckall, Alignment.MIDDLE_RIGHT); hlCmdBtnLayout.addComponent(btndelete); hlCmdBtnLayout.setComponentAlignment(btndelete, Alignment.MIDDLE_RIGHT); hlCmdBtnLayout.setExpandRatio(btndelete, 1); // build search layout hlSearchLayout = new GERPAddEditHLayout(); assembleSearchLayout(); hlSrchContainer.addComponent(GERPPanelGenerator.createPanel(hlSearchLayout)); resetFields(); loadSrchRslt(); }