aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--user-document-templates/montage-application-cloud/index.html6
-rw-r--r--user-document-templates/montage-application-cloud/main.reel/main.js163
-rw-r--r--user-document-templates/montage-application-cloud/package.json2
3 files changed, 167 insertions, 4 deletions
diff --git a/user-document-templates/montage-application-cloud/index.html b/user-document-templates/montage-application-cloud/index.html
index d1f9634d..ac0405ca 100644
--- a/user-document-templates/montage-application-cloud/index.html
+++ b/user-document-templates/montage-application-cloud/index.html
@@ -13,7 +13,7 @@
13 <link href="default_html.css" id="nj-stage-stylesheet" rel="stylesheet" type="text/css" media="screen"/> 13 <link href="default_html.css" id="nj-stage-stylesheet" rel="stylesheet" type="text/css" media="screen"/>
14 <link href="styles.css" id="nj-default-stylesheet" rel="stylesheet" type="text/css" media="screen"/> 14 <link href="styles.css" id="nj-default-stylesheet" rel="stylesheet" type="text/css" media="screen"/>
15 15
16 <script type="text/javascript" data-package="." src="../../node_modules/montage/montage.js"></script> 16 <script type="text/javascript" data-package="." src="../../node_modules/montage-user/montage.js"></script>
17 17
18 <script type="text/javascript"> 18 <script type="text/javascript">
19 function getElement(x,y) { 19 function getElement(x,y) {
@@ -24,8 +24,8 @@
24 <script type="text/montage-serialization"> 24 <script type="text/montage-serialization">
25 { 25 {
26 "owner": { 26 "owner": {
27 "module": "./appdelegate", 27 "module": "main.reel",
28 "name": "MyAppDelegate" 28 "name": "Main"
29 } 29 }
30 } 30 }
31 </script> 31 </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..415794d8
--- /dev/null
+++ b/user-document-templates/montage-application-cloud/main.reel/main.js
@@ -0,0 +1,163 @@
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
17 /**
18 * Adding window hooks to callback into this object from Ninja.
19 */
20 templateDidLoad: {
21 value: function(){
22 window.addComponent = this.addComponentToUserDocument;
23// window.addBinding = this.addBindingToUserDocument;
24
25 // Dispatch event when this template has loaded.
26 var newEvent = document.createEvent( "CustomEvent" );
27 newEvent.initCustomEvent( "userTemplateDidLoad", false, true );
28
29 document.body.dispatchEvent( newEvent );
30
31 }
32 },
33
34 addComponentToUserDocument:{
35 value:function(containerElement, componentType){
36 var component = null;
37 switch(componentType.type){
38 case "Button":
39
40 //var tmpFix = require("montage/ui/button.reel");
41 //var str = "montage/ui/button.reel";
42 var stro = componentType.path;
43
44 var button = require(stro);
45
46 var buttonInstance = button[componentType.name];
47
48 buttonInstance.element = containerElement;
49 buttonInstance.deserializedFromTemplate();
50
51 buttonInstance.needsDraw = true;
52 buttonInstance.label = "Button";
53
54 return buttonInstance;
55 break;
56 case "Checkbox":
57 component = Checkbox.create();
58 component.element = containerElement;
59 component.needsDraw = true;
60 break;
61 case "Condition":
62 component = Condition.create();
63 component.element = containerElement;
64 component.needsDraw = true;
65 break;
66 case "DynamicText":
67 component = DynamicText.create();
68 component.element = containerElement;
69 component.value = "Label";
70 component.needsDraw = true;
71 break;
72 case "HotText":
73 component = HotText.create();
74 component.element = containerElement;
75 component.needsDraw = true;
76 break;
77 case "HotTextUnit":
78 component = HotTextUnit.create();
79 component.element = containerElement;
80 component.needsDraw = true;
81 break;
82 case "FlowController":
83 component = FlowController.create();
84 component.element = containerElement;
85 component.needsDraw = true;
86 break;
87 case "ImageContainer":
88 component = ImageContainer.create();
89 component.element = containerElement;
90 component.element.style.width = "285px";
91 component.element.style.height = "235px";
92 component.src = "placeholder.jpg";
93 component.needsDraw = true;
94 break;
95 case "Progress":
96 component = Progress.create();
97 component.element = containerElement;
98 component.loading = true;
99 component.needsDraw = true;
100 break;
101 case "Repetition":
102 component = Repetition.create();
103 component.element = containerElement;
104 component.needsDraw = true;
105 break;
106 case "Scrollview":
107 component = Scrollview.create();
108 component.element = containerElement;
109 component.element.style.width = "200px";
110 component.element.style.height = "200px";
111 var dummyContent = document.createElement("div");
112 dummyContent.innerHTML = "<img src='image3.jpg'/>";
113 component.element.appendChild(dummyContent);
114 component.needsDraw = true;
115 break;
116 case "Slider":
117 component = Slider.create();
118 component.element = containerElement;
119// component.value = 0;
120// component._minValue = 0;
121// component._maxValue = 100;
122 component.needsDraw = true;
123 break;
124 case "Slot":
125 component = Slot.create();
126 component.element = containerElement;
127 component.needsDraw = true;
128 break;
129 case "Substitution":
130 component = Substitution.create();
131 component.element = containerElement;
132 component.needsDraw = true;
133 break;
134 case "TextArea":
135 component = TextArea.create();
136 component.element = containerElement;
137 component.needsDraw = true;
138 break;
139 case "Textfield":
140 component = Textfield.create();
141 component.element = containerElement;
142 component.needsDraw = true;
143 break;
144 case "Toggle":
145 component = Toggle.create();
146 component.element = containerElement;
147 component.needsDraw = true;
148 break;
149 case "ToggleButton":
150 component = ToggleButton.create();
151 component.element = containerElement;
152 component.element.classList.add("text");
153 component.needsDraw = true;
154 break;
155 default:
156 console.log("Unrecognized component type");
157 }
158 //console.log(component);
159 return component;
160 }
161 }
162
163}); \ 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
index 5466b3d7..4be312d5 100644
--- a/user-document-templates/montage-application-cloud/package.json
+++ b/user-document-templates/montage-application-cloud/package.json
@@ -3,6 +3,6 @@
3 "lib": "" 3 "lib": ""
4 }, 4 },
5 "mappings": { 5 "mappings": {
6 "montage": "../../node_modules/montage/" 6 "montage": "../../node_modules/montage-user/"
7 } 7 }
8} \ No newline at end of file