private void initDisplayComponentObj() {
   if (this.componentid == null
       || this.componentid.trim().equals("")
       || this.componentid.equals(
           this.ownerComponentObj.getConfigBean().getId())) { // 如果指定的是显示本组件的相应部分
     this.displayComponentObj = this.ownerComponentObj;
     return;
   }
   IComponentType componentObj =
       rrequest.getComponentTypeObj(this.componentid.trim(), null, false);
   if (componentObj == null) {
     throw new WabacusRuntimeException(
         "页面" + rrequest.getPagebean().getId() + "下不存在id为" + componentid + "的组件");
   }
   this.displayComponentObj = (AbsComponentType) componentObj;
   if (rrequest.getShowtype() == Consts.DISPLAY_ON_PAGE) {
     if (this.displayComponentObj instanceof AbsReportType) {
       ReportBean rbDisplay = (ReportBean) this.displayComponentObj.getConfigBean();
       if (rbDisplay.isSlaveReportDependsonListReport()) {
         throw new WabacusRuntimeException(
             rbDisplay.getPath()
                 + "是从报表,不能在id为"
                 + this.ownerComponentObj.getConfigBean().getPath()
                 + "的组件的动态模板中显示它的内容");
       }
     }
     if (this.ownerComponentObj instanceof AbsReportType) {
       ReportBean rbOwner = (ReportBean) this.ownerComponentObj.getConfigBean();
       if (rbOwner.isSlaveReportDependsonListReport()) {
         throw new WabacusRuntimeException(rbOwner.getPath() + "是从报表,不能其动态模板中显示其它组件的内容");
       }
     }
   }
 }
Exemple #2
0
 public String getColLabelWithOrderBy(ColBean cbean, ReportRequest rrequest, String dynlabel) {
   String ordercolumn = cbean.getColumn();
   String label = rrequest.getI18NStringValue(dynlabel);
   label = label == null ? "" : label.trim();
   if (rrequest.getShowtype() != Consts.DISPLAY_ON_PAGE) return label;
   if (ordercolumn == null || ordercolumn.trim().equals("")) return label;
   String[] orderbys =
       (String[]) rrequest.getAttribute(cbean.getReportBean().getId(), "ORDERBYARRAY");
   String arrow = "";
   String order = "asc";
   if (orderbys != null && orderbys.length == 2) {
     if (orderbys[0].equalsIgnoreCase(ordercolumn)) {
       arrow =
           " <img src='"
               + Config.webroot
               + "/webresources/skin/"
               + rrequest.getPageskin()
               + "/images/";
       if (orderbys[1] == null || orderbys[1].equalsIgnoreCase("desc")) {
         arrow = arrow + "desc.gif'>";
         order = "asc";
       } else {
         arrow = arrow + "asc.gif'>";
         order = "desc";
       }
     }
   }
   arrow = Tools.replaceAll(arrow, "//", "/");
   StringBuffer resultBuf = new StringBuffer();
   resultBuf.append("<span onmouseover=\"this.style.cursor='pointer';\" onclick=\"");
   resultBuf
       .append("try{clickorderby(this,'")
       .append(ordercolumn)
       .append("||")
       .append(order)
       .append("');}catch(e){logErrorsAsJsFileLoad(e);}\">");
   resultBuf.append(label).append(arrow);
   resultBuf.append("</span>");
   return resultBuf.toString();
 }