| <?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. |
| |
| --> |
| <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:s="library://ns.adobe.com/flex/spark" |
| xmlns:mx="library://ns.adobe.com/flex/mx" |
| autoDrawBackground="false"> |
| |
| <fx:Script>
|
| <![CDATA[
|
| import data.Item; |
| |
| import mx.core.IFlexDisplayObject; |
| import mx.managers.ISystemManager; |
| |
| public var item:Item; |
|
|
| override public function set data(value:Object):void { |
| super.data = value; |
| |
| item = value as Item; |
| |
| if (!value) { |
| enabledCheckbox.selected = false; |
| } |
| else { |
| enabledCheckbox.selected = item.enabled; |
| nameLabel.text = item.name; |
| } |
| |
| } |
| |
| protected function loadButton_clickHandler(event:MouseEvent):void {
|
| dispatchEvent(new Event("loadView", true));
|
| }
|
|
|
| protected function enabledCheckbox_changeHandler(event:Event):void {
|
| item.enabled = enabledCheckbox.selected; |
| dispatchEvent(new Event("settingChange", true));
|
| }
|
| |
| public function get defaultButton():IFlexDisplayObject { |
| return null; |
| } |
| |
| public function set defaultButton(value:IFlexDisplayObject):void { |
| } |
| |
| override public function get systemManager():ISystemManager { |
| return null; |
| }
|
| ]]>
|
| </fx:Script>
|
| |
| |
| <s:layout> |
| <s:HorizontalLayout verticalAlign="middle" |
| paddingBottom="2" paddingLeft="2" paddingRight="2" paddingTop="2"/> |
| </s:layout> |
| |
| |
| <s:CheckBox id="enabledCheckbox" change="enabledCheckbox_changeHandler(event)"/> |
| |
| <s:Label id="nameLabel" paddingTop="2"/> |
| |
| <s:Spacer width="100%" /> |
| |
| <s:Button id="loadButton" label="Load" click="loadButton_clickHandler(event)"/> |
| |
| </s:ItemRenderer> |