예제 #1
0
  public String createColumnFilter(ReportRequest rrequest, AbsListReportColBean alrcbean) {
    ReportBean rbean = alrcbean.getOwner().getReportBean();
    StringBuffer resultBuf = new StringBuffer();
    AbsListReportFilterBean filterbean = alrcbean.getFilterBean();
    StringBuffer paramsBuf = new StringBuffer();
    paramsBuf.append("{reportguid:\"").append(rbean.getGuid()).append("\"");
    paramsBuf
        .append(",property:\"")
        .append(((ColBean) alrcbean.getOwner()).getProperty())
        .append("\"");
    paramsBuf.append(",webroot:\"").append(Config.webroot).append("\"");
    paramsBuf.append(",skin:\"").append(rrequest.getPageskin()).append("\"");
    CacheDataBean cdb = rrequest.getCdb(rbean.getId());

    String imgurl = "/webresources/skin/" + rrequest.getPageskin() + "/images/";
    paramsBuf.append(",urlParamName:\"");
    if (filterbean.isConditionRelate()) {
      paramsBuf.append(filterbean.getConditionname()).append("\"");
      paramsBuf.append(",multiply:\"false\"");
      String filtervalue = rrequest.getStringAttribute(filterbean.getConditionname(), "");
      if (!filtervalue.equals("")) {
        imgurl = imgurl + "filter2.jpg";
      } else {
        imgurl = imgurl + "filter1.jpg";
      }
    } else {
      paramsBuf.append(filterbean.getId()).append("\"");
      paramsBuf.append(",multiply:\"true\"");
      String filtervalue = rrequest.getStringAttribute(filterbean.getId(), "");
      if (cdb.getFilteredBean() == null
          || filtervalue.trim().equals("")
          || !filterbean.equals(cdb.getFilteredBean())) {
        imgurl = imgurl + "filter1.jpg";
      } else {
        imgurl = imgurl + "filter2.jpg";
      }
    }
    imgurl = Tools.replaceAll(Config.webroot + imgurl, "//", "/"); // 过滤图片路径

    paramsBuf.append(",filterwidth:").append(filterbean.getFilterwidth());
    paramsBuf.append(",filtermaxheight:").append(filterbean.getFiltermaxheight());
    paramsBuf.append("}");
    resultBuf
        .append("<SPAN class=\"filter_span\"><input type=\"button\" id=\"")
        .append(rbean.getGuid() + alrcbean.hashCode())
        .append("\"");
    resultBuf.append(
        " onmouseout=\"try{drag_enabled=true;}catch(e){}\" onmouseover=\"try{drag_enabled=false;this.style.cursor='pointer';}catch(e){}\"");
    resultBuf
        .append(
            " style=\"width:16px;height:17px;background-color:transparent;border:0; background-image: url(")
        .append(imgurl + ");\"");
    resultBuf
        .append(" onclick=\"try{getFilterDataList(this,'")
        .append(Tools.jsParamEncode(paramsBuf.toString()))
        .append("');return false;}catch(e){logErrorsAsJsFileLoad(e);}\"");
    resultBuf.append("/></SPAN>");
    return resultBuf.toString();
  }
예제 #2
0
 public String getFilterConditionExpression(
     ReportRequest rrequest, ReportBean rbean, ReportDataSetValueBean datasetbean) {
   AbsListReportFilterBean filterBean = rrequest.getCdb(rbean.getId()).getFilteredBean();
   if (filterBean == null) return null;
   ColBean cbTmp = (ColBean) filterBean.getOwner();
   if (!cbTmp.isMatchDataSet(datasetbean)) return null;
   String filterval = rrequest.getStringAttribute(filterBean.getId(), "");
   if (filterval.equals("")) return null;
   if (cbTmp.getDatatypeObj() == null
       || cbTmp.getDatatypeObj() instanceof VarcharType
       || cbTmp.getDatatypeObj() instanceof AbsDateTimeType) {
     filterval = Tools.replaceAll(filterval, ";;", "','");
     if (!filterval.startsWith("'")) filterval = "'" + filterval;
     if (filterval.endsWith("','")) filterval = filterval.substring(0, filterval.length() - 3);
     if (!filterval.endsWith("'")) filterval = filterval + "'";
     if (filterval.equals("'")) filterval = "";
   } else {
     filterval = Tools.replaceAll(filterval, ";;", ",");
     if (filterval.endsWith(",")) filterval = filterval.substring(0, filterval.length() - 1);
   }
   String where = null;
   String column = null;
   if (filterBean.getFilterColumnExpression() != null
       && !filterBean.getFilterColumnExpression().trim().equals("")) {
     column = filterBean.getFilterColumnExpression();
   } else {
     column = cbTmp.getColumn();
   }
   if (!filterval.trim().equals("")) {
     where = " where " + column + " in (" + filterval + ") ";
   }
   return where;
 }
예제 #3
0
  public void storeRoworder(ReportRequest rrequest, ReportBean rbean) {
    String rowordertype = rrequest.getStringAttribute(rbean.getId() + "_ROWORDERTYPE", "");
    if (rowordertype.equals("") || !Consts.lstAllRoworderTypes.contains(rowordertype)) return;

    String roworderparams = rrequest.getStringAttribute(rbean.getId() + "_ROWORDERPARAMS", "");
    if (roworderparams.equals("")) return;
    AbsListReportBean alrbean =
        (AbsListReportBean) rbean.getExtendConfigDataForReportType(AbsListReportType.KEY);
    IListReportRoworderPersistence lsObj = alrbean.getLoadStoreRoworderObject(); // 获取到读写行排序顺序值的类对象
    if (lsObj == null) lsObj = Config.default_roworder_object;
    List<Map<String, String>> lstColValusInAllRows =
        EditableReportAssistant.getInstance().parseSaveDataStringToList(roworderparams);
    if (lstColValusInAllRows.size() == 0) return;
    Map<String, String> mColValuesInRow = lstColValusInAllRows.get(0);
    log.debug("被排序记录行参数:" + mColValuesInRow);
    if (rowordertype.equals(Consts.ROWORDER_INPUTBOX)) {
      String newrowordervalue = rrequest.getStringAttribute(rbean.getId() + "_ROWORDERVALUE", "");
      lsObj.storeRoworderByInputbox(rrequest, rbean, mColValuesInRow, newrowordervalue);
    } else if (rowordertype.equals(Consts.ROWORDER_TOP)) {
      lsObj.storeRoworderByTop(rrequest, rbean, mColValuesInRow);
    } else {
      String direct = rrequest.getStringAttribute(rbean.getId() + "_ROWORDERDIRECT", "");
      String destrowParams = rrequest.getStringAttribute(rbean.getId() + "_DESTROWPARAMS", "");
      Map<String, String> mColValuesInDestRow = null;
      if (!destrowParams.trim().equals("")) {
        mColValuesInDestRow =
            EditableReportAssistant.getInstance().parseSaveDataStringToList(destrowParams).get(0);
        log.debug("目标位置记录行参数:" + mColValuesInDestRow);
      }
      if (rowordertype.equals(Consts.ROWORDER_DRAG)) {
        lsObj.storeRoworderByDrag(
            rrequest,
            rbean,
            mColValuesInRow,
            mColValuesInDestRow,
            direct.toLowerCase().trim().equals("true"));
      } else {
        lsObj.storeRoworderByArrow(
            rrequest,
            rbean,
            mColValuesInRow,
            mColValuesInDestRow,
            direct.toLowerCase().trim().equals("true"));
      }
    }
  }