     for pane,index in @panes
       result = index if pane is aPane
     result
-  
+
   #NAVIGATING
   showPaneByIndex:(index)->
     @showPane @getPaneByIndex index
-  
+
   showPaneByName:(name)->
     @showPane @getPaneByName name
-    
+
   showNextPane:->
     activePane  = @getActivePane()
     activeIndex = @getPaneIndex activePane
     @showPane @getPaneByIndex activeIndex + 1
-    
+
   showPreviousPane:->
     activePane  = @getActivePane()
     activeIndex = @getPaneIndex activePane
     @showPane @getPaneByIndex activeIndex - 1
-    
+
 
   #MODIFY PANES/HANDLES
   setPaneTitle:(pane,title)->
     handle = @getHandleByPane pane
     handle.getDomElement().find("b").html title
-    
+
   getHandleByPane: (pane) ->
     index   = @getPaneIndex pane
     handle  = @getHandleByIndex index
-  
+
   hideCloseIcon:(pane)->
     index = @getPaneIndex pane
     handle = @getHandleByIndex index
     handle.getDomElement().addClass("hide-close-icon")
-    
+
   resizeTabHandles:->
     return if @_tabHandleContainerHidden
-    # 
+    #
     # visibleHandles = []
     # visibleTotalSize = 0
-    # 
+    #
     # #FIX hardcoded values
     # containerSize = @tabHandleContainer.getWidth()
     # for handle in @handles
     #   unless handle.$().hasClass("hidden")
     #     visibleHandles.push handle
     #     visibleTotalSize += handle.getWidth()
-    # 
+    #
     # if containerSize-50 < visibleTotalSize
     #   for handle in visibleHandles
     #     handle.$().css width : ((containerSize-50)/visibleHandles.length) - 15,200

    for title in paneTitlesArray
      @addPane pane = new @tabConstructor title : title,null
      pane.setTitle title
  
  addPane:(paneInstance)->
    if paneInstance instanceof KDTabPaneView 
      @panes.push paneInstance
      tabHandleClass = @getOptions().tabHandleView ? KDTabHandleView
      @addHandle newTabHandle = new tabHandleClass

    @setTabHandleContainer options.tabHandleContainer ? null

    @listenWindowResize()

    @listenTo
      KDEventTypes        : ["PaneRemoved","paneAdded"]
      listenedToInstance  : @
