Class TreeControl

    • Field Detail

      • ROOT_NODE_DISPLAYED_PROPERTY

        public static final java.lang.String ROOT_NODE_DISPLAYED_PROPERTY
        The bound property of whether the root node is displayed.
      • TREE_NODE_DRAG_ENABLED_PROPERTY

        public static final java.lang.String TREE_NODE_DRAG_ENABLED_PROPERTY
        The bound property of whether the tree node components have dragging enabled.
    • Constructor Detail

      • TreeControl

        public TreeControl()
        Default constructor with a default tree model.
      • TreeControl

        public TreeControl​(TreeModel treeModel)
        Tree model constructor.
        Parameters:
        treeModel - The component tree model.
        Throws:
        java.lang.NullPointerException - if the given tree model is null.
    • Method Detail

      • getTreeModel

        protected TreeModel getTreeModel()
        Returns:
        The tree model used by this component.
      • isTreeNodeDragEnabled

        public boolean isTreeNodeDragEnabled()
        Returns:
        Whether the tree node component have dragging enabled.
      • setTreeNodeDragEnabled

        public void setTreeNodeDragEnabled​(boolean newTreeNodeDragEnabled)
        Sets whether the tree node components have dragging enabled. This is a bound property of type Boolean.
        Parameters:
        newTreeNodeDragEnabled - true if each tree node component should allow dragging, else false.
        See Also:
        TREE_NODE_DRAG_ENABLED_PROPERTY
      • setRootNodeDisplayed

        public void setRootNodeDisplayed​(boolean newRootNodeDisplayed)
        Sets whether the root node is displayed. This is a bound property of type Boolean. If the root is requested not to be displayed, the root is automatically expanded.
        Parameters:
        newRootNodeDisplayed - true if the root node should be displayed, else false.
        See Also:
        ROOT_NODE_DISPLAYED_PROPERTY, TreeNodeModel.setExpanded(boolean)
      • setTreeNodeRepresentationStrategy

        public <V> TreeControl.TreeNodeRepresentationStrategy<? super V> setTreeNodeRepresentationStrategy​(java.lang.Class<V> valueClass,
                                                                                                           TreeControl.TreeNodeRepresentationStrategy<? super V> treeNodeRepresentationStrategy)
        Installs the given tree node representation strategy to produce representation components for the given value class.
        Type Parameters:
        V - The type of value to represent.
        Parameters:
        valueClass - The class of value with which the strategy should be associated.
        treeNodeRepresentationStrategy - The strategy for generating components to represent values of the given type.
        Returns:
        The representation strategy previously associated with the given value type.
      • getTreeNodeRepresentationStrategy

        public <V> TreeControl.TreeNodeRepresentationStrategy<? super V> getTreeNodeRepresentationStrategy​(java.lang.Class<V> valueClass)
        Returns the given tree node representation strategy assigned to produce representation components for the given value class.
        Type Parameters:
        V - The type of value to represent.
        Parameters:
        valueClass - The class of value with which the strategy should be associated.
        Returns:
        The strategy for generating components to represent values of the given type, or null if there is no associated representation strategy.
        See Also:
        TreeControl.DefaultValueRepresentationStrategy
      • setRootNode

        public void setRootNode​(TreeNodeModel<?> newRootNode)
        Sets the root node of the tree model. This is a bound property.

        If the this control requests that the root not be displayed, this implementation automatically expanded the root node after it is added. This is a bound property.

        Specified by:
        setRootNode in interface TreeModel
        Parameters:
        newRootNode - The new root node of the tree model.
        See Also:
        TreeModel.ROOT_NODE_PROPERTY
      • setAllExpanded

        public void setAllExpanded​(boolean newAllExpanded)
        Description copied from interface: TreeModel
        Sets whether all tree nodes are expanded. This method delegates to the root node TreeNodeModel.setAllExpanded(boolean).
        Specified by:
        setAllExpanded in interface TreeModel
        Parameters:
        newAllExpanded - true if all the nodes should be expanded, or false if they should be collapsed.
      • performAction

        public void performAction​(int force,
                                  int option)
        Description copied from interface: ActionModel
        Performs the action with the given force and option. An ActionEvent is fired to all registered ActionListeners.
        Specified by:
        performAction in interface ActionModel
        Parameters:
        force - The zero-based force, such as 0 for no force or 1 for an action initiated by from a mouse single click.
        option - The zero-based option, such as 0 for an event initiated by a mouse left button click or 1 for an event initiated by a mouse right button click.
      • fireActionPerformed

        protected void fireActionPerformed​(int force,
                                           int option)
        Fires an action event to all registered action listeners. This method delegates to fireActionPerformed(ActionEvent).
        Parameters:
        force - The zero-based force, such as 0 for no force or 1 for an action initiated by from a mouse single click.
        option - The zero-based option, such as 0 for an event initiated by a mouse left button click or 1 for an event initiaged by a mouse right button click.
        See Also:
        ActionListener, ActionEvent
      • fireActionPerformed

        protected void fireActionPerformed​(ActionEvent actionEvent)
        Fires a given action event to all registered action listeners.
        Parameters:
        actionEvent - The action event to fire.