コード例 #1
0
ファイル: StyleGroupSet.java プロジェクト: rossjudson/gs-core
  /**
   * Remove an element from the group set. If the group becomes empty after the element removal,
   * depending on the setting of {@link #areEmptyGroupRemoved()}, the group is deleted or kept.
   * Keeping groups allows to handle faster elements that constantly appear and disappear.
   *
   * @param element The element to remove.
   */
  public void removeElement(Element element) {
    String gid = getElementGroup(element);
    StyleGroup group = groups.get(gid);

    if (group != null) {
      group.removeElement(element);
      removeElementFromReverseSearch(element);

      if (removeEmptyGroups && group.isEmpty()) removeGroup(group);
    }
  }
コード例 #2
0
ファイル: StyleGroupSet.java プロジェクト: rossjudson/gs-core
  /**
   * Remove or keep groups that becomes empty, if true the groups are removed. If this setting was
   * set to false, and is now true, the group set is purged of the empty groups.
   *
   * @param on If true the groups will be removed.
   */
  public void setRemoveEmptyGroups(boolean on) {
    if (removeEmptyGroups == false && on == true) {
      Iterator<? extends StyleGroup> i = groups.values().iterator();

      while (i.hasNext()) {
        StyleGroup g = i.next();

        if (g.isEmpty()) i.remove();
      }
    }

    removeEmptyGroups = on;
  }