Show
Ignore:
Timestamp:
05/19/08 21:54:36 (22 months ago)
Author:
thijs
Message:

Buildbot example update (#298)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • examples/trunk/buildbot/flex/src/org/pyamf/examples/buildbot/BuildbotBase.as

    r1402 r1405  
    1010        import flash.events.NetStatusEvent; 
    1111         
     12        import mx.collections.ArrayCollection; 
    1213        import mx.core.Application; 
    1314        import mx.utils.URLUtil; 
    1415         
     16        import org.pyamf.examples.buildbot.events.BuildEvent; 
    1517        import org.pyamf.examples.buildbot.events.BuildbotEvent; 
     18        import org.pyamf.examples.buildbot.events.BuilderEvent; 
    1619         
    1720        [Event(name="update", type="org.pyamf.examples.buildbot.events.BuildbotEvent")] 
     
    1922         
    2023        /** 
    21          * This examples shows how to communicate with Buildbot and query the build status. 
     24         * This examples shows how to communicate with Buildbot and query 
     25         * the build status. 
    2226         *  
    2327         * @author Thijs Triemstra (info@collab.nl) 
     
    3337                public var status:String = ""; 
    3438                 
     39                /** 
     40                 * Setup gateway url.  
     41                 */              
    3542                public function BuildbotBase() 
    3643                { 
     
    6471                } 
    6572                 
     73                protected function loadComplete( event:BuilderEvent ):void 
     74        { 
     75                var rows:ArrayCollection = new ArrayCollection(event.builder.rows); 
     76                var columns:Array = new Array(); 
     77                 
     78                for (var d:int=0;d<_builders.length;d++) 
     79                        { 
     80                                columns.push(_builders[d].name); 
     81                        } 
     82                dispatchEvent( new BuildbotEvent(BuildbotEvent.UPDATE, rows, columns) ); 
     83        } 
     84         
     85        protected function addBuilders(result:*): void 
     86        { 
     87                        if (result != null) 
     88                        { 
     89                                for (var d:int=0;d<result.length;d++) 
     90                                { 
     91                                        var builder:Builder = new Builder(result[d]); 
     92                                        builder.addEventListener(BuilderEvent.STATUS, getBuilderStatus); 
     93                                        builder.addEventListener(BuilderEvent.LAST_BUILDS, getLastBuilds); 
     94                                        builder.addEventListener(BuilderEvent.LOAD_COMPLETE, loadComplete); 
     95                                        builder.addEventListener(BuildEvent.BUILD_DETAILS, getBuild); 
     96                                        builder.load(); 
     97                                         
     98                                        _builders.push( builder ); 
     99                                } 
     100                        status = result.length + " builder(s) loaded."; 
     101                        } 
     102                        else 
     103                        { 
     104                                var columns:Array = new Array(); 
     105                                var rows:ArrayCollection = new ArrayCollection(); 
     106                                 
     107                                status = "No builders available."; 
     108                                dispatchEvent( new BuildbotEvent(BuildbotEvent.UPDATE) ); 
     109                        } 
     110        } 
     111         
     112        public function getBuilderStatus(event:BuilderEvent): void 
     113        { 
     114        } 
     115         
     116        public function getLastBuilds(event:BuilderEvent): void 
     117        { 
     118        } 
     119         
     120        public function getBuild(event:BuildEvent): void 
     121        { 
     122        } 
     123         
    66124        protected function onNetstatusError(event:NetStatusEvent): void 
    67125        { 
     
    74132        } 
    75133         
     134        /** 
     135         * Notify the user of the problem. 
     136         *  
     137         * @param error 
     138         */         
    76139        protected function onFault( error:* ): void 
    77140        { 
    78             // notify the user of the problem 
    79141            var errorStr:String = ""; 
    80142            for (var d:String in error) {