Пример #1
0
 public static void treeDataBind(TreeAction ta) {
   String SiteID = ApplicationPage.getCurrentSiteID() + "";
   DataTable dt = null;
   Mapx params = ta.getParams();
   String CatalogType = (String) params.get("Type");
   String parentLevel = (String) params.get("ParentLevel");
   String parentID = (String) params.get("ParentID");
   String rootText = "";
   if (CatalogType.equals("1")) rootText = "文档库";
   else if (CatalogType.equals("4")) rootText = "图片库";
   else if (CatalogType.equals("5")) rootText = "视频库";
   else if (CatalogType.equals("6")) rootText = "音频库";
   else if (CatalogType.equals("7")) {
     rootText = "附件库";
   }
   if (ta.isLazyLoad()) {
     QueryBuilder qb =
         new QueryBuilder(
             "select ID,ParentID,TreeLevel,Name,SingleFlag,prop1 from ZCCatalog Where Type =? and SiteID =? and TreeLevel>? and innerCode like ? order by orderflag");
     qb.add(CatalogType);
     qb.add(SiteID);
     qb.add(parentLevel);
     qb.add(CatalogUtil.getInnerCode(parentID) + "%");
     dt = qb.executeDataTable();
   } else {
     QueryBuilder qb =
         new QueryBuilder(
             "select ID,ParentID,TreeLevel,Name,SingleFlag,prop1 from ZCCatalog Where Type =? and SiteID=? and TreeLevel-1<=? order by orderflag");
     qb.add(CatalogType);
     qb.add(SiteID);
     qb.add(ta.getLevel());
     dt = qb.executeDataTable();
   }
   ta.setRootText(rootText);
   dt.setWebMode(false);
   ta.bindData(dt);
   if (CatalogType.equals("1")) {
     List items = ta.getItemList();
     for (int i = 1; i < items.size(); i++) {
       TreeItem item = (TreeItem) items.get(i);
       if ("Y".equals(item.getData().getString("SingleFlag")))
         item.setIcon("Icons/treeicon11.gif");
     }
   }
 }