Mixin: PageMixin

qui.pages.PageMixin

A mixin that offers page behavior.

Extends

Methods

addHistoryEntry()

Ad a new entry to the browser history. This is just a convenience wrapper around qui.navigation.addHistoryEntry.

Source:

attach()

Attach the page to the page container.

Source:

canClose() → {Promise}

Override this method to prevent accidental closing of the page, to the possible extent. Pages can be closed by default.

Source:
Returns:

a promise that, if rejected, will prevent the page close

Type
Promise

close(forceopt) → {Promise}

Close the page. Calls qui.pages.PageMixin#canClose to determine if the page can be closed.

Parameters:
Name Type Attributes Default Description
force Boolean <optional>
false

set to true to force page close without calling qui.pages.PageMixin#canClose

Source:
Returns:

a promise that is resolved as soon as the page is closed and is rejected if the page close was rejected.

Type
Promise

closeOptionsBar()

If this is the current page, close the options bar right away. Otherwise, the options bar will remain closed as soon as this page becomes current.

Source:

detach()

Detach the page from the page container.

Source:

getContext() → (nullable) {qui.pages.PagesContext}

Return the associated pages context.

Source:
Returns:
Type
qui.pages.PagesContext

getContextIndex() → {Number}

Return the index of this page in its context. If page has no context, -1 is returned.

Source:
Returns:
Type
Number

getHistoryState() → {*}

Override this method to specify page state to be saved when page is saved into browser history.

This state will later be restored by calling qui.pages.PageMixin#restoreHistoryState.

Source:
Returns:

the state

Type
*

getNext() → (nullable) {qui.pages.PageMixin}

Return the next page in context.

Source:
Returns:
Type
qui.pages.PageMixin

getOptionsBarContent() → {jQuery|qui.views.ViewMixin}

Return the options bar content of this page.

Source:
Returns:
Type
jQuery | qui.views.ViewMixin

getPageHTML() → {jQuery}

Return the page HTML wrapper. Calls qui.pages.PageMixin#makePageHTML at first invocation.

Source:
Returns:
Type
jQuery

getPathId() → (nullable) {String}

Return the path id of the page.

Source:
Returns:
Type
String

getPrev() → (nullable) {qui.pages.PageMixin}

Return the previous page in context.

Source:
Returns:
Type
qui.pages.PageMixin

getSection() → (nullable) {qui.sections.Section}

Returns the section to which the page currently belongs (may be null).

Source:
Returns:
Type
qui.sections.Section

getTitle() → (nullable) {String}

Return the page title.

Source:
Returns:
Type
String

getVertScrollParams() → {Object}

Return the current vertical scroll parameters.

Source:
Returns:

offset represents the current scroll offset and maxOffset is the maximum scroll offset (0 if no scrolling is possible)

Type
Object

handleBecomeCurrent()

Handle the event of becoming the current page of the current context.

Source:

handleLeaveCurrent()

Handle the event of no longer being the current page of the current context.

Source:

handleResize()

Handle the resize events. Internally calls qui.pages.PageMixin#onResize.

Source:

handleSectionHide()

Handle the event of owning section becoming hidden.

Source:

handleSectionShow()

Handle the event of owning section becoming visible.

Source:

handleVertScroll()

Handle vertical scroll events. Internally calls qui.pages.PageMixin#onVertScroll.

Source:

hasContext() → {Boolean}

Tells if the page has a context, effectively indicating whether the page is currently added to a context, or not.

Source:
Returns:
Type
Boolean

initPageHTML(html)

Override this to further initialize the Page HTML wrapper.

Parameters:
Name Type Description
html jQuery

the HTML wrapper to be initialized

Source:

isClosed() → {Boolean}

Tell if the page has been closed.

Source:
Returns:
Type
Boolean

isColumnLayout() → {Boolean}

Tell if the page layout is a column and does not expand horizontally.

Source:
Returns:
Type
Boolean

isCurrent() → {Boolean}

Tell if this page is the current page within its context.

Source:
Returns:
Type
Boolean

isModal() → {Boolean}

Tell if the page is modal.

Source:
Returns:
Type
Boolean

isPopup() → {Boolean}

Tell if the page is popup.

Source:
Returns:
Type
Boolean

