Package com.extjs.gxt.ui.client.widget.tree

Examples of com.extjs.gxt.ui.client.widget.tree.Tree


    });
    return treeLoader;
  }

  private final Tree createTree() {
    final Tree tree = new Tree();
    tree.setIndentWidth(10);
    tree.setCheckStyle(CheckCascade.CHILDREN);
    tree.setAnimate(false);
    TreeLoader<TreeNode> treeLoader = createTreeLoader();
    TreeStore<TreeNode> treeStore = new TreeStore<TreeNode>(treeLoader);
    treeBinder = new ViewTreeBinder(tree, treeStore, doImport);
    treeBinder.setDisplayProperty("name");
    treeBinder.setAutoSelect(true);
    treeBinder.setIconProvider(new ModelStringProvider<TreeNode>() {
      public String getStringValue(TreeNode model, String property) {
        XObject xObj = model.getXObject();
        return getTreeIconFor(xObj);
      }
    });
    if (isSingle) {
      tree.setSelectionMode(SelectionMode.SINGLE);
      treeBinder.addCheckListener(new CheckChangedListener(){
        private boolean currentlyProcessing = false;
       
        public void checkChanged(CheckChangedEvent event) {
          if (currentlyProcessing) {
View Full Code Here


      public boolean hasChildren(TreeNode data) {
        return data != null && data.getXObject() != null &&
               data.getXObject().hasChildren();
      }
    };
    final Tree reportsTree = createTree(treeLoader);
   
    ToolBar toolbar = new ToolBar();
    TextToolItem addFolder = new TextToolItem("", "icon-create-folder");
    addFolder.setToolTip(WPalo.i18n.reportNavigatorView_addFolderToolTip());
//        "Create new Folder");
    toolbar.add(addFolder);
   
    TextToolItem addSheet = new TextToolItem("", "icon-create-sheet");
    toolbar.add(addSheet);
    addSheet.setToolTip(WPalo.i18n.reportNavigatorView_addWorkbookTemplateToolTip());
//        "Create new Workbook Template");
    addSheet.addSelectionListener(new CreateNewSheet(reportsTree));
    TextToolItem addView = new TextToolItem("", "icon-create-view");
    addView.setToolTip(WPalo.i18n.reportNavigatorView_addAdhocViewTemplateToolTip());
//        "Create new AdHoc View Template");
    toolbar.add(addView);

    toolbar.add(new SeparatorToolItem());
    TextToolItem delItems = new TextToolItem("", "icon-delete");
    delItems.setToolTip(WPalo.i18n.reportNavigatorView_deleteItemsToolTip());
//        "Delete items");
    toolbar.add(delItems);
    delItems.addSelectionListener(new SelectionListener<ComponentEvent>(){
      public void componentSelected(ComponentEvent ce) {
      }
    });
    navigator.setTopComponent(toolbar);
   
    reportsTree.addListener(Events.OnClick, new Listener<BaseEvent>() {
      public void handleEvent(BaseEvent be) {
        TreeNode node = (TreeNode) reportsTree.getSelectedItem().getModel();
        if (node.getXObject() instanceof XView) {
          fireEvent(new AppEvent<TreeNode>(WPaloEvent.SHOW_TEMPLATE_VIEW, node));
        }     
      }     
    });
    reportsTree.addListener(Events.OnDoubleClick, new Listener<BaseEvent>(){
      public void handleEvent(BaseEvent be) {
        TreeNode node = (TreeNode) reportsTree.getSelectedItem().getModel();
        if (node.getXObject() instanceof XTemplate) {
          fireEvent(new AppEvent<TreeNode>(WPaloEvent.EDIT_TEMPLATE_ITEM, node));
        }
        else if (node.getXObject() instanceof XView) {
          fireEvent(new AppEvent<TreeNode>(WPaloEvent.EDIT_TEMPLATE_VIEW, node));
View Full Code Here

    Workbench wb = (Workbench)Registry.get(Workbench.ID);
    wb.addToViewPanel(navigator);
  }

  private final Tree createTree(TreeLoader<TreeNode> loader) {
    Tree tree = new Tree();
    tree.setIndentWidth(6);
    store = new TreeStore<TreeNode>(loader);
    TreeBinder<TreeNode> binder = new TreeNodeBinder(tree, store);
    binder.setDisplayProperty("name");
    binder.setAutoSelect(true);
    binder.addSelectionChangedListener(new SelectionChangedListener<ModelData>() {
View Full Code Here

    ViewModeWorkbench wb = (ViewModeWorkbench)Registry.get(ViewModeWorkbench.ID);
    wb.addToViewPanel(navigator);
  }
 
  private final Tree createTree(TreeLoader<TreeNode> loader) {
    Tree tree = new Tree();
    tree.setIndentWidth(6);
    store = new TreeStore<TreeNode>(loader);
    TreeBinder<TreeNode> binder = new TreeNodeBinder(tree, store, this);
    binder.setDisplayProperty("name");
    binder.setAutoSelect(true);
    return tree;
View Full Code Here

    root = new AdminTreeModel(forUser).getRoot();
    Dispatcher.forwardEvent(WPaloEvent.EXPANDED_ADMIN_SECTION, root);       
  }

  private final Tree createTree(TreeLoader<TreeNode> loader) {
    final Tree tree = new Tree();
    tree.setIndentWidth(1);
    treeStore = new TreeStore<TreeNode>(loader);
    TreeBinder<TreeNode> binder = new TreeNodeBinder(tree, treeStore);
    binder.setDisplayProperty("name");
    binder.setAutoSelect(true);
    binder.setIconProvider(new ModelStringProvider<TreeNode>() {
      public final String getStringValue(TreeNode model, String property) {
        String icon = null;
        String type = model.getXObject().getType();
        if(type.equals(XConstants.TYPE_USERS_NODE))
          icon = "icon-folder";
        else if(type.equals(XConstants.TYPE_GROUPS_NODE))
          icon = "icon-folder";
        else if(type.equals(XGroup.TYPE))
          icon = "icon-group";
        else if(type.equals(XUser.TYPE))
          icon = "icon-user";
        else if (type.equals(XRole.TYPE))
          icon =" icon-role2";

        return icon;
      }
    });
    binder.addSelectionChangedListener(new SelectionChangedListener<ModelData>() {
      public void selectionChanged(SelectionChangedEvent<ModelData> se) {
        TreeNode node = (TreeNode) se.getSelectedItem(); // single selection
        if (node != null && node.getXObject() != null) {
          String type = node.getXObject().getType();
          int eventType = -1;

          if (type.equals(XUser.TYPE))
            eventType = WPaloEvent.EDIT_USER_ITEM;
          else if (type.equals(XGroup.TYPE))
            eventType = WPaloEvent.EDIT_GROUP_ITEM;
          else if (type.equals(XRole.TYPE))
            eventType = WPaloEvent.EDIT_ROLE_ITEM;

          if (eventType > -1) {
            del.setEnabled(true);
            return;
          }
        }
        del.setEnabled(false);
      }
    });
    tree.addListener(Events.OnDoubleClick, new Listener<BaseEvent>() {
      public void handleEvent(BaseEvent be) {     
        TreeNode node = (TreeNode) tree.getSelectedItem().getModel(); // single selection
        if (node != null && node.getXObject() != null) {
          String type = node.getXObject().getType();
          int eventType = -1;

          if (type.equals(XUser.TYPE))
View Full Code Here

      public boolean hasChildren(TreeNode data) {
        return data != null && data.getXObject() != null &&
               data.getXObject().hasChildren();
      }
    };
    Tree usersTree = createTree(treeLoader);
    navigator.add(usersTree);
    usersTree.setStyleName("tree-style");
   
    Workbench wb = (Workbench)Registry.get(Workbench.ID);
    wb.addToViewPanel(navigator);
  }
View Full Code Here

    Workbench wb = (Workbench)Registry.get(Workbench.ID);
    wb.addToViewPanel(navigator);
  }

  private final Tree createTree(TreeLoader<TreeNode> loader) {
    Tree tree = new Tree();
    tree.setIndentWidth(6);
    TreeStore<TreeNode> store = new TreeStore<TreeNode>(loader);
    TreeBinder<TreeNode> binder = new TreeNodeBinder(tree, store);
    binder.setDisplayProperty("name");
    //binder.setAutoSelect(true);
    binder.addSelectionChangedListener(new SelectionChangedListener<ModelData>() {
View Full Code Here

    if (item == null) {
      clearStyles(event);
      return;
    }
    if (event.getDropTarget().component == event.getDragSource().component) {
      Tree source = (Tree) event.getDragSource().component;
      TreeItem sel = source.getSelectedItem();
      List<TreeItem> children = sel.getItems(true);
      if (children.contains(item)) {
        clearStyles(event);
        return;
      }
View Full Code Here

      }))
    
      window.setBottomComponent(buttons);
     
      // tree
      tree = new Tree();
    window.add(tree);

    // add doubleclick listener
    tree.addListener(Events.OnDoubleClick, new Listener<TreeEvent>(){
      public void handleEvent(TreeEvent be) {
View Full Code Here

    if (item == null) {
      event.status.setStatus(false);
      return;
    }
    if (event.target.component == event.source.component) {
      Tree source = (Tree) event.source.component;
      TreeItem sel = source.getSelectedItem();
      List<TreeItem> children = sel.getItems(true);
      if (children.contains(item)) {
        event.status.setStatus(false);
        return;
      }
View Full Code Here

TOP

Related Classes of com.extjs.gxt.ui.client.widget.tree.Tree

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.