|
From: <ma...@us...> - 2010-11-14 17:08:20
|
Revision: 122
http://openautomation.svn.sourceforge.net/openautomation/?rev=122&view=rev
Author: mayerch
Date: 2010-11-14 16:10:20 +0000 (Sun, 14 Nov 2010)
Log Message:
-----------
Add new custom widget to toggle beween designs and insert it into the demo config
Modified Paths:
--------------
CometVisu/trunk/visu/lib/visudesign_custom.js
CometVisu/trunk/visu/visu_config.xml
Modified: CometVisu/trunk/visu/lib/visudesign_custom.js
===================================================================
--- CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-14 12:55:07 UTC (rev 121)
+++ CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-14 16:10:20 UTC (rev 122)
@@ -34,3 +34,41 @@
});
****************************************
*/
+
+/**
+ * This is a custom function that extends the available widgets.
+ * It's purpose is to change the design of the visu during runtime
+ * to demonstrate all available
+ */
+VisuDesign_Custom.prototype.addCreator("designtoggle", {
+ create: function( page, path ) {
+ var ret_val = $('<div class="widget" />');
+ ret_val.addClass( 'switch' );
+ var label = '<div class="label">' + page.textContent + '</div>';
+ var actor = '<div class="actor switchUnpressed">';
+ var value = $('link').attr('href').split('/')[1];
+ actor += '<div class="value">' + value + '</div>';
+ actor += '</div>';
+ ret_val.append( label ).append( $(actor).data( {
+ 'mapping' : $(page).attr('mapping'),
+ 'style' : $(page).attr('style'),
+ 'value' : value,
+ 'type' : 'toggle'
+ } ).bind('click',designToggleAction) );
+ return ret_val;
+ },
+ attributes: {
+ },
+ content: "string"
+});
+
+function designToggleAction()
+{
+ var designs = [ 'pure', 'discreet' ];
+ var oldDesign = $('.value',this).text();
+ var newDesign = designs[ (designs.indexOf(oldDesign) + 1) % designs.length ];
+ $('.value',this).text(newDesign);
+ $('link').each(function(){
+ this.href = this.href.replace( oldDesign, newDesign );
+ });
+}
Modified: CometVisu/trunk/visu/visu_config.xml
===================================================================
--- CometVisu/trunk/visu/visu_config.xml 2010-11-14 12:55:07 UTC (rev 121)
+++ CometVisu/trunk/visu/visu_config.xml 2010-11-14 16:10:20 UTC (rev 122)
@@ -44,6 +44,7 @@
<slide address="12/4/250" datatype="9" min="-18" max="26">Slide</slide>
<info address="12/4/250" datatype="9" style="BluePurpleRed">Slide Info</info>
<info address="12/4/250" datatype="9" style="BluePurpleRed" mapping="Sign">Slide Info</info>
+ <designtoggle>Change design</designtoggle>
<line />
<image src="icon/comet_128_ff8000.png" >Ein Bild</image>
<image src="icon/comet_128_ff8000.png" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|