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

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


    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


    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

    }
    deleteItem.setEnabled(true);
  }
 
  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);
    binder.addSelectionChangedListener(new SelectionChangedListener<ModelData>() {
View Full Code Here

    });
    return toolbar;   
  }
 
  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

//    toolbar.add(delFolder);
    return toolbar;   
  }
 
  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

    LayoutContainer panel = new LayoutContainer();
    panel.setLayout(new RowLayout());
    panel.add(new LabelField(constants.views() + ":"));
    LayoutContainer treePanel = new LayoutContainer();
    selectionTree = new ViewSelectionTree(importViews, false);
    Tree viewTree = selectionTree.getTree();
    viewTree.setCheckable(true);
//    treePanel.setSize(210, 200);
    treePanel.setWidth("100%");
    treePanel.setHeight(200);
    treePanel.setBorders(true);
    treePanel.setScrollMode(Scroll.AUTOY);
View Full Code Here

      }
    }   
  }
 
  private final Tree createTree(XUser user, TreeLoader<TreeNode> loader) {
    final Tree tree = new Tree();
    tree.setIndentWidth(18);
    tree.setSelectionMode(SelectionMode.SINGLE);
    TreeStore<TreeNode> treeStore = new TreeStore<TreeNode>(loader);
    treeBinder = new TreeNodeBinder(tree, treeStore);
    treeBinder.setDisplayProperty("name");
    treeBinder.setAutoSelect(true);
    treeBinder.init();
    // tree model:
    browserModel = new ViewBrowserModel(user, treeStore);
    tree.addListener(Events.SelectionChange, new Listener<BaseEvent>() {
      public void handleEvent(BaseEvent be) {
        TreeItem selection = tree.getSelectedItem();
        if (selection == null) {
          if (deleteItem != null) {
            deleteItem.setEnabled(false);
            deleteItem.setIconStyle("icon-delete-off");
          }
          if (renameItem != null) {
            renameItem.setEnabled(false);
          }
          if (editViewProperties != null) {
            editViewProperties.setEnabled(false);
          }
          if (createDirectLink != null) {
            createDirectLink.setEnabled(false);
          }
        } else {
          checkSelection(tree);
        }
      }
    });
    tree.addListener(Events.OnClick, new Listener<BaseEvent>() {
      public void handleEvent(BaseEvent be) {
        checkSelection(tree);       
      }
    });

    tree.addListener(Events.OnDoubleClick, new Listener<TreeEvent>() {
      public void handleEvent(TreeEvent be) {
        handleAction(OPEN);
      }
    });
    tree.addListener(Events.OnKeyUp, new Listener<TreeEvent>() {
      public void handleEvent(TreeEvent te) {
        if (te.getKeyCode() == F2) {
          handleAction(RENAME);
        }
      }
    });
    String sessionId = ((Workbench)Registry.get(Workbench.ID)).getUser().getSessionId();
    WPaloFolderServiceProvider.getInstance().hasWritePermission(sessionId,
        new Callback<Boolean>() {
          public void onSuccess(Boolean result) {
            if (result) {
              addDragAndDrop(treeBinder);
            }
          }
        });

   
    tree.setContextMenu(createContextMenu());
    tree.getRootItem().setExpanded(true);

    return tree;
  }
View Full Code Here

      }
    );                       
  }

  private final void addDragAndDrop(final TreeBinder<TreeNode> binder) {
    final Tree tree = binder.getTree();
    // D 'n' D:
    TreeDragSource dragSource = new TreeDragSource(binder);
    dragSource.addDNDListener(new DNDListener() {
      @SuppressWarnings("unchecked")
      public void dragStart(DNDEvent e) {
        List selection = (List) e.data;
        if (!isValid(selection)) {
          e.doit = false;
          e.status.setStatus(false);
        }
      }
    });

    TreeDropTarget dropTarget = new TreeDropTarget(binder);
    dropTarget.setAllowSelfAsSource(true);
    dropTarget.setFeedback(Feedback.APPEND);
    dropTarget.setOperation(Operation.MOVE);
    dropTarget.addDNDListener(new DNDListener() {
      public void dragDrop(final DNDEvent e) {
        final TreeItem target = tree.findItem(e.getTarget());
        if (target != null) {
          XObject wrappedObj = browserModel.getWrappedXObject((TreeNode) target.getModel());
          if (wrappedObj instanceof XStaticFolder) {
            dropToStaticFolder((XStaticFolder) wrappedObj, target, e);
          }           
View Full Code Here

    root = new AccountTreeModel(forUser).getRoot();
    Dispatcher.forwardEvent(WPaloEvent.EXPANDED_ACCOUNT_SECTION, root);
  }

  private final Tree createTree(TreeLoader<TreeNode> loader) {
    final Tree tree = new Tree();
    tree.setIndentWidth(6);   
    treeStore = new TreeStore<TreeNode>(loader);
    TreeBinder<TreeNode> binder = new TreeNodeBinder(tree, treeStore);
    binder.setDisplayProperty("name");
    binder.setAutoSelect(true);
    binder.setIconProvider(new ModelStringProvider<TreeNode>() {
      public String getStringValue(TreeNode model, String property) {
        String icon = null;
        String type = model.getXObject().getType();
        if(type.equals(XConstants.TYPE_ACCOUNTS_NODE)) {
          icon = "icon-folder";
        } else if(type.equals(XConstants.TYPE_CONNECTIONS_NODE)) {
          icon = "icon-folder";
        } else if(type.equals(XAccount.class.getName())) {
          icon = "icon-account";
        } else if(type.equals(XConnection.class.getName())) {
          icon = "icon-connection";
        }
        return icon;
      }
    });
    binder.addSelectionChangedListener(new SelectionChangedListener<ModelData>() {
      public void selectionChanged(SelectionChangedEvent<ModelData> se) {
        TreeNode node = (TreeNode) se.getSelectedItem();
        if (node != null && node.getXObject() != null) {
          String type = node.getXObject().getType();
          int eventType = -1;
          if (type.equals(XAccount.class.getName()))
            eventType = WPaloEvent.EDIT_ACCOUNT_ITEM;
          else if (type.equals(XConnection.class.getName()))
            eventType = WPaloEvent.EDIT_CONNECTION_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(XAccount.class.getName()))
            eventType = WPaloEvent.EDIT_ACCOUNT_ITEM;
View Full Code Here

    LayoutContainer panel = new LayoutContainer();
    panel.setLayout(new RowLayout());
    panel.add(new LabelField(constants.views() + ":"));
    LayoutContainer treePanel = new LayoutContainer();
    selectionTree = new ViewSelectionTree(false, true);
    Tree viewTree = selectionTree.getTree();
    viewTree.setCheckable(true);
//    treePanel.setSize(210, 200);
    treePanel.setWidth("100%");
    treePanel.setHeight(230);
    treePanel.setBorders(true);
    treePanel.setScrollMode(Scroll.AUTOY);
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.