org.netbeans.spi.viewmodel/2 1.32.1

org.netbeans.spi.viewmodel
Interface ReorderableTreeModelFilter

All Superinterfaces:
Model, TreeModelFilter

public interface ReorderableTreeModelFilter
extends TreeModelFilter

Filters an original tree data model that supports reordering of child nodes. The created Node will contain an implementation of Index in it's lookup if canReorder(org.netbeans.spi.viewmodel.ReorderableTreeModel, java.lang.Object) returns true.

Since:
1.25

Method Summary
 boolean canReorder(ReorderableTreeModel original, Object parent)
          Provide if this filter implementation can reorder children nodes.
 void reorder(ReorderableTreeModel original, Object parent, int[] perm)
          Reorder children nodes with a given permutation.
 
Methods inherited from interface org.netbeans.spi.viewmodel.TreeModelFilter
addModelListener, getChildren, getChildrenCount, getRoot, isLeaf, removeModelListener
 

Method Detail

canReorder

boolean canReorder(ReorderableTreeModel original,
                   Object parent)
                   throws UnknownTypeException
Provide if this filter implementation can reorder children nodes.

Parameters:
original - The original ReorderableTreeModel
parent - The parent node of children that are test for reorder
Returns:
true if this model can handle reordering of children, false otherwise
Throws:
UnknownTypeException - if this model implementation is not able to decide the reorder capability for given node type

reorder

void reorder(ReorderableTreeModel original,
             Object parent,
             int[] perm)
             throws UnknownTypeException
Reorder children nodes with a given permutation.

Parameters:
parent - The parent node of children that are being reordered
perm - permutation with the length of current child nodes. The permutation lists the new positions of the original nodes, that is, for nodes [A,B,C,D] and permutation [0,3,1,2], the final order would be [A,C,D,B].
Throws:
IllegalArgumentException - if the permutation is not valid
UnknownTypeException - if this model implementation is not able to perform the reorder for given node type

org.netbeans.spi.viewmodel/2 1.32.1

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.