コード例 #1
0
  private XMLTreeLoader initPreviewHack(final XMLTreeLoader loader) {
    loader.addListener(
        new TreeLoaderListener() {

          @Override
          public void onLoadException(TreeLoader self, TreeNode node, String response) {
            // TODO Auto-generated method stub
          }

          @Override
          public void onLoad(TreeLoader self, TreeNode node, String response) {

            GQuery gqueryNode = $(".x-tree-node-anchor");
            for (int i = 0; i < gqueryNode.length(); i++) {
              Element element = gqueryNode.get(i);
              if (element.getAttribute("target").trim() != "" && element.hasAttribute("target")) {
                GWT.log("attaching preview to target" + element.getAttribute("target"));
                if (element.hasChildNodes()) {
                  String id = ((Element) element.getChild(0)).getId();
                  ((Element) element.getChild(0)).removeAttribute("qtip");
                  if (id == null) {
                    GWT.log("could not attach to child because of false structure");
                  } else {
                    GWT.log("attaching preview to id " + id);
                    NativeContext.showPreview(
                        element.getAttribute("target"), ".region-content", "#" + id);
                    // Competence_webapp.showPreview(
                    // element.getAttribute("target"),
                    // ".region-main", "#" + id);
                  }
                }
              }
            }
            // gqueryNode.after("hello people");
          }

          @Override
          public boolean doBeforeLoad(TreeLoader self, TreeNode node) {
            return true;
          }
        });
    return loader;
  }
コード例 #2
0
  protected XMLTreeLoader initXMLLoader() {
    final XMLTreeLoader loader = new XMLTreeLoader();
    loader.setDataUrl(databaseConnectionString);
    loader.setMethod(Connection.GET);
    loader.setRootTag("userTrees");
    loader.setFolderTitleMapping("@name");
    loader.setFolderTag("activity");
    loader.setLeafTitleMapping("@name");
    loader.setLeafTag("activityEntry");
    // loader.setQtipMapping("@treetipp");
    loader.setDisabledMapping("@disabled");
    loader.setCheckedMapping("@checked");
    loader.setIconMapping("@icon");
    // loader.setHrefMapping("moodleUrl");
    loader.setHrefTargetMapping("moodleUrl");

    return initPreviewHack(loader);
  }