|
From: <ma...@us...> - 2010-12-12 15:06:06
|
Revision: 207
http://openautomation.svn.sourceforge.net/openautomation/?rev=207&view=rev
Author: mayerch
Date: 2010-12-12 15:06:00 +0000 (Sun, 12 Dec 2010)
Log Message:
-----------
First step towards moving addesses from the attributes to own elements (-> feature whish #3133031).
Also inital step towards feature whish #3134595 (Change data types to transfer functions)
As this will break all existing config files and as this is only the first step, that converted the info widget, there's a new config file (visu_config_neu.xml) that can be called by adding "?config=neu" to the visu URL. This file contains the new config syntax and will be extended by each widget that gets transformed.
NOTE: this will also break the editor!
So if you aren't perfectly sure about what you are doing, DO NOT update to the latest SVN version yet!
Modified Paths:
--------------
CometVisu/trunk/visu/designs/structure_pure.js
Added Paths:
-----------
CometVisu/trunk/visu/visu_config_neu.xml
Modified: CometVisu/trunk/visu/designs/structure_pure.js
===================================================================
--- CometVisu/trunk/visu/designs/structure_pure.js 2010-12-12 13:22:42 UTC (rev 206)
+++ CometVisu/trunk/visu/designs/structure_pure.js 2010-12-12 15:06:00 UTC (rev 207)
@@ -110,34 +110,40 @@
});
this.addCreator("info", {
- create: function( page, path ) {
- var ret_val = $('<div class="widget" />');
- ret_val.addClass( 'info' );
- var label = '<div class="label">' + page.textContent + '</div>';
- ga_list.push( $(page).attr('address') );
- var actor = '<div class="actor">';
- if( $(page).attr('pre') ) actor += '<div>' + $(page).attr('pre') + '</div>';
- actor += '<div class="value">-</div>';
- if( $(page).attr('post') ) actor += '<div>' + $(page).attr('post') + '</div>';
- actor += '</div>';
- ret_val.append( label ).append( $(actor).data( {
- 'GA': $(page).attr('address'),
- 'datatype': $(page).attr('datatype'),
- 'mapping' : $(page).attr('mapping'),
- 'styling' : $(page).attr('styling')
- } ).bind('_'+$(page).attr('address'), this.update ) );
- return ret_val;
- },
- update: defaultUpdate,
- attributes: {
- address: {type: "address", required: true},
- datatype: {type: "datatype", required: true},
- pre: {type: "string", required: false},
- post: {type: "string", required: false},
- mapping: {type: "mapping", required: false},
- styling: {type: "styling", required: false}
- },
- content: {type: "string", required: true}
+ create: function( page, path ) {
+ var $p = $(page);
+ var ret_val = $('<div class="widget info" />');
+ var labelElement = $p.find('label')[0];
+ var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
+ var address = {};
+ $p.find('address').each( function(){
+ var src = this.getAttribute('src');
+ var transform = this.getAttribute('transform');
+ ga_list.push( src )
+ address[ '_' + src ] = transform;
+ });
+ var actor = '<div class="actor">';
+ if( $p.attr('pre') ) actor += '<div>' + $p.attr('pre') + '</div>';
+ actor += '<div class="value">-</div>';
+ if( $p.attr('post') ) actor += '<div>' + $p.attr('post') + '</div>';
+ actor += '</div>';
+ var $actor = $(actor).data({
+ 'address' : address,
+ 'mapping' : $p.attr('mapping'),
+ 'styling' : $p.attr('styling')
+ });
+ for( var addr in address ) $actor.bind( addr, this.update );
+ ret_val.append( label ).append( $actor );
+ return ret_val;
+ },
+ update: defaultUpdate,
+ attributes: {
+ pre: {type: "string", required: false},
+ post: {type: "string", required: false},
+ mapping: {type: "mapping", required: false},
+ styling: {type: "styling", required: false}
+ },
+ content: {type: "string", required: true}
});
this.addCreator("shade", this.getCreator("info"));
@@ -529,11 +535,20 @@
return { x: 0, y: 0 }; // sanity return
}
+/**
+ * temporary function till the transformation framework is implemented
+ */
+function transform( raw, type )
+{
+ return decodeDPT( raw, type.substr(4) ); // filter away the 'DPT:'
+}
function defaultUpdate( e, data, passedElement )
{
var element = passedElement || $(this);
- var value = decodeDPT( data, element.data('datatype') );
+ //var datatype = element.data().address[ e.type ];
+ //var value = decodeDPT( data, element.data('datatype') );
+ var value = transform( data, element.data().address[ e.type ] );
element.data( 'value', value );
element.find('.value').text( map( value, element ) );
Added: CometVisu/trunk/visu/visu_config_neu.xml
===================================================================
--- CometVisu/trunk/visu/visu_config_neu.xml (rev 0)
+++ CometVisu/trunk/visu/visu_config_neu.xml 2010-12-12 15:06:00 UTC (rev 207)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" design="pure" xsi:noNamespaceSchemaLocation="visu_config.xsd">
+ <meta>
+ <plugins>
+ <!--
+ <plugin name="colorchooser"/>
+ <plugin name="diagram"/>
+ -->
+ </plugins>
+ <mappings>
+ <mapping name="OpenClose">
+ <entry value="0">zu</entry>
+ <entry value="1">offen</entry>
+ </mapping>
+ <mapping name="OnOff">
+ <entry value="0">Aus</entry>
+ <entry value="1">An</entry>
+ </mapping>
+ <mapping name="Sign">
+ <entry range_min="-1e99" range_max="0">Negativ</entry>
+ <entry value="0">Null</entry>
+ <entry range_min="0" range_max="1e99">Positiv</entry>
+ </mapping>
+ </mappings>
+ <stylings>
+ <styling name="RedGreen">
+ <entry value="0">red</entry>
+ <entry value="1">green</entry>
+ </styling>
+ <styling name="GreenRed">
+ <entry value="0">green</entry>
+ <entry value="1">red</entry>
+ </styling>
+ <styling name="BluePurpleRed">
+ <entry range_min="-100" range_max="0">blue</entry>
+ <entry value="0">purple</entry>
+ <entry range_min="0" range_max="100">red</entry>
+ </styling>
+ </stylings>
+ <statusbar>
+ <status type="html"><![CDATA[
+ <img src="icon/comet_64_ff8000.png" alt="CometVisu" /> by <a href="http://www.cometvisu.org/">CometVisu.org</a>
+ - <a href=".?config=neu">Reload</a>
+ - <a href=".">Default Config</a>
+ ]]></status>
+ <status type="html" condition="!edit"><![CDATA[
+ - <a href="edit_config.html">Edit</a>
+ ]]></status>
+ <status type="html" condition="edit"><![CDATA[
+ - <a href=".">normal Mode</a>
+ ]]></status>
+ <status type="html"><![CDATA[
+ - <a href="check_config.php">Check Config</a>
+ ]]></status>
+ </statusbar>
+ </meta>
+ <page name="Übersicht">
+ <text align="center">CometVisu format neu</text>
+ <info styling="BluePurpleRed">
+ <label>Slide Info</label>
+ <address src="12/4/250" transform="DPT:9" />
+ <address src="12/4/251" transform="DPT:9.001" />
+ </info>
+ <line />
+ <designtoggle>Change design</designtoggle>
+ </page>
+</pages>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|