blob: a2f55f7a96362acd2860fbce6c48165788597384 [file] [log] [blame]
<?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.*"
xmlns:local="*"
implements="com.flexcapacitor.views.IInspector"
styleName="inspectablePanel"
>
<!--
ArgumentError: Error #2004: One of the parameters is invalid.
be sure to add the style 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 cornerRadius:StyleMetaData = ClassUtils.getMetaDataOfStyle(target, "cornerRadius");
borderWeightRenderer.data = ClassUtils.getMetaDataOfStyle(target, "borderWeight");
borderColorRenderer.data = ClassUtils.getMetaDataOfStyle(target, "borderColor");
borderAlphaRenderer.data = ClassUtils.getMetaDataOfStyle(target, "borderAlpha");
if (cornerRadius) {
cornerRadiusRenderer.data = cornerRadius;
}
}
protected function propertyChangeHandler(event:RadiateEvent):void {
callLater(update);
}
]]>
</fx:Script>
<fx:Declarations>
</fx:Declarations>
<s:layout>
<s:VerticalLayout />
</s:layout>
<s:HGroup width="100%" verticalAlign="baseline" gap="{getStyle('gap')}">
<s:Label text="Corner Radius" styleName="inspectablePanelLabel" width="{getStyle('labelWidth')}"/>
<renderers:NumberRenderer id="cornerRadiusRenderer" height="24" />
</s:HGroup>
<s:HGroup width="100%" verticalAlign="baseline" gap="{getStyle('gap')}">
<s:Label text="Border Weight" styleName="inspectablePanelLabel" width="{getStyle('labelWidth')}"/>
<renderers:NumberRenderer id="borderWeightRenderer" height="24" />
</s:HGroup>
<s:HGroup width="100%" verticalAlign="baseline" gap="{getStyle('gap')}">
<s:Label text="Border Alpha" styleName="inspectablePanelLabel" width="{getStyle('labelWidth')}"/>
<renderers:NumberRenderer id="borderAlphaRenderer" height="24" />
</s:HGroup>
<s:HGroup width="100%" verticalAlign="baseline" gap="{getStyle('gap')}">
<s:Label text="Border Color" styleName="inspectablePanelLabel" width="{getStyle('labelWidth')}"/>
<renderers:ColorPickerRenderer id="borderColorRenderer" height="24" includeCopyIcon="false"/>
</s:HGroup>
</s:Group>