@@ -46,7 +46,19 @@ var CCLScripting = function(workerUrl){
4646 this . deregisterObject = function ( objectId ) {
4747 delete objects [ objectId ] ;
4848 } ;
49-
49+ this . updateProperty = function ( objectId , propName , value ) {
50+ if ( ! objects [ objectId ] ) {
51+ scripter . logger . error ( "Object not found." ) ;
52+ return ;
53+ }
54+ if ( ! objects [ objectId ] [ propName ] ) {
55+ scripter . logger . error ( "Property \"" + propName
56+ + "\" not defined for object of type " +
57+ objects [ objectId ] . getClass ( ) + "." ) ;
58+ return ;
59+ }
60+ objects [ objectId ] [ propName ] = value ;
61+ } ;
5062 this . callMethod = function ( objectId , methodName , params ) {
5163 if ( ! objects [ objectId ] ) {
5264 scripter . logger . error ( "Object not found." ) ;
@@ -260,6 +272,9 @@ var CCLScripting = function(workerUrl){
260272 this . addListener ( "Runtime:CallMethod" , function ( pl ) {
261273 self . getContext ( ) . callMethod ( pl . id , pl . method , pl . params ) ;
262274 } ) ;
275+ this . addListener ( "Runtime:UpdateProperty" , function ( pl ) {
276+ self . getContext ( ) . updateProperty ( pl . id , pl . name , pl . value ) ;
277+ } ) ;
263278 } ;
264279 /** This is the DOM Manipulation Library **/
265280 var _ = function ( type , props , children , callback ) {
@@ -295,7 +310,7 @@ var CCLScripting = function(workerUrl){
295310 } ;
296311 /** Define some unpackers **/
297312 var ScriptingContext = CCLScripting . prototype . ScriptingContext ;
298- ScriptingContext . prototype . Unpack . Comment = function ( stage , data , ctx ) {
313+ ScriptingContext . prototype . Unpack . TextField = function ( stage , data , ctx ) {
299314 this . DOM = _ ( "div" , {
300315 "style" :{
301316 "position" :"absolute" ,
@@ -579,7 +594,13 @@ var CCLScripting = function(workerUrl){
579594 applyStroke ( e , this ) ;
580595 defaultGroup . appendChild ( e ) ;
581596 } ;
582-
597+ this . __defineGetter__ ( "filters" , function ( f ) {
598+ return [ ] ;
599+ } ) ;
600+ this . __defineSetter__ ( "filters" , function ( f ) {
601+ console . log ( f ) ;
602+ this . setFilters ( [ f ] ) ;
603+ } ) ;
583604 this . setFilters = function ( params ) {
584605 var filters = params [ 0 ] ;
585606 //Remove old filters
0 commit comments