remove IItemRendererFactory and fix up examples so it they work again. Also edit BarChartExample to use the barchart in FlexJSJX instead of in its own project.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/0b8875a8 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/0b8875a8 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/0b8875a8 Branch: refs/heads/develop Commit: 0b8875a874e3063724d23e60e237ec27ed9353c0 Parents: ec91173 Author: Alex Harui <[email protected]> Authored: Wed Jan 29 15:27:40 2014 -0800 Committer: Alex Harui <[email protected]> Committed: Wed Jan 29 15:27:54 2014 -0800 ---------------------------------------------------------------------- examples/BarChartExample/build.xml | 47 ++++++++ examples/BarChartExample/src/MyInitialView.mxml | 57 ++++----- .../custom/beads/ChartItemRendererFactory.as | 100 ---------------- .../flex/html/custom/beads/IChartSeries.as | 37 ------ .../apache/flex/html/custom/beads/XAxisBead.as | 107 ----------------- .../html/custom/beads/layout/BarChartLayout.as | 118 ------------------- .../custom/supportClasses/BarChartSeries.as | 70 ----------- .../custom/supportClasses/BoxItemRenderer.as | 116 ------------------ examples/ListsTest/build.xml | 3 + examples/build.xml | 1 + .../org/apache/flex/charts/core/IChartSeries.as | 6 +- .../charts/supportClasses/BarChartSeries.as | 10 +- .../charts/supportClasses/BoxItemRenderer.as | 10 +- .../flex/core/IItemRendererClassFactory.as | 29 +++++ .../apache/flex/core/IItemRendererFactory.as | 25 ---- .../org/apache/flex/core/SimpleCSSValuesImpl.as | 3 +- .../supportClasses/UIItemRendererBase.as | 41 +++++-- 17 files changed, 142 insertions(+), 638 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/examples/BarChartExample/build.xml ---------------------------------------------------------------------- diff --git a/examples/BarChartExample/build.xml b/examples/BarChartExample/build.xml new file mode 100644 index 0000000..f60f62b --- /dev/null +++ b/examples/BarChartExample/build.xml @@ -0,0 +1,47 @@ +<?xml version="1.0"?> +<!-- + + 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. + +--> + + +<project name="barchartexample" default="main" basedir="."> + <property name="FLEXJS_HOME" location="../.."/> + <property name="example" value="BarChartExample" /> + + <property file="${FLEXJS_HOME}/env.properties"/> + <property environment="env"/> + <property file="${FLEXJS_HOME}/build.properties"/> + <property name="FLEX_HOME" value="${FLEXJS_HOME}"/> + <property name="FALCON_HOME" value="${env.FALCON_HOME}"/> + <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/> + <property name="GOOG_HOME" value="${env.GOOG_HOME}"/> + + <include file="${basedir}/../build_example.xml" /> + + <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}"> + </target> + + <target name="clean"> + <delete dir="${basedir}/bin" failonerror="false" /> + <delete dir="${basedir}/bin-debug" failonerror="false" /> + <delete dir="${basedir}/bin-release" failonerror="false" /> + </target> + + + +</project> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/examples/BarChartExample/src/MyInitialView.mxml ---------------------------------------------------------------------- diff --git a/examples/BarChartExample/src/MyInitialView.mxml b/examples/BarChartExample/src/MyInitialView.mxml index 18e93a0..c5f7337 100644 --- a/examples/BarChartExample/src/MyInitialView.mxml +++ b/examples/BarChartExample/src/MyInitialView.mxml @@ -21,9 +21,7 @@ limitations under the License. xmlns:basic="library://ns.apache.org/flexjs/basic" xmlns:local="*" xmlns:models="models.*" - xmlns:custom="org.apache.flex.html.custom.*" - xmlns:customBeads="org.apache.flex.html.custom.beads.*" - xmlns:customSup="org.apache.flex.html.custom.supportClasses.*"> +> <fx:Script> <![CDATA[ @@ -31,45 +29,34 @@ limitations under the License. ]]> </fx:Script> - <fx:Style> - @namespace custom "org.apache.flex.html.custom.*"; - - custom|BarChart - { - IBeadModel: ClassReference("org.apache.flex.html.staticControls.beads.models.ArraySelectionModel"); - IBeadView: ClassReference("org.apache.flex.html.custom.beads.BarChartView"); - IBeadController: ClassReference("org.apache.flex.html.staticControls.beads.controllers.ListSingleSelectionMouseController"); - IBeadLayout: ClassReference("org.apache.flex.html.custom.beads.layout.BarChartLayout"); - IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.custom.beads.ChartItemRendererFactory"); - IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory"); - IItemRenderer: ClassReference("org.apache.flex.html.custom.supportClasses.BoxItemRenderer"); - } - </fx:Style> - <basic:Label id="output" x="450" y="30" width="100" /> - <custom:BarChart id="barChart" x="20" y="20" width="400" height="200"> - <custom:beads> + <basic:BarChart id="barChart" x="20" y="20" width="400" height="200"> + <basic:beads> <basic:ConstantBinding sourceID="applicationModel" sourcePropertyName="productList" destinationPropertyName="dataProvider" /> - <customBeads:XAxisBead labelField="title" /> - </custom:beads> - <custom:series> - <customSup:BarChartSeries yField="sales" + <basic:XAxisBead labelField="title" /> + </basic:beads> + <basic:series> + <basic:BarChartSeries yField="sales" fillColor="0xFF964D"> - <customSup:itemRenderer> - <customSup:BoxItemRenderer /> - </customSup:itemRenderer> - </customSup:BarChartSeries> - <customSup:BarChartSeries yField="detail" + <basic:itemRenderer> + <fx:Component> + <basic:BoxItemRenderer /> + </fx:Component> + </basic:itemRenderer> + </basic:BarChartSeries> + <basic:BarChartSeries yField="detail" fillColor="0x964DFF"> - <customSup:itemRenderer> - <customSup:BoxItemRenderer /> - </customSup:itemRenderer> - </customSup:BarChartSeries> - </custom:series> - </custom:BarChart> + <basic:itemRenderer> + <fx:Component> + <basic:BoxItemRenderer /> + </fx:Component> + </basic:itemRenderer> + </basic:BarChartSeries> + </basic:series> + </basic:BarChart> </basic:ViewBase> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/examples/BarChartExample/src/org/apache/flex/html/custom/beads/ChartItemRendererFactory.as ---------------------------------------------------------------------- diff --git a/examples/BarChartExample/src/org/apache/flex/html/custom/beads/ChartItemRendererFactory.as b/examples/BarChartExample/src/org/apache/flex/html/custom/beads/ChartItemRendererFactory.as deleted file mode 100644 index 76e6b97..0000000 --- a/examples/BarChartExample/src/org/apache/flex/html/custom/beads/ChartItemRendererFactory.as +++ /dev/null @@ -1,100 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.custom.beads -{ - import org.apache.flex.core.IBead; - import org.apache.flex.core.IDataProviderItemRendererMapper; - import org.apache.flex.core.IItemRendererClassFactory; - import org.apache.flex.core.IItemRendererParent; - import org.apache.flex.core.ISelectionModel; - import org.apache.flex.core.IStrand; - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.html.staticControls.beads.IListView; - - public class ChartItemRendererFactory implements IBead, IDataProviderItemRendererMapper - { - public function ChartItemRendererFactory() - { - } - - private var selectionModel:ISelectionModel; - protected var dataGroup:IItemRendererParent; - - private var _seriesRenderers:Array; - public function get seriesRenderers():Array - { - return _seriesRenderers; - } - - private var _strand:IStrand; - - public function set strand(value:IStrand):void - { - _strand = value; - selectionModel = value.getBeadByType(ISelectionModel) as ISelectionModel; - var listView:IListView = value.getBeadByType(IListView) as IListView; - dataGroup = listView.dataGroup; -// selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler); - - var dp:Array = selectionModel.dataProvider as Array; - if (!dp) - return; - - _seriesRenderers = new Array(); - - dataGroup.removeAllElements(); - - var series:Array = IChart(_strand).series; - - for( var j:int=0; j < dp.length; j++) - { - var renderers:Array = new Array(); - - for( var i:int=0; i < series.length; i++) - { - var s:IChartSeries = series[i] as IChartSeries; - var k:IChartItemRenderer = s.itemRenderer.newInstance() as IChartItemRenderer; - k.xField = s.xField; - k.yField = s.yField; - k.fillColor = s.fillColor; - k.data = dp[j]; - k.index = j; - - renderers.push(k); - - dataGroup.addElement(k); - } - - _seriesRenderers.push(renderers); - } - - IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated")); - } - - public function get itemRendererFactory():IItemRendererClassFactory - { - return null; - } - - public function set itemRendererFactory(value:IItemRendererClassFactory):void - { - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/examples/BarChartExample/src/org/apache/flex/html/custom/beads/IChartSeries.as ---------------------------------------------------------------------- diff --git a/examples/BarChartExample/src/org/apache/flex/html/custom/beads/IChartSeries.as b/examples/BarChartExample/src/org/apache/flex/html/custom/beads/IChartSeries.as deleted file mode 100644 index a975c86..0000000 --- a/examples/BarChartExample/src/org/apache/flex/html/custom/beads/IChartSeries.as +++ /dev/null @@ -1,37 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.custom.beads -{ - import org.apache.flex.core.IItemRendererFactory; - - public interface IChartSeries - { - function get xField():String; - function set xField(value:String):void; - - function get yField():String; - function set yField(value:String):void; - - function get fillColor():uint; - function set fillColor(value:uint):void; - - function get itemRenderer():IItemRendererFactory; - function set itemRenderer(value:IItemRendererFactory):void; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/examples/BarChartExample/src/org/apache/flex/html/custom/beads/XAxisBead.as ---------------------------------------------------------------------- diff --git a/examples/BarChartExample/src/org/apache/flex/html/custom/beads/XAxisBead.as b/examples/BarChartExample/src/org/apache/flex/html/custom/beads/XAxisBead.as deleted file mode 100644 index 2670d8f..0000000 --- a/examples/BarChartExample/src/org/apache/flex/html/custom/beads/XAxisBead.as +++ /dev/null @@ -1,107 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.custom.beads -{ - import org.apache.flex.core.FilledRectangle; - import org.apache.flex.core.IBead; - import org.apache.flex.core.IDataProviderItemRendererMapper; - import org.apache.flex.core.ISelectionModel; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.UIBase; - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.html.staticControls.Label; - import org.apache.flex.html.staticControls.beads.models.ArraySelectionModel; - - public class XAxisBead implements IBead, IChartAxis - { - public function XAxisBead() - { - } - - private var _labelField:String; - public function get labelField():String - { - return _labelField; - } - public function set labelField(value:String):void - { - _labelField = value; - } - - private var _strand:IStrand; - public function set strand(value:IStrand):void - { - _strand = value; - - // in order to draw or create the labels, need to know when the series has been created. - IEventDispatcher(_strand).addEventListener("layoutComplete",handleItemsCreated); - } - - private function handleItemsCreated(event:Event):void - { - var charter:ChartItemRendererFactory = - _strand.getBeadByType(IDataProviderItemRendererMapper) as ChartItemRendererFactory; - - var model:ArraySelectionModel = _strand.getBeadByType(ISelectionModel) as ArraySelectionModel; - var items:Array; - if (model.dataProvider is Array) items = model.dataProvider as Array; - else return; - - var renderers:Array = charter.seriesRenderers; - var series:Array = IChart(_strand).series; - - var xpos:Number = 0; - var useWidth:Number = UIBase(_strand).width / renderers.length; - - // draw the horzontal axis - var horzLine:FilledRectangle = new FilledRectangle(); - horzLine.fillColor = 0x111111; - horzLine.x = 0; - horzLine.y = UIBase(_strand).height; - horzLine.height = 1; - horzLine.width = UIBase(_strand).width; - UIBase(_strand).addElement(horzLine); - - // place the labels below the axis enough to account for the tick marks - var labelY:Number = UIBase(_strand).height + 8; - - for(var i:int=0; i < items.length; i++) { - var label:Label = new Label(); - label.text = items[i][labelField]; - label.x = xpos; - label.y = labelY; - - UIBase(_strand).addElement(label); - - // add a tick mark, too - var tick:FilledRectangle = new FilledRectangle(); - tick.fillColor = 0x111111; - tick.x = xpos + useWidth/2; - tick.y = UIBase(_strand).height; - tick.width = 1; - tick.height = 5; - UIBase(_strand).addElement(tick); - - var r:UIBase = UIBase(renderers[i][0]); - xpos += useWidth; - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/examples/BarChartExample/src/org/apache/flex/html/custom/beads/layout/BarChartLayout.as ---------------------------------------------------------------------- diff --git a/examples/BarChartExample/src/org/apache/flex/html/custom/beads/layout/BarChartLayout.as b/examples/BarChartExample/src/org/apache/flex/html/custom/beads/layout/BarChartLayout.as deleted file mode 100644 index 4553229..0000000 --- a/examples/BarChartExample/src/org/apache/flex/html/custom/beads/layout/BarChartLayout.as +++ /dev/null @@ -1,118 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.custom.beads.layout -{ - import org.apache.flex.core.IBeadLayout; - import org.apache.flex.core.IDataProviderItemRendererMapper; - import org.apache.flex.core.ILayoutParent; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.UIBase; - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.html.custom.beads.ChartItemRendererFactory; - import org.apache.flex.html.custom.beads.IChart; - import org.apache.flex.html.custom.beads.IChartItemRenderer; - import org.apache.flex.html.custom.supportClasses.BarChartSeries; - - public class BarChartLayout implements IBeadLayout - { - public function BarChartLayout() - { - } - - private var _strand:IStrand; - - public function set strand(value:IStrand):void - { - _strand = value; - IEventDispatcher(value).addEventListener("widthChanged", changeHandler); - IEventDispatcher(value).addEventListener("childrenAdded", changeHandler); - IEventDispatcher(value).addEventListener("itemsCreated", changeHandler); - } - - private var _gap:Number = 20; - public function get gap():Number - { - return _gap; - } - public function set gap(value:Number):void - { - _gap = value; - } - - private function changeHandler(event:Event):void - { - var layoutParent:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent; - - var factory:ChartItemRendererFactory = _strand.getBeadByType(IDataProviderItemRendererMapper) as ChartItemRendererFactory; - var n:int = factory.seriesRenderers.length; - - var xpos:Number = 0; - var useWidth:Number = (UIBase(_strand).width / n) - gap; - var useHeight:Number = UIBase(_strand).height; - - var maxYValue:Number = 0; - var series:Array = IChart(_strand).series; - trace("There are "+series.length+" series in this chart"); - var seriesMaxes:Array = []; - - for (var s:int = 0; s < series.length; s++) - { - var bcs:BarChartSeries = series[s] as BarChartSeries; - seriesMaxes.push({maxValue:0,scaleFactor:0}); - - for (var i:int = 0; i < n; i++) - { - var m:Array = factory.seriesRenderers[i] as Array; - var item:IChartItemRenderer = m[s] as IChartItemRenderer; - var data:Object = item.data; - var field:String = bcs.yField; - - var yValue:Number = Number(data[field]); - seriesMaxes[s].maxValue = Math.max(seriesMaxes[s].maxValue,yValue); - } - - seriesMaxes[s].scaleFactor = useHeight/seriesMaxes[s].maxValue; - } - - for (i = 0; i < n; i++) - { - m = factory.seriesRenderers[i] as Array; - for (s=0; s < m.length; s++) - { - var seriesWidth:Number = useWidth/series.length; - var child:IChartItemRenderer = m[s] as IChartItemRenderer; - data = child.data - yValue = Number(data[child.yField]); - - child.y = useHeight - yValue*seriesMaxes[s].scaleFactor; - child.x = xpos; - child.width = seriesWidth; - child.height = yValue*seriesMaxes[s].scaleFactor; - xpos += seriesWidth; - } - - xpos += gap; - - } - - IEventDispatcher(_strand).dispatchEvent(new Event("layoutComplete")); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/examples/BarChartExample/src/org/apache/flex/html/custom/supportClasses/BarChartSeries.as ---------------------------------------------------------------------- diff --git a/examples/BarChartExample/src/org/apache/flex/html/custom/supportClasses/BarChartSeries.as b/examples/BarChartExample/src/org/apache/flex/html/custom/supportClasses/BarChartSeries.as deleted file mode 100644 index b4e17ed..0000000 --- a/examples/BarChartExample/src/org/apache/flex/html/custom/supportClasses/BarChartSeries.as +++ /dev/null @@ -1,70 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.custom.supportClasses -{ - import org.apache.flex.core.IItemRendererFactory; - import org.apache.flex.html.custom.beads.IChartSeries; - - public class BarChartSeries implements IChartSeries - { - public function BarChartSeries() - { - } - - private var _xField:String = "x"; - public function get xField():String - { - return _xField; - } - public function set xField(value:String):void - { - _xField = value; - } - - private var _yField:String; - public function get yField():String - { - return _yField; - } - public function set yField(value:String):void - { - _yField = value; - } - - private var _fillColor:uint; - public function get fillColor():uint - { - return _fillColor; - } - public function set fillColor(value:uint):void - { - _fillColor = value; - } - - private var _itemRenderer:IItemRendererFactory; - public function get itemRenderer():IItemRendererFactory - { - return _itemRenderer; - } - public function set itemRenderer(value:IItemRendererFactory):void - { - _itemRenderer = value; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/examples/BarChartExample/src/org/apache/flex/html/custom/supportClasses/BoxItemRenderer.as ---------------------------------------------------------------------- diff --git a/examples/BarChartExample/src/org/apache/flex/html/custom/supportClasses/BoxItemRenderer.as b/examples/BarChartExample/src/org/apache/flex/html/custom/supportClasses/BoxItemRenderer.as deleted file mode 100644 index a39a441..0000000 --- a/examples/BarChartExample/src/org/apache/flex/html/custom/supportClasses/BoxItemRenderer.as +++ /dev/null @@ -1,116 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.custom.supportClasses -{ - import org.apache.flex.core.FilledRectangle; - import org.apache.flex.core.IItemRenderer; - import org.apache.flex.core.IItemRendererFactory; - import org.apache.flex.html.custom.beads.IChartItemRenderer; - import org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase; - - public class BoxItemRenderer extends UIItemRendererBase implements IChartItemRenderer, IItemRendererFactory - { - public function BoxItemRenderer() - { - super(); - } - - override public function newInstance():IItemRenderer - { - return new BoxItemRenderer(); - } - - private var _itemRendererParent:Object; - public function get itemRendererParent():Object - { - return _itemRendererParent; - } - public function set itemRendererParent(value:Object):void - { - _itemRendererParent = value; - } - - private var filledRect:FilledRectangle; - - private var _yField:String = "y"; - public function get yField():String - { - return _yField; - } - public function set yField(value:String):void - { - _yField = value; - } - - private var _xField:String = "x"; - public function get xField():String - { - return _xField; - } - public function set xField(value:String):void - { - _xField = value; - } - - private var _fillColor:uint; - public function get fillColor():uint - { - return _fillColor; - } - public function set fillColor(value:uint):void - { - _fillColor = value; - } - - override public function addedToParent():void - { - super.addedToParent(); - } - - override public function set data(value:Object):void - { - super.data = value; - - if (filledRect == null) { - filledRect = new FilledRectangle(); - addElement(filledRect); - } - } - - override public function set width(value:Number):void - { - super.width = value; - drawBar(); - } - - override public function set height(value:Number):void - { - super.height = value; - drawBar(); - } - - protected function drawBar():void - { - if (filledRect) { - filledRect.fillColor = fillColor; - filledRect.drawRect(0,0,this.width,this.height); - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/examples/ListsTest/build.xml ---------------------------------------------------------------------- diff --git a/examples/ListsTest/build.xml b/examples/ListsTest/build.xml index 12a0be6..eddb5f6 100644 --- a/examples/ListsTest/build.xml +++ b/examples/ListsTest/build.xml @@ -27,6 +27,9 @@ <property environment="env"/> <property file="${FLEXJS_HOME}/build.properties"/> <property name="FLEX_HOME" value="${FLEXJS_HOME}"/> + <property name="FALCON_HOME" value="${env.FALCON_HOME}"/> + <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/> + <property name="GOOG_HOME" value="${env.GOOG_HOME}"/> <include file="${basedir}/../build_example.xml" /> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/examples/build.xml ---------------------------------------------------------------------- diff --git a/examples/build.xml b/examples/build.xml index 0fd2f7a..aa52af0 100644 --- a/examples/build.xml +++ b/examples/build.xml @@ -86,6 +86,7 @@ <ant dir="${basedir}/ListsTest"/> <ant dir="${basedir}/StatesTest"/> <ant dir="${basedir}/StockQuote"/> + <ant dir="${basedir}/BarChartExample"/> </target> <!-- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/core/IChartSeries.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/core/IChartSeries.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/core/IChartSeries.as index 7a7e059..bb0dc45 100644 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/core/IChartSeries.as +++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/core/IChartSeries.as @@ -18,7 +18,7 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.charts.core { - import org.apache.flex.core.IItemRendererFactory; + import mx.core.IFactory; public interface IChartSeries { @@ -31,7 +31,7 @@ package org.apache.flex.charts.core function get fillColor():uint; function set fillColor(value:uint):void; - function get itemRenderer():IItemRendererFactory; - function set itemRenderer(value:IItemRendererFactory):void; + function get itemRenderer():IFactory; + function set itemRenderer(value:IFactory):void; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BarChartSeries.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BarChartSeries.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BarChartSeries.as index 6128932..99040be 100644 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BarChartSeries.as +++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BarChartSeries.as @@ -18,8 +18,8 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.charts.supportClasses { - import org.apache.flex.core.IItemRendererFactory; - + import mx.core.IFactory; + import org.apache.flex.charts.core.IChartSeries; public class BarChartSeries implements IChartSeries @@ -58,12 +58,12 @@ package org.apache.flex.charts.supportClasses _fillColor = value; } - private var _itemRenderer:IItemRendererFactory; - public function get itemRenderer():IItemRendererFactory + private var _itemRenderer:IFactory; + public function get itemRenderer():IFactory { return _itemRenderer; } - public function set itemRenderer(value:IItemRendererFactory):void + public function set itemRenderer(value:IFactory):void { _itemRenderer = value; } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as index 1ad84fb..2df2565 100644 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as +++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as @@ -20,22 +20,16 @@ package org.apache.flex.charts.supportClasses { import org.apache.flex.core.FilledRectangle; import org.apache.flex.core.IItemRenderer; - import org.apache.flex.core.IItemRendererFactory; import org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase; import org.apache.flex.charts.core.IChartItemRenderer; - public class BoxItemRenderer extends UIItemRendererBase implements IChartItemRenderer, IItemRendererFactory + public class BoxItemRenderer extends UIItemRendererBase implements IChartItemRenderer { public function BoxItemRenderer() { super(); } - - override public function newInstance():IItemRenderer - { - return new BoxItemRenderer(); - } - + private var _itemRendererParent:Object; public function get itemRendererParent():Object { http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRendererClassFactory.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRendererClassFactory.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRendererClassFactory.as index 5f8c751..d4638f8 100644 --- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRendererClassFactory.as +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRendererClassFactory.as @@ -18,8 +18,37 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.core { + /** + * The IItemRendererClassFactory interface is the basic interface for beads + * that generate instances of IItemRenderers. Note that this is not the same + * as an mx.core.IFactory which is a lower-level interface for generating + * an instance of just about anything. IItemRendererClassFactory implementations + * often use IFactory to generate the actual item renderer instance, but + * the IItemRendererClassFactory bead allows for more computation about which + * renderer to instantiate. For example, the default implementation + * in org.apache.flex.core.ItemRendererClassFactory checks for an itemRenderer + * property on the strand, then looks for a default definition in CSS, but + * also handles the renderer being defined in MXML in sub tags of the + * ItemRendererClassFactory. Other more advanced implementations could + * return different renderers based on the data item's type. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ public interface IItemRendererClassFactory extends IBead { + // TODO: add additional parameters like the data item and index + /** + * This method is called to generate another instance of an item renderer + * and attach it to the given parent. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ function createItemRenderer(parent:IItemRendererParent):IItemRenderer; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRendererFactory.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRendererFactory.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRendererFactory.as deleted file mode 100644 index 598e02b..0000000 --- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRendererFactory.as +++ /dev/null @@ -1,25 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.core -{ - public interface IItemRendererFactory - { - function newInstance():IItemRenderer; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as index ce14fb3..71c0b66 100644 --- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as @@ -51,8 +51,7 @@ package org.apache.flex.core } else { - var className:String = getQualifiedClassName(mainClass); - c = ApplicationDomain.currentDomain.getDefinition(className) as Class; + c = mainClass.constructor as Class; } generateCSSStyleDeclarations(c["factoryFunctions"], c["data"]); } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0b8875a8/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/UIItemRendererBase.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/UIItemRendererBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/UIItemRendererBase.as index 95c5297..215f7a2 100644 --- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/UIItemRendererBase.as +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/UIItemRendererBase.as @@ -19,30 +19,47 @@ package org.apache.flex.html.staticControls.supportClasses { import org.apache.flex.core.IItemRenderer; - import org.apache.flex.core.IItemRendererFactory; import org.apache.flex.core.UIBase; + import org.apache.flex.core.ValuesManager; import org.apache.flex.events.Event; + import org.apache.flex.utils.MXMLDataInterpreter; - public class UIItemRendererBase extends UIBase implements IItemRenderer, IItemRendererFactory + public class UIItemRendererBase extends UIBase implements IItemRenderer { public function UIItemRendererBase() { } - public function newInstance():IItemRenderer - { - return new UIItemRendererBase(); - } - override public function addedToParent():void { super.addedToParent(); - // very common for item renderers to be resized by their containers, - addEventListener("widthChanged", sizeChangeHandler); - addEventListener("heightChanged", sizeChangeHandler); - } - + // very common for item renderers to be resized by their containers, + addEventListener("widthChanged", sizeChangeHandler); + addEventListener("heightChanged", sizeChangeHandler); + + // each MXML file can also have styles in fx:Style block + ValuesManager.valuesImpl.init(this); + + MXMLDataInterpreter.generateMXMLProperties(this, mxmlProperties); + MXMLDataInterpreter.generateMXMLInstances(this, this, MXMLDescriptor); + + dispatchEvent(new Event("initComplete")); + + } + + public function get MXMLDescriptor():Array + { + return null; + } + + private var mxmlProperties:Array ; + + public function generateMXMLAttributes(data:Array):void + { + mxmlProperties = data; + } + public var backgroundColor:uint = 0xFFFFFF; public var highlightColor:uint = 0xCEDBEF; public var selectedColor:uint = 0xA8C6EE;
