| <?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" |
| xmlns:renderers="com.flexcapacitor.views.renderers.*" |
| |
| implements="com.flexcapacitor.views.IInspector" |
| styleName="inspectablePanel"> |
| |
| <fx:Script> |
| <![CDATA[ |
| import com.flexcapacitor.controller.Radiate; |
| import com.flexcapacitor.events.RadiateEvent; |
| import com.flexcapacitor.model.StyleMetaData; |
| import com.flexcapacitor.utils.ClassUtils; |
| |
| public var radiate:Radiate; |
| public var target:Object; |
| public var data:Object; |
| |
| 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 backgroundColor:StyleMetaData = ClassUtils.getMetaDataOfStyle(target, "backgroundColor"); |
| var backgroundAlpha:StyleMetaData = ClassUtils.getMetaDataOfStyle(target, "backgroundAlpha"); |
| |
| if (!backgroundColor) { |
| backgroundColor = ClassUtils.getMetaDataOfStyle(target, "contentBackgroundColor"); |
| } |
| |
| if (!backgroundAlpha) { |
| backgroundAlpha = ClassUtils.getMetaDataOfStyle(target, "contentBackgroundAlpha"); |
| } |
| |
| if (backgroundColor) { |
| backgroundColorRenderer.data = backgroundColor; |
| } |
| |
| if (backgroundAlpha) { |
| backgroundAlphaRenderer.data = backgroundAlpha; |
| } |
| } |
| |
| 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="Background Color" styleName="inspectablePanelLabel" width="{getStyle('labelWidth')}"/> |
| <renderers:ColorPickerRenderer id="backgroundColorRenderer" height="24" includeCopyIcon="false"/> |
| </s:HGroup> |
| |
| <s:HGroup width="100%" verticalAlign="baseline" gap="{getStyle('gap')}"> |
| <s:Label text="Background Alpha" styleName="inspectablePanelLabel" width="{getStyle('labelWidth')}"/> |
| <renderers:NumberRenderer id="backgroundAlphaRenderer" height="24" /> |
| </s:HGroup> |
| </s:Group> |