aboutsummaryrefslogtreecommitdiff
path: root/user-document-templates
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-14 11:22:21 -0800
committerValerio Virgillito2012-02-14 11:22:21 -0800
commitab1466b2627e40f58afcaa3d425d4145fa47525a (patch)
tree5c0de8b4db67b07b0e745e776e99eabff989d804 /user-document-templates
parent33c805d441abb2f83fd1ac9ee2d3d4282acc009f (diff)
parentdf898049b2990f456a305eb18434b887468225cf (diff)
downloadninja-ab1466b2627e40f58afcaa3d425d4145fa47525a.tar.gz
Merge branch 'components' of https://github.com/mencio/ninja-internal into integration
Conflicts: js/io/document/html-document.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'user-document-templates')
-rwxr-xr-xuser-document-templates/montage-application-cloud/appdelegate.js162
-rwxr-xr-xuser-document-templates/montage-application-cloud/index.html4
-rw-r--r--user-document-templates/montage-application-cloud/main.reel/main.js55
3 files changed, 57 insertions, 164 deletions
diff --git a/user-document-templates/montage-application-cloud/appdelegate.js b/user-document-templates/montage-application-cloud/appdelegate.js
deleted file mode 100755
index 3c21b46e..00000000
--- a/user-document-templates/montage-application-cloud/appdelegate.js
+++ /dev/null
@@ -1,162 +0,0 @@
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
10exports.MyAppDelegate = Montage.create(Component, {
11 templateDidLoad: {
12 value: function(){
13 window.addComponent = this.addComponentToUserDocument;
14 window.addBinding = this.addBindingToUserDocument;
15
16 var newEvent = document.createEvent( "CustomEvent" );
17 newEvent.initCustomEvent( "userTemplateDidLoad", false, true );
18
19 document.body.dispatchEvent( newEvent );
20
21 }
22 },
23
24 addComponentToUserDocument:{
25 value:function(containerElement, componentType){
26 var component = null;
27 switch(componentType){
28 case "Button":
29 component = Button.create();
30 component.element = containerElement;
31 component.element.classList.add("text");
32 component.value = "Button";
33 component.needsDraw = true;
34 break;
35 case "Checkbox":
36 component = Checkbox.create();
37 component.element = containerElement;
38 component.needsDraw = true;
39 break;
40 case "Condition":
41 component = Condition.create();
42 component.element = containerElement;
43 component.needsDraw = true;
44 break;
45 case "DynamicText":
46 component = DynamicText.create();
47 component.element = containerElement;
48 component.value = "Label";
49 component.needsDraw = true;
50 break;
51 case "HotText":
52 component = HotText.create();
53 component.element = containerElement;
54 component.needsDraw = true;
55 break;
56 case "HotTextUnit":
57 component = HotTextUnit.create();
58 component.element = containerElement;
59 component.needsDraw = true;
60 break;
61 case "FlowController":
62 component = FlowController.create();
63 component.element = containerElement;
64 component.needsDraw = true;
65 break;
66 case "ImageContainer":
67 component = ImageContainer.create();
68 component.element = containerElement;
69 component.element.style.width = "285px";
70 component.element.style.height = "235px";
71 component.src = "placeholder.jpg";
72 component.needsDraw = true;
73 break;
74 case "Progress":
75 component = Progress.create();
76 component.element = containerElement;
77 component.loading = true;
78 component.needsDraw = true;
79 break;
80 case "Repetition":
81 component = Repetition.create();
82 component.element = containerElement;
83 component.needsDraw = true;
84 break;
85 case "Scrollview":
86 component = Scrollview.create();
87 component.element = containerElement;
88 component.element.style.width = "200px";
89 component.element.style.height = "200px";
90 var dummyContent = document.createElement("div");
91 dummyContent.innerHTML = "<img src='image3.jpg'/>";
92 component.element.appendChild(dummyContent);
93 component.needsDraw = true;
94 break;
95 case "Slider":
96 component = Slider.create();
97 component.element = containerElement;
98// component.value = 0;
99// component._minValue = 0;
100// component._maxValue = 100;
101 component.needsDraw = true;
102 break;
103 case "Slot":
104 component = Slot.create();
105 component.element = containerElement;
106 component.needsDraw = true;
107 break;
108 case "Substitution":
109 component = Substitution.create();
110 component.element = containerElement;
111 component.needsDraw = true;
112 break;
113 case "TextArea":
114 component = TextArea.create();
115 component.element = containerElement;
116 component.needsDraw = true;
117 break;
118 case "Textfield":
119 component = Textfield.create();
120 component.element = containerElement;
121 component.needsDraw = true;
122 break;
123 case "Toggle":
124 component = Toggle.create();
125 component.element = containerElement;
126 component.needsDraw = true;
127 break;
128 case "ToggleButton":
129 component = ToggleButton.create();
130 component.element = containerElement;
131 component.element.classList.add("text");
132 component.needsDraw = true;
133 break;
134 default:
135 console.log("Unrecognized component type");
136 }
137 //console.log(component);
138 return component;
139 }
140 },
141 addBindingToUserDocument:{
142 value:function(boundComponent, boundValue, targetComponent, targetValue){
143 if(targetComponent[targetValue] != undefined && boundComponent[boundValue] != undefined){
144 Object.defineBinding(boundComponent, boundValue, {
145 boundObject: targetComponent,
146 boundObjectPropertyPath: targetValue,
147 boundValueMutator: function(value) {
148 return(value);
149 }
150 });
151 } else {
152 if(targetComponent[targetValue] == undefined){
153 console.log("Binding Fail - Component Property Not Found: " + targetValue);
154 alert("Binding Failed - Component Property Not Found: " + targetValue)
155 } else if(boundComponent[boundValue] == undefined){
156 console.log("Binding Fail - Component Property Not Found: " + boundValue);
157 alert("Binding Failed - Component Property Not Found: " + boundValue);
158 }
159 }
160 }
161 }
162}); \ 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
index 63dd5926..49931969 100755
--- a/user-document-templates/montage-application-cloud/index.html
+++ b/user-document-templates/montage-application-cloud/index.html
@@ -25,8 +25,8 @@
25 <script type="text/montage-serialization"> 25 <script type="text/montage-serialization">
26 { 26 {
27 "owner": { 27 "owner": {
28 "module": "./appdelegate", 28 "module": "main.reel",
29 "name": "MyAppDelegate" 29 "name": "Main"
30 } 30 }
31 } 31 }
32 </script> 32 </script>
diff --git a/user-document-templates/montage-application-cloud/main.reel/main.js b/user-document-templates/montage-application-cloud/main.reel/main.js
new file mode 100644
index 00000000..86871fd3
--- /dev/null
+++ b/user-document-templates/montage-application-cloud/main.reel/main.js
@@ -0,0 +1,55 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No 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> */
6var Montage = require("montage/core/core").Montage,
7 Component = require("montage/ui/component").Component;
8
9//var Button = ("montage/ui/button.reel").Button;
10
11exports.Main = Montage.create(Component, {
12
13 hasTemplate: {
14 value: false
15 },
16