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.AlertManeuverPopUp
29 * @desc AlertManeuverPopUp module visual representation
31 * @filesource app/view/sdl/AlertManeuverPopUp.js
35 SDL.AlertManeuverPopUp = Em.ContainerView.create( {
37 elementId: 'AlertManeuverPopUp',
39 classNames: 'AlertManeuverPopUp',
42 ['activate:AlertManeuverActive'
65 * Wagning image on Alert Maneuver PopUp
67 image: Em.View.extend( {
68 elementId: 'alertManeuverPopUpImage',
70 classNames: 'alertManeuverPopUpImage'
73 applicationName: SDL.Label.extend( {
75 elementId: 'applicationName',
77 classNames: 'applicationName',
79 contentBinding: 'parentView.appName'
82 message1: SDL.Label.extend( {
84 elementId: 'message1',
86 classNames: 'message1',
88 contentBinding: 'parentView.content1'
91 message2: SDL.Label.extend( {
93 elementId: 'message2',
95 classNames: 'message2',
97 contentBinding: 'parentView.content2'
100 message3: SDL.Label.extend( {
102 elementId: 'message3',
104 classNames: 'message3',
106 contentBinding: 'parentView.content3'
110 * Container for softbuttons
112 softbuttons: Em.ContainerView.extend( {
113 elementId: 'alertManeuverSoftButtons',
115 classNames: 'alertManeuverSoftButtons'
121 closeButton: SDL.Button.create( {
123 classNames: 'closeButton softButton',
124 action: 'closeAlertMeneuverPopUp',
125 target: 'SDL.SDLController',
130 * @desc Function creates Soft Buttons on AlertPoUp
131 * @param {Object} params
133 addSoftButtons: function( params ) {
135 var count = this.get( 'softbuttons' ).removeAllChildren();
139 var softButtonsClass;
140 switch( params.length ){
142 softButtonsClass = 'one';
145 softButtonsClass = 'two';
148 softButtonsClass = 'three';
151 softButtonsClass = 'four';
155 for( var i = 0; i < params.length; i++ ){
156 this.get( 'softbuttons.childViews' ).pushObject( SDL.Button.create( SDL.PresetEventsCustom, {
157 softButtonID: params[i].softButtonID,
158 icon: params[i].image,
159 text: params[i].text,
160 classNames: 'list-item softButton ' + softButtonsClass,
161 elementId: 'softButton' + i,
162 templateName: params[i].image ? 'rightIcon' : 'text',
163 systemAction: params[i].systemAction
169 AlertManeuverActive: function( message ) {
173 if( message.playTone ){
174 SDL.Audio.play( 'audio/alert.wav' );
177 this.addSoftButtons( message.softButtons );
178 if( message.ttsChunks ){
179 SDL.SDLModel.onPrompt( message.ttsChunks.ttsChunks );
182 this.set( 'appName', SDL.SDLController.getApplicationModel( message.appId ).appName );
184 this.set( 'activate', true );
186 clearTimeout( this.timer );
187 this.timer = setTimeout( function() {
188 self.set( 'activate', false );