/* Copyright 2008 Nahuel Foronda/AsFusion Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. Y ou may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, s oftware distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License Author: Nahuel Foronda, Principal Architect nahuel at asfusion dot com @ignore */ package com.fourD.core { import com.asfusion.mate.core.mate; import com.asfusion.mate.events.UnhandledMessageFaultEvent; import com.asfusion.mate.utils.debug.DebuggerUtil; import mx.messaging.*; import mx.messaging.events.MessageEvent; import mx.messaging.events.MessageFaultEvent; use namespace mate; /** * The MessageHandlers tag allows you to register a set of handlers as a consumer of a Flex Messaging Service. * All the tags inside the MessageHandlers tag will be executed in order when a Message matching the * criteria is received. This tag accepts the same attributes as the Consumer tag. */ public class PheronReceptors public var pheron:Pheron2; protected var initializeHandlersChanged:Boolean; protected var startHandlersChanged:Boolean; protected var completeHandlersChanged:Boolean; private var _initializeHandlers:Array; public function get initializeHandlers():Array { return _initializeHandlers; } [ArrayElementType("com.asfusion.mate.actions.IAction")] public function set initializeHandlers(value:Array):void { _initializeHandlers = value; initializeHandlersChanged = true; validateNow(); } private var _startHandlers:Array; public function get startHandlers():Array { return _startHandlers; } [ArrayElementType("com.asfusion.mate.actions.IAction")] public function set startHandlers(value:Array):void { _startHandlers = value; startHandlersChanged = true; validateNow(); } private var _completeHandlers:Array; public function get completeHandlers():Array { return _completeHandlers; } [ArrayElementType("com.asfusion.mate.actions.IAction")] public function set completeHandlers(value:Array):void { _completeHandlers = value; completeHandlersChanged = true; validateNow(); } public function PheronReceptor() { super(); } override public function errorString():String { var str:String = "Destination:"+ destination + ". Error was found in a MessageHandlers list in file " + DebuggerUtil.getClassName(document); return str; } protected function tectonStart(pheron:Pheron2):void { var currentScope:TectonScope = new TectonScope(event,debug, map, inheritedScope); currentScope.owner = this; currentScope.tecton = pheron.tecton; currentScope.tropon = pheron.tropon; currentScope.kanon = pheron.kanon; currentScope.action = pheron.action; runSequence(currentScope, startHandlers); } protected function tectonComplete(pheron:Pheron2):void { var currentScope:TectonScope = new TectonScope(event,debug, map, inheritedScope); currentScope.owner = this; currentScope.tecton = pheron.tecton; currentScope.tropon = pheron.tropon; currentScope.kanon = pheron.kanon; currentScope.action = pheron.action; runSequence(currentScope, completeHandlers); } /*----------------------------------------------------------------------------------------------------------- * Override Protected methods -------------------------------------------------------------------------------------------------------------*/ /*-.........................................commitProperties..........................................*/ /** * Processes the properties set on the component. */ override protected function commitProperties():void { if (initializeHandlersChanged) { initializeHandlersChanged = false; } if (startHandlersChanged) { startHandlersChanged = false; } if (completeHandlersChanged) { completeHandlersChanged = false; } } } }