aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/components/focus-manager.reel/focus-manager.js49
-rwxr-xr-xjs/controllers/elements/element-controller.js17
-rwxr-xr-xjs/ninja.reel/ninja.css4
-rwxr-xr-xjs/ninja.reel/ninja.html11
-rwxr-xr-xjs/panels/Splitter.js6
-rwxr-xr-xjs/panels/properties.reel/properties.html72
-rwxr-xr-xjs/panels/properties.reel/properties.js64
-rwxr-xr-xjs/stage/stage.reel/stage.html7
-rwxr-xr-xjs/stage/stage.reel/stage.js11
9 files changed, 126 insertions, 115 deletions
diff --git a/js/components/focus-manager.reel/focus-manager.js b/js/components/focus-manager.reel/focus-manager.js
new file mode 100644
index 00000000..65a84bc1
--- /dev/null
+++ b/js/components/focus-manager.reel/focus-manager.js
@@ -0,0 +1,49 @@
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> */
6
7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component;
9
10exports.FocusManager = Montage.create(Component, {
11
12 hasTemplate: {
13 value: false
14 },
15
16 element: {
17 serializable: true,
18 enumerable: true,
19 get: function() {
20 return this._element;
21 },
22 set: function(value) {
23 // call super set
24 Object.getPropertyDescriptor(Component, "element").set.call(this, value);
25 }
26 },
27
28 hiddenInput: {
29 value: null
30 },
31
32 prepareForDraw: {
33 value: function() {
34 this.hiddenInput = document.createElement("input");
35 this.hiddenInput.type = "text";
36
37 this.element.appendChild(this.hiddenInput);
38
39 }
40 },
41
42 setFocus: {
43 value: function() {
44 this.hiddenInput.focus();
45 }
46 }
47
48});
49
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 9f00604f..70aba54e 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -51,23 +51,6 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
51 51
52 setAttribute: { 52 setAttribute: {
53 value: function(el, att, value) { 53 value: function(el, att, value) {
54 if(att === "id") {
55 if(value === "") {
56 el.setAttribute(att, value);
57 return;
58 }
59
60 // Then check if this is a valid id by the following spec: http://www.w3.org/TR/REC-html40/types.html#h-6.2
61 var regexID = /^([a-zA-Z])+([a-zA-Z0-9_\.\:\-])+/;
62 if(!regexID.test(value)) {
63 alert("Invalid ID");
64 return;
65 } else if (this.application.ninja.currentDocument._document.getElementById(value) !== null) {
66 alert("The following ID: " + value + " is already in Use");
67 }
68
69 }
70
71 el.setAttribute(att, value); 54 el.setAttribute(att, value);
72 } 55 }
73 }, 56 },
diff --git a/js/ninja.reel/ninja.css b/js/ninja.reel/ninja.css
index 83c0e569..61251eff 100755
--- a/js/ninja.reel/ninja.css
+++ b/js/ninja.reel/ninja.css
@@ -7,3 +7,7 @@
7.main { 7.main {
8 padding: 100px; 8 padding: 100px;
9} 9}
10
11.hidden {
12 display: none;
13}
diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html
index 3dc45498..f9e1efdd 100755
--- a/js/ninja.reel/ninja.html
+++ b/js/ninja.reel/ninja.html
@@ -287,6 +287,13 @@
287 "name": "MainMenuController" 287 "name": "MainMenuController"
288 }, 288 },
289 289
290 "focusManager": {
291 "object": "js/components/focus-manager.reel",
292 "properties": {
293 "element": {"#": "focus-container" }
294 }
295 },
296
290 "owner": { 297 "owner": {
291 "module": "js/ninja.reel", 298 "module": "js/ninja.reel",
292 "name": "Ninja", 299 "name": "Ninja",
@@ -396,7 +403,9 @@
396 403
397 <section data-montage-id="bottomSplitter" class="bottomSplitter splitter"></section> 404 <section data-montage-id="bottomSplitter" class="bottomSplitter splitter"></section>
398 </section> 405 </section>
399 406
407 <div data-montage-id="focus-container" class="hidden"></div>
408
400 <section id="popupWindows"></section> 409 <section id="popupWindows"></section>
401 410
402 </div> 411 </div>
diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js
index a396ea28..e92cb2dd 100755
--- a/js/panels/Splitter.js
+++ b/js/panels/Splitter.js
@@ -91,12 +91,6 @@ exports.Splitter = Montage.create(Component, {
91 } 91 }
92 }, 92 },
93 93
94 didDraw: {
95 value: function() {
96 this.application.ninja.stage.resizeCanvases = true;
97 }
98 },
99
100 handleClick : { 94 handleClick : {
101 value: function() { 95 value: function() {
102 if (!this.disabled) { 96 if (!this.disabled) {
diff --git a/js/panels/properties.reel/properties.html b/js/panels/properties.reel/properties.html
index 72a6def6..d212ae80 100755
--- a/js/panels/properties.reel/properties.html
+++ b/js/panels/properties.reel/properties.html
@@ -10,35 +10,19 @@
10 <link rel="stylesheet" href="properties.css" type="text/css"> 10 <link rel="stylesheet" href="properties.css" type="text/css">
11 <script type="text/montage-serialization"> 11 <script type="text/montage-serialization">
12 { 12 {
13 "elementNameInput1": { 13 "elementName": {
14 "module": "montage/ui/textfield.reel", 14 "prototype": "montage/ui/textfield.reel",
15 "name": "Textfield",
16 "properties": { 15 "properties": {
17 "element": {"#": "elementName"}, 16 "element": {"#": "elementName"},
18 "readOnly": true 17 "readOnly": true
19 },
20 "bindings": {
21 "value": {
22 "boundObject": {"@": "owner"},
23 "boundObjectPropertyPath": "elementName",
24 "oneway": true
25 }
26 } 18 }
27 }, 19 },
28 20
29 "elementID": { 21 "elementId": {
30 "module": "montage/ui/textfield.reel", 22 "prototype": "montage/ui/textfield.reel",
31 "name": "Textfield",
32 "properties": { 23 "properties": {
33 "element": {"#": "elementID"}, 24 "element": {"#": "elementId"},
34 "readOnly": false 25 "readOnly": false
35 },
36 "bindings": {
37 "value": {
38 "boundObject": {"@": "owner"},
39 "boundObjectPropertyPath": "elementID",
40 "oneway": true
41 }
42 } 26 }
43 }, 27 },
44 28
@@ -46,35 +30,11 @@
46 "module": "montage/ui/textfield.reel", 30 "module": "montage/ui/textfield.reel",
47 "name": "Textfield", 31 "name": "Textfield",
48 "properties": { 32 "properties": {
49 "element": {"#": "elementClassName"}, 33 "element": {"#": "elementClass"},
50 "readOnly": false 34 "readOnly": false
51 },
52 "bindings": {
53 "value": {
54 "boundObject": {"@": "owner"},
55 "boundObjectPropertyPath": "elementClassName",
56 "oneway": true
57 }
58 }
59 },
60
61 "elementNameAttribute": {
62 "module": "montage/ui/textfield.reel",
63 "name": "Textfield",
64 "properties": {
65 "element": {"#": "elementNameAttribute"},
66 "readOnly": false
67 },
68 "bindings": {
69 "value": {
70 "boundObject": {"@": "owner"},
71 "boundObjectPropertyPath": "nameAttribute",
72 "oneway": false
73 }
74 } 35 }
75 }, 36 },