mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Rename Pane to PaneView
This commit is contained in:
@@ -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", ->
|
||||
@@ -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'))
|
||||
@@ -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")
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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 ->
|
||||
@@ -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
|
||||
@@ -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()
|
||||
|
||||
@@ -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 ->
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{View} = require './space-pen-extensions'
|
||||
Pane = null
|
||||
PaneView = null
|
||||
|
||||
### Internal ###
|
||||
module.exports =
|
||||
@@ -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: ->
|
||||
|
||||
@@ -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}
|
||||
@@ -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?
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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'
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user