Пример #1
0
  /**
   * A tool has been removed. Batched removes will come through the toolsRemoved method.
   *
   * @param name The catalog name
   * @param group The toolGroup removed from
   */
  public void toolGroupRemoved(String name, ToolGroup group) {
    if (!name.equals(catalog.getName())) return;

    group.removeToolGroupListener(this);

    TreePath path = new TreePath(catalogRoot);
    Object[] children = new Object[1];
    int[] indicies = new int[1];

    ToolGroupTreeNode child = catalogRoot.getTreeNodeChild(group);
    int index = catalogRoot.getIndex(child);
    indicies[0] = index;
    children[0] = child;

    catalogRoot.remove(child);

    TreeModelEvent treeEvent = new TreeModelEvent(this, path, indicies, children);
    fireTreeNodesRemoved(treeEvent);
  }
Пример #2
0
  /**
   * A tool has been removed. Batched removes will come through the toolsRemoved method.
   *
   * @param evt The event that caused this method to be called
   */
  public void toolRemoved(ToolGroupEvent evt) {
    ToolGroup group = (ToolGroup) evt.getSource();
    SimpleTool tool = (SimpleTool) evt.getChild();

    TreePath path = buildTreePath(group);

    Object[] children = new Object[1];
    int[] indicies = new int[1];
    int index;

    ToolGroupTreeNode parent = (ToolGroupTreeNode) path.getLastPathComponent();
    ToolGroupTreeNode child = parent.getTreeNodeChild(tool);
    index = getIndexOfChild(parent, child);
    indicies[0] = index;
    children[0] = child;

    parent.remove(child);

    TreeModelEvent treeEvent = new TreeModelEvent(this, path, indicies, children);
    fireTreeNodesRemoved(treeEvent);
  }
Пример #3
0
  /**
   * A group of tool groups have been removed.
   *
   * @param name The catalog name
   * @param groups The list of tool groups that have been removed
   */
  public void toolGroupsRemoved(String name, List<ToolGroup> groups) {
    if (!name.equals(catalog.getName())) return;

    TreePath path = new TreePath(catalogRoot);
    Object[] children = new Object[groups.size()];
    int[] indicies = new int[groups.size()];

    for (int i = 0; i < groups.size(); i++) {
      ToolGroup group = groups.get(i);

      group.removeToolGroupListener(this);

      ToolGroupTreeNode child = catalogRoot.getTreeNodeChild(group);

      int index = catalogRoot.getIndex(child);
      indicies[i] = index;
      children[i] = child;

      catalogRoot.remove(child);
    }

    TreeModelEvent treeEvent = new TreeModelEvent(this, path, indicies, children);
    fireTreeNodesRemoved(treeEvent);
  }