2 * Copyright (c) 2013, Ford Motor Company All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * · Redistributions of source code must retain the above copyright notice,
7 * this list of conditions and the following disclaimer.
8 * · Redistributions in binary form must reproduce the above copyright notice,
9 * this list of conditions and the following disclaimer in the documentation
10 * and/or other materials provided with the distribution.
11 * · Neither the name of the Ford Motor Company nor the names of its
12 * contributors may be used to endorse or promote products derived from this
13 * software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
28 * @name SDL.TurnByTurnView
29 * @desc TurnByTurnView module visual representation
31 * @filesource app/view/sdl/shared/turnByTurnView.js
35 SDL.TurnByTurnView = SDL.SDLAbstractView.create( {
37 elementId: 'TurnByTurnView',
39 classNames: 'TurnByTurnView',
61 navigationText2: null,
65 distanceToManeuver: null,
66 distanceToManeuverScale: null,
67 maneuverComplete: null,
69 activate: function( params ) {
71 this.softButtons.addItems( params.softButtons );
72 this.set( 'captionText.content', params.navigationText1 );
73 this.set( 'appId', params.appId );
74 this.set( 'navigationText2', params.navigationText2 );
75 this.set( 'eta', params.eta );
76 this.set( 'totalDistance', params.totalDistance );
77 this.set( 'turnIcon', params.turnIcon );
78 this.set( 'distanceToManeuver', params.distanceToManeuver );
79 this.set( 'distanceToManeuverScale', params.distanceToManeuverScale );
80 this.set( 'maneuverComplete', params.maneuverComplete );
82 this.set( 'active', true );
89 deactivate: function() {
90 this.set( 'active', false );
93 totalDistanceLabel: SDL.Label.extend( {
94 classNames: 'totalDistanceLabel',
95 contentBinding: 'parentView.totalDistance'
98 etaLabel: SDL.Label.extend( {
99 classNames: 'etaLabel',
100 contentBinding: 'parentView.eta'
103 turnList: SDL.Button.create( {
104 elementId: 'turnList',
105 classNames: 'turnList btn',
108 SDL.SDLController.tbtTurnList( this._parentView.appId );
112 templateName: 'arrow'
115 turnIconImage: Em.View.create( {
116 classNames: 'turnIcon btn',
122 if( this._parentView.turnIcon ){
123 return 'background-image: URL(' + this._parentView.turnIcon + ');';
127 }.property( 'this.parentView.turnIcon' )
130 navigationText2: SDL.Label.extend( {
131 classNames: 'navigationText2',
132 contentBinding: 'parentView.navigationText2'
135 homeScreen: SDL.Button.create( {
136 elementId: 'homeScreen',
137 classNames: 'homeScreen btn',
139 iconBinding: 'SDL.SDLAppController.model.appIcon',
140 target: 'this.parentView',
141 action: 'deactivate',
145 softButtons: SDL.MenuList.extend( {
149 groupName: "TurnByTurnView",
151 content: Em.ContainerView.extend( {