Пример #1
0
 /**
  * 输出 javascript 树
  *
  * @param prefix js变量前缀,不能为空
  * @param w 输出对象,如jsp中的out
  * @param href 超链接,href中的/oid/会被替换为对象的oid属性
  * @param alwayClickable 始终可以点击
  * @throws IOException
  */
 public void output(String prefix, Writer w, String href, boolean alwayClickable)
     throws IOException {
   w.write("var " + prefix + " = new Ext.tree.TreeNode({\n" + "text: '" + getName() + "',\n");
   if (alwayClickable || isClickable())
     w.write("href: '" + href.replaceAll("/oid/", "" + getOid()) + "',\n");
   w.write("draggable:false" + "});\n");
   for (int i = 0; i < this.subItems.size(); i++) {
     TreeObject l = (TreeObject) this.subItems.get(i);
     l.output(prefix + "_" + i, w, href, alwayClickable);
     w.write(prefix + ".appendChild(" + prefix + "_" + i + ");\n");
   }
 };
Пример #2
0
 /**
  * 输出 javascript 树
  *
  * @param prefix js变量前缀,不能为空
  * @param w 输出对象,如jsp中的out
  * @param href 超链接,href中的/oid/会被替换为对象的oid属性
  * @throws IOException
  */
 public void output(String prefix, Writer w, String href) throws IOException {
   output(prefix, w, href, false);
 };