1//////////////////////////////////////////////////////////////////////////////// 2// 3// ADOBE SYSTEMS INCORPORATED 4// Copyright 2009 Adobe Systems Incorporated 5// All Rights Reserved. 6// 7// NOTICE: Adobe permits you to use, modify, and distribute this file 8// in accordance with the terms of the license agreement accompanying it. 9// 10//////////////////////////////////////////////////////////////////////////////// 11 12package mx.automation.codec 13{ 14 15 import mx.automation.AutomationError; 16 import mx.automation.qtp.IQTPPropertyDescriptor; 17 import mx.automation.IAutomationManager; 18 import mx.automation.IAutomationObject; 19 import mx.automation.IAutomationTabularData; 20 import mx.core.mx_internal; 21 import mx.controls.AdvancedDataGrid; 22 import mx.automation.delegates.advancedDataGrid.AdvancedDataGridAutomationImpl; 23 24 use namespace mx_internal; 25 26 [ResourceBundle("automation_agent")] 27 28 /** 29 * Translates between internal Flex List item and automation-friendly version 30 * 31 * @langversion 3.0 32 * @playerversion Flash 9 33 * @playerversion AIR 1.1 34 * @productversion Flex 3 35 */ 36 public class AdvancedDataGridSelectedCellCodec extends DefaultPropertyCodec 37 { 38 //-------------------------------------------------------------------------- 39 // 40 // Constructor 41 // 42 //-------------------------------------------------------------------------- 43 44 public function AdvancedDataGridSelectedCellCodec() 45 { 46 super(); 47 } 48 49 //-------------------------------------------------------------------------- 50 // 51 // Overridden methods 52 // 53 //-------------------------------------------------------------------------- 54 55 /** 56 * @private 57 */ 58 override public function encode(automationManager:IAutomationManager, 59 obj:Object, 60 propertyDescriptor:IQTPPropertyDescriptor, 61 relativeParent:IAutomationObject):Object 62 { 63 var val:Object = getMemberFromObject(automationManager, obj, propertyDescriptor); 64 65 if (val != null) 66 { 67 //val = relativeParent.automationTabularData.getAutomationValueForFiedData(val).join(" | "); 68 var adg:AdvancedDataGrid = relativeParent as AdvancedDataGrid; 69 var objdel:AdvancedDataGridAutomationImpl = (adg.automationDelegate) as AdvancedDataGridAutomationImpl; 70 var ret:Array = []; 71 72 if((val.columnIndex == -1)&& (val.rowIndex != -1)) 73 return objdel.getRowData(val.rowIndex,true); 74 75 if((val.rowIndex != -1) &&(val.columnIndex != -1)) 76 ret.push(objdel.getCellData(val.rowIndex,val.columnIndex,true)); 77 78 val= ret; 79 80 } 81 82 return val; 83 } 84 85 /** 86 * @private 87 */ 88 override public function decode(automationManager:IAutomationManager, 89 obj:Object, 90 value:Object, 91 propertyDescriptor:IQTPPropertyDescriptor, 92 relativeParent:IAutomationObject):void 93 { 94 var message:String = resourceManager.getString( 95 "automation_agent", "notSupported"); 96 throw new AutomationError(message, AutomationError.ILLEGAL_OPERATION); 97 } 98 } 99 100} 101