aboutsummaryrefslogtreecommitdiff
path: root/user-document-templates/montage-application-cloud
diff options
context:
space:
mode:
authorPierre Frisch2011-12-22 07:25:50 -0800
committerValerio Virgillito2012-01-27 11:18:17 -0800
commitb89a7ee8b956c96a1dcee995ea840feddc5d4b27 (patch)
tree0f3136ab0ecdbbbed6a83576581af0a53124d6f1 /user-document-templates/montage-application-cloud
parent2401f05d1f4b94d45e4568b81fc73e67b969d980 (diff)
downloadninja-b89a7ee8b956c96a1dcee995ea840feddc5d4b27.tar.gz
First commit of Ninja to ninja-internal
Signed-off-by: Valerio Virgillito <rmwh84@motorola.com>
Diffstat (limited to 'user-document-templates/montage-application-cloud')
-rw-r--r--user-document-templates/montage-application-cloud/appdelegate.js187
-rw-r--r--user-document-templates/montage-application-cloud/default_html.css74
-rw-r--r--user-document-templates/montage-application-cloud/index.html49
-rw-r--r--user-document-templates/montage-application-cloud/package.json8
-rw-r--r--user-document-templates/montage-application-cloud/styles.css5
5 files changed, 323 insertions, 0 deletions
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 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component;
9
10var Button = require("montage/ui/button.reel").Button,
11 Checkbox = require("montage/ui/checkbox.reel").Checkbox,
12 Condition = require("montage/ui/condition.reel").Condition,
13 DynamicText = require("montage/ui/dynamic-text.reel").DynamicText,
14
15 FlowController = require("montage/ui/flow-controller.reel").FlowController,
16
17 HotText = require("montage/ui/hottext.reel").HotText,
18 HotTextUnit = require("montage/ui/hottextunit.reel").HotTextUnit,
19
20 ImageContainer = require("montage/ui/photo-editor.reel").PhotoEditor,
21 Progress = require("montage/ui/progress.reel").Progress,
22
23 Repetition = require("montage/ui/repetition.reel").Repetition,
24 Scrollview = require("montage/ui/scrollview.reel").Scrollview,
25 Slider = require("montage/ui/slider.reel").Slider,
26 Slot = require("montage/ui/slot.reel").Slot,
27 Substitution = require("montage/ui/substitution.reel").Substitution,
28
29 TextArea = require("montage/ui/textarea.reel").TextArea,
30 Textfield = require("montage/ui/textfield.reel").Textfield,
31
32 Toggle = require("montage/ui/toggle.reel").Toggle,
33 ToggleButton = require("montage/ui/button.reel").ToggleButton;
34
35exports.MyAppDelegate = Montage.create(Component, {
36 templateDidLoad: {
37 value: function(){
38 window.addComponent = this.addComponentToUserDocument;
39 window.addBinding = this.addBindingToUserDocument;
40
41 var newEvent = document.createEvent( "CustomEvent" );
42 newEvent.initCustomEvent( "userTemplateDidLoad", false, true );
43
44 document.body.dispatchEvent( newEvent );
45
46 }
47 },
48
49 addComponentToUserDocument:{
50 value:function(containerElement, componentType){
51 var component = null;
52 switch(componentType){
53 case "Button":
54 component = Button.create();
55 component.element = containerElement;
56 component.element.classList.add("text");
57 component.value = "Button";
58 component.needsDraw = true;
59 break;
60 case "Checkbox":
61 component = Checkbox.create();
62 component.element = containerElement;
63 component.needsDraw = true;
64 break;
65 case "Condition":
66 component = Condition.create();
67 component.element = containerElement;
68 component.needsDraw = true;
69 break;
70 case "DynamicText":
71 component = DynamicText.create();
72 component.element = containerElement;
73 component.value = "Label";
74 component.needsDraw = true;
75 break;
76 case "HotText":
77 component = HotText.create();
78 component.element = containerElement;
79 component.needsDraw = true;
80 break;
81 case "HotTextUnit":
82 component = HotTextUnit.create();
83 component.element = containerElement;
84 component.needsDraw = true;
85 break;
86 case "FlowController":
87 component = FlowController.create();
88 component.element = containerElement;
89 component.needsDraw = true;
90 break;
91 case "ImageContainer":
92 component = ImageContainer.create();
93 component.element = containerElement;
94 component.element.style.width = "285px";
95 component.element.style.height = "235px";
96 component.src = "placeholder.jpg";
97 component.needsDraw = true;
98 break;
99 case "Progress":
100 component = Progress.create();
101 component.element = containerElement;
102 component.loading = true;
103 component.needsDraw = true;
104 break;
105 case "Repetition":
106 component = Repetition.create();
107 component.element = containerElement;
108 component.needsDraw = true;
109 break;
110 case "Scrollview":
111 component = Scrollview.create();
112 component.element = containerElement;
113 component.element.style.width = "200px";
114 component.element.style.height = "200px";
115 var dummyContent = document.createElement("div");
116 dummyContent.innerHTML = "<img src='image3.jpg'/>";
117 component.element.appendChild(dummyContent);
118 component.needsDraw = true;
119 break;
120 case "Slider":
121 component = Slider.create();
122 component.element = containerElement;
123// component.value = 0;
124// component._minValue = 0;
125// component._maxValue = 100;
126 component.needsDraw = true;
127 break;
128 case "Slot":
129 component = Slot.create();
130 component.element = containerElement;
131 component.needsDraw = true;
132 break;
133 case "Substitution":
134 component = Substitution.create();
135 component.element = containerElement;
136 component.needsDraw = true;
137 break;
138 case "TextArea":
139 component = TextArea.create();
140 component.element = containerElement;
141 component.needsDraw = true;
142 break;
143 case "Textfield":
144 component = Textfield.create();
145 component.element = containerElement;
146 component.needsDraw = true;
147 break;
148 case "Toggle":
149 component = Toggle.create();
150 component.element = containerElement;
151 component.needsDraw = true;
152 break;
153 case "ToggleButton":
154 component = ToggleButton.create();
155 component.element = containerElement;
156 component.element.classList.add("text");
157 component.needsDraw = true;
158 break;
159 default:
160 console.log("Unrecognized component type");
161 }
162 //console.log(component);
163 return component;
164 }
165 },
166 addBindingToUserDocument:{
167 value:function(boundComponent, boundValue, targetComponent, targetValue){
168 if(targetComponent[targetValue] != undefined && boundComponent[boundValue] != undefined){
169 Object.defineBinding(boundComponent, boundValue, {
170 boundObject: targetComponent,
171 boundObjectPropertyPath: targetValue,
172 boundValueMutator: function(value) {
173 return(value);
174 }
175 });
176 } else {
177 if(targetComponent[targetValue] == undefined){
178 console.log("Binding Fail - Component Property Not Found: " + targetValue);
179 alert("Binding Failed - Component Property Not Found: " + targetValue)
180 } else if(boundComponent[boundValue] == undefined){
181 console.log("Binding Fail - Component Property Not Found: " + boundValue);
182 alert("Binding Failed - Component Property Not Found: " + boundValue);
183 }
184 }
185 }
186 }
187}); \ 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 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or