Class: ViewManager

ViewManager

new tart.ui.ViewManager(opt_rootEl)

This class handles view transitions and view history in a consistent manner. Should be used by views who would like to contain other views. Also, each application should have at least one ViewManager.

Name Type Description
opt_rootEl Element optional

Root element for this view manager.

Members

statictart.ui.ViewManager.Statestring

View manager states.

Properties:
Name Type Default Description
DEFAULT string default
STARTED_GESTURE string started
CLOSING_SIDEBAR string closingSidebar
OPENING_SIDEBAR string openingSidebar
SIDEBAR_OPEN string sidebarOpen
GOING_TO_BACK_VIEW string going

topIndexnumber

3d transform Z position for the uppermost view. Used to set the right view on top.

Methods

protectedbackGestureTouchEnd_(e)

Handles touch end event when they occur in a back gesture.

Name Type Description
e goog.events.Event

Touch end event.

protectedbackGestureTouchMove_(e)

Handle touch move events when they occur in a back gesture.

Name Type Description
e goog.events.Event

Touch end event.

canGoBack(){boolean}

Returns true if there is one or more views in history, returns false otherwise.

Returns:
Type Description
boolean Whether the view manager can push current view.

protectedcloseSidebarTouchMove_(e)

Close sidebar touch move functionality.

Name Type Description
e goog.events.Event

X coordinate difference.

protectedinitTouchEvents_()

Initializes touch event handlers for all touch end and touch move events ocurring on the root element.

protectedonTouchEnd_(e)

Handles touch end events and decides how the view transitions should follow.

Name Type Description
e goog.events.Event

Touch end event.

protectedonTouchMove_(e)

Handles touch move events and decides how the view transitions should occur.

Name Type Description
e goog.events.Event

Touch move event.

protectedopenSidebarTouchMove_(e)

Close sidebar touch move functionality.

Name Type Description
e goog.events.Event

X coordinate difference.

pull(view, opt_canGoBack)

Name Type Description
view tart.ui.View

View to pull into view.

opt_canGoBack boolean optional

Whether this view keeps history so that one can go back to the previous view.

Switches to the previous view if there's one.

setCurrentView(view, opt_noDispose)

Makes a given view the foremost view without animations and with disposing previous views in history.

Name Type Description
view tart.ui.View

The view to set as the foremost view.

opt_noDispose boolean optional

Whether to dispose the current view.

toggleSidebar()

Toggles the sidebar on or off according to its current state. This is to be used for a menu button, for example.

protectedtoggleSidebar_(state)

Toggles the sidebar on or off according to a given state.

Name Type Description
state boolean

Whether to open or close the sidebar.