| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You 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, software |
| 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. |
| |
| --> |
| |
| |
| <!--- The Spark DefaultComplexItemRenderer class is an item renderer class that |
| displays a Flex component in a Group container. |
| Each component is wrapped in its own Group container. |
| Therefore, it is useful when the children of the container |
| are visual elements, such as Flex components. . |
| |
| @langversion 3.0 |
| @playerversion Flash 10 |
| @playerversion AIR 1.5 |
| @productversion Flex 4 |
| --> |
| <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" |
| autoDrawBackground="true"> |
| <!-- Setting autoDrawBackground will automatically draw the selection/rollover background rectangle for you. |
| If you would like to customize the appearance of your item renderer even further when |
| the item renderer is selected or hovered, you should turn this flag off and use states. |
| For more information on this and custom item renderer examples, check out the Flex documentation. |
| --> |
| |
| <fx:Script> |
| <![CDATA[ |
| |
| import mx.core.IVisualElement; |
| |
| /** |
| * @copy spark.components.DataRenderer#data |
| */ |
| [Bindable("dataChanged")] |
| override public function set data(value:Object):void |
| { |
| super.data = value; |
| |
| //First lets remove everything from the contentGroup |
| contentGroup.removeAllElements(); |
| |
| //Then add the new items anew |
| if (value is Array) |
| { |
| for (var i:int = 0; i < value.length; i++) |
| { |
| contentGroup.addElement(IVisualElement(value[i])); |
| } |
| } |
| else if (value is IVisualElement) |
| { |
| contentGroup.addElement(IVisualElement(value)); |
| } |
| } |
| ]]> |
| </fx:Script> |
| |
| <!--- The container used to wrap each Flex component defined in the host component. --> |
| <s:Group id="contentGroup" verticalCenter="0" left="2" right="2" top="2" bottom="2" /> |
| |
| </s:ItemRenderer> |