 
     # options.cssClass = "workspace-launcher"
     # options.partial  = "<span>+</span>"
-    options.cssClass  = "workspace-launcher vertical"
+    options.cssClass     = "workspace-launcher vertical"
 
     super options, data
 
-    @sessionKeys       = {}
-    @panel             = @getDelegate()
-    @workspace         = @panel.getDelegate()
-    @container         = new KDView cssClass: "workspace-floating-panes"
-    @keysRef           = @workspace.workspaceRef.child "floatingPaneKeys"
-    @isJoinedASession  = @workspace.getOptions().joinedASession
-    @lastActivePaneKey = null
+    @sessionKeys         = {}
+    @panel               = @getDelegate()
+    @workspace           = @panel.getDelegate()
+    @container           = new KDView cssClass: "workspace-floating-panes"
+    {workspaceRef}       = @workspace
+    @isJoinedASession    = @workspace.getOptions().joinedASession
+    @lastActivePaneKey   = null
+    @keysRef             = workspaceRef.child "floatingPaneKeys"
+    @paneStateRef        = workspaceRef.child "floatingPaneState"
+    @paneVisibilityState = chat: no, preview: no, terminal: no
 
     @panel.addSubView @container
 

  handleLaunch: (paneKey) ->
    pane = @[paneKey]
    if @lastActivePaneKey is paneKey
      @hidePane pane
    else
      lastActivePane = @getPaneByType @lastActivePaneKey
      @hidePane lastActivePane if lastActivePane
      @showPane pane, paneKey

  hidePane: (pane) ->
    pane.unsetClass "active"
    @lastActivePaneKey = null

  showPane: (pane, paneKey) ->
    return @chat.dock.emit "click"  if paneKey is "chat"
    pane.setClass "active"
    @lastActivePaneKey = paneKey

  createChatPane: ->
    @container.addSubView @chat = new ChatPane
      delegate : @panel.getDelegate()
      floating : yes

  createTerminalPane: ->
    terminalClass    = SharableTerminalPane

        @createPanes()
    else
      @createPanes()

    @paneStateRef.on "value", (snapshot) =>
      state  = snapshot.val()
      map    = @paneVisibilityState
      return unless state

      for own key, value of state
        pane = @getPaneByType key
        if value is no then @hidePane pane, key, no else @showPane pane, key, no

  click: ->
    @toggleClass "active"
