Pane
Import :
const Pane = brackets.getModule("view/Pane")
Pane
Kind: global class
See: MainViewManager for more information
- Pane
- new Pane(id, $container)
- .id :
string - .$container :
JQuery - .$el :
JQuery - .$header :
JQuery - .$headerText :
JQuery - .$headerFlipViewBtn :
JQuery - .$headerCloseBtn :
JQuery - .$content :
JQuery - .ITEM_NOT_FOUND
- .ITEM_FOUND_NO_SORT
- .ITEM_FOUND_NEEDS_SORT
- .mergeFrom(other)
- .destroy()
- .getViewList() ⇒
Array.<File> - .getViewListSize() ⇒
number - .findInViewList(fullPath) ⇒
number - .findInViewListAddedOrder(fullPath) ⇒
number - .findInViewListMRUOrder(fullPath) ⇒
number - .reorderItem(file, [index], [force]) ⇒
number - .addToViewList(file, [index]) ⇒
number - .addListToViewList(fileList) ⇒
Array.<File> - .makeViewMostRecent(file)
- .sortViewList(compareFn)
- .swapViewListIndexes(index1, index2) ⇒
boolean - .traverseViewListByMRU(direction, [current]) ⇒
File - .showInterstitial(show)
- .getViewForPath(path) ⇒
boolean - .addView(view, show)
- .showView(view)
- .updateLayout(forceRefresh)
- .getCurrentlyViewedFile() ⇒
File - .getCurrentlyViewedEditor() ⇒
File - .getCurrentlyViewedPath() ⇒
string - .destroyViewIfNotNeeded(view)
- .removeView(file, suppressOpenNextFile, preventViewChange) ⇒
boolean - .removeViews(list) ⇒
Array.<File> - .focus()
- .loadState(state) ⇒
jQuery.Promise - .saveState() ⇒
Object - .getScrollState() ⇒
Object - .restoreAndAdjustScrollState([state], [heightDelta])
new Pane(id, $container)
Pane Objects are constructed by the MainViewManager object when a Pane view is needed.
| Param | Type | Description |
|---|---|---|
| id | string | The id to use to identify this pane. |
| $container | jQuery | The parent jQuery container to place the pane view. |
pane.id : string
id of the pane
Kind: instance property of Pane
Read only: true
pane.$container : JQuery
container where the pane lives
Kind: instance property of Pane
Read only: true
pane.$el : JQuery
the wrapped DOM node of this pane
Kind: instance property of Pane
Read only: true
pane.$header : JQuery
the wrapped DOM node container that contains name of current view and the switch view button, or informational string if there is no view
Kind: instance property of Pane
Read only: true
pane.$headerText : JQuery
the wrapped DOM node that contains name of current view, or informational string if there is no view
Kind: instance property of Pane
Read only: true
pane.$headerFlipViewBtn : JQuery
the wrapped DOM node that is used to flip the view to another pane
Kind: instance property of Pane
Read only: true
pane.$headerCloseBtn : JQuery
close button of the pane
Kind: instance property of Pane
Read only: true
pane.$content : JQuery
the wrapped DOM node that contains views
Kind: instance property of Pane
Read only: true
pane.ITEM_NOT_FOUND
Return value from reorderItem when the Item was not found
Kind: instance constant of Pane
See: reorderItem
pane.ITEM_FOUND_NO_SORT
Return value from reorderItem when the Item was found at its natural index and the workingset does not need to be resorted
Kind: instance constant of Pane
See: reorderItem
pane.ITEM_FOUND_NEEDS_SORT
Return value from reorderItem when the Item was found and reindexed and the workingset needs to be resorted
Kind: instance constant of Pane
See: reorderItem
pane.mergeFrom(other)
Merges the another Pane object's contents into this Pane
Kind: instance method of Pane
| Param | Type | Description |
|---|---|---|
| other | Pane | Pane from which to copy |
pane.destroy()
Removes the DOM node for the Pane, removes all event handlers and _resets all internal data structures
Kind: instance method of Pane
pane.getViewList() ⇒ Array.<File>
Returns a copy of the view file list
Kind: instance method of Pane
pane.getViewListSize() ⇒ number
Returns the number of entries in the view file list
Kind: instance method of Pane
pane.findInViewList(fullPath) ⇒ number
Returns the index of the item in the view file list
Kind: instance method of Pane
Returns: number - index of the item or -1 if not found
| Param | Type | Description |
|---|---|---|
| fullPath | string | the full path of the item to look for |
pane.findInViewListAddedOrder(fullPath) ⇒ number
Returns the order in which the item was added
Kind: instance method of Pane
Returns: number - order of the item or -1 if not found
| Param | Type | Description |
|---|---|---|
| fullPath | string | the full path of the item to look for |
pane.findInViewListMRUOrder(fullPath) ⇒ number
Returns the order in which the item was last used
Kind: instance method of Pane
Returns: number - order of the item or -1 if not found.
0 indicates most recently used, followed by 1 and so on...
| Param | Type | Description |
|---|---|---|
| fullPath | string | the full path of the item to look for |
pane.reorderItem(file, [index], [force]) ⇒ number
reorders the specified file in the view list to the desired position
Kind: instance method of Pane
Returns: number - this function returns one of the following manifest constants:
ITEM_NOT_FOUND : The request file object was not found
ITEM_FOUND_NO_SORT : The request file object was found but it was already at the requested index
ITEM_FOUND_NEEDS_SORT : The request file object was found and moved to a new index and the list should be resorted
| Param | Type | Description |
|---|---|---|
| file | File | the file object of the item to reorder |
| [index] | number | the new position of the item |
| [force] | boolean | true to force the item into that position, false otherwise. (Requires an index be requested) |
pane.addToViewList(file, [index]) ⇒ number
Adds the given file to the end of the workingset, if it is not already in the list Does not change which document is currently open in the editor. Completes synchronously.
Kind: instance method of Pane
Returns: number - index of where the item was added
| Param | Type | Description |
|---|---|---|
| file | File | file to add |
| [index] | number | position where to add the item |
pane.addListToViewList(fileList) ⇒ Array.<File>
Adds the given file list to the end of the workingset.
Kind: instance method of Pane
Returns: Array.<File> - list of files added to the list
| Param | Type |
|---|---|
| fileList | Array.<File> |
pane.makeViewMostRecent(file)
Moves the specified file to the front of the MRU (Most Recently Used) list.
Kind: instance method of Pane
| Param | Type | Description |
|---|---|---|
| file | File | The file to move to the front of the MRU list. |
pane.sortViewList(compareFn)
Sorts items in the pane's view list.
Kind: instance method of Pane
| Param | Type | Description |
|---|---|---|
| compareFn | function | The function used to compare items in the view list. |
pane.swapViewListIndexes(index1, index2) ⇒ boolean
Swaps two items in the file view list (used while dragging items in the working set view)
Kind: instance method of Pane
Returns: boolean - } true
| Param | Type | Description |
|---|---|---|
| index1 | number | the index of the first item to swap |
| index2 | number | the index of the second item to swap |
pane.traverseViewListByMRU(direction, [current]) ⇒ File
Traverses the list and returns the File object of the next item in the MRU order
Kind: instance method of Pane
Returns: File - The File object of the next item in the travesal order or null if there isn't one.
| Param | Type | Description |
|---|---|---|
| direction | number | Must be 1 or -1 to traverse forward or backward |
| [current] | string | the fullPath of the item where traversal is to start. If this parameter is omitted then the path of the current view is used. If the current view is a temporary view then the first item in the MRU list is returned |
pane.showInterstitial(show)
Shows the pane's interstitial page
Kind: instance method of Pane
| Param | Type | Description |
|---|---|---|
| show | boolean | show or hide the interstitial page |
pane.getViewForPath(path) ⇒ boolean
retrieves the view object for the given path
Kind: instance method of Pane
Returns: boolean - show - show or hide the interstitial page
| Param | Type | Description |
|---|---|---|
| path | string | the fullPath of the view to retrieve |
pane.addView(view, show)
Adds a view to the pane
Kind: instance method of Pane
| Param | Type | Description |
|---|---|---|
| view | View | the View object to add |
| show | boolean | true to show the view right away, false otherwise |
pane.showView(view)
Swaps the current view with the requested view. If the interstitial page is shown, it is hidden. If the currentView is a temporary view, it is destroyed.
Kind: instance method of Pane
| Param | Type | Description |
|---|---|---|
| view | View | the to show |
pane.updateLayout(forceRefresh)
Sets pane content height. Updates the layout causing the current view to redraw itself
Kind: instance method of Pane
| Param | Type | Description |
|---|---|---|
| forceRefresh | boolean | true to force a resize and refresh of the current view, false if just to resize forceRefresh is only used by Editor views to force a relayout of all editor DOM elements. Custom View implementations should just ignore this flag. |
pane.getCurrentlyViewedFile() ⇒ File
Retrieves the File object of the current view
Kind: instance method of Pane
Returns: File - the File object of the current view or null if there isn't one
pane.getCurrentlyViewedEditor() ⇒ File
Retrieves the File object of the current view
Kind: instance method of Pane
Returns: File - the File object of the current view or null if there isn't one
pane.getCurrentlyViewedPath() ⇒ string
Retrieves the path of the current view
Kind: instance method of Pane
Returns: string - the path of the current view or null if there isn't one
pane.destroyViewIfNotNeeded(view)
destroys the view if it isn't needed
Kind: instance method of Pane
| Param | Type | Description |
|---|---|---|
| view | View | the view to destroy |
pane.removeView(file, suppressOpenNextFile, preventViewChange) ⇒ boolean
Removes the view and opens the next view
Kind: instance method of Pane
Returns: boolean - true if the file was removed from the working set
This function will remove a temporary view of a file but will return false in that case
| Param | Type | Description |
|---|---|---|
| file | File | the file to close |
| suppressOpenNextFile | boolean | suppresses opening the next file in MRU order |
| preventViewChange | boolean | if suppressOpenNextFile is truthy, this flag can be used to prevent the current view from being destroyed. Ignored if suppressOpenNextFile is falsy |
pane.removeViews(list) ⇒ Array.<File>
Removes the specifed file from all internal lists, destroys the view of the file (if there is one) and shows the interstitial page if the current view is destroyed.
Kind: instance method of Pane
Returns: Array.<File> - Array of File objects removed from the working set.
This function will remove temporary views but the file objects for those views will not be found
in the result set. Only the file objects removed from the working set are returned.
| Param | Type | Description |
|---|---|---|
| list | Array.<File> | Array of files to remove |
pane.focus()
Gives focus to the last thing that had focus, the current view or the pane in that order
Kind: instance method of Pane
pane.loadState(state) ⇒ jQuery.Promise
serializes the pane state from JSON
Kind: instance method of Pane
Returns: jQuery.Promise - A promise which resolves to {fullPath:string, paneId:string} which can be passed as command data to FILE_OPEN
| Param | Type | Description |
|---|---|---|
| state | Object | the state to load |