Class BaseTreeNode

    • Constructor Detail

      • BaseTreeNode

        public BaseTreeNode()
        Creates a tree node that has no parent and no children, but which allows children.
      • BaseTreeNode

        public BaseTreeNode​(Object userObject)
        Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified user object.
        Parameters:
        userObject - an Object provided by the user that constitutes the node's data
      • BaseTreeNode

        public BaseTreeNode​(Object userObject,
                            boolean allowsChildren)
        Creates a tree node with no parent, no children, initialized with the specified user object, and that allows children only if specified.
        Parameters:
        userObject - an Object provided by the user that constitutes the node's data
        allowsChildren - if true, the node is allowed to have child nodes -- otherwise, it is always a leaf node
    • Method Detail

      • toTransferable

        public Transferable toTransferable()
        Turns the node/userObject into a transferable string.
        Returns:
        the generated string
      • getTransferDataFlavors

        public DataFlavor[] getTransferDataFlavors()
        Returns an array of DataFlavor objects indicating the flavors the data can be provided in. The array should be ordered according to preference for providing the data (from most richly descriptive to least descriptive).
        Specified by:
        getTransferDataFlavors in interface Transferable
        Returns:
        an array of data flavors in which this data can be transferred
      • isDataFlavorSupported

        public boolean isDataFlavorSupported​(DataFlavor flavor)
        Returns whether or not the specified data flavor is supported for this object.
        Specified by:
        isDataFlavorSupported in interface Transferable
        Parameters:
        flavor - the requested flavor for the data
        Returns:
        boolean indicating whether or not the data flavor is supported
      • toPlainText

        public String toPlainText()
        Returns the plain text representation of this node.

        Default implementation simply returns DefaultMutableTreeNode.toString().
        Returns:
        the string representation
      • getChildren

        public List<BaseTreeNode> getChildren()
        Returns the children as list.
        Returns:
        the children as list