Package com.extjs.gxt.ui.client.data

Examples of com.extjs.gxt.ui.client.data.LoadEvent


              private int index = 0;
              private int size = kids.size();

              public boolean execute() {
                if (index >= size) {
                  LoadEvent le = new LoadEvent(null, parentNode);
//                  ((Workbench) Registry.get(Workbench.ID)).hideWaitCursor();
                  tree.loaded(le);
                  return false;
                }
                TreeNode tn = kids.get(index);
                XObject xObj = tn.getXObject();

                String name;
                String image = "";
                if (xObj instanceof XElementNode) {
                  int count = ((XElementNode) xObj)
                      .getChildCount();
                  image = "<img paddingTop=\"2px\" width=\"16\" height=\"14\" src=\"icons/element_";
                  XElementType xElemType =     
                    ((XElementNode) xObj).getElement().getElementType();
                  if (XElementType.CONSOLIDATED.equals(xElemType)) {
                    image += "con2.png\">&nbsp;";
                  } else if (XElementType.NUMERIC.equals(xElemType)) {
                    image += "num2.png\">&nbsp;";
                  } else if (XElementType.STRING.equals(xElemType)) {
                    image += "str2.png\">&nbsp;";
                  } else {
                    image = "";
                  }
                  name = count == 0 ? xObj.getName() : xObj
                      .getName()
                      + " <i><font color=\"gray\">("
                      + count + ")</i></font>";
                } else {
                  name = xObj.getName();
                }

                SelectingFastMSTreeItem item = new SelectingFastMSTreeItem(image + name, tree);
               
                if (tn.hasChildren()) {
                  item.becomeInteriorNode();
                  parents.put(tn, item);
                }
                item.setModel(tn);
                HasFastMSTreeItems parentItem = tree;
                if (tn.getParent() != null) {
                  FastMSTreeItem pItem = parents.get(tn.getParent());
                  if (pItem != null) {
                    parentItem = pItem;
                  }
                }
                parentItem.fastAddItem(item);
                index++;
                if (index >= size) {
                  LoadEvent le = new LoadEvent(null, parentNode);
//                  ((Workbench) Registry.get(Workbench.ID)).hideWaitCursor();
                  tree.loaded(le);
                }
                return index < size;
              }
View Full Code Here


      public void onSuccess(final List <TreeNode> kids) {
        DeferredCommand.addCommand(new IncrementalCommand() {         
          private int index = 0;
          public boolean execute() {   
            if (index >= kids.size()) {
              LoadEvent le = new LoadEvent(null, parentNode);
              tree.loaded(le);
              ((Workbench)Registry.get(Workbench.ID)).hideWaitCursor();
              return false;
            }

            XObject xObj = kids.get(index).getXObject();
            String name;
            String image = "";
            if (xObj instanceof XElementNode) {
              image = "<img paddingTop=\"2px\" width=\"16\" height=\"14\" src=\"icons/element_";
              XElementType xElemType =     
                ((XElementNode) xObj).getElement().getElementType();
              if (XElementType.CONSOLIDATED.equals(xElemType)) {
                image += "con2.png\">&nbsp;";
              } else if (XElementType.NUMERIC.equals(xElemType)) {
                image += "num2.png\">&nbsp;";
              } else if (XElementType.STRING.equals(xElemType)) {
                image += "str2.png\">&nbsp;";
              } else {
                image = "";
              }
              int count = ((XElementNode) xObj).getChildCount();
              name = count == 0 ? xObj.getName() : xObj.getName() + " <i><font color=\"gray\">(" + count + ")</i></font>";
              ((XElementNode) xObj).setAxisHierarchyId(hierarchyId, viewId);
            } else {
              name = xObj.getName();
            }

            FastMSTreeItem item = new FastMSTreeItem(image + name) {
              public void ensureChildren() {
                loadChildren(this, getModel());
              }
            };
            if (kids.get(index).hasChildren()) {
              item.becomeInteriorNode();
            }
            item.setModel(kids.get(index));
            parentItem.addItem(item);
            if (item.getParentItem() != null &&
                item.getParentItem().getModel() != null) {
              item.getParentItem().getModel().addChild(kids.get(index));
            }
            index++;
            if (item.getParentItem() != null) {
              if (item.getParentItem().getFinishHandler() != null && index >= kids.size()) {
                item.getParentItem().getFinishHandler().onSuccess(null);
              }             
            }
            if (index >= kids.size()) {
              LoadEvent le = new LoadEvent(null, parentNode);
              tree.loaded(le);
              ((Workbench)Registry.get(Workbench.ID)).hideWaitCursor();
            }
            return index < kids.size();
          }
View Full Code Here

TOP

Related Classes of com.extjs.gxt.ui.client.data.LoadEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.