예제 #1
0
 public static void treeDataBind(TreeAction ta) {
   String id = ta.getParam("ID");
   ZCFullTextSchema ft = new ZCFullTextSchema();
   ft.setID(id);
   if (XString.isEmpty(id)) {
     ta.getParams().put("CatalogType", OperateType.INSERT);
     Catalog.treeDataBind(ta);
   } else {
     ft.fill();
     if (!ft.getRelaText().equalsIgnoreCase("-1")) {
       ta.getParams().put("IDs", ft.getRelaText());
     }
   }
   if ("Article".equals(ta.getParam("Type"))) {
     ta.getParams().put("CatalogType", OperateType.INSERT);
     Catalog.treeDataBind(ta);
   }
   if ("Image".equals(ta.getParam("Type"))) {
     ta.getParams().put("CatalogType", 4);
     ImageLib.treeDataBind(ta);
   }
   if ("Video".equals(ta.getParam("Type"))) {
     ta.getParams().put("CatalogType", OperateType.DELETE_AND_BACKUP);
     VideoLib.treeDataBind(ta);
   }
   if ("Audio".equals(ta.getParam("Type"))) {
     ta.getParams().put("CatalogType", 6);
     AudioLib.treeDataBind(ta);
   }
   if ((ta.getDataSource() != null) && (XString.isEmpty(ta.getParam("ParentID")))) {
     DataTable dt = ta.getDataSource();
     dt.insertRow(new Object[dt.getColCount()], 0);
     dt.set(0, 0, "-1");
     dt.set(0, 1, "0");
     dt.set(0, 2, "1");
     dt.set(0, 3, "<font class='red'>全部</font>");
     DataRow dr = dt.getDataRow(0);
     TreeItem root = ta.getItem(0);
     TreeItem item = new TreeItem();
     item.setData(dr);
     item.setAction(ta);
     item.setID(dr.getString(ta.getIdentifierColumnName()));
     item.setParentID(root.getID());
     item.setLevel(root.getLevel() + 1);
     item.setParent(root);
     item.setIcon("Icons/treeicon09.gif");
     item.setLast(false);
     try {
       item.parseHtml(ta.getItemInnerHtml(dr));
     } catch (Exception e) {
       e.printStackTrace();
     }
     ta.getItemList().add(1, item);
     if ("Article".equals(ta.getParam("Type"))) {
       List items = ta.getItemList();
       for (int i = 1; i < items.size(); i++) {
         item = (TreeItem) items.get(i);
         if ("Y".equals(item.getData().getString("SingleFlag")))
           item.setIcon("Icons/treeicon11.gif");
       }
     }
   }
 }