Class DOMTreeModel

    • Constructor Detail

      • DOMTreeModel

        public DOMTreeModel()
        Creates a new instance of DOMTreeModel
    • Method Detail

      • setDocument

        public void setDocument​(Document doc)
        Set DOM Document
        Parameters:
        doc - The DOM Document
      • getDocument

        public Document getDocument()
        Return DOM Document
        Returns:
        DOM Document
      • setNodeFilter

        public void setNodeFilter​(NodeFilter nodeFilter)
        NodeFilter which is used by TreeWalker, default is null It refreshes the tree.
        Parameters:
        nodeFilter - The NodeFilter
      • getNodeFilter

        public NodeFilter getNodeFilter()
        Return NodeFilter
        Returns:
        NodeFilter
      • buildTree

        protected MutableTreeNode buildTree​(TreeWalker tw)
        buildTree implementation. It is recursiverly walkthrough the passed TreeWalker
        Parameters:
        tw - The TreeWalker
        Returns:
        MutableTreeNode
      • isLeaf

        public boolean isLeaf​(Object node)
        Returns whether the specified node is a leaf node.
        Specified by:
        isLeaf in interface TreeModel
        Overrides:
        isLeaf in class DefaultTreeModel
        Parameters:
        node - the node to check
        Returns:
        true if the node is a leaf node
      • valueForPathChanged

        public void valueForPathChanged​(TreePath path,
                                        Object newValue)
        This sets the user object of the TreeNode identified by path and posts a node changed. If you use custom user objects in the TreeModel you're going to need to subclass this and set the user object of the changed node to something meaningful.
        Specified by:
        valueForPathChanged in interface TreeModel
        Overrides:
        valueForPathChanged in class DefaultTreeModel
        Parameters:
        path - path to the node that the user has altered
        newValue - the new value from the TreeCellEditor
      • reload

        public void reload​(TreeNode node)
        Invoke this method if you've modified the TreeNodes upon which this model depends. The model will notify all of its listeners that the model has changed below the node node.
        Overrides:
        reload in class DefaultTreeModel
        Parameters:
        node - The node to reload
      • getTreeNode

        public TreeNode getTreeNode​(Node domNode)
      • getDOMNode

        public Node getDOMNode​(TreeNode treeNode)
      • moveNodeUp

        public void moveNodeUp​(TreeNode node)
      • moveNodeDown

        public void moveNodeDown​(TreeNode node)
      • removeNode

        public void removeNode​(TreeNode node)
      • domNodeHandleEvent

        protected void domNodeHandleEvent​(Event evt)
        Detect the change in DOM document and update the TreeModel accordingly
        Parameters:
        evt - The dom Event