   ###
   expand: ->
     if @collapsible and @collapsed and not @_collapseTransitioning
-      @collapsed = false
-      setCollapseFlag @
-      @prefixedClasses.remove COLLAPSED_CLS
-      @prefixedClasses.add EXPANDING_CLS
-
-      increaseParentTreeHeight = (tree, h) ->
-        if not tree then return
-        tree.increaseHeight h
-        if tree.parent.parent and tree.parent.parent.collapsible
-          increaseParentTreeHeight tree.parent.parent, h
-
-      @_getDescendantsHeight().then (h) =>
-        promises = []
-        @children.get(TREE_TAG_NAME).every (tree) ->
-          promises.push tree.expand()
-        Promise.all(promises).then =>
-          transitionHelper 'expand', @
-          if @_targetTree then increaseParentTreeHeight(@parent, h)
-
+      @_expand()
     else
       Promise.fulfilled()
 



  ###*
  # Updates the "collapsible" display state of this item.
  #
  # @method _updateCollapsible
  # @memberof stout-ui/tree/TreeItemView#
  # @private
  ###
  _updateCollapsible: ->

    # Update collapsed and collapsable classes based on child trees.
    @prefixedClasses.remove COL_CLS, COLLAPSED_CLS

    if @children.get(TREE_TAG_NAME).length > 0 and @collapsible

      if @collapsed
        @collapsed = false
        @collapse()
      else
        @expand()

      @prefixedClasses.add COL_CLS

    if @collapsed and @collapsible



  ###*
  # Collapses child trees and their descendants. This method doesn't do any
  # checking to determine if a collpase should be "allowed" or not.
  #
  # @method _collapse
  # @memberof stout-ui/tree/TreeItemView#
  # @private
  ###
  _collapse: ->
    @collapsed = true
    setCollapseFlag @
    @prefixedClasses.remove EXPANDING_CLS
    @prefixedClasses.add COLLAPSING_CLS

    reduceParentTreeHeight = (tree, h) ->
      if not tree then return
      tree.reduceHeight h
      if tree.parent.parent and tree.parent.parent.collapsible
        reduceParentTreeHeight tree.parent.parent, h

    @_getDescendantsHeight().then (h) =>
      promises = []
      @children.get(TREE_TAG_NAME).every (tree) ->
        promises.push tree.collapse()
      Promise.all(promises).then =>
        transitionHelper 'collapse', @
        if @_targetTree then reduceParentTreeHeight(@parent, h)


  ###*
  # Expands child trees and their descendants. This method doesn't do any
  # checking to determine if an expand should be "allowed" or not.
  #
  # @method _expand
  # @memberof stout-ui/tree/TreeItemView#
  ###
  _expand: ->
    @collapsed = false
    setCollapseFlag @
    @prefixedClasses.remove COLLAPSED_CLS
    @prefixedClasses.add EXPANDING_CLS

    increaseParentTreeHeight = (tree, h) ->
      if not tree then return
      tree.increaseHeight h
      if tree.parent.parent and tree.parent.parent.collapsible
        increaseParentTreeHeight tree.parent.parent, h

    @_getDescendantsHeight().then (h) =>
      promises = []
      @children.get(TREE_TAG_NAME).every (tree) ->
        promises.push tree.expand()
      Promise.all(promises).then =>
        transitionHelper 'expand', @
        if @_targetTree then increaseParentTreeHeight(@parent, h)


  ###*
  # Opens the child tree of this tree item, if it is currently collapsed and
  # is collapsible.
  #
