PanelView
Import :
const PanelView = brackets.getModule("view/PanelView")
Panel
Kind: global class
- Panel
- new Panel($panel, id, [title])
- .$panel :
jQueryObject - .isVisible() ⇒
boolean - .registerCanBeShownHandler(canShowHandlerFn) ⇒
boolean - .canBeShown() ⇒
boolean - .registerOnCloseRequestedHandler(handler)
- .requestClose() ⇒
Promise.<boolean> - .show()
- .hide()
- .focus() ⇒
boolean - .setVisible(visible)
- .setTitle(newTitle)
- .destroy()
- .getPanelType() ⇒
string
new Panel($panel, id, [title])
Represents a panel below the editor area (a child of ".content").
| Param | Type | Description |
|---|---|---|
| $panel | jQueryObject | The entire panel, including any chrome, already in the DOM. |
| id | string | Unique panel identifier. |
| [title] | string | Optional display title for the tab bar. |
panel.$panel : jQueryObject
Dom node holding the rendered panel
Kind: instance property of Panel
panel.isVisible() ⇒ boolean
Determines if the panel is visible
Kind: instance method of Panel
Returns: boolean - true if visible, false if not
panel.registerCanBeShownHandler(canShowHandlerFn) ⇒ boolean
Registers a call back function that will be called just before panel is shown. The handler should return true if the panel can be shown, else return false and the panel will not be shown.
Kind: instance method of Panel
Returns: boolean - true if visible, false if not
| Param | Type | Description |
|---|---|---|
| canShowHandlerFn | function | null | function that should return true of false if the panel can be shown/not. or null to clear the handler. |
panel.canBeShown() ⇒ boolean
Returns true if th panel can be shown, else false.
Kind: instance method of Panel
panel.registerOnCloseRequestedHandler(handler)
Registers an async handler that is called before the panel is closed via user interaction (e.g. clicking the
tab close button). The handler should return true to allow the close, or false to prevent it.
Kind: instance method of Panel
| Param | Type | Description |
|---|---|---|
| handler | function | null | An async function returning a boolean, or null to clear the handler. |
panel.requestClose() ⇒ Promise.<boolean>
Requests the panel to hide, invoking the registered onCloseRequested handler first (if any).
If the handler returns false, the panel stays open. If it returns true or no handler is
registered, hide() is called.
Kind: instance method of Panel
Returns: Promise.<boolean> - Resolves to true if the panel was hidden, false if prevented.
panel.show()
Shows the panel
Kind: instance method of Panel
panel.hide()
Hides the panel
Kind: instance method of Panel
panel.focus() ⇒ boolean
Attempts to focus the panel. Override this in panels that support focus (e.g. terminal). The default implementation returns false.
Kind: instance method of Panel
Returns: boolean - true if the panel accepted focus, false otherwise
panel.setVisible(visible)
Sets the panel's visibility state
Kind: instance method of Panel
| Param | Type | Description |
|---|---|---|
| visible | boolean | true to show, false to hide |
panel.setTitle(newTitle)
Updates the display title shown in the tab bar for this panel.
Kind: instance method of Panel
| Param | Type | Description |
|---|---|---|
| newTitle | string | The new title to display. |
panel.destroy()
Destroys the panel, removing it from the tab bar, internal maps, and the DOM. After calling this, the Panel instance should not be reused.
Kind: instance method of Panel
panel.getPanelType() ⇒ string
gets the Panel's type
Kind: instance method of Panel
_panelMap : Object.<string, Panel>
Maps panel ID to Panel instance
Kind: global variable
_$container : jQueryObject
The single container wrapping all bottom panels
Kind: global variable
_$tabBar : jQueryObject
The tab bar inside the container
Kind: global variable
_$tabsOverflow : jQueryObject
Scrollable area holding the tab elements
Kind: global variable
_openIds : Array.<string>
Ordered list of currently open (tabbed) panel IDs
Kind: global variable
_activeId : string | null
The panel ID of the currently visible (active) tab
Kind: global variable
_isMaximized : boolean
Whether the bottom panel is currently maximized
Kind: global variable
_preMaximizeHeight : number | null
The panel height before maximize, for restore
Kind: global variable
_$editorHolder : jQueryObject
The editor holder element, passed from WorkspaceManager
Kind: global variable
_recomputeLayout : function
recomputeLayout callback from WorkspaceManager
Kind: global variable
_defaultPanelId : string | null
The default/quick-access panel ID
Kind: global variable
_$addBtn : jQueryObject
The "+" button inside the tab overflow area
Kind: global variable
EVENT_PANEL_HIDDEN : string
Event when panel is hidden
Kind: global constant
EVENT_PANEL_SHOWN : string
Event when panel is shown
Kind: global constant
PANEL_TYPE_BOTTOM_PANEL : string
type for bottom panel
Kind: global constant
MAXIMIZE_THRESHOLD : number
Pixel threshold for detecting near-maximize state during resize. If the editor holder height is within this many pixels of zero, the panel is treated as maximized. Keeps the maximize icon responsive during drag without being overly sensitive.
Kind: global constant
MIN_PANEL_HEIGHT : number
Minimum panel height (matches Resizer minSize) used as a floor when computing a sensible restore height.
Kind: global constant
PREF_BOTTOM_PANEL_MAXIMIZED
Preference key for persisting the maximize state across reloads.
Kind: global constant
init($container, $tabBar, $tabsOverflow, $editorHolder, recomputeLayoutFn, defaultPanelId)
Initializes the PanelView module with references to the bottom panel container DOM elements. Called by WorkspaceManager during htmlReady.
Kind: global function
| Param | Type | Description |
|---|---|---|
| $container | jQueryObject | The bottom panel container element. |
| $tabBar | jQueryObject | The tab bar element inside the container. |
| $tabsOverflow | jQueryObject | The scrollable area holding tab elements. |
| $editorHolder | jQueryObject | The editor holder element (for maximize height calculation). |
| recomputeLayoutFn | function | Callback to trigger workspace layout recomputation. |
| defaultPanelId | string | The ID of the default/quick-access panel. |
exitMaximizeOnResize()
Exit maximize state without resizing (for external callers like drag-resize). Clears internal maximize state and resets the button icon.
Kind: global function
enterMaximizeOnResize()
Enter maximize state during a drag-resize that reaches the maximum height. No pre-maximize height is stored because the user arrived here via continuous dragging; a sensible default will be computed if they later click the Restore button.
Kind: global function
restoreIfMaximized()
Restore the container's CSS height to the pre-maximize value and clear maximize state. Must be called BEFORE Resizer.hide() so the Resizer reads the correct height. If not maximized, this is a no-op. When the saved height is near-max or unknown, a sensible default is used.
Kind: global function
isMaximized() ⇒ boolean
Returns true if the bottom panel is currently maximized.
Kind: global function
getOpenBottomPanelIDs() ⇒ Array.<string>
Returns a copy of the currently open bottom panel IDs in tab order.
Kind: global function
hideAllOpenPanels() ⇒ Array.<string>
Hides every open bottom panel tab in a single batch
Kind: global function
Returns: Array.<string> - The IDs of panels that were open (useful for restoring later).
getActiveBottomPanel() ⇒ Panel | null
Returns the currently active (visible) bottom panel, or null if none.
Kind: global function
showNextPanel() ⇒ boolean
Cycle to the next open bottom panel tab. If the container is hidden or no panels are open, does nothing and returns false.
Kind: global function
Returns: boolean - true if a panel switch occurred