Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.TreeItem


            }
        }
    }

    public void onOpen(OpenEvent<TreeItem> event) {
        final TreeItem node = event.getTarget();
        if ( ExplorerNodeConfig.TEST_SCENARIOS_ROOT_ID.equals( itemWidgets.get( node ) ) ) {
            RepositoryServiceFactory.getPackageService().listPackages( new GenericCallback<PackageConfigData[]>() {
                public void onSuccess(PackageConfigData[] conf) {
                    node.removeItems();
                    removeTestScenarioIDs( itemWidgets );

                    for (int i = 0; i < conf.length; i++) {
                        final PackageConfigData c = conf[i];
                        TreeItem pkg = new TreeItem( Util.getHeader( images.packages(),
                                c.name ) );

                        node.addItem( pkg );
                        pkg.setUserObject( c );
                        itemWidgets.put( pkg,
                                ExplorerNodeConfig.TEST_SCENARIOS_ID );
                    }
                }
            } );
        } else if ( ExplorerNodeConfig.ANALYSIS_ROOT_ID.equals( itemWidgets.get( node ) ) ) {
            RepositoryServiceFactory.getPackageService().listPackages( new GenericCallback<PackageConfigData[]>() {
                public void onSuccess(PackageConfigData[] conf) {
                    node.removeItems();
                    removeAnalysisIDs( itemWidgets );
                    for (int i = 0; i < conf.length; i++) {
                        final PackageConfigData c = conf[i];
                        TreeItem pkg = new TreeItem( Util.getHeader( images.packages(),
                                c.name ) );

                        node.addItem( pkg );
                        pkg.setUserObject( c );
                        itemWidgets.put( pkg,
                                ExplorerNodeConfig.ANALYSIS_ID );
                    }
                }
            } );
View Full Code Here


    }

    private void removeTestScenarioIDs(Map<TreeItem, String> itemWidgets) {
        for (Iterator<Map.Entry<TreeItem, String>> it = itemWidgets.entrySet().iterator(); it.hasNext(); ) {
            Map.Entry<TreeItem, String> entry = it.next();
            TreeItem item = entry.getKey();
            String id = entry.getValue();
            if ( ExplorerNodeConfig.TEST_SCENARIOS_ID.equals( id ) ) {
                it.remove();
            }
        }
View Full Code Here

    }

    private void removeAnalysisIDs(Map<TreeItem, String> itemWidgets) {
        for (Iterator<Map.Entry<TreeItem, String>> it = itemWidgets.entrySet().iterator(); it.hasNext(); ) {
            Map.Entry<TreeItem, String> entry = it.next();
            TreeItem item = entry.getKey();
            String id = entry.getValue();
            if ( ExplorerNodeConfig.ANALYSIS_ID.equals( id ) ) {
                it.remove();
            }
        }
View Full Code Here

        ExplorerNodeConfig.setupDeploymentTree( mainTree,
                itemWidgets );
    }

    public void onSelection(SelectionEvent<TreeItem> event) {
        TreeItem item = event.getSelectedItem();

        if ( item.getUserObject() instanceof SnapshotPlace ) {
            clientFactory.getPlaceController().goTo( (SnapshotPlace) item.getUserObject() );
        }
    }
View Full Code Here

            clientFactory.getPlaceController().goTo( (SnapshotPlace) item.getUserObject() );
        }
    }

    public void onOpen(OpenEvent<TreeItem> event) {
        final TreeItem node = event.getTarget();
        if ( ExplorerNodeConfig.PACKAGE_SNAPSHOTS.equals( itemWidgets.get( node ) ) ) {
            return;
        }
        if ( node.getUserObject() instanceof PackageConfigData ) {
            final PackageConfigData packageConfigData = (PackageConfigData) node.getUserObject();

            RepositoryServiceFactory.getPackageService().listSnapshots(
                    packageConfigData.name,
                    new GenericCallback<SnapshotInfo[]>() {
                        public void onSuccess(SnapshotInfo[] snaps) {
                            node.removeItems();
                            for (final SnapshotInfo snapInfo : snaps) {
                                TreeItem snap = new TreeItem( snapInfo.getName() );
                                snap.setUserObject( new SnapshotPlace( packageConfigData.name, snapInfo.getName() ) );
                                node.addItem( snap );
                            }
                        }
                    } );
        }
View Full Code Here

        };

        for (int i = 0; i < adminStructure.length; i++) {

            Object[] packageData = adminStructure[i];
            TreeItem localChildNode = new TreeItem(Util.getHeader((ImageResource) packageData[1], (String) packageData[0]));
            itemWidgets.put(localChildNode, (String) packageData[2]);

            addItem(localChildNode);
        }
    }
View Full Code Here

    super();

    // Add an open handler to have a lazy loading treeview
    addOpenHandler(new OpenHandler<TreeItem>() {
          public void onOpen(OpenEvent<TreeItem> event) {
              TreeItem item = event.getTarget();
              if (item.getState() && item.getChildCount() == 1) {

            Node node = (Node) item.getUserObject();
            loadChildren(item, node.getId() + ExplorerConstants.JSON_TREE_REQUEST_EXTENSION);

            // Remove the temporary item when we finish loading
            item.getChild(0).remove();

          }


            }
View Full Code Here

    });
  }

  public void populate() {
    root = new TreeItem(constants.rootItemDescription());
//    try {
//
//            SessionInfo info = (SessionInfo)   this.getClass().getClassLoader().loadClass("org.apache.sling.explorer.client.sling.SessionInfo").newInstance();
//
//            root = new TreeItem(info.getUser());
View Full Code Here

      Node node = new Node(jsonObject.get("id").isString().stringValue(),
          jsonObject.get("leaf").isBoolean().booleanValue(),
          jsonObject.get("text").isString().stringValue());
      if (node.getText() != null) {
        TreeItem item = new TreeItem();
        item.setText(node.getText());
        item.setUserObject(node);
        if (!node.isLeaf())
          item.addItem(""); // Temporarily add an item so we can expand this node

        treeItem.addItem(item);

      }
    }
View Full Code Here

  private TreeItem add(TreeItem parent, TreeType type) {
    if (type == TreeType.TEXT) {
      return parent.addItem("text");
    } else if (type == TreeType.HTML) {
      TreeItem item = new TreeItem();
      item.setHTML("<h1>html</h1>");
      parent.addItem(item);
      return item;
    } else if (type == TreeType.CHECKBOX) {
      return parent.addItem(new CheckBox("myBox"));
    } else {
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.TreeItem

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.