📄 companysearchaction.java
字号:
package com.leeman.wkexs.master.company.web;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.beans.PropertyEditor;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionFormBean;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.commons.beanutils.PropertyUtils;
import com.leeman.common.web.ui.*;
import com.leeman.wkexs.web.base.BaseForm;
import com.leeman.wkexs.web.base.BaseConstants;
import com.leeman.wkexs.web.base.BaseSearchAction;
import com.leeman.wkexs.web.base.BaseCollectionCache;
import com.leeman.common.util.Formatter;
import com.leeman.common.util.EjbGetter;
import com.leeman.common.util.DateUtils;
import com.leeman.wkexs.master.company.entity.*;
import com.leeman.wkexs.master.company.handler.*;
public final class CompanySearchAction extends BaseSearchAction
{
public void doInit(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
{
CompanyCollectionCache cache = new CompanyCollectionCache();
this.setCollectionCache(request, cache);
}
public void initSearchForm(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception
{
SearchForm searchForm = (SearchForm) form;
ArrayList activeList = this.getSysXlatItemListByFieldWithBlank(BaseConstants.XLAT_ACTIVE_TYPE, getLangId(request));
searchForm.setActiveList(activeList);
}
public void doSearch(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
{
SearchForm searchForm = (SearchForm)form;
//Do the Searching
CompanyCollectionCache collectionCache = (CompanyCollectionCache)getCollectionCache(request);
CompanySO searchKey = (CompanySO)collectionCache.getSearchKey();
CachedPager pager = collectionCache.getSearchPager();
CompanyHandler handler = CompanyHandlerHelper.getCompanyHandler();
ArrayList result = handler.getList(searchKey, pager.calcCacheRecordStart(), pager.getCacheRecordSize());
/*Map map = this.getSysXlatItemShotDesc(BaseConstants.XLAT_ACTIVE_TYPE,getLangId(request));
for(int i=0; i<result.size(); i++)
{
CompanyVO tempVO = (CompanyVO)result.get(i);
tempVO.setActive_desc((String)map.get(tempVO.getActive()));
result.set(i,tempVO);
}*/
pager.setCachedRange(pager.calcCacheRecordStart(), result.size());
collectionCache.setSearchResults(result);
}
protected void updateCollectionCache(HttpServletRequest request, ActionForm form) throws Exception
{
CompanyCollectionCache collectionCache = (CompanyCollectionCache)getCollectionCache(request);
SearchForm searchForm = (SearchForm)form;
CompanySO so = new CompanySO();
so.setCompany_id(searchForm.getCompany_id().trim());
so.setCompany_name(searchForm.getCompany_name().trim());
so.setCompany_address(searchForm.getCompany_address().trim());
so.setBase_currency(searchForm.getBase_currency().trim());
so.setTelephone(searchForm.getTelephone().trim());
so.setFax(searchForm.getFax().trim());
so.setEmail(searchForm.getEmail().trim());
so.setActive(searchForm.getActive().trim());
collectionCache.setSearchKey(so);
}
/**
* Overrides
*/
public void loadFormFromCache(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
CompanyCollectionCache collectionCache = (CompanyCollectionCache)getCollectionCache(request);
CompanySO so = (CompanySO)collectionCache.getSearchKey();
SearchForm searchForm = (SearchForm)form;
searchForm.setCompany_id(so.getCompany_id());
searchForm.setCompany_name(so.getCompany_name());
searchForm.setCompany_address(so.getCompany_address());
searchForm.setTelephone(so.getTelephone());
searchForm.setFax(so.getFax());
searchForm.setEmail(so.getEmail());
searchForm.setActive(so.getActive());
}
/**
* Overrides
*/
public void doNewSearch(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
super.doNewSearch(mapping, form, request, response);
setInitFocus(request, "document.forms[0].company_id");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -