mirror of
https://github.com/atom/atom.git
synced 2026-02-14 16:45:14 -05:00
Construct Pane w/ multiple items. Show first item on construction.
This commit is contained in:
committed by
probablycorey
parent
68b05a5d8d
commit
2bdc077d2a
@@ -6,11 +6,20 @@ module.exports =
|
||||
class Pane extends View
|
||||
@content: (wrappedView) ->
|
||||
@div class: 'pane', =>
|
||||
@subview 'wrappedView', wrappedView if wrappedView
|
||||
@div class: 'item-views', outlet: 'itemViews'
|
||||
|
||||
@deserialize: ({wrappedView}) ->
|
||||
new Pane(deserialize(wrappedView))
|
||||
|
||||
initialize: (@items...) ->
|
||||
@viewsByItem = new WeakMap
|
||||
@showItem(@items[0])
|
||||
|
||||
showItem: (item) ->
|
||||
@itemViews.children().hide()
|
||||
@itemViews.append(item) unless @itemViews.children(item).length
|
||||
item.show()
|
||||
|
||||
serialize: ->
|
||||
deserializer: "Pane"
|
||||
wrappedView: @wrappedView?.serialize()
|
||||
|
||||
Reference in New Issue
Block a user