Package com.sencha.gxt.core.shared

Examples of com.sencha.gxt.core.shared.FastSet


      // If allowed to drop only nodes or both, then we need to remove items from the list
      // that also have their parents being dragged
      ModelKeyProvider<? super M> kp = getWidget().getStore().getKeyProvider();
     
      // Start by looking for all selected non-leaf items
      FastSet nonLeafKeys = new FastSet();
      for (M item : selected) {
        if (getWidget().isLeaf(item)) {
          // While we're at it, if we're only allowed nodes, cancel if we see a leaf
          if (treeSource == TreeSource.NODE) {
            event.setCancelled(true);
            return;
          }
        } else {
          nonLeafKeys.add(kp.getKey(item));
        }
      }
     
      // Walking backward (so we can remove as we go) through the list of all selected items, for
      // each item, check if it has a parent already in the list.
      // Clearly that parent is a non-leaf, so will be in the set we established in the last loop
      // Note: see TreeGridDragSource it's similar
      for (int i = selected.size() - 1; i >= 0; i--) {
        // TODO consider tracking these parents, and if they are part of another
        // parent, adding them to the keyset
        M parent = selected.get(i);
        while ((parent = getWidget().getStore().getParent(parent)) != null) {
          // If we find that this item's parent is also selected, then we can skip this item
          if (nonLeafKeys.contains(kp.getKey(parent))) {
            selected.remove(i);
            break;
          }
        }
      }
View Full Code Here


      // If allowed to drop only nodes or both, then we need to remove items from the list
      // that also have their parents being dragged
      ModelKeyProvider<? super M> kp = getWidget().getTreeStore().getKeyProvider();

      // Start by looking for all selected non-leaf items
      FastSet nonLeafKeys = new FastSet();
      for (M item : selected) {
        if (getWidget().isLeaf(item)) {
          // While we're at it, if we're only allowed nodes, cancel if we see a leaf
          if (treeGridSource == TreeSource.NODE) {
            event.setCancelled(true);
            return;
          }
        } else {
          nonLeafKeys.add(kp.getKey(item));
        }
      }

      // Walking backward (so we can remove as we go) through the list of all selected items, for
      // each item, check if it has a parent already in the list.
      // Clearly that parent is a non-leaf, so will be in the set we established in the last loop
      for (int i = selected.size() - 1; i >= 0; i--) {
        // TODO consider tracking these parents, and if they are part of another
        // parent, adding them to the keyset
        M parent = selected.get(i);
        if (parent == null) { // EXTGWT-2692
          selected.remove(i);
        } else {
          while ((parent = getWidget().getTreeStore().getParent(parent)) != null) {
            // If we find that this item's parent is also selected, then we can skip this item
            if (nonLeafKeys.contains(kp.getKey(parent))) {
              selected.remove(i);
              break;
            }
          }
        }
View Full Code Here

    }
  }

  protected Set<String> getSet(TreeState state) {
    if (state.getExpandedKeys() == null) {
      state.setExpandedKeys(new FastSet());
    }
    return state.getExpandedKeys();
  }
View Full Code Here

          return;
        }
      }
    } else {
      ModelKeyProvider<? super M> kp = getWidget().getStore().getKeyProvider();
      FastSet nonLeafKeys = new FastSet();
      for (M item : selected) {
        if (getWidget().isLeaf(item)) {
          if (treeSource == TreeSource.NODE) {
            event.setCancelled(true);
            return;
          }
        } else {
          nonLeafKeys.add(kp.getKey(item));
        }
      }
      for (int i = selected.size() - 1; i >= 0; i--) {
        // TODO consider tracking these parents, and if they are part of another
        // parent, adding them to the keyset
        M parent = selected.get(i);
        while ((parent = getWidget().getStore().getParent(parent)) != null) {
          if (nonLeafKeys.contains(kp.getKey(parent))) {
            selected.remove(i);
          }
        }
      }
      for (M item : selected) {
View Full Code Here

          return;
        }
      }
    } else {
      ModelKeyProvider<? super M> kp = getWidget().getTreeStore().getKeyProvider();
      FastSet nonLeafKeys = new FastSet();
      for (M item : selected) {
        if (getWidget().isLeaf(item)) {
          if (treeGridSource == TreeSource.NODE) {
            event.setCancelled(true);
            return;
          }
        } else {
          nonLeafKeys.add(kp.getKey(item));
        }
      }
      for (int i = selected.size() - 1; i >= 0; i--) {
        // TODO consider tracking these parents, and if they are part of another
        // parent, adding them to the keyset
        M parent = selected.get(i);
        while ((parent = getWidget().getTreeStore().getParent(parent)) != null) {
          if (nonLeafKeys.contains(kp.getKey(parent))) {
            selected.remove(i);
          }
        }
      }
      for (M item : selected) {
View Full Code Here

    }
  }

  protected Set<String> getSet(TreeState state) {
    if (state.getExpandedKeys() == null) {
      state.setExpandedKeys(new FastSet());
    }
    return state.getExpandedKeys();
  }
View Full Code Here

  public ListStore(ModelKeyProvider<? super M> keyProvider) {
    super(keyProvider);
    visibleItems = allItems = new ArrayList<M>();

    if (ListStore.class.desiredAssertionStatus()) {
      debugKeys = new FastSet();
    }
  }
View Full Code Here

    }
    return newMap;
  }

  public Collection<String> getPropertyNames() {
    Set<String> set = new FastSet();
    if (map != null) {
      set.addAll(map.keySet());
    }
    return set;
  }
View Full Code Here

TOP

Related Classes of com.sencha.gxt.core.shared.FastSet

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.