Class Tree<M,​C>

    • Method Detail

      • collapseAll

        public void collapseAll()
        Collapses all nodes.
      • expandAll

        public void expandAll()
        Expands all nodes.
      • findNode

        public Tree.TreeNode<M> findNode​(com.google.gwt.dom.client.Element target)
        Returns the tree node for the given target.
        Parameters:
        target - the target element
        Returns:
        the tree node or null if no match
      • findNode

        public Tree.TreeNode<M> findNode​(M model)
        Returns the tree node for the given model.
        Parameters:
        model - the model
        Returns:
        the tree node or null if no match
      • focus

        public void focus()
        Description copied from class: Component
        Try to focus this widget.
        Overrides:
        focus in class Component
      • getAppearance

        public Tree.TreeAppearance getAppearance()
        Returns the tree appearance.
        Returns:
        the tree appearance
      • getCell

        public com.google.gwt.cell.client.Cell<C> getCell()
        Return the tree's cell.
        Returns:
        the cell
      • getChecked

        public Tree.CheckState getChecked​(M model)
        Returns the models checked state.
        Parameters:
        model - the model
        Returns:
        the check state
      • getCheckedSelection

        public List<M> getCheckedSelection()
        Returns the current checked selection. Only items that have been rendered will be returned in this list. Set setAutoLoad(boolean) to true to fully render the tree to receive all checked items in the tree.
        Specified by:
        getCheckedSelection in interface CheckProvider<M>
        Returns:
        the checked selection
      • getCheckNodes

        public Tree.CheckNodes getCheckNodes()
        Returns the child nodes value which determines what node types have a check box. Only applies when check boxes have been enabled ( setCheckable(boolean).
        Returns:
        the child nodes value
      • getCheckStyle

        public Tree.CheckCascade getCheckStyle()
        The check cascade style value which determines if check box changes cascade to parent and children.
        Returns:
        the check cascade style
      • getIconProvider

        public IconProvider<M> getIconProvider()
        Returns the model icon provider.
        Returns:
        the icon provider
      • getSelectionModel

        public TreeSelectionModel<M> getSelectionModel()
        Returns the tree's selection model.
        Returns:
        the selection model
      • getStore

        public TreeStore<M> getStore()
        Returns the tree's store.
        Returns:
        the store
      • getTreeStore

        public TreeStore<M> getTreeStore()
        Returns the tree's store.
        Returns:
        the store
        Since:
        4.0.3
      • getStyle

        public TreeStyle getStyle()
        Returns the tree style.
        Returns:
        the tree style
      • getView

        public TreeView<M> getView()
        Returns the tree's view.
        Returns:
        the view
      • isAutoExpand

        public boolean isAutoExpand()
        Returns true if auto expand is enabled.
        Returns:
        the auto expand state
      • isAutoLoad

        public boolean isAutoLoad()
        Returns true if auto load is enabled.
        Returns:
        the auto load state
      • isAutoSelect

        public boolean isAutoSelect()
        Returns true if select on load is enabled.
        Returns:
        the auto select state
      • isBufferedRender

        public boolean isBufferedRender()
        Returns true if buffered rendering is enabled.
        Returns:
        true for buffered rendering
      • isCaching

        public boolean isCaching()
        Returns true when a loader is queried for it's children each time a node is expanded. Only applies when using a loader with the tree store.
        Returns:
        true if caching
      • isCheckable

        public boolean isCheckable()
        Returns true if check boxes are enabled.
        Returns:
        the check box state
      • isChecked

        public boolean isChecked​(M model)
        Description copied from interface: CheckProvider
        Returns true if the model is checked.
        Specified by:
        isChecked in interface CheckProvider<M>
        Parameters:
        model - the model
        Returns:
        the check state
      • isExpanded

        public boolean isExpanded​(M model)
        Returns true if the model is expanded.
        Parameters:
        model - the model
        Returns:
        true if expanded
      • isExpandOnFilter

        public boolean isExpandOnFilter()
        Returns the if expand all and collapse all is enabled on filter changes.
        Returns:
        the expand all collapse all state
      • isLeaf

        public boolean isLeaf​(M model)
        Returns true if the model is a leaf node. The leaf state allows a tree item to specify if it has children before the children have been realized.
        Parameters:
        model - the model
        Returns:
        the leaf state
      • isTrackMouseOver

        public boolean isTrackMouseOver()
        Returns true if nodes are highlighted on mouse over.
        Returns:
        true if enabled
      • onBrowserEvent

        public void onBrowserEvent​(com.google.gwt.user.client.Event event)
        Specified by:
        onBrowserEvent in interface com.google.gwt.user.client.EventListener
        Overrides:
        onBrowserEvent in class Component
      • refresh

        public void refresh​(M model)
      • scrollIntoView

        public void scrollIntoView​(M model)
        Scrolls the tree to ensure the given model is visible.
        Parameters:
        model - the model to scroll into view
      • setAutoExpand

        public void setAutoExpand​(boolean autoExpand)
        If set to true, all non leaf nodes will be expanded automatically (defaults to false).
        Parameters:
        autoExpand - the auto expand state to set.
      • setAutoLoad

        public void setAutoLoad​(boolean autoLoad)
        Sets whether all children should automatically be loaded recursively (defaults to false). Useful when the tree must be fully populated when initially rendered.
        Parameters:
        autoLoad - true to auto load
      • setAutoSelect

        public void setAutoSelect​(boolean autoSelect)
        True to select the first model after the store's data changes (defaults to false).
        Parameters:
        autoSelect - true to auto select
      • setBufferedRender

        public void setBufferedRender​(boolean bufferRender)
        True to only render tree nodes that are in view (defaults to false). Set this to true when dealing with very large trees.
        Parameters:
        bufferRender - true to buffer render
      • setCaching

        public void setCaching​(boolean caching)
        Sets whether the children should be cached after first being retrieved from the store (defaults to true). When false, a load request will be made each time a node is expanded.
        Parameters:
        caching - the caching state
      • setCell

        public void setCell​(com.google.gwt.cell.client.Cell<C> cell)
        Sets the tree's cell.
        Parameters:
        cell - the cell
      • setCheckable

        public void setCheckable​(boolean checkable)
        Sets whether check boxes are used in the tree (defaults to false).
        Parameters:
        checkable - true for check boxes
      • setChecked

        public void setChecked​(M item,
                               Tree.CheckState checked)
        Sets the check state of the item. The checked state will only be set for nodes that have been rendered, setAutoLoad(boolean) can be used to render all children.
        Parameters:
        item - the item
        checked - the check state
      • setCheckedSelection

        public void setCheckedSelection​(List<M> selection)
        Description copied from interface: CheckProvider
        Sets the current checked selection.
        Specified by:
        setCheckedSelection in interface CheckProvider<M>
        Parameters:
        selection - the checked selection
      • setCheckNodes

        public void setCheckNodes​(Tree.CheckNodes checkNodes)
        Sets which tree items will display a check box (defaults to BOTH).

        Valid values are:

        • BOTH - both nodes and leafs
        • PARENT - only nodes with children
        • LEAF - only leafs
        Parameters:
        checkNodes - the child nodes value
      • setCheckStyle

        public void setCheckStyle​(Tree.CheckCascade checkStyle)
        Sets the cascading behavior for check tree (defaults to PARENTS). When using CHILDREN, it is important to note that the cascade will only be applied to rendered nodes. setAutoLoad(boolean) can be used to fully render the tree on render.

        Valid values are:

        • NONE - no cascading
        • PARENTS - cascade to parents
        • CHILDREN - cascade to children
        Parameters:
        checkStyle - the child style
      • setExpanded

        public void setExpanded​(M model,
                                boolean expand)
        Sets the item's expand state.
        Parameters:
        model - the model
        expand - true to expand
      • setExpanded

        public void setExpanded​(M model,
                                boolean expand,
                                boolean deep)
        Sets the item's expand state.
        Parameters:
        model - the model
        expand - true to expand
        deep - true to expand all children recursively
      • setExpandOnFilter

        public void setExpandOnFilter​(boolean expandOnFilter)
        Sets whether the tree should expand all and collapse all when filters are applied (defaults to true).
        Parameters:
        expandOnFilter - true to expand and collapse on filter changes
      • setIconProvider

        public void setIconProvider​(IconProvider<M> iconProvider)
        Sets the tree's model icon provider which provides the icon style for each model.
        Parameters:
        iconProvider - the icon provider
      • setLeaf

        public void setLeaf​(M model,
                            boolean leaf)
        Sets the item's leaf state. The leaf state allows control of the expand icon before the children have been realized.
        Parameters:
        model - the model
        leaf - the leaf state
      • setLoader

        public void setLoader​(TreeLoader<M> loader)
        Sets the tree loader.
        Parameters:
        loader - the loader
      • setSelectionModel

        public void setSelectionModel​(TreeSelectionModel<M> sm)
        Sets the tree's selection model.
        Parameters:
        sm - the selection model
      • setStore

        public void setStore​(TreeStore<M> store)
        Assigns a new store to the tree. May be null, in which case the tree must not be attached to the dom. All selection is lost when this takes place and items are re-rendered.
        Parameters:
        store - the new store to bind to, or null to detach from the store
      • setStyle

        public void setStyle​(TreeStyle style)
        Sets the tree style.
        Parameters:
        style - the tree style
      • setTrackMouseOver

        public void setTrackMouseOver​(boolean trackMouseOver)
        True to highlight nodes when the mouse is over (defaults to true).
        Parameters:
        trackMouseOver - true to highlight nodes on mouse over
      • setView

        public void setView​(TreeView<M> view)
        Sets the tree's view. Only needs to be called when customizing the tree's presentation.
        Parameters:
        view - the view
      • toggle

        public void toggle​(M model)
        Toggles the model's expand state. If the model is not visible, does nothing.
        Parameters:
        model - the model
      • redraw

        public void redraw()
        Since:
        4.0.3
      • redraw

        public void redraw​(M parent)
        Completely redraws the children of the given parent (or all items if parent is null), throwing away details like currently expanded nodes, etc. Not designed to be used to update nodes, look into refresh(Object) or Store.update(Object).
        Parameters:
        parent - the parent of the items to redraw