     @on 'focusin', => @makeActive()
     @on 'focusout', => @autosaveActiveItem()
 
+  # Private:
   afterAttach: (onDom) ->
     if @focusOnAttach and onDom
       @focusOnAttach = null

PaneRow = require 'pane-row'
PaneColumn = require 'pane-column'

module.exports =
class Pane extends View

  ### Internal ###
  @acceptsDocuments: true

  @content: (wrappedView) ->

          @viewsByItem.set(item, view)
      view

  # Private:
  viewForActiveItem: ->
    @viewForItem(@activeItem)

  # Private:
  serialize: ->
    state = @state.clone()
    state.set('items', item.serialize() for item, index in @items)
    state.set('focused', @is(':has(:focus)'))
    state

  # Private:
  getState: -> @state

  # Private:
  adjustDimensions: -> # do nothing

  # Private:
  horizontalGridUnits: -> 1

  # Private:
  verticalGridUnits: -> 1

  # Public: Creates a new pane above with a copy of the currently focused item.
  splitUp: (items...) ->
    @split(items, 'column', 'before')

  # Public: Creates a new pane below with a copy of the currently focused item.
  splitDown: (items...) ->
    @split(items, 'column', 'after')

  # Public: Creates a new pane left with a copy of the currently focused item.
  splitLeft: (items...) ->
    @split(items, 'row', 'before')

  # Public: Creates a new pane right with a copy of the currently focused item.
  splitRight: (items...) ->
    @split(items, 'row', 'after')

  # Private:
  split: (items, axis, side) ->
    PaneContainer = require 'pane-container'

