diff options
author | Eric Guzman | 2012-05-29 15:29:11 -0700 |
---|---|---|
committer | Eric Guzman | 2012-05-29 15:29:11 -0700 |
commit | 25ac55c285bb4850118c644dc57adaeda5b9a859 (patch) | |
tree | b645941d7916716cbaf4860355df4101fc0f4c3c /js/document/views | |
parent | 1fda3cea5f8dced1e14533969722e30b8ea1e6fa (diff) | |
parent | 58e454c828abf0b64fa62120359bcd78a0d34ac4 (diff) | |
download | ninja-25ac55c285bb4850118c644dc57adaeda5b9a859.tar.gz |
Merge branch 'dom-architecture' of github.com:Motorola-Mobility/ninja-internal into CSSPanelUpdates
Diffstat (limited to 'js/document/views')
-rwxr-xr-x | js/document/views/base.js | 2 | ||||
-rwxr-xr-x | js/document/views/code.js | 56 | ||||
-rwxr-xr-x | js/document/views/design.js | 42 |
3 files changed, 60 insertions, 40 deletions
diff --git a/js/document/views/base.js b/js/document/views/base.js index db72cc60..d13dce1a 100755 --- a/js/document/views/base.js +++ b/js/document/views/base.js | |||
@@ -28,7 +28,7 @@ exports.BaseDocumentView = Montage.create(Component, { | |||
28 | value: null | 28 | value: null |
29 | }, | 29 | }, |
30 | //////////////////////////////////////////////////////////////////// | 30 | //////////////////////////////////////////////////////////////////// |
31 | // | 31 | //TODO: This should be renamed to better illustrate it's a container (iframe for design, div for code view) |
32 | iframe: { | 32 | iframe: { |
33 | get: function() {return this._iframe;}, | 33 | get: function() {return this._iframe;}, |
34 | set: function(value) {this._iframe= value;} | 34 | set: function(value) {this._iframe= value;} |
diff --git a/js/document/views/code.js b/js/document/views/code.js index 66d1c702..0a0ff5c1 100755 --- a/js/document/views/code.js +++ b/js/document/views/code.js | |||
@@ -10,15 +10,13 @@ var Montage = require("montage/core/core").Montage, | |||
10 | Component = require("montage/ui/component").Component, | 10 | Component = require("montage/ui/component").Component, |
11 | BaseDocumentView = require("js/document/views/base").BaseDocumentView; | 11 | BaseDocumentView = require("js/document/views/base").BaseDocumentView; |
12 | //////////////////////////////////////////////////////////////////////// | 12 | //////////////////////////////////////////////////////////////////////// |
13 | // | 13 | // |
14 | var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentView, { | 14 | exports.CodeDocumentView = Montage.create(BaseDocumentView, { |
15 | //////////////////////////////////////////////////////////////////// | 15 | //////////////////////////////////////////////////////////////////// |
16 | // | 16 | // |
17 | hasTemplate: { | 17 | hasTemplate: { |
18 | enumerable: false, | ||
19 | value: false | 18 | value: false |
20 | }, | 19 | }, |
21 | |||
22 | //////////////////////////////////////////////////////////////////// | 20 | //////////////////////////////////////////////////////////////////// |
23 | // | 21 | // |
24 | _editor: { | 22 | _editor: { |
@@ -28,7 +26,7 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie | |||
28 | // | 26 | // |
29 | editor: { | 27 | editor: { |
30 | get: function() {return this._editor;}, | 28 | get: function() {return this._editor;}, |
31 | set: function(value) {this._editor= value;} | 29 | set: function(value) {this._editor = value;} |
32 | }, | 30 | }, |
33 | //////////////////////////////////////////////////////////////////// | 31 | //////////////////////////////////////////////////////////////////// |
34 | // | 32 | // |
@@ -39,7 +37,7 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie | |||
39 | // | 37 | // |
40 | textArea: { | 38 | textArea: { |
41 | get: function() {return this._textArea;}, | 39 | get: function() {return this._textArea;}, |
42 | set: function(value) {this._textArea= value;} | 40 | set: function(value) {this._textArea = value;} |
43 | }, | 41 | }, |
44 | //////////////////////////////////////////////////////////////////// | 42 | //////////////////////////////////////////////////////////////////// |
45 | // | 43 | // |
@@ -50,14 +48,10 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie | |||
50 | // | 48 | // |
51 | textViewContainer: { | 49 | textViewContainer: { |
52 | get: function() {return this._textViewContainer;}, | 50 | get: function() {return this._textViewContainer;}, |
53 | set: function(value) {this._textViewContainer= value;} | 51 | set: function(value) {this._textViewContainer = value;} |
54 | }, | 52 | }, |
55 | //////////////////////////////////////////////////////////////////// | 53 | //////////////////////////////////////////////////////////////////// |
56 | // | 54 | // |
57 | |||
58 | /** | ||
59 | * Public method | ||
60 | */ | ||
61 | initialize:{ | 55 | initialize:{ |
62 | value: function(parentContainer){ | 56 | value: function(parentContainer){ |
63 | //create contianer | 57 | //create contianer |
@@ -65,42 +59,35 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie | |||
65 | //this.textViewContainer.id = "codemirror_" + uuid; | 59 | //this.textViewContainer.id = "codemirror_" + uuid; |
66 | this.textViewContainer.style.display = "block"; | 60 | this.textViewContainer.style.display = "block"; |
67 | parentContainer.appendChild(this.textViewContainer); | 61 | parentContainer.appendChild(this.textViewContainer); |
68 | |||
69 | //create text area | 62 | //create text area |
70 | this.textArea = this.createTextAreaElement(); | 63 | this.textArea = this.createTextAreaElement(); |
71 | } | 64 | } |
72 | }, | 65 | }, |
73 | 66 | //////////////////////////////////////////////////////////////////// | |
74 | /** | 67 | //Creates a textarea element which will contain the content of the opened text document |
75 | * Public method | ||
76 | * Creates a textarea element which will contain the content of the opened text document. | ||
77 | */ | ||
78 | createTextAreaElement: { | 68 | createTextAreaElement: { |
79 | value: function() { | 69 | value: function() { |
80 | var textArea = document.createElement("textarea"); | 70 | var textArea = document.createElement("textarea"); |
81 | // textArea.id = "code"; | 71 | //textArea.id = "code"; |
82 | // textArea.name = "code"; | 72 | //textArea.name = "code"; |
83 | this.textViewContainer.appendChild(textArea); | 73 | this.textViewContainer.appendChild(textArea); |
84 | 74 | //Returns textarea element | |
85 | return textArea; | 75 | return textArea; |
86 | } | 76 | } |
87 | }, | 77 | }, |
88 | //////////////////////////////////////////////////////////////////// | 78 | //////////////////////////////////////////////////////////////////// |
89 | // | 79 | //Creates a new instance of a code editor |
90 | /** | ||
91 | * Public method | ||
92 | * Creates a new instance of a code editor | ||
93 | */ | ||
94 | initializeTextView: { | 80 | initializeTextView: { |
95 | value: function(file, textDocument) { | 81 | value: function(file, textDocument) { |
82 | // | ||
96 | var type; | 83 | var type; |
97 | 84 | // | |
98 | if(this.activeDocument) { | 85 | if(this.activeDocument) { |
99 | //need to hide only if another document was open before | 86 | //need to hide only if another document was open before |
100 | // this.application.ninja.documentController._hideCurrentDocument(); | 87 | //this.application.ninja.documentController._hideCurrentDocument(); |
101 | // this.hideOtherDocuments(doc.uuid); | 88 | //this.hideOtherDocuments(doc.uuid); |
102 | } | 89 | } |
103 | 90 | // | |
104 | switch(file.extension) { | 91 | switch(file.extension) { |
105 | case "css" : | 92 | case "css" : |
106 | type = "css"; | 93 | type = "css"; |
@@ -130,18 +117,18 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie | |||
130 | type = "xml"; | 117 | type = "xml"; |
131 | break; | 118 | break; |
132 | } | 119 | } |
120 | // | ||
133 | this.textViewContainer.style.display="block"; | 121 | this.textViewContainer.style.display="block"; |
134 | 122 | // | |
135 | this.editor = this.application.ninja.codeEditorController.createEditor(this, type, file.extension, textDocument); | 123 | this.editor = this.application.ninja.codeEditorController.createEditor(this, type, file.extension, textDocument); |
136 | this.editor.hline = this.editor.setLineClass(0, "activeline"); | 124 | this.editor.hline = this.editor.setLineClass(0, "activeline"); |
137 | |||
138 | |||
139 | } | 125 | } |
140 | }, | 126 | }, |
141 | //////////////////////////////////////////////////////////////////// | 127 | //////////////////////////////////////////////////////////////////// |
142 | // | 128 | // |
143 | show: { | 129 | show: { |
144 | value: function (callback) { | 130 | value: function (callback) { |
131 | // | ||
145 | this.textViewContainer.style.display = "block"; | 132 | this.textViewContainer.style.display = "block"; |
146 | // | 133 | // |
147 | if (callback) callback(); | 134 | if (callback) callback(); |
@@ -151,6 +138,7 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie | |||
151 | // | 138 | // |
152 | hide: { | 139 | hide: { |
153 | value: function (callback) { | 140 | value: function (callback) { |
141 | // | ||
154 | this.textViewContainer.style.display = "none"; | 142 | this.textViewContainer.style.display = "none"; |
155 | // | 143 | // |
156 | if (callback) callback(); | 144 | if (callback) callback(); |
@@ -164,8 +152,8 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie | |||
164 | this.textViewContainer.className = "codeViewContainer "+themeClass; | 152 | this.textViewContainer.className = "codeViewContainer "+themeClass; |
165 | } | 153 | } |
166 | } | 154 | } |
167 | //////////////////////////////////////////////////////////////////////// | 155 | //////////////////////////////////////////////////////////////////// |
168 | //////////////////////////////////////////////////////////////////////// | 156 | //////////////////////////////////////////////////////////////////// |
169 | }); | 157 | }); |
170 | //////////////////////////////////////////////////////////////////////// | 158 | //////////////////////////////////////////////////////////////////////// |
171 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file | 159 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file |
diff --git a/js/document/views/design.js b/js/document/views/design.js index b3887fdf..c7313708 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js | |||
@@ -69,6 +69,30 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
69 | }, | 69 | }, |
70 | //////////////////////////////////////////////////////////////////// | 70 | //////////////////////////////////////////////////////////////////// |
71 | // | 71 | // |
72 | _liveNodeList: { | ||
73 | value: null | ||
74 | }, | ||
75 | //////////////////////////////////////////////////////////////////// | ||
76 | // | ||
77 | getLiveNodeList: { | ||
78 | value: function(useFilter) { | ||
79 | if(useFilter) { | ||
80 | var filteredNodes = [], | ||
81 | childNodes = Array.prototype.slice.call(this._liveNodeList, 0); | ||
82 | |||
83 | childNodes.forEach(function(item) { | ||
84 | if( (item.nodeType === 1) && (item.nodeName !== "STYLE") && (item.nodeName !== "SCRIPT")) { | ||
85 | filteredNodes.push(item); | ||
86 | } | ||
87 | }); | ||
88 | return filteredNodes; | ||
89 | } else { | ||
90 | return Array.prototype.slice.call(this._liveNodeList, 0); | ||
91 | } | ||
92 | } | ||
93 | }, | ||
94 | //////////////////////////////////////////////////////////////////// | ||
95 | // | ||
72 | initialize: { | 96 | initialize: { |
73 | value: function (parent) { | 97 | value: function (parent) { |
74 | //Creating iFrame for view | 98 | //Creating iFrame for view |
@@ -87,7 +111,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
87 | render: { |