|
From: <ma...@us...> - 2012-04-14 21:10:44
|
Revision: 753
http://openautomation.svn.sourceforge.net/openautomation/?rev=753&view=rev
Author: mayerch
Date: 2012-04-14 21:10:37 +0000 (Sat, 14 Apr 2012)
Log Message:
-----------
Added layout support for most missing widgets (=> necessary for 2d pages)
Modified Paths:
--------------
CometVisu/trunk/visu/structure/pure/_common.js
CometVisu/trunk/visu/structure/pure/break.js
CometVisu/trunk/visu/structure/pure/iframe.js
CometVisu/trunk/visu/structure/pure/image.js
CometVisu/trunk/visu/structure/pure/imagetrigger.js
CometVisu/trunk/visu/structure/pure/infotrigger.js
CometVisu/trunk/visu/structure/pure/multitrigger.js
CometVisu/trunk/visu/structure/pure/page.js
CometVisu/trunk/visu/structure/pure/switch.js
CometVisu/trunk/visu/structure/pure/text.js
CometVisu/trunk/visu/structure/pure/toggle.js
CometVisu/trunk/visu/structure/pure/video.js
Modified: CometVisu/trunk/visu/structure/pure/_common.js
===================================================================
--- CometVisu/trunk/visu/structure/pure/_common.js 2012-04-14 15:23:12 UTC (rev 752)
+++ CometVisu/trunk/visu/structure/pure/_common.js 2012-04-14 21:10:37 UTC (rev 753)
@@ -353,12 +353,21 @@
//console.log( e, data, e.data, pos.x, pos.y );
}
-function extractLayout( layout )
+function extractLayout( layout, defaultValues )
{
var ret_val = 'position:absolute;';
- if( layout.getAttribute('x' ) ) ret_val += 'left:' + layout.getAttribute('x' ) + ';';
- if( layout.getAttribute('y' ) ) ret_val += 'top:' + layout.getAttribute('y' ) + ';';
- if( layout.getAttribute('width') ) ret_val += 'width:' + layout.getAttribute('width') + ';';
+ if( layout.getAttribute('x' ) ) ret_val += 'left:' + layout.getAttribute('x' ) + ';';
+ else if( defaultValues[ 'x' ] ) ret_val += 'left:' + defaultValues[ 'x' ] + ';';
+
+ if( layout.getAttribute('y' ) ) ret_val += 'top:' + layout.getAttribute('y' ) + ';';
+ else if( defaultValues[ 'y' ] ) ret_val += 'top:' + defaultValues[ 'y' ] + ';';
+
+ if( layout.getAttribute('width' ) ) ret_val += 'width:' + layout.getAttribute('width' ) + ';';
+ else if( defaultValues[ 'width' ] ) ret_val += 'width:' + defaultValues[ 'width' ] + ';';
+
+ if( layout.getAttribute('height') ) ret_val += 'height:' + layout.getAttribute('height') + ';';
+ else if( defaultValues[ 'height'] ) ret_val += 'height:' + defaultValues[ 'height'] + ';';
+
return ret_val;
}
Modified: CometVisu/trunk/visu/structure/pure/break.js
===================================================================
--- CometVisu/trunk/visu/structure/pure/break.js 2012-04-14 15:23:12 UTC (rev 752)
+++ CometVisu/trunk/visu/structure/pure/break.js 2012-04-14 21:10:37 UTC (rev 753)
@@ -16,7 +16,7 @@
*/
basicdesign.addCreator('break', {
- create: function( page, path ) {
+ create: function( element, path ) {
return $( '<br />' );
},
attributes: {},
Modified: CometVisu/trunk/visu/structure/pure/iframe.js
===================================================================
--- CometVisu/trunk/visu/structure/pure/iframe.js 2012-04-14 15:23:12 UTC (rev 752)
+++ CometVisu/trunk/visu/structure/pure/iframe.js 2012-04-14 21:10:37 UTC (rev 753)
@@ -18,20 +18,22 @@
basicdesign.addCreator('iframe', {
create: function( page, path ) {
var $p = $(page);
- var ret_val = $('<div class="widget iframe" />');
+ var layout = $p.find('layout')[0];
+ var style = layout ? 'style="' + extractLayout( layout ) + '"' : '';
+ var ret_val = $('<div class="widget iframe" ' + style + '/>');
ret_val.setWidgetLayout($p);
ret_val.append( '<div class="label">' + page.textContent + '</div>' );
- var style = '';
+ var iframeStyle = '';
if( $p.attr('width' ) ) {
- style += 'width:' + $p.attr('width' ) + ';';
+ iframeStyle += 'width:' + $p.attr('width' ) + ';';
} else { // default width is 100% of widget space (fix bug #3175343 part 1)
- style += 'width: 100%;';
+ iframeStyle += 'width: 100%;';
}
- if( $p.attr('height') ) style += 'height:' + $p.attr('height') + ';';
+ if( $p.attr('height') ) iframeStyle += 'height:' + $p.attr('height') + ';';
if( $p.attr('frameborder') == 'false' ) style += 'border: 0px ;';
- if( $p.attr('background') ) style += 'background-color:' + $p.attr('background') + ';';
- if( style != '' ) style = 'style="' + style + '"';
- var actor = '<div class="actor"><iframe src="' +$p.attr('src') + '" ' + style + '></iframe></div>';
+ if( $p.attr('background') ) iframeStyle += 'background-color:' + $p.attr('background') + ';';
+ if( iframeStyle != '' ) iframeStyle = 'style="' + iframeStyle + '"';
+ var actor = '<div class="actor"><iframe src="' +$p.attr('src') + '" ' + iframeStyle + '></iframe></div>';
var refresh = $p.attr('refresh') ? $p.attr('refresh')*1000 : 0;
ret_val.append( $(actor).data( {
@@ -41,8 +43,8 @@
},
attributes: {
src: { type: 'uri' , required: true },
- width: { type: 'string' , required: false },
- height: { type: 'string' , required: false },
+ width: { type: 'string' , required: false }, // only for the iframe - not the widget!
+ height: { type: 'string' , required: false }, // only for the iframe - not the widget!
frameborder: { type: 'list' , required: false, list: {'true': "yes", 'false': "no"} },
background: { type: 'string' , required: false },
refresh: { type: 'numeric', required: false },
@@ -50,7 +52,8 @@
rowspan: { type: 'numeric', required: false }
},
elements: {
- label: { type: 'string', required: false, multi: false }
+ layout: { type: 'layout' , required: false, multi: false },
+ label: { type: 'string' , required: false, multi: false }
},
content: false
});
\ No newline at end of file
Modified: CometVisu/trunk/visu/structure/pure/image.js
===================================================================
--- CometVisu/trunk/visu/structure/pure/image.js 2012-04-14 15:23:12 UTC (rev 752)
+++ CometVisu/trunk/visu/structure/pure/image.js 2012-04-14 21:10:37 UTC (rev 753)
@@ -18,19 +18,21 @@
basicdesign.addCreator('image', {
create: function( page, path ) {
var $p = $(page);
- var ret_val = $('<div class="widget clearfix image" />');
+ var layout = $p.find('layout')[0];
+ var style = layout ? 'style="' + extractLayout( layout ) + '"' : '';
+ var ret_val = $('<div class="widget clearfix image" ' + style + '/>');
ret_val.setWidgetLayout($p);
var labelElement = $p.find('label')[0];
ret_val.append( labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '' );
- var style = '';
+ var imgStyle = '';
if( $p.attr('width' ) ) {
- style += 'width:' + $p.attr('width' ) + ';';
+ imgStyle += 'width:' + $p.attr('width' ) + ';';
} else {
- style += 'width: 100%;';
+ imgStyle += 'width: 100%;';
}
- if( $p.attr('height') ) style += 'height:' + $p.attr('height') + ';';
- if( style != '' ) style = 'style="' + style + '"';
- var actor = '<div class="actor"><img src="' +$p.attr('src') + '" ' + style + ' /></div>';
+ if( $p.attr('height') ) imgStyle += 'height:' + $p.attr('height') + ';';
+ if( imgStyle != '' ) imgStyle = 'style="' + imgStyle + '"';
+ var actor = '<div class="actor"><img src="' +$p.attr('src') + '" ' + imgStyle + '/></div>';
var refresh = $p.attr('refresh') ? $p.attr('refresh')*1000 : 0;
ret_val.append( $(actor).data( {
'refresh': refresh
@@ -39,14 +41,15 @@
},
attributes: {
src: { type: 'uri' , required: true },
- width: { type: 'string' , required: false },
- height: { type: 'string' , required: false },
+ width: { type: 'string' , required: false }, // only for the image - not the widget!
+ height: { type: 'string' , required: false }, // only for the image - not the widget!
refresh: { type: 'numeric', required: false },
colspan: { type: 'numeric', required: false },
rowspan: { type: 'numeric', required: false }
},
elements: {
- label: { type: 'string', required: false, multi: false }
+ layout: { type: 'layout' , required: false, multi: false },
+ label: { type: 'string' , required: false, multi: false }
},
content: false
});
\ No newline at end of file
Modified: CometVisu/trunk/visu/structure/pure/imagetrigger.js
===================================================================
--- CometVisu/trunk/visu/structure/pure/imagetrigger.js 2012-04-14 15:23:12 UTC (rev 752)
+++ CometVisu/trunk/visu/structure/pure/imagetrigger.js 2012-04-14 21:10:37 UTC (rev 753)
@@ -35,9 +35,8 @@
}
];
});
- var style = ' style=" ';
- style += $p.attr('width' ) ? 'width:' + $p.attr('width' ) + ';' : 'width: 100%;';
- style += $p.attr('height' ) ? 'height:' + $p.attr('height' ) + ';"' : '"';
+ var layout = $e.find('layout')[0];
+ var style = layout ? 'style="' + extractLayout( layout, {width:'100%'} ) + '"' : '';
var actor = '<div class="actor">';
if ( $p.attr('type')=='show' )
@@ -99,8 +98,6 @@
},
attributes: {
src: { type: 'uri' , required: true },
- width: { type: 'string' , required: false },
- height: { type: 'string' , required: false },
refresh: { type: 'numeric', required: false },
colspan: { type: 'numeric', required: false },
rowspan: { type: 'numeric', required: false },
@@ -110,6 +107,7 @@
suffix: { type: 'list' , required: false, list: {'png': '.png', 'jpg': '.jpg', 'gif': '.gif', 'svg': '.svg', 'bmp': '.bmp'} }
},
elements: {
+ layout: { type: 'layout' , required: false, multi: false },
label: { type: 'string' , required: false, multi: false },
address: { type: 'address', required: true , multi: true }
},
Modified: CometVisu/trunk/visu/structure/pure/infotrigger.js
===================================================================
--- CometVisu/trunk/visu/structure/pure/infotrigger.js 2012-04-14 15:23:12 UTC (rev 752)
+++ CometVisu/trunk/visu/structure/pure/infotrigger.js 2012-04-14 21:10:37 UTC (rev 753)
@@ -18,7 +18,9 @@
basicdesign.addCreator('infotrigger', {
create: function( page, path ) {
var $p = $(page);
- var ret_val = $('<div class="widget clearfix switch" />');
+ var layout = $p.find('layout')[0];
+ var style = layout ? 'style="' + extractLayout( layout ) + '"' : '';
+ var ret_val = $('<div class="widget clearfix switch" ' + style + '/>');
ret_val.setWidgetLayout($p);
// handle label
var labelElement = $p.find('label')[0];
@@ -161,6 +163,7 @@
rowspan: { type: 'numeric', required: false }
},
elements: {
+ layout: { type: 'layout' , required: false, multi: false },
label: { type: 'string' , required: false, multi: false },
address: { type: 'address', required: true , multi: true , options: {variant: ['', 'isbutton']} }
},
Modified: CometVisu/trunk/visu/structure/pure/multitrigger.js
===================================================================
--- CometVisu/trunk/visu/structure/pure/multitrigger.js 2012-04-14 15:23:12 UTC (rev 752)
+++ CometVisu/trunk/visu/structure/pure/multitrigger.js 2012-04-14 21:10:37 UTC (rev 753)
@@ -18,7 +18,9 @@
basicdesign.addCreator('multitrigger', {
create: function( page, path ) {
var $p = $(page);
- var ret_val = $('<div class="widget clearfix switch" />');
+ var layout = $p.find('layout')[0];
+ var style = layout ? 'style="' + extractLayout( layout ) + '"' : '';
+ var ret_val = $('<div class="widget clearfix switch" ' + style + '/>');
ret_val.setWidgetLayout($p)
var labelElement = $p.find('label')[0];
var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
@@ -152,6 +154,7 @@
rowspan: { type: 'numeric', required: false }
},
elements: {
+ layout: { type: 'layout' , required: false, multi: false },
label: { type: 'string' , required: false, multi: false },
address: { type: 'address', required: true , multi: true }
},
Modified: CometVisu/trunk/visu/structure/pure/page.js
===================================================================
--- CometVisu/trunk/visu/structure/pure/page.js 2012-04-14 15:23:12 UTC (rev 752)
+++ CometVisu/trunk/visu/structure/pure/page.js 2012-04-14 21:10:37 UTC (rev 753)
@@ -40,7 +40,9 @@
if ($p.attr('visible')=='false') {
ret_val=$('');
} else { // default is visible
- ret_val = $('<div class="widget clearfix link pagelink"/>');
+ var layout = $p.find('layout')[0];
+ var style = layout ? 'style="' + extractLayout( layout ) + '"' : '';
+ ret_val = $('<div class="widget clearfix link pagelink" ' + style + '/>');
ret_val.setWidgetLayout($p);
var tst = $('<div ' + wstyle + '><a href="javascript:scrollToPage(\''+path+'\')">' + name + '</a></div>');
@@ -112,6 +114,7 @@
floor: { type: 'addr' , required: false }
},
elements: {
+ layout: { type: 'layout' , required: false, multi: false }
},
update: function(e, data) {
var element = $(this);
Modified: CometVisu/trunk/visu/structure/pure/switch.js
===================================================================
--- CometVisu/trunk/visu/structure/pure/switch.js 2012-04-14 15:23:12 UTC (rev 752)
+++ CometVisu/trunk/visu/structure/pure/switch.js 2012-04-14 21:10:37 UTC (rev 753)
@@ -18,7 +18,9 @@
basicdesign.addCreator('switch', {
create: function( page, path ) {
var $p = $(page);
- var ret_val = $('<div class="widget clearfix switch" />');
+ var layout = $p.find('layout')[0];
+ var style = layout ? 'style="' + extractLayout( layout ) + '"' : '';
+ var ret_val = $('<div class="widget clearfix switch" ' + style + '/>');
ret_val.setWidgetLayout($p)
var labelElement = $p.find('label')[0];
var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
@@ -65,8 +67,9 @@
rowspan: { type: 'numeric', required: false }
},
elements: {
- label: { type: 'string' , required: true, multi: false },
- address: { type: 'address', required: true, multi: true }
+ layout: { type: 'layout' , required: false, multi: false },
+ label: { type: 'string' , required: true , multi: false },
+ address: { type: 'address', required: true , multi: true }
},
content: false
});
\ No newline at end of file
Modified: CometVisu/trunk/visu/structure/pure/text.js
===================================================================
--- CometVisu/trunk/visu/structure/pure/text.js 2012-04-14 15:23:12 UTC (rev 752)
+++ CometVisu/trunk/visu/structure/pure/text.js 2012-04-14 21:10:37 UTC (rev 753)
@@ -18,7 +18,9 @@
basicdesign.addCreator('text', {
create: function( page, path ) {
var $p = $(page);
- var ret_val = $('<div class="widget clearfix text" />');
+ var layout = $p.find('layout')[0];
+ var style = layout ? 'style="' + extractLayout( layout ) + '"' : '';
+ var ret_val = $('<div class="widget clearfix text" ' + style + '/>');
ret_val.setWidgetLayout($p);
var style = '';
if( $p.attr('align') ) style += 'text-align:' + $p.attr('align') + ';';
@@ -32,6 +34,7 @@
rowspan: { type: 'numeric', required: false }
},
elements: {
+ layout: { type: 'layout' , required: false, multi: false }
},
content: { type: 'string', required: true }
});
\ No newline at end of file
Modified: CometVisu/trunk/visu/structure/pure/toggle.js
===================================================================
--- CometVisu/trunk/visu/structure/pure/toggle.js 2012-04-14 15:23:12 UTC (rev 752)
+++ CometVisu/trunk/visu/structure/pure/toggle.js 2012-04-14 21:10:37 UTC (rev 753)
@@ -18,7 +18,9 @@
basicdesign.addCreator('toggle', {
create: function( page, path ) {
var $p = $(page);
- var ret_val = $('<div class="widget clearfix toggle" />');
+ var layout = $p.find('layout')[0];
+ var style = layout ? 'style="' + extractLayout( layout ) + '"' : '';
+ var ret_val = $('<div class="widget clearfix toggle" ' + style + '/>');
ret_val.setWidgetLayout($p);
var labelElement = $p.find('label')[0];
var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
@@ -69,8 +71,9 @@
rowspan: { type: 'numeric', required: false }
},
elements: {
- label: { type: 'string' , required: true, multi: false },
- address: { type: 'address', required: true, multi: true }
+ layout: { type: 'layout' , required: false, multi: false },
+ label: { type: 'string' , required: true, multi: false },
+ address: { type: 'address', required: true, multi: true }
},
content: false
});
\ No newline at end of file
Modified: CometVisu/trunk/visu/structure/pure/video.js
===================================================================
--- CometVisu/trunk/visu/structure/pure/video.js 2012-04-14 15:23:12 UTC (rev 752)
+++ CometVisu/trunk/visu/structure/pure/video.js 2012-04-14 21:10:37 UTC (rev 753)
@@ -18,7 +18,9 @@
basicdesign.addCreator('video', {
create: function( page, path ) {
var $p = $(page);
- var ret_val = $('<div class="widget clearfix video" />');
+ var layout = $p.find('layout')[0];
+ var style = layout ? 'style="' + extractLayout( layout ) + '"' : '';
+ var ret_val = $('<div class="widget clearfix video" ' + style + '/>');
ret_val.setWidgetLayout($p);
var labelElement = $p.find('label')[0];
ret_val.append( labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '' );
@@ -40,6 +42,7 @@
rowspan: { type: 'numeric', required: false }
},
elements: {
+ layout: { type: 'layout' , required: false, multi: false },
label: { type: 'string' , required: false, multi: false }
},
content: false
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|