You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/04/15 23:43:07 UTC
[02/55] [abbrv] git commit: [flex-asjs] [refs/heads/develop] - move
AS classes from FlexJSJX to final home. Build scripts will be fixed up in a
later commit
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
new file mode 100644
index 0000000..2a0ad3c
--- /dev/null
+++ b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
@@ -0,0 +1,432 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.beads.layouts
+{
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.ILayoutParent;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The OneFlexibleChildVerticalLayout class is a simple layout
+ * bead. It takes the set of children and lays them out
+ * vertically in one column, separating them according to
+ * CSS layout rules for margin and padding styles. But it
+ * will size the one child to take up as much or little
+ * room as possible.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class OneFlexibleChildVerticalLayout implements IBeadLayout
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function OneFlexibleChildVerticalLayout()
+ {
+ }
+
+
+ /**
+ * The flexible child
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var flexibleChild:IUIBase;
+
+ // the strand/host container is also an ILayoutChild because
+ // can have its size dictated by the host's parent which is
+ // important to know for layout optimization
+ private var host:ILayoutChild;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ host = value as ILayoutChild;
+
+ // if host is going to be sized by its parent, then don't
+ // run layout when the children are added until after the
+ // initial sizing by the parent.
+ if (host.isWidthSizedToContent() && host.isHeightSizedToContent())
+ {
+ addOtherListeners();
+ }
+ else
+ {
+ host.addEventListener("widthChanged", changeHandler);
+ host.addEventListener("heightChanged", changeHandler);
+ host.addEventListener("sizeChanged", sizeChangeHandler);
+ if (!isNaN(host.explicitWidth) && !isNaN(host.explicitHeight))
+ addOtherListeners();
+ }
+ }
+
+ private function addOtherListeners():void
+ {
+ host.addEventListener("childrenAdded", changeHandler);
+ host.addEventListener("layoutNeeded", changeHandler);
+ host.addEventListener("itemsCreated", changeHandler);
+ }
+
+ private function sizeChangeHandler(event:Event):void
+ {
+ addOtherListeners();
+ changeHandler(event);
+ }
+
+ private function changeHandler(event:Event):void
+ {
+ var layoutParent:ILayoutParent = host.getBeadByType(ILayoutParent) as ILayoutParent;
+ var contentView:IParentIUIBase = layoutParent ? layoutParent.contentView : IParentIUIBase(host);
+
+ var ilc:ILayoutChild;
+ var n:int = contentView.numElements;
+ var marginLeft:Object;
+ var marginRight:Object;
+ var marginTop:Object;
+ var marginBottom:Object;
+ var margin:Object;
+ var maxWidth:Number = 0;
+ var horizontalMargins:Array = new Array(n);
+
+ var hh:Number = layoutParent.resizableView.height;
+ var padding:Object = determinePadding();
+ if (isNaN(padding.paddingBottom))
+ padding.paddingBottom = 0;
+ hh -= padding.paddingTop + padding.paddingBottom;
+ var yy:int = padding.paddingTop;
+ var flexChildIndex:int;
+ var ml:Number;
+ var mr:Number;
+ var mt:Number;
+ var mb:Number;
+ var lastmb:Number;
+ var lastmt:Number;
+ var halign:Object;
+
+ for (var i:int = 0; i < n; i++)
+ {
+ var child:IUIBase = contentView.getElementAt(i) as IUIBase;
+ if (child == flexibleChild)
+ {
+ flexChildIndex = i;
+ break;
+ }
+ margin = ValuesManager.valuesImpl.getValue(child, "margin");
+ if (margin is Array)
+ {
+ if (margin.length == 1)
+ marginLeft = marginTop = marginRight = marginBottom = margin[0];
+ else if (margin.length <= 3)
+ {
+ marginLeft = marginRight = margin[1];
+ marginTop = marginBottom = margin[0];
+ }
+ else if (margin.length == 4)
+ {
+ marginLeft = margin[3];
+ marginBottom = margin[2];
+ marginRight = margin[1];
+ marginTop = margin[0];
+ }
+ }
+ else if (margin == null)
+ {
+ marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
+ marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
+ marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
+ marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
+ }
+ else
+ {
+ marginLeft = marginTop = marginBottom = marginRight = margin;
+ }
+ mt = Number(marginTop);
+ if (isNaN(mt))
+ mt = 0;
+ mb = Number(marginBottom);
+ if (isNaN(mb))
+ mb = 0;
+ if (marginLeft == "auto")
+ ml = 0;
+ else
+ {
+ ml = Number(marginLeft);
+ if (isNaN(ml))
+ ml = 0;
+ }
+ if (marginRight == "auto")
+ mr = 0;
+ else
+ {
+ mr = Number(marginRight);
+ if (isNaN(mr))
+ mr = 0;
+ }
+ child.x = ml;
+ if (child is ILayoutChild)
+ {
+ ilc = child as ILayoutChild;
+ if (!isNaN(ilc.percentWidth))
+ ilc.setWidth(contentView.width * ilc.percentWidth / 100, true);
+ }
+ maxWidth = Math.max(maxWidth, ml + child.width + mr);
+ child.y = yy + mt;
+ yy += child.height + mt + mb;
+ lastmb = mb;
+ halign = ValuesManager.valuesImpl.getValue(child, "horizontal-align");
+ horizontalMargins[i] = { marginLeft: ml, marginRight: mr, halign: halign };
+ }
+
+ if (n > 0 && n > flexChildIndex)
+ {
+ for (i = n - 1; i > flexChildIndex; i--)
+ {
+ child = contentView.getElementAt(i) as IUIBase;
+ margin = ValuesManager.valuesImpl.getValue(child, "margin");
+ if (margin is Array)
+ {
+ if (margin.length == 1)
+ marginLeft = marginTop = marginRight = marginBottom = margin[0];
+ else if (margin.length <= 3)
+ {
+ marginLeft = marginRight = margin[1];
+ marginTop = marginBottom = margin[0];
+ }
+ else if (margin.length == 4)
+ {
+ marginLeft = margin[3];
+ marginBottom = margin[2];
+ marginRight = margin[1];
+ marginTop = margin[0];
+ }
+ }
+ else if (margin == null)
+ {
+ marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
+ marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
+ marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
+ marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
+ }
+ else
+ {
+ marginLeft = marginTop = marginBottom = marginRight = margin;
+ }
+ mt = Number(marginTop);
+ if (isNaN(mt))
+ mt = 0;
+ mb = Number(marginBottom);
+ if (isNaN(mb))
+ mb = 0;
+ if (marginLeft == "auto")
+ ml = 0;
+ else
+ {
+ ml = Number(marginLeft);
+ if (isNaN(ml))
+ ml = 0;
+ }
+ if (marginRight == "auto")
+ mr = 0;
+ else
+ {
+ mr = Number(marginRight);
+ if (isNaN(mr))
+ mr = 0;
+ }
+ child.x = ml;
+ if (child is ILayoutChild)
+ {
+ ilc = child as ILayoutChild;
+ if (!isNaN(ilc.percentWidth))
+ ilc.setWidth(contentView.width * ilc.percentWidth / 100, true);
+ }
+ maxWidth = Math.max(maxWidth, ml + child.width + mr);
+ child.y = hh - child.height - mb;
+ hh -= child.height + mt + mb;
+ lastmt = mt;
+ halign = ValuesManager.valuesImpl.getValue(child, "horizontal-align");
+ horizontalMargins[i] = { marginLeft: ml, marginRight: mr, halign: halign };
+ }
+
+ child = contentView.getElementAt(flexChildIndex) as IUIBase;
+ margin = ValuesManager.valuesImpl.getValue(child, "margin");
+ if (margin is Array)
+ {
+ if (margin.length == 1)
+ marginLeft = marginTop = marginRight = marginBottom = margin[0];
+ else if (margin.length <= 3)
+ {
+ marginLeft = marginRight = margin[1];
+ marginTop = marginBottom = margin[0];
+ }
+ else if (margin.length == 4)
+ {
+ marginLeft = margin[3];
+ marginBottom = margin[2];
+ marginRight = margin[1];
+ marginTop = margin[0];
+ }
+ }
+ else if (margin == null)
+ {
+ marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
+ marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
+ marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
+ marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
+ }
+ else
+ {
+ marginLeft = marginTop = marginBottom = marginRight = margin;
+ }
+ mt = Number(marginTop);
+ if (isNaN(mt))
+ mt = 0;
+ mb = Number(marginBottom);
+ if (isNaN(mb))
+ mb = 0;
+ if (marginLeft == "auto")
+ ml = 0;
+ else
+ {
+ ml = Number(marginLeft);
+ if (isNaN(ml))
+ ml = 0;
+ }
+ if (marginRight == "auto")
+ mr = 0;
+ else
+ {
+ mr = Number(marginRight);
+ if (isNaN(mr))
+ mr = 0;
+ }
+ child.x = ml;
+ if (child is ILayoutChild)
+ {
+ ilc = child as ILayoutChild;
+ if (!isNaN(ilc.percentWidth))
+ ilc.setWidth(contentView.width * ilc.percentWidth / 100, true);
+ }
+ maxWidth = Math.max(maxWidth, ml + child.width + mr);
+ child.y = yy + mt;
+ child.height = hh - yy - mb;
+ halign = ValuesManager.valuesImpl.getValue(child, "horizontal-align");
+ horizontalMargins[flexChildIndex] = { marginLeft: ml, marginRight: mr, halign: halign };
+ }
+
+ for (i = 0; i < n; i++)
+ {
+ var obj:Object = horizontalMargins[0]
+ child = contentView.getElementAt(i) as IUIBase;
+ if (obj.halign == "center")
+ child.x = (maxWidth - child.width) / 2;
+ else if (obj.halign == "bottom")
+ child.x = maxWidth - child.width - obj.marginRight;
+ else
+ child.x = obj.marginLeft;
+ }
+ layoutParent.resizableView.width = maxWidth;
+ }
+
+ // TODO (aharui): utility class or base class
+ /**
+ * Determines the top and left padding values, if any, as set by
+ * padding style values. This includes "padding" for all padding values
+ * as well as "padding-left" and "padding-top".
+ *
+ * Returns an object with paddingLeft and paddingTop properties.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function determinePadding():Object
+ {
+ var paddingLeft:Object;
+ var paddingTop:Object;
+ var paddingRight:Object;
+ var padding:Object = ValuesManager.valuesImpl.getValue(host, "padding");
+ if (typeof(padding) == "Array")
+ {
+ if (padding.length == 1)
+ paddingLeft = paddingTop = paddingRight = padding[0];
+ else if (padding.length <= 3)
+ {
+ paddingLeft = padding[1];
+ paddingTop = padding[0];
+ paddingRight = padding[1];
+ }
+ else if (padding.length == 4)
+ {
+ paddingLeft = padding[3];
+ paddingTop = padding[0];
+ paddingRight = padding[1];
+ }
+ }
+ else if (padding == null)
+ {
+ paddingLeft = ValuesManager.valuesImpl.getValue(host, "padding-left");
+ paddingTop = ValuesManager.valuesImpl.getValue(host, "padding-top");
+ paddingRight = ValuesManager.valuesImpl.getValue(host, "padding-right");
+ }
+ else
+ {
+ paddingLeft = paddingTop = paddingRight = padding;
+ }
+ var pl:Number = Number(paddingLeft);
+ var pt:Number = Number(paddingTop);
+ var pr:Number = Number(paddingRight);
+ if (isNaN(pl))
+ pl = 0;
+ if (isNaN(pr))
+ pr = 0;
+ if (isNaN(pt))
+ pt = 0;
+ return {paddingLeft:pl, paddingTop:pt, paddingRight:pr};
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
new file mode 100644
index 0000000..d4b801b
--- /dev/null
+++ b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
@@ -0,0 +1,151 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.beads.layouts
+{
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IMeasurementBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IContainer;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * ColumnLayout is a class that organizes the positioning of children
+ * of a container into a set of columns where each column's width is set to
+ * the maximum size of all of the children in that column.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VerticalColumnLayout implements IBeadLayout
+ {
+ /**
+ * constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VerticalColumnLayout()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ IEventDispatcher(value).addEventListener("widthChanged", changeHandler);
+ IEventDispatcher(value).addEventListener("heightChanged", changeHandler);
+ IEventDispatcher(value).addEventListener("childrenAdded", changeHandler);
+ }
+
+
+ private var _numColumns:int;
+
+ /**
+ * The number of columns.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get numColumns():int
+ {
+ return _numColumns;
+ }
+ public function set numColumns(value:int):void
+ {
+ _numColumns = value;
+ }
+
+ /**
+ * @private
+ */
+ private function changeHandler(event:Event):void
+ {
+ var sw:Number = UIBase(_strand).width;
+ var sh:Number = UIBase(_strand).height;
+
+ var e:IUIBase;
+ var i:int;
+ var col:int = 0;
+ var columns:Array = [];
+ for (i = 0; i < numColumns; i++)
+ columns[i] = 0;
+
+ var children:Array = IContainer(_strand).getChildren();
+ var n:int = children.length;
+
+ // determine max widths of columns
+ for (i = 0; i < n; i++) {
+ e = children[i];
+ var thisPrefWidth:int = 0;
+ if (e is IStrand)
+ {
+ var mb:IMeasurementBead = e.getBeadByType(IMeasurementBead) as IMeasurementBead;
+ if (mb)
+ thisPrefWidth = mb.measuredWidth;
+ else
+ thisPrefWidth = e.width;
+ }
+ else
+ thisPrefWidth = e.width;
+
+ columns[col] = Math.max(columns[col], thisPrefWidth);
+ col = (col + 1) % numColumns;
+ }
+
+ var curx:int = 0;
+ var cury:int = 0;
+ var maxHeight:int = 0;
+ col = 0;
+ for (i = 0; i < n; i++) {
+ e = children[i];
+ e.x = curx;
+ e.y = cury;
+ curx += columns[col++];
+ maxHeight = Math.max(e.height, maxHeight);
+ if (col == numColumns)
+ {
+ cury += maxHeight;
+ maxHeight = 0;
+ col = 0;
+ curx = 0;
+ }
+ }
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("layoutComplete"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/models/DataGridModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/models/DataGridModel.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/models/DataGridModel.as
new file mode 100644
index 0000000..f50b36a
--- /dev/null
+++ b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/models/DataGridModel.as
@@ -0,0 +1,72 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.beads.models
+{
+ import org.apache.flex.core.IDataGridModel;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The DataGridModel class bead extends org.apache.flex.html.beads.modelsArraySelectionModel
+ * and adds the array of org.apache.flex.html.supportClasses.DataGridColumns used to define
+ * each of the column in the DataGrid.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridModel extends ArraySelectionModel implements IDataGridModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridModel()
+ {
+ super();
+ }
+
+ private var _columns:Array;
+
+ /**
+ * The array of org.apache.flex.html.supportClasses.DataGridColumns used to
+ * define each column of the org.apache.flex.html.DataGrid.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get columns():Array
+ {
+ return _columns;
+ }
+ public function set columns(value:Array):void
+ {
+ if (_columns != value) {
+ _columns = value;
+ dispatchEvent( new Event("columnsChanged"));
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/models/DataGridPresentationModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/models/DataGridPresentationModel.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/models/DataGridPresentationModel.as
new file mode 100644
index 0000000..2959aad
--- /dev/null
+++ b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/models/DataGridPresentationModel.as
@@ -0,0 +1,86 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.beads.models
+{
+ import org.apache.flex.core.IDataGridPresentationModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The DataGridPresentationModel class contains the data to label the columns
+ * of the org.apache.flex.html.DataGrid along with the height of the rows.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridPresentationModel extends ListPresentationModel implements IDataGridPresentationModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridPresentationModel()
+ {
+ super();
+ }
+
+ private var _columnLabels:Array;
+
+ /**
+ * The labels for each column.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get columnLabels():Array
+ {
+ return _columnLabels;
+ }
+ public function set columnLabels(value:Array):void
+ {
+ if (value != _columnLabels) {
+ _columnLabels = value;
+ dispatchEvent(new Event("columnsChanged"));
+ }
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/models/DateChooserModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/models/DateChooserModel.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/models/DateChooserModel.as
new file mode 100644
index 0000000..4b6fc18
--- /dev/null
+++ b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/models/DateChooserModel.as
@@ -0,0 +1,189 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.beads.models
+{
+ import org.apache.flex.core.IDateChooserModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The DateChooserModel is a bead class that manages the data for a DataChooser.
+ * This includes arrays of names for the months and days of the week as well the
+ * currently selected date.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateChooserModel extends EventDispatcher implements IDateChooserModel
+ {
+ public function DateChooserModel()
+ {
+ // default displayed year and month to "today"
+ var today:Date = new Date();
+ displayedYear = today.getFullYear();
+ displayedMonth = today.getMonth();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _dayNames:Array = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
+ private var _monthNames:Array = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
+ private var _displayedYear:Number;
+ private var _displayedMonth:Number;
+ private var _firstDayOfWeek:Number = 0;
+ private var _selectedDate:Date;
+
+ /**
+ * An array of strings used to name the days of the week with Sunday being the
+ * first element of the array.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dayNames():Array
+ {
+ return _dayNames;
+ }
+ public function set dayNames(value:Array):void
+ {
+ _dayNames = value;
+ dispatchEvent( new Event("dayNamesChanged") );
+ }
+
+ /**
+ * An array of strings used to name the months of the year with January being
+ * the first element of the array.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get monthNames():Array
+ {
+ return _monthNames;
+ }
+ public function set monthNames(value:Array):void
+ {
+ _monthNames = value;
+ dispatchEvent( new Event("monthNames") );
+ }
+
+ /**
+ * The year currently displayed by the DateChooser.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get displayedYear():Number
+ {
+ return _displayedYear;
+ }
+ public function set displayedYear(value:Number):void
+ {
+ if (value != _displayedYear) {
+ _displayedYear = value;
+ dispatchEvent( new Event("displayedYearChanged") );
+ }
+ }
+
+ /**
+ * The month currently displayed by the DateChooser.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get displayedMonth():Number
+ {
+ return _displayedMonth;
+ }
+ public function set displayedMonth(value:Number):void
+ {
+ if (_displayedMonth != value) {
+ _displayedMonth = value;
+ dispatchEvent( new Event("displayedMonthChanged") );
+ }
+ }
+
+ /**
+ * The index of the first day of the week, Sunday = 0.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get firstDayOfWeek():Number
+ {
+ return _firstDayOfWeek;
+ }
+ public function set firstDayOfWeek(value:Number):void
+ {
+ if (value != _firstDayOfWeek) {
+ _firstDayOfWeek = value;
+ dispatchEvent( new Event("firstDayOfWeekChanged") );
+ }
+ }
+
+ /**
+ * The currently selected date or null if no date has been selected.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedDate():Date
+ {
+ return _selectedDate;
+ }
+ public function set selectedDate(value:Date):void
+ {
+ if (value != _selectedDate) {
+ _selectedDate = value;
+ dispatchEvent( new Event("selectedDateChanged") );
+
+ displayedMonth = value.getMonth();
+ displayedYear = value.getFullYear();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/HTML/asjs/src/org/apache/flex/html/supportClasses/DataGridColumn.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/supportClasses/DataGridColumn.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/supportClasses/DataGridColumn.as
new file mode 100644
index 0000000..927da73
--- /dev/null
+++ b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/supportClasses/DataGridColumn.as
@@ -0,0 +1,127 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.supportClasses
+{
+ import mx.core.IFactory;
+
+ /**
+ * The DataGridColumn class is the collection of properties that describe
+ * a column of the org.apache.flex.html.DataGrid: which renderer
+ * to use for each cell in the column, the width of the column, the label for the
+ * column, and the name of the field in the data containing the value to display
+ * in the column.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridColumn
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridColumn()
+ {
+ }
+
+ private var _itemRenderer:IFactory;
+
+ /**
+ * The itemRenderer class or factory to use to make instances of itemRenderers for
+ * display of data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRenderer():IFactory
+ {
+ return _itemRenderer;
+ }
+ public function set itemRenderer(value:IFactory):void
+ {
+ _itemRenderer = value;
+ }
+
+ private var _columnWidth:Number = Number.NaN;
+
+ /**
+ * The width of the column (default is 100 pixels).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get columnWidth():Number
+ {
+ return _columnWidth;
+ }
+ public function set columnWidth(value:Number):void
+ {
+ _columnWidth = value;
+ }
+
+ private var _label:String;
+
+ /**
+ * The label for the column (appears in the header area).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get label():String
+ {
+ return _label;
+ }
+ public function set label(value:String):void
+ {
+ _label = value;
+ }
+
+ private var _dataField:String;
+
+ /**
+ * The name of the field containing the data value presented by the column. This value is used
+ * by the itemRenderer is select the property from the data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataField():String
+ {
+ return _dataField;
+ }
+ public function set dataField(value:String):void
+ {
+ _dataField = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/HTML/asjs/src/org/apache/flex/html/supportClasses/DateChooserButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/supportClasses/DateChooserButton.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/supportClasses/DateChooserButton.as
new file mode 100644
index 0000000..2d80b2f
--- /dev/null
+++ b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/supportClasses/DateChooserButton.as
@@ -0,0 +1,67 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.supportClasses
+{
+ import org.apache.flex.html.TextButton;
+
+ /**
+ * The DateChooserButton class is used for each button in the DateChooser. The
+ * button holds the day of the month the button is representing.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateChooserButton extends TextButton
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateChooserButton()
+ {
+ super();
+ className = "DateChooserButton";
+ }
+
+ private var _dayOfMonth:int;
+
+ /**
+ * The day of the month the button represents.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dayOfMonth():int
+ {
+ return _dayOfMonth;
+ }
+ public function set dayOfMonth(value:int):void
+ {
+ _dayOfMonth = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/HTML/asjs/src/org/apache/flex/html/supportClasses/GraphicsItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/supportClasses/GraphicsItemRenderer.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/supportClasses/GraphicsItemRenderer.as
new file mode 100644
index 0000000..4d90c03
--- /dev/null
+++ b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/supportClasses/GraphicsItemRenderer.as
@@ -0,0 +1,295 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.supportClasses
+{
+ import org.apache.flex.core.ISelectableItemRenderer;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.core.graphics.GraphicsContainer;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ /**
+ * The GraphicsItemRenderer provides a base class for itemRenderers that use graphics rather than
+ * components.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class GraphicsItemRenderer extends GraphicsContainer implements ISelectableItemRenderer
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function GraphicsItemRenderer()
+ {
+ super();
+ }
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ // very common for item renderers to be resized by their containers,
+ addEventListener("widthChanged", sizeChangeHandler);
+ addEventListener("heightChanged", sizeChangeHandler);
+
+ // each MXML file can also have styles in fx:Style block
+ ValuesManager.valuesImpl.init(this);
+
+ MXMLDataInterpreter.generateMXMLProperties(this, mxmlProperties);
+ MXMLDataInterpreter.generateMXMLInstances(this, this, MXMLDescriptor);
+
+ dispatchEvent(new Event("initBindings"));
+ dispatchEvent(new Event("initComplete"));
+
+ }
+
+ private var _labelField:String = "label";
+
+ /**
+ * The name of the field within the data to use as a label. Some itemRenderers use this field to
+ * identify the value they should show while other itemRenderers ignore this if they are showing
+ * complex information.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get labelField():String
+ {
+ return _labelField;
+ }
+ public function set labelField(value:String):void
+ {
+ _labelField = value;
+ }
+
+ private var _index:int;
+
+ /**
+ * The position with the dataProvider being shown by the itemRenderer instance.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get index():int
+ {
+ return _index;
+ }
+ public function set index(value:int):void
+ {
+ _index = value;
+ }
+
+ private var _selected:Boolean;
+
+ /**
+ * Whether or not the itemRenderer is in a selected state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selected():Boolean
+ {
+ return _selected;
+ }
+ public function set selected(value:Boolean):void
+ {
+ _selected = value;
+ updateRenderer();
+ }
+
+ private var _hovered:Boolean;
+
+ /**
+ * Whether or not the itemRenderer is in a hovered state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get hovered():Boolean
+ {
+ return _hovered;
+ }
+ public function set hovered(value:Boolean):void
+ {
+ _hovered = value;
+ updateRenderer();
+ }
+
+ private var _down:Boolean;
+
+ /**
+ * Whether or not the itemRenderer is in a down (or pre-selected) state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get down():Boolean
+ {
+ return _down;
+ }
+ public function set down(value:Boolean):void
+ {
+ _down = value;
+ updateRenderer();
+ }
+
+ private var _data:Object;
+
+ [Bindable("__NoChangeEvent__")]
+ /**
+ * The data being represented by this itemRenderer. This can be something simple like a String or
+ * a Number or something very complex.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get data():Object
+ {
+ return _data;
+ }
+ public function set data(value:Object):void
+ {
+ _data = value;
+ }
+
+ private var _dataField:String;
+
+ /**
+ * The name of the field within the data the itemRenderer should use.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataField():String
+ {
+ return _dataField;
+ }
+ public function set dataField(value:String):void
+ {
+ _dataField = value;
+ }
+
+ private var _itemRendererParent:Object;
+
+ /**
+ * The parent container for the itemRenderer instance.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRendererParent():Object
+ {
+ return _itemRendererParent;
+ }
+ public function set itemRendererParent(value:Object):void
+ {
+ _itemRendererParent = value;
+ }
+
+ /**
+ * @private
+ */
+ public function updateRenderer():void
+ {
+// if (down)
+// backgroundColor = downColor;
+// else if (hovered)
+// backgroundColor = highlightColor;
+// else if (selected)
+// backgroundColor = selectedColor;
+ }
+
+ /**
+ * @copy org.apache.flex.core.ItemRendererClassFactory#mxmlContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var mxmlContent:Array;
+
+ /**
+ * @private
+ */
+ public function get MXMLDescriptor():Array
+ {
+ return null;
+ }
+
+ private var mxmlProperties:Array ;
+
+ /**
+ * @private
+ */
+ public function generateMXMLAttributes(data:Array):void
+ {
+ mxmlProperties = data;
+ }
+
+ /**
+ * @private
+ */
+ private function sizeChangeHandler(event:Event):void
+ {
+ adjustSize();
+ }
+
+ /**
+ * This function is called whenever the itemRenderer changes size. Sub-classes should override
+ * this method an handle the size change.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function adjustSize():void
+ {
+ // handle in subclass
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/Mobile/asjs/MobileClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/asjs/MobileClasses.as b/frameworks/projects/Mobile/asjs/MobileClasses.as
new file mode 100644
index 0000000..9454aad
--- /dev/null
+++ b/frameworks/projects/Mobile/asjs/MobileClasses.as
@@ -0,0 +1,95 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+
+/**
+ * @private
+ * This class is used to link additional classes into rpc.swc
+ * beyond those that are found by dependecy analysis starting
+ * from the classes specified in manifest.xml.
+ */
+internal class FlexJSJXClasses
+{
+ import org.apache.flex.mobile.beads.StackedViewManagerView; StackedViewManagerView;
+ import org.apache.flex.mobile.beads.TabbedViewManagerView; TabbedViewManagerView;
+ import org.apache.flex.mobile.chrome.NavigationBar; NavigationBar;
+ import org.apache.flex.mobile.chrome.TabBar; TabBar;
+ import org.apache.flex.mobile.chrome.ToolBar; ToolBar;
+ import org.apache.flex.mobile.models.ViewManagerModel; ViewManagerModel;
+
+ import org.apache.flex.charts.beads.ChartView; ChartView;
+ import org.apache.flex.charts.beads.ChartItemRendererFactory; ChartItemRendererFactory;
+ import org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData; DataItemRendererFactoryForSeriesData;
+ import org.apache.flex.charts.beads.DataTipBead; DataTipBead;
+ import org.apache.flex.charts.beads.HorizontalCategoryAxisBead; HorizontalCategoryAxisBead;
+ import org.apache.flex.charts.beads.HorizontalLinearAxisBead; HorizontalLinearAxisBead;
+ import org.apache.flex.charts.beads.VerticalCategoryAxisBead; VerticalCategoryAxisBead;
+ import org.apache.flex.charts.beads.VerticalLinearAxisBead; VerticalLinearAxisBead;
+ import org.apache.flex.charts.beads.layouts.BarChartLayout; BarChartLayout;
+ import org.apache.flex.charts.beads.layouts.ColumnChartLayout; ColumnChartLayout;
+ import org.apache.flex.charts.beads.layouts.LineChartCategoryVsLinearLayout; LineChartCategoryVsLinearLayout;
+ import org.apache.flex.charts.beads.layouts.LineChartLinearVsLinearLayout; LineChartLinearVsLinearLayout;
+ import org.apache.flex.charts.beads.layouts.PieChartLayout; PieChartLayout;
+ import org.apache.flex.charts.beads.layouts.StackedBarChartLayout; StackedBarChartLayout;
+ import org.apache.flex.charts.beads.layouts.StackedColumnChartLayout; StackedColumnChartLayout;
+ import org.apache.flex.charts.supportClasses.BarSeries; BarSeries;
+ import org.apache.flex.charts.supportClasses.LineSeries; LineSeries;
+ import org.apache.flex.charts.supportClasses.PieSeries; PieSeries;
+ import org.apache.flex.charts.supportClasses.BoxItemRenderer; BoxItemRenderer;
+ import org.apache.flex.charts.supportClasses.LineSegmentItemRenderer; LineSegmentItemRenderer;
+ import org.apache.flex.charts.supportClasses.WedgeItemRenderer; WedgeItemRenderer;
+ import org.apache.flex.charts.optimized.SVGChartAxisGroup; SVGChartAxisGroup;
+ import org.apache.flex.charts.optimized.SVGChartDataGroup; SVGChartDataGroup;
+ import org.apache.flex.charts.optimized.SVGBoxItemRenderer; SVGBoxItemRenderer;
+ import org.apache.flex.charts.optimized.SVGWedgeItemRenderer; SVGWedgeItemRenderer;
+ import org.apache.flex.charts.optimized.SVGLineSegmentItemRenderer; SVGLineSegmentItemRenderer;
+
+ import org.apache.flex.effects.Tween; Tween;
+ import org.apache.flex.effects.Move; Move;
+ import org.apache.flex.effects.Fade; Fade;
+
+ import org.apache.flex.html.accessories.DateFormatMMDDYYYYBead; DateFormatMMDDYYYYBead;
+ import org.apache.flex.html.beads.DataGridColumnView; DataGridColumnView;
+ import org.apache.flex.html.beads.DataGridView; DataGridView;
+ import org.apache.flex.html.beads.DateChooserView; DateChooserView;
+ import org.apache.flex.html.beads.DateFieldView; DateFieldView;
+ import org.apache.flex.html.beads.FormatableLabelView; FormatableLabelView;
+ import org.apache.flex.html.beads.FormatableTextInputView; FormatableTextInputView;
+ import org.apache.flex.html.beads.layouts.DataGridLayout; DataGridLayout;
+ import org.apache.flex.html.beads.layouts.FlexibleFirstChildHorizontalLayout; FlexibleFirstChildHorizontalLayout;
+ import org.apache.flex.html.beads.models.DataGridModel; DataGridModel;
+ import org.apache.flex.html.beads.models.DateChooserModel; DateChooserModel;
+ import org.apache.flex.html.beads.models.DataGridPresentationModel; DataGridPresentationModel;
+ import org.apache.flex.html.beads.controllers.DateChooserMouseController; DateChooserMouseController;
+ import org.apache.flex.html.beads.controllers.DateFieldMouseController; DateFieldMouseController;
+ import org.apache.flex.html.supportClasses.DataGridColumn; DataGridColumn;
+ import org.apache.flex.html.supportClasses.DateChooserButton; DateChooserButton;
+ import org.apache.flex.html.supportClasses.GraphicsItemRenderer; GraphicsItemRenderer;
+
+ import org.apache.flex.html.beads.TitleBarView; TitleBarView;
+ import org.apache.flex.html.beads.TitleBarMeasurementBead; TitleBarMeasurementBead;
+
+ import org.apache.flex.core.DropType; DropType;
+ import org.apache.flex.core.ParentDocumentBead; ParentDocumentBead;
+ import org.apache.flex.core.StatesWithTransitionsImpl; StatesWithTransitionsImpl;
+}
+
+}
+
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IView.as b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IView.as
new file mode 100644
index 0000000..232d212
--- /dev/null
+++ b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IView.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.mobile
+{
+ /**
+ * The IView interface is implemented by any class that can be managed by
+ * an IViewManager.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IView
+ {
+ /**
+ * The parent view manager.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get viewManager():IViewManager;
+ function set viewManager(value:IViewManager):void;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IViewManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IViewManager.as b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IViewManager.as
new file mode 100644
index 0000000..54bb22a
--- /dev/null
+++ b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IViewManager.as
@@ -0,0 +1,42 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.mobile
+{
+ /**
+ * The IViewManager interface is implemented by classes that manage or control
+ * IViews.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IViewManager extends IView
+ {
+ /**
+ * The view that is currently active in the view manager.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get selectedView():IView;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/StackedViewManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/StackedViewManager.as b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/StackedViewManager.as
new file mode 100644
index 0000000..54f3fd1
--- /dev/null
+++ b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/StackedViewManager.as
@@ -0,0 +1,291 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.mobile
+{
+ import org.apache.flex.events.Event;
+ import org.apache.flex.mobile.ManagerBase;
+ import org.apache.flex.mobile.chrome.NavigationBar;
+ import org.apache.flex.mobile.chrome.ToolBar;
+ import org.apache.flex.mobile.models.ViewManagerModel;
+
+ /**
+ * Event dispatched when the currently selected view changes.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event("viewChanged")]
+
+ /**
+ * The StackedViewManager displays a single View at a time from a
+ * collection of Views where views[0] is at the bottom and views[n-1]
+ * is at the top and displayed.
+ *
+ * The StackedViewManager has an optional navigation bar at the top
+ * and an optional tool bar at the bottom. The views are displayed
+ * within the StackedViewManager's content area.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class StackedViewManager extends ManagerBase implements IViewManager
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function StackedViewManager()
+ {
+ super();
+
+ className = "StackedViewManager";
+ }
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ var n:int = ViewManagerModel(model).views.length;
+ if (n > 0) {
+ for (var i:int = 0; i < n; i++)
+ {
+ var view:IView = ViewManagerModel(model).views[i] as IView;
+ view.viewManager = this;
+ if (i == (n-1)) {
+ addElement(view,false);
+ _topView = view;
+ }
+ }
+ }
+ }
+
+ /**
+ * The title to use in the NavigationBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get title():String
+ {
+ return ViewManagerModel(model).title;
+ }
+ public function set title(value:String):void
+ {
+ ViewManagerModel(model).title = value;
+ }
+
+ /**
+ * @private
+ */
+ override public function toString():String
+ {
+ return ViewManagerModel(model).title;
+ }
+
+ /**
+ * True if this view manager is displaying a NavigationBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get hasNavigationBar():Boolean
+ {
+ return ViewManagerModel(model).navigationBarItems != null;
+ }
+
+ /**
+ * The contents of the NavigationBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get navigationBarItems():Array
+ {
+ return ViewManagerModel(model).navigationBarItems;
+ }
+ public function set navigationBarItems(value:Array):void
+ {
+ ViewManagerModel(model).navigationBarItems = value;
+ }
+
+ /**
+ * The NavigationBar (or null if not present).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get navigationBar():NavigationBar
+ {
+ return ViewManagerModel(model).navigationBar;
+ }
+
+ /**
+ * True if this view manager is displaying a ToolBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get hasToolBar():Boolean
+ {
+ return ViewManagerModel(model).toolBarItems != null;
+ }
+
+ /**
+ * The contents of the ToolBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get toolBarItems():Array
+ {
+ return ViewManagerModel(model).toolBarItems;
+ }
+ public function set toolBarItems(value:Array):void
+ {
+ ViewManagerModel(model).toolBarItems = value;
+ }
+
+ /**
+ * The ToolBar (or null if not present).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get toolBar():ToolBar
+ {
+ return ViewManagerModel(model).toolBar;
+ }
+
+ private var _topView:IView;
+
+ /**
+ * The top-most (current) view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedView():IView
+ {
+ return _topView;
+ }
+
+ /**
+ * The current set of views in the stack. The last entry is
+ * the top-most (visible) view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get views():Array
+ {
+ return ViewManagerModel(model).views;
+ }
+ public function set views(value:Array):void
+ {
+ ViewManagerModel(model).views = value;
+ }
+
+ /**
+ * Pushes the next view onto the navigation stack.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function push(nextView:IView):void
+ {
+ nextView.viewManager = this;
+ ViewManagerModel(model).pushView(nextView);
+
+ removeElement(_topView);
+ _topView = nextView;
+ addElement(_topView);
+
+ dispatchEvent( new Event("viewChanged") );
+ }
+ /**
+ * Pops the top-most view from the navigation stack.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function pop():void
+ {
+ if (ViewManagerModel(model).views.length > 1) {
+ var lastView:Object = ViewManagerModel(model).popView();
+ removeElement(_topView);
+ addElement(lastView);
+ _topView = lastView as IView;
+
+ dispatchEvent( new Event("viewChanged") );
+ }
+ }
+
+ private var _viewManager:IViewManager;
+
+ /**
+ * This view manager's parent view manager, if any.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get viewManager():IViewManager
+ {
+ return _viewManager;
+ }
+ public function set viewManager(value:IViewManager):void
+ {
+ _viewManager = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/TabbedViewManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/TabbedViewManager.as b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/TabbedViewManager.as
new file mode 100644
index 0000000..78cda35
--- /dev/null
+++ b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/TabbedViewManager.as
@@ -0,0 +1,257 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.mobile
+{
+ import org.apache.flex.events.Event;
+ import org.apache.flex.mobile.ManagerBase;
+ import org.apache.flex.mobile.chrome.NavigationBar;
+ import org.apache.flex.mobile.chrome.TabBar;
+ import org.apache.flex.mobile.chrome.ToolBar;
+ import org.apache.flex.mobile.models.ViewManagerModel;
+
+ /**
+ * Event dispatched when the current (selected) view changes.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="viewChanged")]
+
+ /**
+ * The TabbedViewManager displays a set of views, only one of which is active at
+ * a time. The other views are reachable via a set of tab buttons at the bottom of
+ * the view manager's space.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TabbedViewManager extends ManagerBase implements IViewManager
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TabbedViewManager()
+ {
+ super();
+
+ className = "TabbedViewManager";
+
+ model.addEventListener("selectedIndexChanged", changeView);
+ }
+
+ /**
+ * A title that can be used in the NavigationBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get title():String
+ {
+ return ViewManagerModel(model).title;
+ }
+ public function set title(value:String):void
+ {
+ ViewManagerModel(model).title = value;
+ }
+
+ /**
+ * @private
+ */
+ override public function toString():String
+ {
+ return ViewManagerModel(model).title;
+ }
+
+ /**
+ * True if this view manager instance is displaying a NavigationBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get hasNavigationBar():Boolean
+ {
+ return ViewManagerModel(model).navigationBarItems != null;
+ }
+
+ /**
+ * The items that make up the NavigationBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get navigationBarItems():Array
+ {
+ return ViewManagerModel(model).navigationBarItems;
+ }
+ public function set navigationBarItems(value:Array):void
+ {
+ ViewManagerModel(model).navigationBarItems = value;
+ }
+
+ /**
+ * The NavigationBar (or null if not present).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get navigationBar():NavigationBar
+ {
+ return ViewManagerModel(model).navigationBar;
+ }
+
+ /**
+ * The TabBar (or null if not present).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get tabBar():TabBar
+ {
+ return ViewManagerModel(model).tabBar;
+ }
+
+ /**
+ * The index (starting at zero) of the currently visible view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedIndex():Number
+ {
+ return ViewManagerModel(model).selectedIndex;
+ }
+ public function set selectedIndex(value:Number):void
+ {
+ ViewManagerModel(model).selectedIndex = value;
+ }
+
+ private var _currentView:IView;
+
+ /**
+ * The currently visible view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedView():IView
+ {
+ return _currentView;
+ }
+
+ /**
+ * The current set of views in the stack. The last entry is
+ * the top-most (visible) view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get views():Array
+ {
+ return ViewManagerModel(model).views;
+ }
+ public function set views(value:Array):void
+ {
+ ViewManagerModel(model).views = value;
+ }
+
+ /**
+ * @private
+ */
+ private function changeView( event:Event ):void
+ {
+ var index:Number = ViewManagerModel(model).selectedIndex;
+ if (_currentView) {
+ removeElement(_currentView);
+ }
+ _currentView = views[index];
+ addElement(_currentView);
+
+ dispatchEvent( new Event("viewChanged") );
+ }
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ var n:int = ViewManagerModel(model).views.length;
+ if (n > 0) {
+ for (var i:int = 0; i < n; i++)
+ {
+ var view:IView = ViewManagerModel(model).views[i] as IView;
+ view.viewManager = this;
+ if (i == 0) {
+ addElement(view,false);
+ }
+ }
+ ViewManagerModel(model).selectedIndex = 0;
+ }
+ }
+
+ /**
+ * IViewManager
+ */
+
+ private var _viewManager:IViewManager;
+
+ /**
+ * This view manager's parent view manager, if any.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get viewManager():IViewManager
+ {
+ return _viewManager;
+ }
+ public function set viewManager(value:IViewManager):void
+ {
+ _viewManager = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/View.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/View.as b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/View.as
new file mode 100644
index 0000000..456116f
--- /dev/null
+++ b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/View.as
@@ -0,0 +1,80 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.mobile
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.html.Container;
+
+ /**
+ * The View class represents the area for a mobile app's primary
+ * interface elements.
+ */
+ public class View extends Container implements IView
+ {
+ public function View()
+ {
+ super();
+ }
+
+ private var _title:String;
+ public function get title():String
+ {
+ return _title;
+ }
+ public function set title(value:String):void
+ {
+ _title = value;
+ }
+
+ override public function toString():String
+ {
+ return _title;
+ }
+
+ private var _viewManager:IViewManager;
+ public function get viewManager():IViewManager
+ {
+ return _viewManager;
+ }
+ public function set viewManager(value:IViewManager):void
+ {
+ _viewManager = value;
+ }
+
+ private var _controller:IBeadController;
+ public function get controller():IBeadController
+ {
+ if (_controller == null) {
+ _controller = getBeadByType(IBeadController) as IBeadController;
+ if (_controller == null) {
+ _controller = new (ValuesManager.valuesImpl.getValue(this, "iBeadController")) as IBeadController;
+ addBead(_controller);
+ }
+ }
+ return _controller;
+ }
+ public function set controller(value:IBeadController):void
+ {
+ _controller = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/beads/StackedViewManagerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/beads/StackedViewManagerView.as b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/beads/StackedViewManagerView.as
new file mode 100644
index 0000000..1d3ae57
--- /dev/null
+++ b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/beads/StackedViewManagerView.as
@@ -0,0 +1,184 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.mobile.beads
+{
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.html.beads.layouts.NonVirtualHorizontalLayout;
+ import org.apache.flex.mobile.ManagerBase;
+ import org.apache.flex.mobile.chrome.NavigationBar;
+ import org.apache.flex.mobile.chrome.ToolBar;
+ import org.apache.flex.mobile.models.ViewManagerModel;
+
+ /**
+ * The StackedViewManagerView creates the visual elements of the StackedViewManager. This
+ * includes a NavigationBar, ToolBar, and contentArea.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class StackedViewManagerView implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function StackedViewManagerView()
+ {
+ super();
+
+ layoutReady = false;
+ }
+
+ private var _navigationBar:NavigationBar;
+ private var _toolBar:ToolBar;
+
+ private var layoutReady:Boolean;
+
+ private var _strand:ManagerBase;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value as ManagerBase;
+ _strand.addEventListener("widthChanged", changeHandler);
+ _strand.addEventListener("heightChanged", changeHandler);
+
+ var model:ViewManagerModel = value.getBeadByType(IBeadModel) as ViewManagerModel;
+ model.addEventListener("viewsChanged", handleModelChanged);
+ model.addEventListener("viewPushed", handleModelChanged);
+ model.addEventListener("viewPopped", handleModelChanged);
+
+ if (model.navigationBarItems)
+ {
+ _navigationBar = new NavigationBar();
+ _navigationBar.controls = model.navigationBarItems;
+ _navigationBar.addBead(new NonVirtualHorizontalLayout());
+ _strand.addElement(_navigationBar);
+ }
+
+ if (model.toolBarItems)
+ {
+ _toolBar = new ToolBar();
+ _toolBar.controls = model.toolBarItems;
+ _toolBar.addBead(new NonVirtualHorizontalLayout());
+ _strand.addElement(_toolBar);
+ }
+
+ layoutReady = true;
+ layoutChromeElements();
+ }
+
+ /**
+ * @private
+ */
+ private function layoutChromeElements():void
+ {
+ var contentAreaY:Number = 0;
+ var contentAreaHeight:Number = _strand.height;
+
+ var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
+
+ if (_navigationBar)
+ {
+ _navigationBar.x = 0;
+ _navigationBar.y = 0;
+ _navigationBar.width = _strand.width;
+
+ contentAreaY = _navigationBar.height;
+ contentAreaHeight -= _navigationBar.height;
+
+ model.navigationBar = _navigationBar;
+ }
+
+ if (_toolBar)
+ {
+ _toolBar.x = 0;
+ _toolBar.y = _strand.height - _toolBar.height;
+ _toolBar.width = _strand.width;
+
+ contentAreaHeight -= _toolBar.height;
+
+ model.toolBar = _toolBar;
+ }
+
+ _strand.contentArea.x = 0;
+ _strand.contentArea.y = contentAreaY;
+ _strand.contentArea.width = _strand.width;
+ _strand.contentArea.height = contentAreaHeight;
+ }
+
+
+ /**
+ * @private
+ */
+ protected function changeHandler(event:Event):void
+ {
+ if (layoutReady) layoutChromeElements();
+ }
+
+ /**
+ * @private
+ */
+ private function handleModelChanged(event:Event):void
+ {
+ trace("Model event: "+event.type);
+ }
+
+ /**
+ * @private
+ */
+ public function get host():IUIBase
+ {
+ return _strand;
+ }
+
+ /**
+ * @private
+ */
+ public function get viewWidth():Number
+ {
+ return _strand.width;
+ }
+
+ /**
+ * @private
+ */
+ public function get viewHeight():Number
+ {
+ return _strand.height;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72b21f62/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/beads/TabbedViewManagerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/beads/TabbedViewManagerView.as b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/beads/TabbedViewManagerView.as
new file mode 100644
index 0000000..e5652c8
--- /dev/null
+++ b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/beads/TabbedViewManagerView.as
@@ -0,0 +1,184 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.mobile.beads
+{
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.html.beads.layouts.NonVirtualHorizontalLayout;
+ import org.apache.flex.mobile.ManagerBase;
+ import org.apache.flex.mobile.chrome.NavigationBar;
+ import org.apache.flex.mobile.chrome.TabBar;
+ import org.apache.flex.mobile.models.ViewManagerModel;
+
+ /**
+ * The TabbedViewManagerView constructs the visual elements of the TabbedViewManager. The
+ * elements may be a navigation bar, a tab bar, and the contentArea.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TabbedViewManagerView implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TabbedViewManagerView()
+ {
+ super();
+ layoutReady = false;
+ }
+
+ private var _navigationBar:NavigationBar;
+ private var _tabBar:TabBar;
+
+ private var layoutReady:Boolean;
+
+ private var _strand:ManagerBase;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value as ManagerBase;
+ _strand.addEventListener("widthChanged", changeHandler);
+ _strand.addEventListener("heightChanged", changeHandler);
+
+ var model:ViewManagerModel = value.getBeadByType(IBeadModel) as ViewManagerModel;
+ model.addEventListener("viewsChanged", changeHandler);
+
+ if (model.navigationBarItems)
+ {
+ _navigationBar = new NavigationBar();
+ _navigationBar.controls = model.navigationBarItems;
+ _navigationBar.addBead(new NonVirtualHorizontalLayout());
+ _strand.addElement(_navigationBar);
+ }
+
+ // TabbedViewManager always has a TabBar
+ _tabBar = new TabBar();
+ _tabBar.dataProvider = model.views;
+ _tabBar.labelField = "title";
+ _strand.addElement(_tabBar);
+ _tabBar.addEventListener("change",handleButtonBarChange);
+
+ layoutReady = true;
+ layoutChromeElements();
+ }
+
+ /**
+ * @private
+ */
+ private function layoutChromeElements():void
+ {
+ var contentAreaY:Number = 0;
+ var contentAreaHeight:Number = _strand.height;
+
+ var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
+
+ if (_navigationBar)
+ {
+ _navigationBar.x = 0;
+ _navigationBar.y = 0;
+ _navigationBar.width = _strand.width;
+
+ contentAreaY = _navigationBar.height;
+ contentAreaHeight -= _navigationBar.height;
+
+ model.navigationBar = _navigationBar;
+ }
+
+ if (_tabBar)
+ {
+ _tabBar.x = 0;
+ _tabBar.y = _strand.height - _tabBar.height;
+ _tabBar.width = _strand.width;
+
+ contentAreaHeight -= _tabBar.height;
+
+ model.tabBar = _tabBar;
+ }
+
+ _strand.contentArea.x = 0;
+ _strand.contentArea.y = contentAreaY;
+ _strand.contentArea.width = _strand.width;
+ _strand.contentArea.height = contentAreaHeight;
+ }
+
+ /**
+ * @private
+ */
+ protected function changeHandler(event:Event):void
+ {
+ if (layoutReady) layoutChromeElements();
+ }
+
+ /**
+ * @private
+ */
+ private function handleButtonBarChange(event:Event):void
+ {
+ var newIndex:Number = _tabBar.selectedIndex;
+ var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
+
+ // doing this will trigger the selectedIndexChanged event which will
+ // tell the strand to switch views
+ model.selectedIndex = newIndex;
+ }
+
+ /**
+ * @private
+ */
+ public function get host():IUIBase
+ {
+ return _strand;
+ }
+
+ /**
+ * @private
+ */
+ public function get viewWidth():Number
+ {
+ return _strand.width;
+ }
+
+ /**
+ * @private
+ */
+ public function get viewHeight():Number
+ {
+ return _strand.height;
+ }
+ }
+}
\ No newline at end of file