       @setClass 'edit-mode'
       @titleInput.setValue title
       @titleInput.setFocus()
+      windowController.addLayer this
     else
       @unsetClass 'edit-mode'
+      windowController.removeLayer this
 
 
   setTitle: (newTitle) ->

  setTitleEditMode: (isEditMode) ->

    { title } = @getOptions()

    if isEditMode
      return  unless @isEditable and @getWidth() >= MIN_EDIT_WIDTH

    view.addSubView @titleInput

    @on 'dblclick', @lazyBound 'setTitleEditMode', yes
    @on 'ReceivedClickElsewhere', @lazyBound 'setTitleEditMode', no


  setDraggable: ->