isPrevKeptVisible() → {Boolean}

Tell if the page is kept visible while the next page is current.

Source:
Returns:
Type
Boolean

isVisible() → {Boolean}

Tell if the page is visible.

Source:
Returns:
Type
Boolean

load() → {Promise}

Override this to implement how the page is loaded.

Does nothing by default, returning a resolved promise.

Source:
Returns:
Type
Promise

makeOptionsBarContent() → {jQuery|qui.views.ViewMixin}

Override this method to enable the options bar for this page.

Source:
Returns:
Type
jQuery | qui.views.ViewMixin

makePageHTML() → {jQuery}

Create the page HTML wrapper. This method is called only once per page instance.

Source:
Returns:
Type
jQuery

Override this method to customize navigation beyond this page. By default, it returns null, preventing further navigation.

It is safe to assume that this page is visible and loaded when this method is called.

Parameters:
Name Type Description
pathId String

the next path id

Source:
Returns:

the next page or null if navigation to given path id is not possible; a promise that resolves to a page can also be returned

Type
qui.pages.PageMixin | Promise.<qui.pages.PageMixin>

onBecomeCurrent()

Called when the page becomes the current page on the current context.

Source:

onClose()

Called when the page is closed.

Source:

onCloseNext(next)

Called when the next page is closed.

Parameters:
Name Type Description
next qui.pages.PageMixin

the next page that has just been closed

Source:

onLeaveCurrent()

Called when the page is no longer the current page on the current context.

Source:

onOptionsChange(options)

Called when the page options change; the page options are defined by the options bar content.

This currently works only when using an qui.forms.OptionsForm for the options bar content.

Parameters:
Name Type Description
options Object
Source:

onPush()

Called when the page is pushed to a context.

Source:

onResize()

Called when the page is resized.

Source:

onSectionHide()

Called when the section to which page belongs is hidden.

Source:

onSectionShow()

Called when the section to which page belongs is shown.

Source:

onVertScroll(offset, maxOffset)

Called when the page is scrolled vertically.

Parameters:
Name Type Description
offset Number

the vertical scroll offset

maxOffset Number

the maximum vertical scroll offset

Source:

openOptionsBar()

If this is the current page, open the options bar right away. Otherwise, the options bar will be automatically opened as soon as this page becomes current.

Source:

pushPage(page, historyEntryopt) → {Promise}

Push a new page after this one. Any following pages will be closed. The new page is not guaranteed to be pushed by the time the function exists.

Parameters:
Name Type Attributes Default Description
page qui.pages.PageMixin

the page to be pushed

historyEntry Boolean <optional>
null

whether to create a new history entry for current page before adding the new page, or not (determined automatically by default, using new page's pathId)

Source:
Returns:

a promise that resolves as soon as the page is pushed, or rejected if the page cannot be pushed

Type
Promise

pushSelf(context)

Push this page to a context.

Parameters:
Name Type Description
context qui.pages.PagesContext
Source:

restoreHistoryState(state)

Override this method to implement restoring page state from history.

This method will be given as argument the state that has been previously created by qui.pages.PageMixin#getHistoryState.

This method must be prepared to receive a null history state.

Parameters:
Name Type Description
state *
Source:

setColumnLayout(columnLayout)

Set the page column layout.

Parameters:
Name Type Description
columnLayout Boolean
Source:

setKeepPrevVisible(keepPrevVisible)

Set the keep-prev-visible flag, controlling if the page is kept visible while the next page is current.

Parameters:
Name Type Description
keepPrevVisible Boolean
Source:

setModal(modal)

Set the modal flag.

Parameters:
Name Type Description
modal Boolean
Source:

setPathId(pathIdnullable)

Update the path id of the page.

Parameters:
Name Type Attributes Description
pathId String <nullable>
Source:

setPopup(popup)

Set the popup flag.

Parameters:
Name Type Description
popup Boolean
Source:

setTitle(titlenullable)

Set the page title.

Parameters:
Name Type Attributes Description
title String <nullable>

the new title

Source:

updateHistoryState()

Call this whenever the content of the history state changes.

Source:

whenLoaded() → {Promise}

Return a promise that settles as soon as the page is loaded.

This method calls qui.pages.PageMixin#load once per page instance.

Source:
Returns:
Type
Promise