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 --- .../montage-application-cloud/appdelegate.js | 187 +++++++++++++++++++++ .../montage-application-cloud/default_html.css | 74 ++++++++ .../montage-application-cloud/index.html | 49 ++++++ .../montage-application-cloud/package.json | 8 + .../montage-application-cloud/styles.css | 5 + 5 files changed, 323 insertions(+) create mode 100644 user-document-templates/montage-application-cloud/appdelegate.js create mode 100644 user-document-templates/montage-application-cloud/default_html.css create mode 100644 user-document-templates/montage-application-cloud/index.html create mode 100644 user-document-templates/montage-application-cloud/package.json create mode 100644 user-document-templates/montage-application-cloud/styles.css (limited to 'user-document-templates') diff --git a/user-document-templates/montage-application-cloud/appdelegate.js b/user-document-templates/montage-application-cloud/appdelegate.js new file mode 100644 index 00000000..64ce6f59 --- /dev/null +++ b/user-document-templates/montage-application-cloud/appdelegate.js @@ -0,0 +1,187 @@ +/* +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. +
*/ + +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; + +var Button = require("montage/ui/button.reel").Button, + Checkbox = require("montage/ui/checkbox.reel").Checkbox, + Condition = require("montage/ui/condition.reel").Condition, + DynamicText = require("montage/ui/dynamic-text.reel").DynamicText, + + FlowController = require("montage/ui/flow-controller.reel").FlowController, + + HotText = require("montage/ui/hottext.reel").HotText, + HotTextUnit = require("montage/ui/hottextunit.reel").HotTextUnit, + + ImageContainer = require("montage/ui/photo-editor.reel").PhotoEditor, + Progress = require("montage/ui/progress.reel").Progress, + + Repetition = require("montage/ui/repetition.reel").Repetition, + Scrollview = require("montage/ui/scrollview.reel").Scrollview, + Slider = require("montage/ui/slider.reel").Slider, + Slot = require("montage/ui/slot.reel").Slot, + Substitution = require("montage/ui/substitution.reel").Substitution, + + TextArea = require("montage/ui/textarea.reel").TextArea, + Textfield = require("montage/ui/textfield.reel").Textfield, + + Toggle = require("montage/ui/toggle.reel").Toggle, + ToggleButton = require("montage/ui/button.reel").ToggleButton; + +exports.MyAppDelegate = Montage.create(Component, { + templateDidLoad: { + value: function(){ + window.addComponent = this.addComponentToUserDocument; + window.addBinding = this.addBindingToUserDocument; + + var newEvent = document.createEvent( "CustomEvent" ); + newEvent.initCustomEvent( "userTemplateDidLoad", false, true ); + + document.body.dispatchEvent( newEvent ); + + } + }, + + addComponentToUserDocument:{ + value:function(containerElement, componentType){ + var component = null; + switch(componentType){ + case "Button": + component = Button.create(); + component.element = containerElement; + component.element.classList.add("text"); + component.value = "Button"; + component.needsDraw = true; + break; + case "Checkbox": + component = Checkbox.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "Condition": + component = Condition.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "DynamicText": + component = DynamicText.create(); + component.element = containerElement; + component.value = "Label"; + component.needsDraw = true; + break; + case "HotText": + component = HotText.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "HotTextUnit": + component = HotTextUnit.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "FlowController": + component = FlowController.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "ImageContainer": + component = ImageContainer.create(); + component.element = containerElement; + component.element.style.width = "285px"; + component.element.style.height = "235px"; + component.src = "placeholder.jpg"; + component.needsDraw = true; + break; + case "Progress": + component = Progress.create(); + component.element = containerElement; + component.loading = true; + component.needsDraw = true; + break; + case "Repetition": + component = Repetition.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "Scrollview": + component = Scrollview.create(); + component.element = containerElement; + component.element.style.width = "200px"; + component.element.style.height = "200px"; + var dummyContent = document.createElement("div"); + dummyContent.innerHTML = ""; + component.element.appendChild(dummyContent); + component.needsDraw = true; + break; + case "Slider": + component = Slider.create(); + component.element = containerElement; +// component.value = 0; +// component._minValue = 0; +// component._maxValue = 100; + component.needsDraw = true; + break; + case "Slot": + component = Slot.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "Substitution": + component = Substitution.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "TextArea": + component = TextArea.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "Textfield": + component = Textfield.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "Toggle": + component = Toggle.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "ToggleButton": + component = ToggleButton.create(); + component.element = containerElement; + component.element.classList.add("text"); + component.needsDraw = true; + break; + default: + console.log("Unrecognized component type"); + } + //console.log(component); + return component; + } + }, + addBindingToUserDocument:{ + value:function(boundComponent, boundValue, targetComponent, targetValue){ + if(targetComponent[targetValue] != undefined && boundComponent[boundValue] != undefined){ + Object.defineBinding(boundComponent, boundValue, { + boundObject: targetComponent, + boundObjectPropertyPath: targetValue, + boundValueMutator: function(value) { + return(value); + } + }); + } else { + if(targetComponent[targetValue] == undefined){ + console.log("Binding Fail - Component Property Not Found: " + targetValue); + alert("Binding Failed - Component Property Not Found: " + targetValue) + } else if(boundComponent[boundValue] == undefined){ + console.log("Binding Fail - Component Property Not Found: " + boundValue); + alert("Binding Failed - Component Property Not Found: " + boundValue); + } + } + } + } +}); \ No newline at end of file diff --git a/user-document-templates/montage-application-cloud/default_html.css b/user-document-templates/montage-application-cloud/default_html.css new file mode 100644 index 00000000..05aaf1d0 --- /dev/null +++ b/user-document-templates/montage-application-cloud/default_html.css @@ -0,0 +1,74 @@ +/* +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. +
*/ + +* { + -webkit-transition-duration: 0s !important; + -webkit-animation-duration: 0s !important; +} + +html{ + overflow:hidden; +} + +body +{ + background: #808080; +} + +#Viewport +{ + margin: 0px; + padding: 0px; + top: 200px; + left: 700px; + /*position: absolute;*/ + /*height: 600px;*/ + /*width: 800px;*/ + opacity: 0.99; + z-index:2; +} + +#stageBG +{ + background: #ffffff; + top: 200px; + left: 700px; + z-index:1; +} + +.stageDimension +{ + position: absolute; + height: 600px; + width: 800px; +} + +.stageView +{ + border: 1px solid black; + -webkit-transform-style: preserve-3d; + -webkit-transform: perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); +} + +.stageContentShadow { + -webkit-box-shadow: 3px 5px 4px rgba(0,0,0,.5); + -moz-box-shadow: 3px 5px 4px rgba(0,0,0,.5); + box-shadow: 3px 5px 4px rgba(0,0,0,.5); +} + +#userHead +{ + display: none; +} + +.global3DSettings { + -webkit-transform-style: preserve-3d; + -webkit-transform: perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); +} + +.elem-red-outline { + outline: red solid thin; +} \ No newline at end of file diff --git a/user-document-templates/montage-application-cloud/index.html b/user-document-templates/montage-application-cloud/index.html new file mode 100644 index 00000000..d1f9634d --- /dev/null +++ b/user-document-templates/montage-application-cloud/index.html @@ -0,0 +1,49 @@ + + + + + + + Ninja Prototype + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ + + + \ No newline at end of file diff --git a/user-document-templates/montage-application-cloud/package.json b/user-document-templates/montage-application-cloud/package.json new file mode 100644 index 00000000..5466b3d7 --- /dev/null +++ b/user-document-templates/montage-application-cloud/package.json @@ -0,0 +1,8 @@ +{ + "directories": { + "lib": "" + }, + "mappings": { + "montage": "../../node_modules/montage/" + } +} \ No newline at end of file diff --git a/user-document-templates/montage-application-cloud/styles.css b/user-document-templates/montage-application-cloud/styles.css new file mode 100644 index 00000000..0441c1cf --- /dev/null +++ b/user-document-templates/montage-application-cloud/styles.css @@ -0,0 +1,5 @@ +/* + 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. +
*/ \ No newline at end of file -- cgit v1.2.3