| <?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:Group xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:s="library://ns.adobe.com/flex/spark" |
| xmlns:mx="library://ns.adobe.com/flex/mx" |
| implements="com.flexcapacitor.views.IInspector" |
| xmlns:renderers="com.flexcapacitor.views.renderers.*" |
| styleName="inspectablePanel"> |
| |
| <fx:Script> |
| <![CDATA[ |
| import com.flexcapacitor.controller.Radiate; |
| import com.flexcapacitor.events.RadiateEvent; |
| import com.flexcapacitor.model.AccessorMetaData; |
| import com.flexcapacitor.utils.ClassUtils; |
| |
| public var radiate:Radiate; |
| public var target:Object; |
| public var data:Object; |
| |
| public var fonts:Array; |
| |
| public function activate():void { |
| radiate = Radiate.getInstance(); |
| |
| radiate.addEventListener(RadiateEvent.TARGET_CHANGE, handleTargetChange, false, 0, true); |
| radiate.addEventListener(RadiateEvent.PROPERTY_CHANGED, propertyChangeHandler, false, 0, true); |
| |
| if (radiate.target) { |
| target = radiate.target; |
| } |
| |
| update(); |
| } |
| |
| public function deactivate():void { |
| radiate.removeEventListener(RadiateEvent.TARGET_CHANGE, handleTargetChange); |
| radiate.removeEventListener(RadiateEvent.PROPERTY_CHANGED, propertyChangeHandler); |
| } |
| |
| protected function handleTargetChange(event:RadiateEvent):void { |
| if (target!=event.selectedItem) { |
| target = event.selectedItem; |
| update(); |
| } |
| } |
| |
| public function update():void { |
| var textAccessor:AccessorMetaData = ClassUtils.getMetaDataOfProperty(target, "text"); |
| |
| textRenderer.data = textAccessor; |
| } |
| |
| protected function propertyChangeHandler(event:RadiateEvent):void {
|
| callLater(update);
|
| } |
| |
| ]]> |
| </fx:Script> |
| |
| <s:layout> |
| <s:VerticalLayout /> |
| </s:layout> |
| |
| <s:HGroup width="100%" verticalAlign="baseline" gap="{getStyle('gap')}"> |
| <s:Label text="Text" styleName="inspectablePanelLabel" width="{getStyle('labelWidth')}"/> |
| <renderers:TextRenderer id="textRenderer" height="24" /> |
| </s:HGroup> |
| </s:Group> |