/** * @param request * @return * @throws FragmentEventException */ public HtmlFragmentResponse searchFinancial(HtmlFragmentRequest request) throws FragmentEventException { HtmlFragmentResponse res = getResponse(); try { FinancialBean bean = (FinancialBean) request.getForm("searchFinancial"); Company c = bean.getFinancial(); if (c == null) { c = new Company(); bean.setFinancial(c); } List<Company> cs = finService.getCompanies(c, bean.getOffset(), bean.getLimit()); List<FinancialBean> cbs = new ArrayList<FinancialBean>(); if (cs != null) { for (Company company : cs) { FinancialBean cb = new FinancialBean(); cb.setFinancial(company); cbs.add(cb); } } int allCount = finService.allCount(c); TableWidget table = new DefaultTableWidget( "financials", cbs, new PagingBean(bean.getPageNum(), bean.getNumPerPage(), allCount)); res.addTable(table); FormWidget form = new DefaultFormWidget("searchFinancial", bean); res.addForm(form); res.forward("pages/financial/financialManager.html"); } catch (Exception e) { log.error(e.getMessage(), e); throw new FragmentEventException(e); } return res; }