Skip to content

Instantly share code, notes, and snippets.

@gAmUssA
Created January 12, 2011 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gAmUssA/776640 to your computer and use it in GitHub Desktop.
Save gAmUssA/776640 to your computer and use it in GitHub Desktop.
Automation delegate for Band component of SuperGrid
package com.theriabook.automation.delegates.controls.superGridClasses
{
import com.theriabook.controls.superGridClasses.Band;
import com.theriabook.controls.superGridClasses.DataGridItemRenderer;
import flash.display.DisplayObject;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import mx.automation.Automation;
import mx.automation.IAutomationObject;
import mx.automation.IAutomationObjectHelper;
import mx.automation.delegates.core.UIComponentAutomationImpl;
[Mixin]
/**
* Automation delegate for Band component of SuperGrid
*/
public class BandAutomationImpl extends UIComponentAutomationImpl
{
//----------------------------------------------------------------------
//
// Class Methods
//
//----------------------------------------------------------------------
public static function init(root:DisplayObject):void
{
Automation.registerDelegateClass(Band, BandAutomationImpl);
}
//----------------------------------------------------------------------
//
// Constructor
//
//----------------------------------------------------------------------
public function BandAutomationImpl(obj:Band)
{
super(obj);
//TODO add band events listeners
}
//----------------------------------------------------------------------
//
// Variables
//
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//
// Overriden Properties
//
//----------------------------------------------------------------------
override public function get numAutomationChildren():int
{
return band.numChildren;
}
public override function get automationValue():Array
{
return [band.data.toString()];
}
public override function get automationName():String
{
return band.name || super.automationName;
}
//----------------------------------------------------------------------
//
// Properties
//
//----------------------------------------------------------------------
public function get band():Band
{
return uiComponent as Band;
}
//----------------------------------------------------------------------
//
// Overriden Methods
//
//----------------------------------------------------------------------
override public function getAutomationChildAt(index:int):IAutomationObject
{
var childList:Array = getAllChildren();
//var item:DataGridItemRenderer = childList[index];
trace(childList[index]);
return childList[index] as IAutomationObject;
}
override public function getAutomationChildren():Array
{
trace("0");
var childArray:Array = getAllChildren();
return childArray;
}
override public function createAutomationIDPart(child:IAutomationObject):Object
{
//var help:IAutomationObjectHelper = Automation.automationObjectHelper;
//return help.helpCreateIDPart(uiAutomationObject, child);
var id:Object = super.createAutomationIDPart(child);
id["automationName"] = id["automationIndex"];
return id;
}
override public function createAutomationIDPartWithRequiredProperties(child:IAutomationObject, properties:Array):Object
{
var help:IAutomationObjectHelper = Automation.automationObjectHelper;
return help.helpCreateIDPartWithRequiredProperties(uiAutomationObject,child,properties);
}
override public function resolveAutomationIDPart(criteria:Object):Array
{
var help:IAutomationObjectHelper = Automation.automationObjectHelper;
return help.helpResolveIDPart(uiAutomationObject, criteria);
}
override public function replayAutomatableEvent(event:Event):Boolean
{
var help:IAutomationObjectHelper = Automation.automationObjectHelper;
if (event is MouseEvent && event.type == MouseEvent.CLICK)
return help.replayClick(uiComponent, MouseEvent(event));
else if (event is KeyboardEvent)
return help.replayKeyboardEvent(uiComponent, KeyboardEvent(event));
else
return super.replayAutomatableEvent(event);
}
//----------------------------------------------------------------------
//
// Methods
//
//----------------------------------------------------------------------
public function getAllChildren():Array
{
var childsArray:Array = [];
var child:DataGridItemRenderer;
var n:uint = band.numChildren;
for (var i:uint=0; i < n; i++)
{
if (band.getChildAt(i) is DataGridItemRenderer)
{
child = band.getChildAt(i) as DataGridItemRenderer;
//trace(child.className);
childsArray.push(child);
}
}
return childsArray;
}
//----------------------------------------------------------------------
//
// Overriden Handlers
//
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//
// Handlers
//
//----------------------------------------------------------------------
}
}
@gAmUssA
Copy link
Author

