Hi

Am am creating a custom component and a delegate that extends the
UIComponentAutomationImpl, so that it is possible to test the
component with either QTP or FunFX. 

(I am doing this to learn how to create such components, so the
components could have been created much easier, with a repeater).

I am able to create the delegate and make an swc of the delegate, and
when createing the custom component, the delegate is mixed in. But I
am getting a null pointer exception in the constructor of the
UIComponentAutomationImpl.

It seems that when I create an instance of CustomComponent, it sends a
null value to the constructor of the delegate. When I debug the init
method it gets a customcomponentapplication_manager.

Does anybody know what I am doing wrong? Thanks for any pointers.



// The delegate class
[Mixin]
public class CustomComponentDelegate extends UIComponentAutomationImpl
{               
  public static function init(root:DisplayObject):void {
    Automation.registerDelegateClass(CustomComponent,
CustomComponentDelegate);
  }
                
  private var comp:CustomComponent;
  public function CustomComponentDelegate(component:CustomComponent) {    
    super(comp);
    comp = component
  }
  //More methods eg numAutomationChildren etc
}

[Event(name="itemClick", type="event.CustomItemClickEvent")]
[DefaultProperty("dataProvider")]
        
public class CustomComponent extends VBox
{
  private var _dataProvider:Array;
  private var _renderers:Array = [];
  private var _itemRenderer:IFactory = new ClassFactory(Button);
                
  public function CustomComponent(){
    super();
  }
                
  override protected function createChildren():void{
    super.createChildren();
    for(var i:int=0; i<_dataProvider.length; i++){
      var inst:UIComponent = createInstance();
      Button(inst).label = _dataProvider[i];
    }
    invalidateSize();
    invalidateDisplayList();
  }

  private function createInstance():UIComponent{
    var inst:UIComponent = _itemRenderer.newInstance();
    inst.addEventListener(MouseEvent.CLICK, itemClickHandler);
    this.addChild(inst);
    return inst;
  }
  //More method like itemClickHandler etc
}

Reply via email to