dsto.dfc.swing.tree
Interface DfcTreeModel

All Superinterfaces:
TreeModel
All Known Implementing Classes:
AbstractDfcTreeModel, CommandViewTreeModel, CustomizersTreeModel, DefaultDfcTreeModel, DfcSwingTreeModel

public interface DfcTreeModel
extends TreeModel

Extends the JFC TreeModel to include capabilities such as adding and removing entries plus copy and paste support.

Version:
$Revision$

Method Summary
 void addEntry(Object parent, Object entry, int index)
          Add a child to parent at a given index.
 boolean canAddEntry(Object parent, Object entry, int index)
          Test if a child can be added at a given index.
 boolean canCopyEntry(Object entry)
          Test if an entry may be copied into a transferable.
 boolean canMoveEntry(Object entry, Object newParent, int newIndex)
           
 boolean canPasteEntry(Object parent, int index, Transferable transferable)
          Test if a transferable may be pasted.
 boolean canRemoveEntry(Object entry)
          Test if an entry may be removed.
 Transferable copyEntry(Object entry)
          Copy an entry into a transferable.
 Object getParent(Object entry)
          Get the parent for a given entry, or null if the entry is the root.
 Object[] getPathForEntry(Object entry)
          Get the path for a given entry.
 boolean isMutable()
          True if the tree can be changed.
 void moveEntry(Object entry, Object newParent, int newIndex)
          Move a child from one location to another.
 void pasteEntry(Object parent, int index, Transferable transferable)
          Paste transferable data into the tree.
 void removeEntry(Object entry)
          Remove an entry and any children.
 
Methods inherited from interface javax.swing.tree.TreeModel
addTreeModelListener, getChild, getChildCount, getIndexOfChild, getRoot, isLeaf, removeTreeModelListener, valueForPathChanged
 

Method Detail

isMutable

boolean isMutable()
True if the tree can be changed. The can* methods indicate what operations are permitted.


getParent

Object getParent(Object entry)
Get the parent for a given entry, or null if the entry is the root.


getPathForEntry

Object[] getPathForEntry(Object entry)
Get the path for a given entry.

Returns:
the path for the entry or null if entry does not exist in the tree.

canAddEntry

boolean canAddEntry(Object parent,
                    Object entry,
                    int index)
Test if a child can be added at a given index.

Parameters:
parent - The parent entry.
entry - The child entry.
index - The index to add the child at. Use -1 to add child at end.

addEntry

void addEntry(Object parent,
              Object entry,
              int index)
              throws UnsupportedOperationException,
                     IndexOutOfBoundsException
Add a child to parent at a given index.

Parameters:
parent - The parent entry.
entry - The child entry.
index - The index to add the child at. Use -1 to add child at end.
Throws:
UnsupportedOperationException
IndexOutOfBoundsException

canRemoveEntry

boolean canRemoveEntry(Object entry)
Test if an entry may be removed.


removeEntry

void removeEntry(Object entry)
                 throws UnsupportedOperationException
Remove an entry and any children.

Throws:
UnsupportedOperationException

canMoveEntry

boolean canMoveEntry(Object entry,
                     Object newParent,
                     int newIndex)

moveEntry

void moveEntry(Object entry,
               Object newParent,
               int newIndex)
               throws UnsupportedOperationException,
                      IndexOutOfBoundsException
Move a child from one location to another. In the case where the old and new parents are the same, newIndex refers to the index space before any changes has been made.

Throws:
UnsupportedOperationException
IndexOutOfBoundsException

canPasteEntry

boolean canPasteEntry(Object parent,
                      int index,
                      Transferable transferable)
Test if a transferable may be pasted.

Parameters:
parent - The parent entry to paste at.
index - The index of the new entry in parent (may be -1 to add last).
transferable - The data to paste.

pasteEntry

void pasteEntry(Object parent,
                int index,
                Transferable transferable)
                throws UnsupportedOperationException,
                       UnsupportedFlavorException,
                       CloneNotSupportedException,
                       IOException
Paste transferable data into the tree.

Parameters:
parent - The parent entry to paste at.
index - The index of the new entry in parent (may be -1 to add last).
transferable - The data to paste.
Throws:
UnsupportedOperationException
UnsupportedFlavorException
CloneNotSupportedException
IOException

canCopyEntry

boolean canCopyEntry(Object entry)
Test if an entry may be copied into a transferable.

Parameters:
entry - The entry to copy.

copyEntry

Transferable copyEntry(Object entry)
                       throws UnsupportedOperationException,
                              CloneNotSupportedException
Copy an entry into a transferable.

Parameters:
entry - The entry to copy.
Throws:
UnsupportedOperationException
CloneNotSupportedException


Copyright © 2008 Commonwealth of Australia