gAmUssA commented Jan 12, 2011

[SWF] Users:apple:Workspaces:Flexx:swf-demo:bin-debug:DemoApplication.swf - 3,973,005 bytes after decompression
[SWF] Users:apple:Workspaces:Flexx:swf-demo:bin-debug:DemoApplication.swf:[[DYNAMIC]]:1 - 650,777 bytes after decompression
[SWF] Users:apple:Workspaces:Flexx:swf-demo:bin-debug:DemoApplication.swf:[[DYNAMIC]]:2 - 370,463 bytes after decompression
[SWF] Users:apple:Workspaces:Flexx:swf-demo:bin-debug:DemoApplication.swf:[[DYNAMIC]]:3 - 2,311,734 bytes after decompression
[SWF] Users:apple:Workspaces:Flexx:swf-demo:bin-debug:DemoApplication.swf:[[DYNAMIC]]:4 - 1,432,382 bytes after decompression
[SWF] Users:apple:Workspaces:Flexx:swf-demo:bin-debug:DemoApplication.swf:[[DYNAMIC]]:5 - 323,354 bytes after decompression
[SWF] Users:apple:Workspaces:Flexx:swf-demo:bin-debug:DemoApplication.swf:[[DYNAMIC]]:6 - 441,362 bytes after decompression
[SWF] Users:apple:Workspaces:Flexx:swf-demo:bin-debug:swc-erf-demo.swf - 63,288 bytes after decompression
ListBase added change listener
Done :46
Done :26
Wed Jan 12 16:20:06 GMT-0500 2011 WARN - org.as3commons.reflect.Type - The class with the name 'AS3.vec::Vector.flash.geom::Vector3D' could not be found in the application domain '[object ApplicationDomain]'
MonkeyLinkTestLauncher: antRun was not specified, will lay low for now...
Connected and timing
DemoApplication.ApplicationSkin4._ApplicationSkin_Group1.contentGroup.grid.SuperGridContentHolder32.Band179.DataGridItemRenderer180
DemoApplication.ApplicationSkin4._ApplicationSkin_Group1.contentGroup.grid.SuperGridContentHolder32.Band179.DataGridItemRenderer181
DemoApplication.ApplicationSkin4._ApplicationSkin_Group1.contentGroup.grid.SuperGridContentHolder32.Band179.DataGridItemRenderer182
DemoApplication.ApplicationSkin4._ApplicationSkin_Group1.contentGroup.grid.SuperGridContentHolder32.Band179.DataGridItemRenderer183
DemoApplication.ApplicationSkin4._ApplicationSkin_Group1.contentGroup.grid.SuperGridContentHolder32.Band179.DataGridItemRenderer184
DemoApplication.ApplicationSkin4._ApplicationSkin_Group1.contentGroup.grid.SuperGridContentHolder32.Band179.DataGridItemRenderer185
DemoApplication.ApplicationSkin4._ApplicationSkin_Group1.contentGroup.grid.SuperGridContentHolder32.Band179.DataGridItemRenderer186
DemoApplication.ApplicationSkin4._ApplicationSkin_Group1.contentGroup.grid.SuperGridContentHolder32.Band179.DataGridItemRenderer187
DemoApplication.ApplicationSkin4._ApplicationSkin_Group1.contentGroup.grid.SuperGridContentHolder32.Band179.DataGridItemRenderer188
DemoApplication.ApplicationSkin4._ApplicationSkin_Group1.contentGroup.grid.SuperGridContentHolder32.Band179.DataGridItemRenderer189
Sending respondLoadApplicationAutomationTree to _flexMonkey w/TXCount=2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment