Skip to content

Commit

Permalink
Rename Pane to PaneView
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Sobo committed Jan 13, 2014
1 parent a29c18f commit 4f604ce
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions spec/pane-container-spec.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
path = require 'path'
temp = require 'temp'
PaneContainer = require '../src/pane-container'
Pane = require '../src/pane'
PaneView = require '../src/pane-view'
{_, $, View, $$} = require 'atom'

describe "PaneContainer", ->
Expand All @@ -19,7 +19,7 @@ describe "PaneContainer", ->
isEqual: (other) -> @name is other?.name

container = new PaneContainer
pane1 = new Pane(new TestView('1'))
pane1 = new PaneView(new TestView('1'))
container.setRoot(pane1)
pane2 = pane1.splitRight(new TestView('2'))
pane3 = pane2.splitDown(new TestView('3'))
Expand Down Expand Up @@ -148,7 +148,7 @@ describe "PaneContainer", ->

container = new PaneContainer
container.attachToDom()
pane1 = new Pane(item1a)
pane1 = new PaneView(item1a)
container.setRoot(pane1)

activeItemChangedHandler = jasmine.createSpy("activeItemChangedHandler")
Expand All @@ -160,7 +160,7 @@ describe "PaneContainer", ->
expect(container.getPanes().length).toBe 0
activeItemChangedHandler.reset()

pane = new Pane(item1a)
pane = new PaneView(item1a)
container.setRoot(pane)
expect(activeItemChangedHandler.callCount).toBe 1
expect(activeItemChangedHandler.argsForCall[0][1]).toEqual item1a
Expand Down
6 changes: 3 additions & 3 deletions spec/pane-spec.coffee → spec/pane-view-spec.coffee
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
PaneContainer = require '../src/pane-container'
Pane = require '../src/pane'
PaneView = require '../src/pane-view'
{fs, $, View} = require 'atom'
path = require 'path'
temp = require 'temp'

describe "Pane", ->
describe "PaneView", ->
[container, view1, view2, editor1, editor2, pane] = []

class TestView extends View
Expand All @@ -22,7 +22,7 @@ describe "Pane", ->
view2 = new TestView(id: 'view-2', text: 'View 2')
editor1 = atom.project.openSync('sample.js')
editor2 = atom.project.openSync('sample.txt')
pane = new Pane(view1, editor1, view2, editor2)
pane = new PaneView(view1, editor1, view2, editor2)
container.setRoot(pane)

afterEach ->
Expand Down
6 changes: 3 additions & 3 deletions spec/workspace-view-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Q = require 'q'
path = require 'path'
temp = require 'temp'
Pane = require '../src/pane'
PaneView = require '../src/pane-view'

describe "WorkspaceView", ->
pathToOpen = null
Expand Down Expand Up @@ -212,7 +212,7 @@ describe "WorkspaceView", ->
describe ".openSync(filePath, options)", ->
describe "when there is no active pane", ->
beforeEach ->
spyOn(Pane.prototype, 'focus')
spyOn(PaneView.prototype, 'focus')
atom.workspaceView.getActivePane().remove()
expect(atom.workspaceView.getActivePane()).toBeUndefined()

Expand Down Expand Up @@ -360,7 +360,7 @@ describe "WorkspaceView", ->

describe ".open(filePath)", ->
beforeEach ->
spyOn(Pane.prototype, 'focus')
spyOn(PaneView.prototype, 'focus')

describe "when there is no active pane", ->
beforeEach ->
Expand Down
6 changes: 3 additions & 3 deletions src/pane-axis.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{View} = require './space-pen-extensions'
Pane = null
PaneView = null

### Internal ###
module.exports =
Expand All @@ -25,9 +25,9 @@ class PaneAxis extends View
onChildRemoved: (child) =>
view = @viewForModel(child)
view.detach()
Pane ?= require './pane'
PaneView ?= require './pane-view'

if view instanceof Pane and view.model.isDestroyed()
if view instanceof PaneView and view.model.isDestroyed()
@getContainer()?.trigger 'pane:removed', [view]

getContainer: ->
Expand Down
6 changes: 3 additions & 3 deletions src/pane-container.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Serializable = require 'serializable'
{$, View} = require './space-pen-extensions'
Pane = require './pane'
PaneView = require './pane-view'
PaneContainerModel = require './pane-container-model'

