From b89a7ee8b956c96a1dcee995ea840feddc5d4b27 Mon Sep 17 00:00:00 2001 From: Pierre Frisch Date: Thu, 22 Dec 2011 07:25:50 -0800 Subject: First commit of Ninja to ninja-internal Signed-off-by: Valerio Virgillito --- node_modules/montage/ui/popup/alert.reel/alert.css | 67 +++++++++++ .../montage/ui/popup/alert.reel/alert.html | 120 ++++++++++++++++++ node_modules/montage/ui/popup/alert.reel/alert.js | 134 +++++++++++++++++++++ 3 files changed, 321 insertions(+) create mode 100755 node_modules/montage/ui/popup/alert.reel/alert.css create mode 100755 node_modules/montage/ui/popup/alert.reel/alert.html create mode 100755 node_modules/montage/ui/popup/alert.reel/alert.js (limited to 'node_modules/montage/ui/popup/alert.reel') diff --git a/node_modules/montage/ui/popup/alert.reel/alert.css b/node_modules/montage/ui/popup/alert.reel/alert.css new file mode 100755 index 00000000..6dee8b6a --- /dev/null +++ b/node_modules/montage/ui/popup/alert.reel/alert.css @@ -0,0 +1,67 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +.montage-alert-dialog { + min-width: 300px; +} +.montage-alert-dialog .montage-alert-content { + font-size: 1.3em; + padding: 15px; + +} +.montage-alert-dialog .montage-alert-actions { + float: right; +} + +/* + +.montage-alert-dialog { + font-family: "AG Buch BQ Regular", "AG Buch BQ", Helvetica, Arial, sans-serif; + background-color: #333; + border: 1px solid #333; + border-radius: 5px; + margin: 0; + padding: 0px 3px; +} + +.montage-alert-dialog .header { + height: 25px; + color: #fff; +} + +.montage-alert-dialog .header h4 { + margin: 10px 0; + font-weight: normal; +} + +.montage-alert-dialog .content { + text-align: center; + margin: 5px 0; + background-color: #e6e6e6; + padding: 10px; +} + +.montage-alert-dialog .msg-container { + padding: 10px 0; + border-bottom: 1px solid #ccc; +} + +.montage-alert-dialog .msg { + font-size: 18pt; + font-weight: normal; +} + +.montage-alert-dialog .msg-detail { + font-size: 12pt; + font-weight: normal; + color: #cccccc; +} + +.montage-alert-dialog .action-container { + padding: 10px 0; +} +*/ + diff --git a/node_modules/montage/ui/popup/alert.reel/alert.html b/node_modules/montage/ui/popup/alert.reel/alert.html new file mode 100755 index 00000000..f71da981 --- /dev/null +++ b/node_modules/montage/ui/popup/alert.reel/alert.html @@ -0,0 +1,120 @@ + + + + + + + + + + + +
+ +
+

+
+ +
+
+
+
+ + + +
+ + diff --git a/node_modules/montage/ui/popup/alert.reel/alert.js b/node_modules/montage/ui/popup/alert.reel/alert.js new file mode 100755 index 00000000..54b854a4 --- /dev/null +++ b/node_modules/montage/ui/popup/alert.reel/alert.js @@ -0,0 +1,134 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +/** + @module "montage/ui/popup/alert.reel" + @requires montage/core/core + @requires montage/ui/component + @requires "montage/ui/popup/popup.reel" +*/ + +var Montage = require("montage").Montage; +var Component = require("ui/component").Component; +var Popup = require("ui/popup/popup.reel").Popup; + +/** + @class module:"montage/ui/popup/alert.reel".Alert + @extends module:montage/ui/component.Component + */ + +var Alert = exports.Alert = Montage.create(Component, { + title: { + value: 'Alert' + }, +/** + Description TODO + @type {Property} + @default {String} '' + */ + msg: { + value: '' + }, +/** + Description TODO + @type {Property} + @default {String} '' + */ + details: { + value: '' + }, +/** + Description TODO + @private +*/ + _popup: { + value: null + }, +/** + Description TODO + @type {Function} + @default null + */ + popup: { + set: function(value) { + this._popup = value; + }, + get: function() { + return this._popup; + } + }, + + okCallback: {value: null}, + + prepareForDraw: { + value: function() { + this.element.addEventListener("keyup", this, false); + } + }, +/** + Description TODO + @function + @param {Event} evt The event keyCode. + */ + handleKeyup: { + value: function(evt) { + if (evt.keyCode == 13 /*Enter*/ || + evt.keyCode == 27 /*Escape*/) { + + this.handleOkAction(evt); + } + } + }, +/** + Description TODO + @function + @param {Event} evt The event keyCode. + */ + handleOkAction: { + value: function(evt) { + if(this.okCallback) { + this.okCallback.call(this, evt); + } + var anEvent = document.createEvent("CustomEvent"); + anEvent.initCustomEvent("montage_alert_ok", true, true, null); + + this.dispatchEvent(anEvent); + this.popup.hide(); + } + }, + + // Static method to show an Alert dialog + /** + Displays an Alert dialog with a OK button. + @function + @param {String} msg A message to display in the dialog. + @param {Function} okCallback Function that's invoked when the user clicks OK + @example + ... + */ + show: { + value: function(msg, okCallback) { + var popup = this.application._alertPopup, alert; + if(!popup) { + popup = Popup.create(); + this.popup = popup; + + popup.type = 'alert'; + popup.title = 'Message'; + popup.modal = true; + this.application._alertPopup = popup; + + alert = Alert.create(); + popup.content = alert; + } + alert = popup.content; + alert.msg = msg; + alert.okCallback = okCallback || null; + popup.show(); + } + } +}); + -- cgit v1.2.3