You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2013/12/17 21:40:31 UTC
[1/2] git commit: [flex-asjs] [refs/heads/develop] - BarChart example
for FlexJS: includes source to BarChart in the project so it can be
cross-compiled into JavaScript.
Updated Branches:
refs/heads/develop b6afedb61 -> 0e8662b08
BarChart example for FlexJS: includes source to BarChart in the project so it can be cross-compiled into JavaScript.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/d78fdc0d
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/d78fdc0d
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/d78fdc0d
Branch: refs/heads/develop
Commit: d78fdc0d7c4c12903c5ead28d8b9e531e6a1c4fc
Parents: b6afedb
Author: Peter Ent <pe...@apache.org>
Authored: Tue Dec 17 15:36:21 2013 -0500
Committer: Peter Ent <pe...@apache.org>
Committed: Tue Dec 17 15:36:21 2013 -0500
----------------------------------------------------------------------
.../BarChartExample/src/BarChartExample.mxml | 37 ++++++
examples/BarChartExample/src/MyInitialView.mxml | 56 +++++++++
examples/BarChartExample/src/README.txt | 27 +++++
.../BarChartExample/src/models/ProductsModel.as | 49 ++++++++
.../src/org/apache/flex/html/custom/BarChart.as | 46 ++++++++
.../flex/html/custom/beads/BarChartView.as | 45 +++++++
.../custom/beads/ChartItemRendererFactory.as | 100 ++++++++++++++++
.../org/apache/flex/html/custom/beads/IChart.as | 26 +++++
.../html/custom/beads/IChartItemRenderer.as | 39 +++++++
.../flex/html/custom/beads/IChartSeries.as | 37 ++++++
.../html/custom/beads/layout/BarChartLayout.as | 116 +++++++++++++++++++
.../custom/supportClasses/BarChartSeries.as | 70 +++++++++++
.../custom/supportClasses/BoxItemRenderer.as | 116 +++++++++++++++++++
.../BarChartExample/src/products/Product.as | 43 +++++++
14 files changed, 807 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d78fdc0d/examples/BarChartExample/src/BarChartExample.mxml
----------------------------------------------------------------------
diff --git a/examples/BarChartExample/src/BarChartExample.mxml b/examples/BarChartExample/src/BarChartExample.mxml
new file mode 100644
index 0000000..baa95f8
--- /dev/null
+++ b/examples/BarChartExample/src/BarChartExample.mxml
@@ -0,0 +1,37 @@
+<?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.
+//
+////////////////////////////////////////////////////////////////////////////////
+-->
+<basic:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:local="*"
+ xmlns:models="models.*"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ >
+
+ <basic:valuesImpl>
+ <basic:SimpleCSSValuesImpl />
+ </basic:valuesImpl>
+ <basic:model>
+ <models:ProductsModel />
+ </basic:model>
+ <basic:initialView>
+ <local:MyInitialView />
+ </basic:initialView>
+</basic:Application>
+
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d78fdc0d/examples/BarChartExample/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/BarChartExample/src/MyInitialView.mxml b/examples/BarChartExample/src/MyInitialView.mxml
new file mode 100644
index 0000000..c631c1e
--- /dev/null
+++ b/examples/BarChartExample/src/MyInitialView.mxml
@@ -0,0 +1,56 @@
+<?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.
+
+-->
+<basic:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ xmlns:local="*"
+ xmlns:models="models.*">
+ <fx:Script>
+ <![CDATA[
+
+
+ ]]>
+ </fx:Script>
+
+ <basic:Label id="output" x="450" y="30" width="100" />
+
+ <basic:BarChart id="barChart" x="20" y="20" width="400" height="200">
+ <basic:beads>
+ <basic:ConstantBinding
+ sourceID="applicationModel"
+ sourcePropertyName="productList"
+ destinationPropertyName="dataProvider" />
+ </basic:beads>
+ <basic:series>
+ <basic:BarChartSeries yField="sales"
+ fillColor="0xFF964D">
+ <basic:itemRenderer>
+ <basic:BoxItemRenderer />
+ </basic:itemRenderer>
+ </basic:BarChartSeries>
+ <basic:BarChartSeries yField="detail"
+ fillColor="0x964DFF">
+ <basic:itemRenderer>
+ <basic:BoxItemRenderer />
+ </basic:itemRenderer>
+ </basic:BarChartSeries>
+ </basic:series>
+ </basic:BarChart>
+
+</basic:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d78fdc0d/examples/BarChartExample/src/README.txt
----------------------------------------------------------------------
diff --git a/examples/BarChartExample/src/README.txt b/examples/BarChartExample/src/README.txt
new file mode 100644
index 0000000..71f2f34
--- /dev/null
+++ b/examples/BarChartExample/src/README.txt
@@ -0,0 +1,27 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+This example demonstrates how to construct a BarChart. The example shows a chart
+with two BarSeries on the same axis.
+
+The MyInitialView file references <basic:BarChart>. However, you will also find
+a complete copy of the BarChart source (strand, beads, etc.) in this project
+contained in the org.apache.flex.html.custom package. This copy can be cross-
+compiled into JavaScript; just change <basic:BarChart> to <custom:BarChart>,
+along with additional namespaces, and this chart can be displayed in HTML.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d78fdc0d/examples/BarChartExample/src/models/ProductsModel.as
----------------------------------------------------------------------
diff --git a/examples/BarChartExample/src/models/ProductsModel.as b/examples/BarChartExample/src/models/ProductsModel.as
new file mode 100644
index 0000000..88f6662
--- /dev/null
+++ b/examples/BarChartExample/src/models/ProductsModel.as
@@ -0,0 +1,49 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 models
+{
+ import org.apache.flex.events.EventDispatcher;
+
+ import products.Product;
+
+ public class ProductsModel extends EventDispatcher
+ {
+ public function ProductsModel()
+ {
+ }
+
+ private var _productList:Array = [
+ new Product("ps100","Widgets",44,200,"smallbluerect.jpg"),
+ new Product("tx200","Thingys",5,285,"smallgreenrect.jpg"),
+ new Product("rz300","Sprockets",80,105,"smallyellowrect.jpg"),
+ new Product("dh440","Doohickies",10,340,"smallredrect.jpg"),
+ new Product("ps220","Weejets",35,190,"smallorangerect.jpg")
+ ];
+ public function get productList():Array
+ {
+ return _productList;
+ }
+
+ private var _labelFields:Array = [ "id", "title", "sales", "detail" ];
+ public function get labelFields():Array
+ {
+ return _labelFields;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d78fdc0d/examples/BarChartExample/src/org/apache/flex/html/custom/BarChart.as
----------------------------------------------------------------------
diff --git a/examples/BarChartExample/src/org/apache/flex/html/custom/BarChart.as b/examples/BarChartExample/src/org/apache/flex/html/custom/BarChart.as
new file mode 100644
index 0000000..3232e94
--- /dev/null
+++ b/examples/BarChartExample/src/org/apache/flex/html/custom/BarChart.as
@@ -0,0 +1,46 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.html.custom.beads.BarChartView;
+ import org.apache.flex.html.custom.beads.IChart;
+ import org.apache.flex.html.staticControls.List;
+ import org.apache.flex.html.staticControls.supportClasses.NonVirtualDataGroup;
+
+ public class BarChart extends List implements IChart
+ {
+ public function BarChart()
+ {
+ super();
+ }
+
+ private var _series:Array;
+ public function get series():Array
+ {
+ return _series;
+ }
+ public function set series(value:Array):void
+ {
+ _series = value;
+ dispatchEvent(new Event("seriesChanged"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d78fdc0d/examples/BarChartExample/src/org/apache/flex/html/custom/beads/BarChartView.as
----------------------------------------------------------------------
diff --git a/examples/BarChartExample/src/org/apache/flex/html/custom/beads/BarChartView.as b/examples/BarChartExample/src/org/apache/flex/html/custom/beads/BarChartView.as
new file mode 100644
index 0000000..481ac98
--- /dev/null
+++ b/examples/BarChartExample/src/org/apache/flex/html/custom/beads/BarChartView.as
@@ -0,0 +1,45 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.IBeadLayout;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.html.staticControls.beads.ListView;
+ import org.apache.flex.html.staticControls.supportClasses.NonVirtualDataGroup;
+
+ public class BarChartView extends ListView
+ {
+ public function BarChartView()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+ private var listModel:ISelectionModel;
+
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d78fdc0d/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
new file mode 100644
index 0000000..eb63fc3
--- /dev/null
+++ b/examples/BarChartExample/src/org/apache/flex/html/custom/beads/ChartItemRendererFactory.as
@@ -0,0 +1,100 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.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.IDataProviderItemRendererMapper;
+ 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/d78fdc0d/examples/BarChartExample/src/org/apache/flex/html/custom/beads/IChart.as
----------------------------------------------------------------------
diff --git a/examples/BarChartExample/src/org/apache/flex/html/custom/beads/IChart.as b/examples/BarChartExample/src/org/apache/flex/html/custom/beads/IChart.as
new file mode 100644
index 0000000..49f7eea
--- /dev/null
+++ b/examples/BarChartExample/src/org/apache/flex/html/custom/beads/IChart.as
@@ -0,0 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+ public interface IChart
+ {
+ function get series():Array;
+ function set series(value:Array):void;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d78fdc0d/examples/BarChartExample/src/org/apache/flex/html/custom/beads/IChartItemRenderer.as
----------------------------------------------------------------------
diff --git a/examples/BarChartExample/src/org/apache/flex/html/custom/beads/IChartItemRenderer.as b/examples/BarChartExample/src/org/apache/flex/html/custom/beads/IChartItemRenderer.as
new file mode 100644
index 0000000..d484b9d
--- /dev/null
+++ b/examples/BarChartExample/src/org/apache/flex/html/custom/beads/IChartItemRenderer.as
@@ -0,0 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.IItemRenderer;
+
+ public interface IChartItemRenderer extends IItemRenderer
+ {
+ 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 set x(value:Number):void;
+ function set y(value:Number):void;
+ function set width(value:Number):void;
+ function set height(value:Number):void;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d78fdc0d/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
new file mode 100644
index 0000000..a975c86
--- /dev/null
+++ b/examples/BarChartExample/src/org/apache/flex/html/custom/beads/IChartSeries.as
@@ -0,0 +1,37 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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/d78fdc0d/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
new file mode 100644
index 0000000..9a8b4a0
--- /dev/null
+++ b/examples/BarChartExample/src/org/apache/flex/html/custom/beads/layout/BarChartLayout.as
@@ -0,0 +1,116 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.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;
+ import org.apache.flex.html.staticControls.beads.IDataProviderItemRendererMapper;
+
+ 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;
+
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d78fdc0d/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
new file mode 100644
index 0000000..b4e17ed
--- /dev/null
+++ b/examples/BarChartExample/src/org/apache/flex/html/custom/supportClasses/BarChartSeries.as
@@ -0,0 +1,70 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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/d78fdc0d/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
new file mode 100644
index 0000000..a39a441
--- /dev/null
+++ b/examples/BarChartExample/src/org/apache/flex/html/custom/supportClasses/BoxItemRenderer.as
@@ -0,0 +1,116 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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/d78fdc0d/examples/BarChartExample/src/products/Product.as
----------------------------------------------------------------------
diff --git a/examples/BarChartExample/src/products/Product.as b/examples/BarChartExample/src/products/Product.as
new file mode 100644
index 0000000..fd4b31e
--- /dev/null
+++ b/examples/BarChartExample/src/products/Product.as
@@ -0,0 +1,43 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 products
+{
+ public class Product
+ {
+ public function Product(id:String,title:String,detail:Number,sales:Number,image:String)
+ {
+ this.id = id;
+ this.title = title;
+ this.detail = detail;
+ this.sales = sales;
+ this.image = image;
+ }
+
+ public var id:String;
+ public var title:String;
+ public var detail:Number;
+ public var image:String;
+ public var sales:Number;
+
+ public function toString():String
+ {
+ return title;
+ }
+ }
+}
\ No newline at end of file
[2/2] git commit: [flex-asjs] [refs/heads/develop] - Added BarChart
to FlexJS framework along with supporting files and changes to JavaScript.
Posted by pe...@apache.org.
Added BarChart to FlexJS framework along with supporting files and changes to JavaScript.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/0e8662b0
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/0e8662b0
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/0e8662b0
Branch: refs/heads/develop
Commit: 0e8662b0896fc556611db12c1c8fde9e91b0da4a
Parents: d78fdc0
Author: Peter Ent <pe...@apache.org>
Authored: Tue Dec 17 15:40:19 2013 -0500
Committer: Peter Ent <pe...@apache.org>
Committed: Tue Dec 17 15:40:19 2013 -0500
----------------------------------------------------------------------
.../as/projects/FlexJSUI/basic-manifest.xml | 3 +
frameworks/as/projects/FlexJSUI/defaults.css | 11 +
.../as/projects/FlexJSUI/src/FlexJSUIClasses.as | 9 +-
.../src/org/apache/flex/charts/BarChart.as | 43 ++++
.../apache/flex/charts/beads/BarChartView.as | 41 ++++
.../charts/beads/ChartItemRendererFactory.as | 103 +++++++++
.../flex/charts/beads/layouts/BarChartLayout.as | 112 ++++++++++
.../src/org/apache/flex/charts/core/IChart.as | 26 +++
.../flex/charts/core/IChartItemRenderer.as | 39 ++++
.../org/apache/flex/charts/core/IChartSeries.as | 37 ++++
.../charts/supportClasses/BarChartSeries.as | 71 +++++++
.../charts/supportClasses/BoxItemRenderer.as | 116 ++++++++++
.../src/org/apache/flex/core/FilledRectangle.as | 55 +++++
.../src/org/apache/flex/core/IItemRenderer.as | 3 +
.../apache/flex/core/IItemRendererFactory.as | 25 +++
.../html/staticControls/beads/ButtonBarView.as | 17 ++
.../ButtonBarButtonItemRenderer.as | 2 +
.../supportClasses/DataItemRenderer.as | 10 -
.../supportClasses/TextFieldItemRenderer.as | 9 +
.../supportClasses/UIItemRendererBase.as | 18 +-
.../src/org/apache/flex/core/FilledRectangle.js | 78 +++++++
.../core/IDataProviderItemRendererMapper.js | 38 ----
.../apache/flex/core/IItemRendererFactory.js | 45 ++++
.../src/org/apache/flex/core/ILayoutParent.js | 73 +++++++
.../src/org/apache/flex/core/ISelectionModel.js | 2 +
.../beads/IDataProviderItemRendererMapper.js | 38 ++++
.../flex/html/staticControls/beads/ListView.js | 48 ++++-
.../beads/models/ArraySelectionModel.js | 6 +-
.../supportClasses/UIItemRendererBase.js | 209 +++++++++++++++++++
29 files changed, 1233 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/as/projects/FlexJSUI/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/basic-manifest.xml b/frameworks/as/projects/FlexJSUI/basic-manifest.xml
index 7b2aaa5..bbd0e04 100644
--- a/frameworks/as/projects/FlexJSUI/basic-manifest.xml
+++ b/frameworks/as/projects/FlexJSUI/basic-manifest.xml
@@ -70,5 +70,8 @@
<component id="PasswordInputBead" class="org.apache.flex.html.staticControls.accessories.PasswordInputBead" />
<component id="TextPromptBead" class="org.apache.flex.html.staticControls.accessories.TextPromptBead" />
<component id="DataGridPresentationModel" class="org.apache.flex.html.staticControls.beads.models.DataGridPresentationModel" />
+ <component id="BarChart" class="org.apache.flex.charts.BarChart" />
+ <component id="BarChartSeries" class="org.apache.flex.charts.supportClasses.BarChartSeries" />
+ <component id="BoxItemRenderer" class="org.apache.flex.charts.supportClasses.BoxItemRenderer" />
</componentPackage>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/as/projects/FlexJSUI/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/defaults.css b/frameworks/as/projects/FlexJSUI/defaults.css
index 76a1288..45d8395 100644
--- a/frameworks/as/projects/FlexJSUI/defaults.css
+++ b/frameworks/as/projects/FlexJSUI/defaults.css
@@ -29,6 +29,17 @@
font-size: 12px;
}
+BarChart
+{
+ IBeadModel: ClassReference("org.apache.flex.html.staticControls.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.charts.beads.BarChartView");
+ IBeadController: ClassReference("org.apache.flex.html.staticControls.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.charts.beads.layouts.BarChartLayout");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.charts.beads.ChartItemRendererFactory");
+ IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+ IItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.BoxItemRenderer");
+}
+
Button
{
background-color: #d8d8d8;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
index cf552ce..121ab54 100644
--- a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
+++ b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
@@ -27,6 +27,12 @@ package
*/
internal class FlexJSUIClasses
{
+ import org.apache.flex.charts.beads.BarChartView; BarChartView;
+ import org.apache.flex.charts.beads.ChartItemRendererFactory; ChartItemRendererFactory;
+ import org.apache.flex.charts.beads.layouts.BarChartLayout; BarChartLayout;
+ import org.apache.flex.charts.supportClasses.BarChartSeries; BarChartSeries;
+ import org.apache.flex.charts.supportClasses.BoxItemRenderer; BoxItemRenderer;
+
import org.apache.flex.html.staticControls.accessories.NumericOnlyTextInputBead; NumericOnlyTextInputBead;
import org.apache.flex.html.staticControls.accessories.PasswordInputBead; PasswordInputBead;
import org.apache.flex.html.staticControls.accessories.TextPromptBead; TextPromptBead;
@@ -87,7 +93,8 @@ internal class FlexJSUIClasses
import org.apache.flex.html.staticControls.beads.layouts.VScrollBarLayout; VScrollBarLayout;
import org.apache.flex.html.staticControls.beads.TextItemRendererFactoryForArrayData; TextItemRendererFactoryForArrayData;
import org.apache.flex.html.staticControls.beads.DataItemRendererFactoryForArrayData; DataItemRendererFactoryForArrayData;
- import org.apache.flex.core.ItemRendererClassFactory; ItemRendererClassFactory;
+ import org.apache.flex.core.ItemRendererClassFactory; ItemRendererClassFactory;
+ import org.apache.flex.core.FilledRectangle; FilledRectangle;
import org.apache.flex.events.CustomEvent; CustomEvent;
import org.apache.flex.events.Event; Event;
import org.apache.flex.utils.Timer; Timer;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/BarChart.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/BarChart.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/BarChart.as
new file mode 100644
index 0000000..eef195c
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/BarChart.as
@@ -0,0 +1,43 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.charts
+{
+ import org.apache.flex.charts.core.IChart;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.html.staticControls.List;
+
+ public class BarChart extends List implements IChart
+ {
+ public function BarChart()
+ {
+ super();
+ }
+
+ private var _series:Array;
+ public function get series():Array
+ {
+ return _series;
+ }
+ public function set series(value:Array):void
+ {
+ _series = value;
+ dispatchEvent(new Event("seriesChanged"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/beads/BarChartView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/beads/BarChartView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/beads/BarChartView.as
new file mode 100644
index 0000000..1dd9b0e
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/beads/BarChartView.as
@@ -0,0 +1,41 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.charts.beads
+{
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.html.staticControls.beads.ListView;
+
+ public class BarChartView extends ListView
+ {
+ public function BarChartView()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+ private var listModel:ISelectionModel;
+
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/beads/ChartItemRendererFactory.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/beads/ChartItemRendererFactory.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/beads/ChartItemRendererFactory.as
new file mode 100644
index 0000000..726b8eb
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/beads/ChartItemRendererFactory.as
@@ -0,0 +1,103 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.charts.beads
+{
+ import org.apache.flex.core.IBead;
+ 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.charts.core.IChart;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.html.staticControls.beads.IDataProviderItemRendererMapper;
+ 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/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/beads/layouts/BarChartLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/beads/layouts/BarChartLayout.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/beads/layouts/BarChartLayout.as
new file mode 100644
index 0000000..b2898d5
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/beads/layouts/BarChartLayout.as
@@ -0,0 +1,112 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.charts.beads.layouts
+{
+ import org.apache.flex.core.IBeadLayout;
+ 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.charts.beads.ChartItemRendererFactory;
+ import org.apache.flex.charts.core.IChart;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.supportClasses.BarChartSeries;
+ import org.apache.flex.html.staticControls.beads.IDataProviderItemRendererMapper;
+
+ public class BarChartLayout implements IBeadLayout
+ {
+ 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;
+
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChart.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChart.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChart.as
new file mode 100644
index 0000000..9b10dd6
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChart.as
@@ -0,0 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.charts.core
+{
+ public interface IChart
+ {
+ function get series():Array;
+ function set series(value:Array):void;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChartItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChartItemRenderer.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChartItemRenderer.as
new file mode 100644
index 0000000..01bf1aa
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChartItemRenderer.as
@@ -0,0 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.charts.core
+{
+ import org.apache.flex.core.IItemRenderer;
+
+ public interface IChartItemRenderer extends IItemRenderer
+ {
+ 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 set x(value:Number):void;
+ function set y(value:Number):void;
+ function set width(value:Number):void;
+ function set height(value:Number):void;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChartSeries.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChartSeries.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChartSeries.as
new file mode 100644
index 0000000..7a7e059
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChartSeries.as
@@ -0,0 +1,37 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.charts.core
+{
+ 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/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/BarChartSeries.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/BarChartSeries.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/BarChartSeries.as
new file mode 100644
index 0000000..6128932
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/BarChartSeries.as
@@ -0,0 +1,71 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.charts.supportClasses
+{
+ import org.apache.flex.core.IItemRendererFactory;
+
+ import org.apache.flex.charts.core.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/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
new file mode 100644
index 0000000..1ad84fb
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
@@ -0,0 +1,116 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.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 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/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/FilledRectangle.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/FilledRectangle.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/FilledRectangle.as
new file mode 100644
index 0000000..ca443ea
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/FilledRectangle.as
@@ -0,0 +1,55 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+ import flash.display.Shape;
+
+ import org.apache.flex.core.UIBase;
+
+ public class FilledRectangle extends UIBase
+ {
+ public function FilledRectangle()
+ {
+ super();
+
+ _shape = new flash.display.Shape();
+ this.addElement(_shape);
+ }
+
+ private var _shape:flash.display.Shape;
+
+ private var _fillColor:uint = 0x000000;
+ public function get fillColor():uint
+ {
+ return _fillColor;
+ }
+ public function set fillColor(value:uint):void
+ {
+ _fillColor = value;
+ }
+
+ public function drawRect(x:Number, y:Number, width:Number, height:Number):void
+ {
+ _shape.graphics.clear();
+ _shape.graphics.beginFill(_fillColor);
+ _shape.graphics.drawRect(x, y, width, height);
+ _shape.graphics.endFill();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRenderer.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRenderer.as
index 5f7f685..b5b3f68 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRenderer.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRenderer.as
@@ -25,6 +25,9 @@ package org.apache.flex.core
function get data():Object;
function set data(value:Object):void;
+ function get labelField():String;
+ function set labelField(value:String):void;
+
function get index():int;
function set index(value:int):void;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/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
new file mode 100644
index 0000000..598e02b
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IItemRendererFactory.as
@@ -0,0 +1,25 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/ButtonBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/ButtonBarView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/ButtonBarView.as
index d1c781f..d9f0fd3 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/ButtonBarView.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/ButtonBarView.as
@@ -21,10 +21,15 @@ package org.apache.flex.html.staticControls.beads
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadModel;
import org.apache.flex.core.ILayoutParent;
+ import org.apache.flex.core.IParent;
import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ValuesManager;
import org.apache.flex.events.Event;
import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.staticControls.supportClasses.Border;
public class ButtonBarView extends ListView
{
@@ -33,12 +38,24 @@ package org.apache.flex.html.staticControls.beads
super();
}
+ private var _border:Border;
+
+ override public function get border():Border
+ {
+ return _border;
+ }
+
private var _strand:IStrand;
override public function set strand(value:IStrand):void
{
_strand = value;
super.strand = value;
+
+ _border = new Border();
+ _border.model = new (ValuesManager.valuesImpl.getValue(value, "iBorderModel")) as IBeadModel;
+ _border.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead);
+ IParent(_strand).addElement(_border);
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/ButtonBarButtonItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/ButtonBarButtonItemRenderer.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/ButtonBarButtonItemRenderer.as
index 01750b8..2c6ab08 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/ButtonBarButtonItemRenderer.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/ButtonBarButtonItemRenderer.as
@@ -18,6 +18,8 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.html.staticControls.supportClasses
{
+ import org.apache.flex.core.IItemRenderer;
+ import org.apache.flex.core.IItemRendererParent;
import org.apache.flex.events.Event;
import org.apache.flex.html.staticControls.TextButton;
import org.apache.flex.html.staticControls.beads.ITextItemRenderer;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/DataItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/DataItemRenderer.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/DataItemRenderer.as
index 8f2a5cc..b12050b 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/DataItemRenderer.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/DataItemRenderer.as
@@ -47,16 +47,6 @@ package org.apache.flex.html.staticControls.supportClasses
_rowIndex = value;
}
- private var _labelField:String = "label";
- public function get labelField():String
- {
- return _labelField;
- }
- public function set labelField(value:String):void
- {
- _labelField = value;
- }
-
private var background:Sprite;
override public function addedToParent():void
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/TextFieldItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/TextFieldItemRenderer.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/TextFieldItemRenderer.as
index 6288951..7b2d61e 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/TextFieldItemRenderer.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/TextFieldItemRenderer.as
@@ -105,6 +105,15 @@ package org.apache.flex.html.staticControls.supportClasses
{
text = String(value);
}
+
+ public function get labelField():String
+ {
+ return null;
+ }
+ public function set labelField(value:String):void
+ {
+ // nothing to do for this
+ }
private var _index:int;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/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 5936387..95c5297 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,15 +19,21 @@
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.events.Event;
- public class UIItemRendererBase extends UIBase implements IItemRenderer
+ public class UIItemRendererBase extends UIBase implements IItemRenderer, IItemRendererFactory
{
public function UIItemRendererBase()
{
}
+ public function newInstance():IItemRenderer
+ {
+ return new UIItemRendererBase();
+ }
+
override public function addedToParent():void
{
super.addedToParent();
@@ -53,6 +59,16 @@ package org.apache.flex.html.staticControls.supportClasses
_data = value;
}
+ private var _labelField:String = "label";
+ public function get labelField():String
+ {
+ return _labelField;
+ }
+ public function set labelField(value:String):void
+ {
+ _labelField = value;
+ }
+
private var _index:int;
public function get index():int
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/js/FlexJS/src/org/apache/flex/core/FilledRectangle.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/FilledRectangle.js b/frameworks/js/FlexJS/src/org/apache/flex/core/FilledRectangle.js
new file mode 100644
index 0000000..cdefdd0
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/FilledRectangle.js
@@ -0,0 +1,78 @@
+/**
+ * Licensed 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.
+ */
+
+goog.provide('org.apache.flex.core.FilledRectangle');
+
+goog.require('org.apache.flex.core.UIBase');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.core.UIBase}
+ */
+org.apache.flex.core.FilledRectangle = function() {
+ goog.base(this);
+
+ /**
+ * @private
+ * @type {number}
+ */
+ this.fillColor_ = 0;
+};
+goog.inherits(org.apache.flex.core.FilledRectangle,
+ org.apache.flex.core.UIBase);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.FilledRectangle.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'FilledRectangle',
+ qName: 'org.apache.flex.core.FilledRectangle' }] };
+
+
+/**
+ * @expose
+ * @return {number} The fill color.
+ */
+org.apache.flex.core.UIBase.prototype.get_fillColor = function() {
+ return this.fillColor_;
+};
+
+
+/**
+ * @param {number} value The fill color.
+ */
+org.apache.flex.core.UIBase.prototype.set_fillColor = function(value) {
+ this.fillColor_ = value;
+};
+
+
+/**
+ * @expose
+ * @param {number} x The left coordinate.
+ * @param {number} y The top coordinate.
+ * @param {number} width The width.
+ * @param {number} height The height.
+ */
+org.apache.flex.core.UIBase.prototype.drawRect = function(x, y, width, height) {
+ this.element.style.backgroundColor = '#' + this.fillColor_.toString(16);
+ if (!isNaN(x)) this.set_x(x);
+ if (!isNaN(y)) this.set_y(y);
+ if (!isNaN(width)) this.set_width(width);
+ if (!isNaN(height)) this.set_height(height);
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/js/FlexJS/src/org/apache/flex/core/IDataProviderItemRendererMapper.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/IDataProviderItemRendererMapper.js b/frameworks/js/FlexJS/src/org/apache/flex/core/IDataProviderItemRendererMapper.js
deleted file mode 100644
index a93bab0..0000000
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/IDataProviderItemRendererMapper.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed 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.
- */
-
-/**
- * @fileoverview
- * @suppress {checkTypes}
- */
-
-goog.provide('org.apache.flex.core.IDataProviderItemRendererMapper');
-
-
-
-/**
- * @interface
- */
-org.apache.flex.core.IDataProviderItemRendererMapper = function() {
-};
-
-
-/**
- * Metadata
- *
- * @type {Object.<string, Array.<Object>>}
- */
-org.apache.flex.core.IDataProviderItemRendererMapper.prototype.FLEXJS_CLASS_INFO =
- { names: [{ name: 'IDataProviderItemRendererMapper',
- qName: 'org.apache.flex.core.IDataProviderItemRendererMapper' }] };
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/js/FlexJS/src/org/apache/flex/core/IItemRendererFactory.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/IItemRendererFactory.js b/frameworks/js/FlexJS/src/org/apache/flex/core/IItemRendererFactory.js
new file mode 100644
index 0000000..df712dc
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/IItemRendererFactory.js
@@ -0,0 +1,45 @@
+/**
+ * Licensed 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.
+ */
+
+/**
+ * @fileoverview
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org.apache.flex.core.IItemRendererFactory');
+
+
+
+/**
+ * @interface
+ */
+org.apache.flex.core.IItemRendererFactory = function() {
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.IItemRendererFactory.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'IItemRendererFactory',
+ qName: 'org.apache.flex.core.IItemRendererFactory' }] };
+
+
+/**
+ * @expose
+ * @return {Object} A new instance of the itemRenderer.
+ */
+org.apache.flex.core.IItemRendererFactory.prototype.newInstance = function() {};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/js/FlexJS/src/org/apache/flex/core/ILayoutParent.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/ILayoutParent.js b/frameworks/js/FlexJS/src/org/apache/flex/core/ILayoutParent.js
new file mode 100644
index 0000000..2057ff2
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/ILayoutParent.js
@@ -0,0 +1,73 @@
+/**
+ * Licensed 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.
+ */
+
+/**
+ * @fileoverview
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org.apache.flex.core.ILayoutParent');
+
+
+
+/**
+ * @interface
+ */
+org.apache.flex.core.ILayoutParent = function() {
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.ILayoutParent.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'ILayoutParent',
+ qName: 'org.apache.flex.core.ILayoutParent' }] };
+
+
+/**
+ * @expose
+ * @return {Object} The view that contains the layout objects.
+ */
+org.apache.flex.core.ILayoutParent.prototype.get_contentView = function() {};
+
+
+/**
+ * @expose
+ * @return {Object} The border for the layout area.
+ */
+org.apache.flex.core.ILayoutParent.prototype.get_border = function() {};
+
+
+/**
+ * @expose
+ * @return {Object} The vertical scrollbar.
+ */
+org.apache.flex.core.ILayoutParent.prototype.get_vScrollBar = function() {};
+
+
+/**
+ * @expose
+ * @param {Object} value The vertical scrollbar.
+ */
+org.apache.flex.core.ILayoutParent.prototype.set_vScrollBar = function(value) {};
+
+
+/**
+ * @expose
+ * @return {Object} The view that can be resized.
+ */
+org.apache.flex.core.ILayoutParent.prototype.get_resizeableView = function() {};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/js/FlexJS/src/org/apache/flex/core/ISelectionModel.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/ISelectionModel.js b/frameworks/js/FlexJS/src/org/apache/flex/core/ISelectionModel.js
index 15382f5..0422dcf 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/ISelectionModel.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/ISelectionModel.js
@@ -22,6 +22,8 @@
goog.provide('org.apache.flex.core.ISelectionModel');
+goog.require('org.apache.flex.core.IBeadModel');
+
/**
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/IDataProviderItemRendererMapper.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/IDataProviderItemRendererMapper.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/IDataProviderItemRendererMapper.js
new file mode 100644
index 0000000..cb2e3b8
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/IDataProviderItemRendererMapper.js
@@ -0,0 +1,38 @@
+/**
+ * org.apache.flex.html.staticControls.beads.IDataProviderItemRendererMapper
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org.apache.flex.html.staticControls.beads.IDataProviderItemRendererMapper');
+
+goog.require('org.apache.flex.core.IBead');
+
+
+
+/**
+ * @interface
+ * @extends {org.apache.flex.core.IBead}
+ */
+org.apache.flex.html.staticControls.beads.IDataProviderItemRendererMapper =
+function() {
+};
+
+
+/**
+ * @expose
+ */
+org.apache.flex.html.staticControls.beads.IDataProviderItemRendererMapper.prototype.itemRendererFactory = null;
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.html.staticControls.beads.IDataProviderItemRendererMapper.prototype.FLEXJS_CLASS_INFO = {
+ names: [{ name: 'IDataProviderItemRendererMapper',
+ qName: 'org.apache.flex.html.staticControls.beads.IDataProviderItemRendererMapper'}],
+ interfaces: [org.apache.flex.core.IBead] };
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/ListView.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/ListView.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/ListView.js
index 677a888..9e7dd3b 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/ListView.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/ListView.js
@@ -17,6 +17,7 @@ goog.provide('org.apache.flex.html.staticControls.beads.ListView');
goog.require('org.apache.flex.core.IBeadLayout');
goog.require('org.apache.flex.core.IBeadView');
goog.require('org.apache.flex.core.IItemRendererParent');
+goog.require('org.apache.flex.core.ILayoutParent');
goog.require('org.apache.flex.core.ValuesManager');
goog.require('org.apache.flex.html.staticControls.beads.IListView');
goog.require('org.apache.flex.html.staticControls.beads.TextItemRendererFactoryForArrayData');
@@ -27,6 +28,7 @@ goog.require('org.apache.flex.html.staticControls.supportClasses.NonVirtualDataG
/**
* @constructor
+ * @implements {org.apache.flex.core.ILayoutParent}
* @implements {org.apache.flex.html.staticControls.beads.IListView}
*/
org.apache.flex.html.staticControls.beads.ListView = function() {
@@ -45,7 +47,7 @@ org.apache.flex.html.staticControls.beads.ListView.prototype.
FLEXJS_CLASS_INFO =
{ names: [{ name: 'ListView',
qName: 'org.apache.flex.html.staticControls.beads.ListView' }],
- interfaces: [org.apache.flex.html.staticControls.beads.IListView] };
+ interfaces: [org.apache.flex.html.staticControls.beads.IListView, org.apache.flex.core.ILayoutParent] };
/**
@@ -102,3 +104,47 @@ org.apache.flex.html.staticControls.beads.ListView.prototype.
}
this.lastSelectedIndex = this.model.get_selectedIndex();
};
+
+
+/**
+ * @expose
+ * @return {Object} The view that contains the layout objects.
+ */
+org.apache.flex.html.staticControls.beads.ListView.prototype.get_contentView = function() {
+ return this;
+};
+
+
+/**
+ * @expose
+ * @return {Object} The border for the layout area.
+ */
+org.apache.flex.html.staticControls.beads.ListView.prototype.get_border = function() {
+ return null;
+};
+
+
+/**
+ * @expose
+ * @return {Object} The vertical scrollbar.
+ */
+org.apache.flex.html.staticControls.beads.ListView.prototype.get_vScrollBar = function() {
+ return null;
+};
+
+
+/**
+ * @expose
+ * @param {Object} value The vertical scrollbar.
+ */
+org.apache.flex.html.staticControls.beads.ListView.prototype.set_vScrollBar = function(value) {
+};
+
+
+/**
+ * @expose
+ * @return {Object} The view that can be resized.
+ */
+org.apache.flex.html.staticControls.beads.ListView.prototype.get_resizeableView = function() {
+ return this;
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/models/ArraySelectionModel.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/models/ArraySelectionModel.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/models/ArraySelectionModel.js
index 5fd5d55..f79da72 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/models/ArraySelectionModel.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/models/ArraySelectionModel.js
@@ -14,7 +14,7 @@
goog.provide('org.apache.flex.html.staticControls.beads.models.ArraySelectionModel');
-goog.require('org.apache.flex.core.IBeadModel');
+goog.require('org.apache.flex.core.ISelectionModel');
goog.require('org.apache.flex.events.EventDispatcher');
@@ -22,7 +22,7 @@ goog.require('org.apache.flex.events.EventDispatcher');
/**
* @constructor
* @extends {org.apache.flex.events.EventDispatcher}
- * @implements {org.apache.flex.core.IBeadModel}
+ * @implements {org.apache.flex.core.ISelectionModel}
*/
org.apache.flex.html.staticControls.beads.models.ArraySelectionModel =
function() {
@@ -42,7 +42,7 @@ goog.inherits(
org.apache.flex.html.staticControls.beads.models.ArraySelectionModel.prototype.FLEXJS_CLASS_INFO =
{ names: [{ name: 'ArraySelectionModel',
qName: 'org.apache.flex.html.staticControls.beads.models.ArraySelectionModel' }],
- interfaces: [org.apache.flex.core.IBeadModel] };
+ interfaces: [org.apache.flex.core.ISelectionModel] };
/**
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e8662b0/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/UIItemRendererBase.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/UIItemRendererBase.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/UIItemRendererBase.js
new file mode 100644
index 0000000..47d1579
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/UIItemRendererBase.js
@@ -0,0 +1,209 @@
+/**
+ * Licensed 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.
+ */
+
+goog.provide('org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase');
+
+goog.require('org.apache.flex.core.IItemRenderer');
+goog.require('org.apache.flex.core.IItemRendererFactory');
+goog.require('org.apache.flex.core.UIBase');
+goog.require('org.apache.flex.events.Event');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.core.UIBase}
+ * @implements {org.apache.flex.core.IItemRenderer}
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase =
+function() {
+ this.renderers = new Array();
+ goog.base(this);
+};
+goog.inherits(
+ org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase,
+ org.apache.flex.core.UIBase);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'UIItemRendererBase',
+ qName: 'org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase' }],
+ interfaces: ['org.apache.flex.core.IItemRenderer, org.apache.flex.core.IItemRendererFactory']};
+
+
+/**
+ * @expose
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.addedToParent =
+function() {
+ goog.base(this, 'addedToParent');
+};
+
+
+/**
+ * @expose
+ * @return {Object} The data being used for the itemRenderer.
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.get_data =
+function() {
+ return this.data_;
+};
+
+
+/**
+ * @expose
+ * @param {Object} value The data to use for the itemRenderer.
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.set_data =
+function(value) {
+ this.data_ = value;
+};
+
+
+/**
+ * @expose
+ * @return {String} The name of the field being used to display the label.
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.get_labelField =
+function() {
+ return this.labelField_;
+};
+
+
+/**
+ * @expose
+ * @param {String} value The name of the field to use for the label.
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.set_labelField =
+function(value) {
+ this.labelField_ = value;
+};
+
+
+/**
+ * @expose
+ * @return {Number} The index value set for this itemRenderer.
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.get_index =
+function() {
+ return this.index_;
+};
+
+
+/**
+ * @expose
+ * @param {Number} value The row index for this itemRenderer.
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.set_index =
+function(value) {
+ this.index_ = value;
+};
+
+
+/**
+ * @expose
+ * @return {Boolean} The current value of the hovered state.
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.get_hovered =
+function() {
+ return this.hovered_;
+};
+
+
+/**
+ * @expose
+ * @param {Boolean} value Set to true if the itemRenderer should go into hovered state.
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.set_hovered =
+function(value) {
+ this.hovered_ = value;
+};
+
+
+/**
+ * @expose
+ * @return {Boolean} Whether or not the itemRenderer is selected.
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.get_selected =
+function() {
+ return this.selected_;
+};
+
+
+/**
+ * @expose
+ * @param {Boolean} value True if this itemRenderer instance is selected.
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.set_selected =
+function(value) {
+ this.selected_ = value;
+};
+
+
+/**
+ * @expose
+ * @return {Boolean} The value of the down selection.
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.get_down =
+function() {
+ return this.down_;
+};
+
+
+/**
+ * @expose
+ * @param {Boolean} value True if the mouse is in the down position.
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.set_down =
+function(value) {
+ this.down_ = value;
+};
+
+
+/**
+ * @expose
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.updateRenderer =
+function() {
+ if (this.get_down()) {
+ }
+ else if (this.get_hovered()) {
+ }
+ else if (this.get_selected()) {
+ }
+};
+
+
+/**
+ * @expose
+ * @param {Event} value The event that triggered the size change.
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.sizeChangeHandler =
+function(value) {
+ //this.adjustSize();
+};
+
+
+/**
+ * @expose
+ */
+org.apache.flex.html.staticControls.supportClasses.UIItemRendererBase.prototype.adjustSize =
+function() {
+ // handle in sub-class
+};