# Private: Manages the list of panes within a {WorkspaceView}
Expand Down Expand Up @@ -47,7 +47,7 @@ class PaneContainer extends View
focusedElement = document.activeElement if @hasFocus()

oldRoot = @getRoot()
if oldRoot instanceof Pane and oldRoot.model.isDestroyed()
if oldRoot instanceof PaneView and oldRoot.model.isDestroyed()
@trigger 'pane:removed', [oldRoot]
oldRoot?.detach()
if root?
Expand All @@ -63,7 +63,7 @@ class PaneContainer extends View
removeChild: (child) ->
throw new Error("Removing non-existant child") unless @getRoot() is child
@setRoot(null)
@trigger 'pane:removed', [child] if child instanceof Pane
@trigger 'pane:removed', [child] if child instanceof PaneView

saveAll: ->
pane.saveItems() for pane in @getPanes()
Expand Down
4 changes: 2 additions & 2 deletions src/pane-model.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{Model, Sequence} = require 'theorist'
Serializable = require 'serializable'
PaneAxisModel = require './pane-axis-model'
Pane = null
PaneView = null

# Public: A container for multiple items, one of which is *active* at a given
# time. With the default packages, a tab is displayed for each item and the
Expand Down Expand Up @@ -58,7 +58,7 @@ class PaneModel extends Model
params

# Private: Called by the view layer to construct a view for this model.
getViewClass: -> Pane ?= require './pane'
getViewClass: -> PaneView ?= require './pane-view'

isActive: -> @active

Expand Down
2 changes: 1 addition & 1 deletion src/pane.coffee → src/pane-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PaneModel = require './pane-model'
# Most packages won't need to use this class, unless you're interested in
# building a package that deals with switching between panes or tiems.
module.exports =
class Pane extends View
class PaneView extends View
Serializable.includeInto(this)
Delegator.includeInto(this)

Expand Down
18 changes: 9 additions & 9 deletions src/workspace-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ _ = require 'underscore-plus'
fs = require 'fs-plus'
Serializable = require 'serializable'
EditorView = require './editor-view'
Pane = require './pane'
PaneView = require './pane-view'
PaneColumn = require './pane-column'
PaneRow = require './pane-row'
PaneContainer = require './pane-container'
Expand Down Expand Up @@ -39,7 +39,7 @@ Editor = require './editor'
module.exports =
class WorkspaceView extends View
Serializable.includeInto(this)
atom.deserializers.add(this, Pane, PaneRow, PaneColumn, EditorView)
atom.deserializers.add(this, PaneView, PaneRow, PaneColumn, EditorView)

@version: 2

Expand Down Expand Up @@ -168,7 +168,7 @@ class WorkspaceView extends View
Q(editor ? promise)
.then (editor) =>
if not activePane
activePane = new Pane(editor)
activePane = new PaneView(editor)
@panes.setRoot(activePane)

@itemOpened(editor)
Expand Down Expand Up @@ -203,7 +203,7 @@ class WorkspaceView extends View
pane.activateItem(paneItem)
else
paneItem = atom.project.openSync(uri, {initialLine})
pane = new Pane(paneItem)
pane = new PaneView(paneItem)
@panes.setRoot(pane)

@itemOpened(paneItem)
Expand Down Expand Up @@ -290,11 +290,11 @@ class WorkspaceView extends View
appendToRight: (element) ->
@horizontal.append(element)

# Public: Returns the currently focused {Pane}.
# Public: Returns the currently focused {PaneView}.
getActivePane: ->
@panes.getActivePane()

# Public: Returns the currently focused item from within the focused {Pane}
# Public: Returns the currently focused item from within the focused {PaneView}
getActivePaneItem: ->
@panes.getActivePaneItem()

Expand Down Expand Up @@ -329,15 +329,15 @@ class WorkspaceView extends View
saveAll: ->
@panes.saveAll()

# Public: Fires a callback on each open {Pane}.
# Public: Fires a callback on each open {PaneView}.
eachPane: (callback) ->
@panes.eachPane(callback)

# Public: Returns an Array of all open {Pane}s.
# Public: Returns an Array of all open {PaneView}s.
getPanes: ->
@panes.getPanes()

# Public: Return the id of the given a {Pane}
# Public: Return the id of the given a {PaneView}
indexOfPane: (pane) ->
@panes.indexOfPane(pane)

Expand Down

0 comments on commit 4f604ce

Please sign in to comment.