projects
/
app.Builder.js
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
resources/Editors/Editor.Roo.LayoutDialog.bjs
[app.Builder.js]
/
resources
/
roo.builder.js
diff --git
a/resources/roo.builder.js
b/resources/roo.builder.js
index
c313212
..
bf08085
100644
(file)
--- a/
resources/roo.builder.js
+++ b/
resources/roo.builder.js
@@
-17,7
+17,7
@@
Builder = {
-
saveHTML : function( )
+ saveHTML : function( )
{
//print("TRAVERSE DOM?");
{
//print("TRAVERSE DOM?");
@@
-25,32
+25,38
@@
Builder = {
//print(dom);
var ret = '';
//Roo.select('body > div',true).each(function(el) {
//print(dom);
var ret = '';
//Roo.select('body > div',true).each(function(el) {
+ // if the tree is not ready yet?
+
+
this.traverseDOMTree(function(s) { ret+=s; }, dom, 1);
this.traverseDOMTree(function(s) { ret+=s; }, dom, 1);
-
alert("IPC:SAVEHTML:" + dom
);
+
alert("IPC:SAVEHTML:" + ret
);
return ret;
},
traverseDOMTree : function(cb, currentElement, depth) {
return ret;
},
traverseDOMTree : function(cb, currentElement, depth) {
- if (!currentElement) {
+ if (!currentElement
) {
return;
}
return;
}
- console.log(currentElement);
- if (currentElement.className.match(/roo-dynamic/)) {
+
//
console.log(currentElement);
+ if (currentElement.className
&& currentElement.className
.match(/roo-dynamic/)) {
return;
}
//Roo.log(currentElement);
var j;
return;
}
//Roo.log(currentElement);
var j;
- var nodeName = currentElement.node
_n
ame;
- var tagName = currentElement.tag
_n
ame;
+ var nodeName = currentElement.node
N
ame;
+ var tagName = currentElement.tag
N
ame;
if (nodeName == '#text') {
if (nodeName == '#text') {
- cb(currentElement.node
_v
alue);
+ cb(currentElement.node
V
alue);
return;
}
return;
}
+ if (nodeName.match(/^#/)) { // comments?
+ return;
+ }
@@
-59,8
+65,13
@@
Builder = {
return;
}
if (nodeName != 'BODY') {
return;
}
if (nodeName != 'BODY') {
-
-
+ //Roo.log(currentElement);
+ if (currentElement.hasAttribute('flexy:include')) {
+
+
+ cb( '<flexy:include src="'+currentElement.getAttribute('flexy:include')+'"></flexy:include>');
+ return;
+ }
var i = 0;
// Prints the node tagName, such as <A>, <IMG>, etc
var i = 0;
// Prints the node tagName, such as <A>, <IMG>, etc
@@
-79,7
+90,7
@@
Builder = {
}
}
- cb("<"+currentElement.tag
_n
ame+ ( attr.length ? (' ' + attr.join(' ') ) : '') + ">");
+ cb("<"+currentElement.tag
N
ame+ ( attr.length ? (' ' + attr.join(' ') ) : '') + ">");
}
else {
cb("[unknown tag]");
}
else {
cb("[unknown tag]");
@@
-87,17
+98,19
@@
Builder = {
} else {
tagName = false;
}
} else {
tagName = false;
}
+
+
// Traverse the tree
i = 0;
// Traverse the tree
i = 0;
- var currentElementChild = currentElement.child
_n
odes.item(i);
+ var currentElementChild = currentElement.child
N
odes.item(i);
var allText = true;
while (currentElementChild) {
// Formatting code (indent the tree so it looks nice on the screen)
var allText = true;
while (currentElementChild) {
// Formatting code (indent the tree so it looks nice on the screen)
- if (currentElementChild.node
_n
ame == '#text') {
- cb(currentElementChild.node
_v
alue);
+ if (currentElementChild.node
N
ame == '#text') {
+ cb(currentElementChild.node
V
alue);
i++;
i++;
- currentElementChild=currentElement.child
_n
odes.item(i);
+ currentElementChild=currentElement.child
N
odes.item(i);
continue;
}
allText = false;
continue;
}
allText = false;
@@
-111,7
+124,7
@@
Builder = {
// Recursively traverse the tree structure of the child node
this.traverseDOMTree(cb, currentElementChild, depth+1);
i++;
// Recursively traverse the tree structure of the child node
this.traverseDOMTree(cb, currentElementChild, depth+1);
i++;
- currentElementChild=currentElement.child
_n
odes.item(i);
+ currentElementChild=currentElement.child
N
odes.item(i);
}
if (!allText) {
// The remaining code is mostly for formatting the tree
}
if (!allText) {
// The remaining code is mostly for formatting the tree
@@
-271,7
+284,7
@@
Builder = {
}
id = ''+ id;
var bid = id.length ? 'builder-' + id : '';
}
id = ''+ id;
var bid = id.length ? 'builder-' + id : '';
- console.log('{ "hover-node" : "' + bid + '"}');
+
//
console.log('{ "hover-node" : "' + bid + '"}');
this.lastID = id;
},
clearBootstrap : function()
this.lastID = id;
},
clearBootstrap : function()
@@
-314,7
+327,12
@@
Builder = {
tree.el.attr('xtype', tree['xtype-bootstrap']);
}
tree.el.attr('xtype', tree['xtype-bootstrap']);
}
-
+ if (typeof(tree['flexy:include']) != 'undefined') {
+ //Roo.log("add flexy:if");
+ tree.el.attr('flexy:include', tree['flexy:include']);
+ }
+ //Roo.log("Add xtype")
+ tree.el.attr('xtype', tree['|xns'] + '.' + tree['xtype']);
if (!tree.items || !tree.items.length) { return; }
for (var i = 0; i < tree.items.length; i++){
if (!tree.items || !tree.items.length) { return; }
for (var i = 0; i < tree.items.length; i++){
@@
-328,6
+346,8
@@
Builder = {
Roo.onReady(function() { Builder.clearBootstrap(); });
Roo.XComponent.on('buildcomplete', function() {
Roo.log("xcomponent built!");
Roo.onReady(function() { Builder.clearBootstrap(); });
Roo.XComponent.on('buildcomplete', function() {
Roo.log("xcomponent built!");
+ var m = Roo.XComponent.modules;
+ Builder.applyFlexy(m[m.length-1].el);
-
Builder.applyFlexy(Roo.XComponent.modules[0].el
);
+
Builder.saveHTML.defer(100, Builder
);
});
\ No newline at end of file
});
\ No newline at end of file