- Timestamp:
- 05/19/08 21:54:36 (22 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
examples/trunk/buildbot/flex/src/org/pyamf/examples/buildbot/BuildbotBase.as
r1402 r1405 10 10 import flash.events.NetStatusEvent; 11 11 12 import mx.collections.ArrayCollection; 12 13 import mx.core.Application; 13 14 import mx.utils.URLUtil; 14 15 16 import org.pyamf.examples.buildbot.events.BuildEvent; 15 17 import org.pyamf.examples.buildbot.events.BuildbotEvent; 18 import org.pyamf.examples.buildbot.events.BuilderEvent; 16 19 17 20 [Event(name="update", type="org.pyamf.examples.buildbot.events.BuildbotEvent")] … … 19 22 20 23 /** 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. 22 26 * 23 27 * @author Thijs Triemstra (info@collab.nl) … … 33 37 public var status:String = ""; 34 38 39 /** 40 * Setup gateway url. 41 */ 35 42 public function BuildbotBase() 36 43 { … … 64 71 } 65 72 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 66 124 protected function onNetstatusError(event:NetStatusEvent): void 67 125 { … … 74 132 } 75 133 134 /** 135 * Notify the user of the problem. 136 * 137 * @param error 138 */ 76 139 protected function onFault( error:* ): void 77 140 { 78 // notify the user of the problem79 141 var errorStr:String = ""; 80 142 for (var d:String in error) {
