Class jabberwerx.ui.TabbedView
Extends
jabberwerx.ui.JWView.
Tabbed view implementation.
This class provides the following events:
Constructor Attributes | Constructor Name and Description |
---|---|
Creates a new TabbedView. |
Field Attributes | Field Name and Description |
---|---|
<static> |
jabberwerx.ui.TabbedView.TabAlreadyExistsError
Error thrown when attempting to add a tab with an ID already present in the TabbedView. |
<static> |
jabberwerx.ui.TabbedView.tabListSizeInvalidError
Error thrown when the requested tab size is not valid (not a positive integer). |
- Fields borrowed from class jabberwerx.ui.JWView:
- jq
Method Attributes | Method Name and Description |
---|---|
addTab(id, content)
Adds a new tab to this TabbedView. |
|
createDOM(doc)
Creates the DOM representation of the TabbedView. |
|
destroy()
Destroys this TabbedView. |
|
Retrieves the active tab for this TabbedView. |
|
Retrieves all of the tabs in this TabbedView. |
|
getTab(id)
Retrieves the given tab in this TabbedView. |
|
Retrieves the number of tabs in this TabbedView. |
|
height(h, noupdate)
Retrieves or changes the height of this view. |
|
removeTab(id)
Removes the requested tab from this TabbedView. |
|
restoreDOM(doc)
Restore the DOM for a TabbedView |
|
show()
Shows the TabbedView if hidden in the document. |
|
tabListSize(size)
Retrieves or changes the size (width) of the tab list. |
|
update()
Updates this TabbedView. |
|
width(w, noupdate)
Retrieves or changes the width of this view. |
- Methods borrowed from class jabberwerx.ui.JWView:
- destroyDOM, dimensions, hide, parent, persistOptions, remove, render, restoreRender, restoreUpdate, shouldBeSavedWithGraph, wasUnserialized, willBeSerialized
- Methods borrowed from class jabberwerx.JWModel:
- applyEvent, event
- Methods borrowed from class jabberwerx.JWBase:
- getClassName, graphUnserialized, init, invocation, shouldBeSerializedInline, toString
Error thrown when attempting to add a tab with an ID already present in the TabbedView.
Error thrown when the requested tab size is not valid (not a positive integer).
Adds a new tab to this TabbedView.
A new tab is created with the given id and content, then appended to the end of the tablist. If this is the first tab, it is automatically activated (if this TabbedView is rendered).
- Parameters:
- {String} id
- The identifier for the tab
- {jabberwerx.ui.JWView} content
- The tab content
- Throws:
- {TypeError}
- if {id} not a non-empty string; or if {content} is not an instance of jabberwerx.ui.JWView
- {jabberwerx.ui.TabbedView.TabAlreadyExistsError}
- If a tab for {id} is already present.
- Returns:
- {jabberwerx.ui.TabbedView.Tab} The added tab
Creates the DOM representation of the TabbedView. This implementation produces the following:
<div class='jabberwerx tabpane'> <div class='tabcontent'/> <div class='tablist'/> </div>
- Parameters:
- {Document} doc
- The document to create the DOM with
- Returns:
- {Element} The DOM representing this TabbedView
Destroys this TabbedView. This implementation first destroys all tab currently contained, then calls the superclass' implementation.
Retrieves the active tab for this TabbedView. A tab is active if its contents are what is currently being displayed by the TabbedView.
- Returns:
- {jabberwerx.ui.TabbedView.Tab} The active tab, or null if none
Retrieves all of the tabs in this TabbedView. This method returns a snapshot of the tabs at the time this method is called. Any tabs added or removed since this method is called are not reflected in the returned array.
- Returns:
- {[abberwerx.ui.TabbedView.Tab[]} The tabs in this TabbedView
Retrieves the given tab in this TabbedView.
- Parameters:
- {String} id
- The id of the tab to retrieve
- Throws:
- {TypeError}
- if {id} is not a non-empty string
- Returns:
- {jabberwerx.ui.TabbedView.Tab} The tab for {id}, or null if none available
Retrieves the number of tabs in this TabbedView. This method less expensive than calling #getAllTabs if only the number of tabs is needed.
- Returns:
- {Number} The number of tabs in this TabbedView
Retrieves or changes the height of this view. This implementation extends the superclass to adjust the content and tablist to match the new height.
- Parameters:
- {Number|String} h Optional
- The new height (or undefined to retrieve the current height)
- {Boolean} noupdate Optional
- true if the view should NOT be updated
- Returns:
- {Number|jabberwerx.ui.JWView} The current height (if retrieving); or this jabberwerx.ui.JWView (if changing)
Removes the requested tab from this TabbedView.
- Parameters:
- {String} id
- The id of the tab to remove
- Throws:
- {TypeError}
- If {id} is not a non-empty string
- Returns:
- {Boolean} true if a tab was removed
Restore the DOM for a TabbedView
- Parameters:
- {Document} doc
- The document to use for creating content.
- Returns:
- {jQuery} The element containing the view.
Shows the TabbedView if hidden in the document.
Retrieves or changes the size (width) of the tab list.
- Parameters:
- size
- Throws:
- {jabberwerx.ui.TabbedView.tabListSizeInvalidError}
- If {size} is specified but is not a positive number
- Returns:
- {Number|jabberwerx.ui.TabbedView} size The current tab size (if getting), or this TabbedView (if setting)
Updates this TabbedView. This implementation ensures all tabs (and their content) are rendered. If there are any tabs, but none are active, it will automatically activate the first one.
- Returns:
- {Boolean} true if the view is updatable
Retrieves or changes the width of this view. This implementation extends the superclass to adjust the content and tablist to match the new width.
- Parameters:
- {Number|String} w Optional
- The new width (or undefined to retrieve the current width)
- {Boolean} noupdate Optional
- true if the view should NOT be updated
- Returns:
- {Number|jabberwerx.ui.JWView} The current width (if retrieving); or this jabberwerx.ui.JWView (if changing)