TreeView serializes its attached state

This commit is contained in:
Corey Johnson
2012-06-04 16:02:50 -07:00
parent ded6281e0f
commit 7364ea79cc
2 changed files with 4 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
window.keymap.bindKeys '#root-view'
'alt-tab': 'tree-view:focus'
'meta-/': 'tree-view:toggle'
'ctrl-T': 'tree-view:toggle'
window.keymap.bindKeys '.tree-view'
'right': 'tree-view:expand-directory'

View File

@@ -17,8 +17,7 @@ class TreeView extends View
@instance = TreeView.deserialize(state, rootView)
else
@instance = new TreeView(rootView)
@instance.attach()
@instance.attach()
@serialize: ->
@instance.serialize()
@@ -33,6 +32,7 @@ class TreeView extends View
treeView.root.deserializeEntryExpansionStates(state.directoryExpansionStates)
treeView.selectEntryForPath(state.selectedPath)
treeView.focusAfterAttach = state.hasFocus
treeView.attach() if state.attached
treeView
root: null
@@ -65,6 +65,7 @@ class TreeView extends View
directoryExpansionStates: @root.serializeEntryExpansionStates()
selectedPath: @selectedEntry()?.getPath()
hasFocus: @is(':focus')
attached: @hasParent()
deactivate: ->
@root?.unwatchEntries()