Package com.aoindustries.swing
Class SynchronizingMutableTreeNode<E>
- java.lang.Object
-
- javax.swing.tree.DefaultMutableTreeNode
-
- com.aoindustries.swing.SynchronizingMutableTreeNode<E>
-
- All Implemented Interfaces:
Serializable,Cloneable,MutableTreeNode,TreeNode
public class SynchronizingMutableTreeNode<E> extends DefaultMutableTreeNode
When requested, it will recursively synchronize its children to an externally- provided tree. The is useful when the data source is obtained elsewhere and the tree-based component needs to be synchronized. Since these updates may occur while a user is manipulating the components, only the minimum number of changes to the elements is made. Thus selections and other aspects of the component remain intact. Most importantly, if nothing in the list has changed, the component is not changed.- Author:
- AO Industries, Inc.
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
-
-
Constructor Summary
Constructors Constructor Description SynchronizingMutableTreeNode()SynchronizingMutableTreeNode(Object userObject)SynchronizingMutableTreeNode(Object userObject, boolean allowsChildren)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsynchronize(DefaultTreeModel treeModel, Tree<E> tree)Synchronizes the children of this node with the roots of the provided tree while adding and removing only a minimum number of nodes.voidsynchronize(DefaultTreeModel treeModel, List<Node<E>> children)Synchronizes the children of this node with the provided children while adding and removing only a minimum number of nodes.-
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
-
-
-
-
Method Detail
-
synchronize
public void synchronize(DefaultTreeModel treeModel, Tree<E> tree) throws IOException, SQLException
Synchronizes the children of this node with the roots of the provided tree while adding and removing only a minimum number of nodes. Comparisons are performed using equals on the value objects. This must be called from the Swing event dispatch thread.- Throws:
IOExceptionSQLException
-
synchronize
public void synchronize(DefaultTreeModel treeModel, List<Node<E>> children) throws IOException, SQLException
Synchronizes the children of this node with the provided children while adding and removing only a minimum number of nodes. Comparisons are performed using equals on the value objects. This must be called from the Swing event dispatch thread.- Parameters:
children- If children is null, then doesn't allow children.- Throws:
IOExceptionSQLException
-
-