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 2014/03/25 22:03:49 UTC
[17/35] remove staticControls folders and move components up a level.
Next commit will rename packages inside the files
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ComboBoxView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ComboBoxView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ComboBoxView.as
new file mode 100644
index 0000000..f959cd4
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ComboBoxView.as
@@ -0,0 +1,248 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.DisplayObjectContainer;
+ import flash.display.Sprite;
+
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IComboBoxModel;
+ import org.apache.flex.core.IPopUpHost;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.staticControls.Button;
+ import org.apache.flex.html.staticControls.TextInput;
+
+ /**
+ * The ComboBoxView class creates the visual elements of the org.apache.flex.html.staticControls.ComboBox
+ * component. The job of the view bead is to put together the parts of the ComboBox such as the TextInput
+ * control and org.apache.flex.html.staticControls.Button to trigger the pop-up.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ComboBoxView implements IBeadView, IComboBoxView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ComboBoxView()
+ {
+ }
+
+ private var textInput:TextInput;
+ private var button:Button;
+ private var selectionModel:IComboBoxModel;
+
+ /**
+ * The value of the TextInput component of the ComboBox.
+ *
+ * @copy org.apache.flex.html.staticControls.beads.IComboBoxView#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return textInput.text;
+ }
+ public function set text(value:String):void
+ {
+ textInput.text = value;
+ }
+
+ /**
+ * The HTML value of the TextInput component of the ComboBox.
+ *
+ * @copy org.apache.flex.html.staticControls.beads.IComboBoxView#html
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ return textInput.html;
+ }
+ public function set html(value:String):void
+ {
+ textInput.html = value;
+ }
+
+ 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 get strand():IStrand
+ {
+ return _strand;
+ }
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ selectionModel = value.getBeadByType(IComboBoxModel) as IComboBoxModel;
+ selectionModel.addEventListener("selectedIndexChanged", selectionChangeHandler);
+
+ textInput = new TextInput();
+ IParent(strand).addElement(textInput);
+ textInput.width = 100;
+ textInput.height = 18;
+
+ upSprite = new Sprite();
+ drawButton( upSprite, "up", 18, 18 );
+ overSprite = new Sprite();
+ drawButton( overSprite, "over", 18, 18 );
+ downSprite = new Sprite();
+ drawButton( downSprite, "down", 18, 18 );
+
+ button = new Button();
+ button.upState = upSprite;
+ button.overState = overSprite;
+ button.downState = downSprite;
+ DisplayObjectContainer(strand).addChild(button);
+ button.width = 18;
+ button.height = 18;
+ button.x = textInput.width;
+ button.y = textInput.y;
+
+ // listen for events on the text input and modify the list and selection
+ textInput.addEventListener("change", textChangeHandler,false,0,true);
+ }
+
+ private var upSprite:Sprite;
+ private var overSprite:Sprite;
+ private var downSprite:Sprite;
+
+ /**
+ * @private
+ */
+ private function drawButton( sprite:Sprite, mode:String, width:Number, height:Number ) : void
+ {
+ sprite.graphics.clear();
+ sprite.graphics.lineStyle(1,0xFFFFFF);
+ sprite.graphics.drawRect(0, 0, width-1, height-1);
+ sprite.graphics.lineStyle(-1);
+
+ if( mode == "over" ) sprite.graphics.beginFill(0xCCCCCC);
+ else if( mode == "down" ) sprite.graphics.beginFill(0x888888);
+ sprite.graphics.drawRect(0, 0, width-1, height-1);
+ sprite.graphics.endFill();
+
+ sprite.graphics.beginFill(0x333333);
+ sprite.graphics.moveTo(4,4);
+ sprite.graphics.lineTo(width-4,4);
+ sprite.graphics.lineTo(int(width/2),height-4);
+ sprite.graphics.lineTo(4,4);
+ sprite.graphics.endFill();
+ }
+
+ private var _popUp:IStrand;
+
+ /**
+ * The pop-up component that holds the selection list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get popUp():IStrand
+ {
+ return _popUp;
+ }
+
+ private var _popUpVisible:Boolean;
+
+ /**
+ * This property is true if the pop-up selection list is currently visible.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get popUpVisible():Boolean
+ {
+ return _popUpVisible;
+ }
+ public function set popUpVisible(value:Boolean):void
+ {
+ if (value != _popUpVisible)
+ {
+ _popUpVisible = value;
+ if (value)
+ {
+ if (!_popUp)
+ {
+ var popUpClass:Class = ValuesManager.valuesImpl.getValue(_strand, "iPopUp") as Class;
+ _popUp = new popUpClass() as IStrand;
+ }
+ var root:Object = DisplayObject(_strand).root;
+ var host:DisplayObjectContainer = DisplayObject(_strand).parent;
+ while (host && !(host is IPopUpHost))
+ host = host.parent;
+ if (host)
+ IPopUpHost(host).addElement(popUp);
+ }
+ else
+ {
+ DisplayObject(_popUp).parent.removeChild(_popUp as DisplayObject);
+ }
+ }
+ }
+
+ /**
+ * @private
+ */
+ private function selectionChangeHandler(event:Event):void
+ {
+ text = selectionModel.selectedItem.toString();
+ }
+
+ /**
+ * @private
+ */
+ private function textChangeHandler(event:Event):void
+ {
+ var newEvent:Event = new Event("change");
+ IEventDispatcher(strand).dispatchEvent(newEvent);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ContainerView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ContainerView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ContainerView.as
new file mode 100644
index 0000000..67f1458
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ContainerView.as
@@ -0,0 +1,253 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.DisplayObjectContainer;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.ILayoutParent;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.html.staticControls.Container;
+ import org.apache.flex.html.staticControls.supportClasses.Border;
+ import org.apache.flex.html.staticControls.supportClasses.ContainerContentArea;
+ import org.apache.flex.html.staticControls.supportClasses.ScrollBar;
+
+ /**
+ * The ContainerView class is the default view for
+ * the org.apache.flex.html.staticControls.Container class.
+ * It lets you use some CSS styles to manage the border, background
+ * and padding around the content area.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ContainerView implements IBeadView, ILayoutParent
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ContainerView()
+ {
+ }
+
+ /**
+ * The actual parent that parents the children.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var actualParent:DisplayObjectContainer;
+
+ 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;
+
+ var backgroundColor:Object = ValuesManager.valuesImpl.getValue(value, "background-color");
+ var backgroundImage:Object = ValuesManager.valuesImpl.getValue(value, "background-image");
+ if (backgroundColor != null || backgroundImage != null)
+ {
+ if (value.getBeadByType(IBackgroundBead) == null)
+ value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBackgroundBead")) as IBead);
+ }
+
+ var borderStyle:String;
+ var borderStyles:Object = ValuesManager.valuesImpl.getValue(value, "border");
+ if (borderStyles is Array)
+ {
+ borderStyle = borderStyles[1];
+ }
+ if (borderStyle == null)
+ {
+ borderStyle = ValuesManager.valuesImpl.getValue(value, "border-style") as String;
+ }
+ if (borderStyle != null && borderStyle != "none")
+ {
+ if (value.getBeadByType(IBorderBead) == null)
+ value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead);
+ }
+
+ var padding:Object = determinePadding();
+
+ if (contentAreaNeeded())
+ {
+ actualParent = new ContainerContentArea();
+ DisplayObjectContainer(value).addChild(actualParent);
+ Container(value).setActualParent(actualParent);
+ actualParent.x = padding.paddingLeft;
+ actualParent.y = padding.paddingTop;
+ }
+ else
+ {
+ actualParent = value as UIBase;
+ }
+ }
+
+ /**
+ * 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 padding:Object = ValuesManager.valuesImpl.getValue(_strand, "padding");
+ if (padding is Array)
+ {
+ if (padding.length == 1)
+ paddingLeft = paddingTop = padding[0];
+ else if (padding.length <= 3)
+ {
+ paddingLeft = padding[1];
+ paddingTop = padding[0];
+ }
+ else if (padding.length == 4)
+ {
+ paddingLeft = padding[3];
+ paddingTop = padding[0];
+ }
+ }
+ else if (padding == null)
+ {
+ paddingLeft = ValuesManager.valuesImpl.getValue(_strand, "padding-left");
+ paddingTop = ValuesManager.valuesImpl.getValue(_strand, "padding-top");
+ }
+ else
+ {
+ paddingLeft = paddingTop = padding;
+ }
+ var pl:Number = Number(paddingLeft);
+ var pt:Number = Number(paddingTop);
+
+ return {paddingLeft:pl, paddingTop:pt};
+ }
+
+ /**
+ * Returns true if container to create a separate ContainerContentArea.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function contentAreaNeeded():Boolean
+ {
+ var padding:Object = determinePadding();
+
+ return (!isNaN(padding.paddingLeft) && padding.paddingLeft > 0 ||
+ !isNaN(padding.paddingTop) && padding.paddingTop > 0);
+ }
+
+ /**
+ * The parent of the children.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get contentView():DisplayObjectContainer
+ {
+ return actualParent;
+ }
+
+ /**
+ * The border.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get border():Border
+ {
+ return null;
+ }
+
+ /**
+ * The host component, which can resize to different slots.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get resizableView():DisplayObject
+ {
+ return _strand as DisplayObject;
+ }
+
+ /**
+ * The vertical ScrollBar, if it exists.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get vScrollBar():ScrollBar
+ {
+ return null;
+ }
+
+ /**
+ * The horizontal ScrollBar, if it exists.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get hScrollBar():ScrollBar
+ {
+ return null;
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ControlBarMeasurementBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ControlBarMeasurementBead.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ControlBarMeasurementBead.as
new file mode 100644
index 0000000..8dcbf6d
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ControlBarMeasurementBead.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.staticControls.beads
+{
+ import flash.display.DisplayObjectContainer;
+
+ import org.apache.flex.core.IMeasurementBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.html.staticControls.Container;
+
+ /**
+ * The ControlBarMeasurementBead class measures the size of a org.apache.flex.html.staticControls.ControlBar
+ * component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ControlBarMeasurementBead implements IMeasurementBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ControlBarMeasurementBead()
+ {
+ }
+
+ /**
+ * Returns the overall width of the ControlBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measuredWidth():Number
+ {
+ // Note: the measurement should problably be done by the ControlBar's layout manager bead
+ // since it would know the arrangement of the items and how far apart they are and if
+ // there are margins and paddings and gaps involved.
+ var mwidth:Number = 0;
+ var children:Array = Container(_strand).getChildren();
+ var n:int = children.length;
+ for(var i:int=0; i < n; i++) {
+ var child:IUIBase = children[i] as IUIBase;
+ if( child == null ) continue;
+ var childMeasure:IMeasurementBead = child.getBeadByType(IMeasurementBead) as IMeasurementBead;
+ if (childMeasure)
+ mwidth += childMeasure.measuredWidth;
+ }
+ return mwidth;
+ }
+
+ /**
+ * Returns the overall height of the ControlBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measuredHeight():Number
+ {
+ // Note: the measurement should problably be done by the ControlBar's layout manager bead
+ // since it would know the arrangement of the items and how far apart they are and if
+ // there are margins and paddings and gaps involved.
+ var mheight:Number = 0;
+ var n:int = DisplayObjectContainer(_strand).numChildren;
+ for(var i:int=0; i < n; i++) {
+ var child:IUIBase = DisplayObjectContainer(_strand).getChildAt(i) as IUIBase;
+ if( child == null ) continue;
+ var childMeasure:IMeasurementBead = child.getBeadByType(IMeasurementBead) as IMeasurementBead;
+ mheight += childMeasure.measuredHeight;
+ }
+ return mheight;
+ }
+
+ 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;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
new file mode 100644
index 0000000..565c8df
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
@@ -0,0 +1,143 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IDataProviderItemRendererMapper;
+ import org.apache.flex.core.IItemRenderer;
+ 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.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The DataItemRendererFactoryForArrayData class reads an
+ * array of data and creates an item renderer for every
+ * item in the array. Other implementations of
+ * IDataProviderItemRendererMapper map different data
+ * structures or manage a virtual set of renderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataItemRendererFactoryForArrayData implements IBead, IDataProviderItemRendererMapper
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataItemRendererFactoryForArrayData()
+ {
+ }
+
+ private var selectionModel:ISelectionModel;
+
+ 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;
+ selectionModel = value.getBeadByType(ISelectionModel) as ISelectionModel;
+ var listView:IListView = value.getBeadByType(IListView) as IListView;
+ dataGroup = listView.dataGroup;
+ selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+
+ if (!itemRendererFactory)
+ {
+ _itemRendererFactory = new (ValuesManager.valuesImpl.getValue(_strand, "iItemRendererClassFactory")) as IItemRendererClassFactory;
+ _strand.addBead(_itemRendererFactory);
+ }
+
+ dataProviderChangeHandler(null);
+ }
+
+ private var _itemRendererFactory:IItemRendererClassFactory;
+
+ /**
+ * The org.apache.flex.core.IItemRendererClassFactory used
+ * to generate instances of item renderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRendererFactory():IItemRendererClassFactory
+ {
+ return _itemRendererFactory;
+ }
+
+ /**
+ * @private
+ */
+ public function set itemRendererFactory(value:IItemRendererClassFactory):void
+ {
+ _itemRendererFactory = value;
+ }
+
+ /**
+ * The org.apache.flex.core.IItemRendererParent that will
+ * parent the item renderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var dataGroup:IItemRendererParent;
+
+ private function dataProviderChangeHandler(event:Event):void
+ {
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ dataGroup.removeAllElements();
+
+ var n:int = dp.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var ir:IItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as IItemRenderer;
+ ir.index = i;
+ ir.labelField = selectionModel.labelField;
+ dataGroup.addElement(ir);
+ ir.data = dp[i];
+ }
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DownArrowButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DownArrowButtonView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DownArrowButtonView.as
new file mode 100644
index 0000000..3be7ed6
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DownArrowButtonView.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.html.staticControls.beads
+{
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IBeadView;
+
+ /**
+ * The DownArrowButtonView class is the view for
+ * the down arrow button in a ScrollBar and other controls.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DownArrowButtonView implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DownArrowButtonView()
+ {
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ drawView(upView.graphics, 0xCCCCCC);
+ drawView(downView.graphics, 0x808080);
+ drawView(overView.graphics, 0xEEEEEE);
+ }
+
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ g.lineStyle(1);
+ g.beginFill(bgColor);
+ g.drawRect(0, 0, 16, 16);
+ g.endFill();
+ g.lineStyle(0);
+ g.beginFill(0);
+ g.moveTo(4, 4);
+ g.lineTo(12, 4);
+ g.lineTo(8, 12);
+ g.lineTo(4, 4);
+ g.endFill();
+ }
+
+ private var _strand:IStrand;
+
+ private var shape:Shape;
+
+ /**
+ * @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;
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 16, 16);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = shape;
+ }
+
+ private var upView:Shape;
+ private var downView:Shape;
+ private var overView:Shape;
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DropDownListView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DropDownListView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DropDownListView.as
new file mode 100644
index 0000000..0849c7a
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DropDownListView.as
@@ -0,0 +1,283 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.DisplayObjectContainer;
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ import flash.display.Sprite;
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.CSSTextField;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IPopUpHost;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IPopUpHost;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The DropDownListView class is the default view for
+ * the org.apache.flex.html.staticControls.DropDownList class.
+ * It displays a simple text label with what appears to be a
+ * down arrow button on the right, but really, the entire
+ * view is the button that will display or dismiss the dropdown.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DropDownListView implements IDropDownListView, IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DropDownListView()
+ {
+ upSprite = new Sprite();
+ downSprite = new Sprite();
+ overSprite = new Sprite();
+ upTextField = new CSSTextField();
+ downTextField = new CSSTextField();
+ overTextField = new CSSTextField();
+ upSprite.addChild(upTextField);
+ overSprite.addChild(overTextField);
+ downSprite.addChild(downTextField);
+ upTextField.border = true;
+ downTextField.border = true;
+ overTextField.border = true;
+ upTextField.background = true;
+ downTextField.background = true;
+ overTextField.background = true;
+ upTextField.borderColor = 0;
+ downTextField.borderColor = 0;
+ overTextField.borderColor = 0;
+ upTextField.backgroundColor = 0xEEEEEE;
+ downTextField.backgroundColor = 0x808080;
+ overTextField.backgroundColor = 0xFFFFFF;
+ upTextField.selectable = false;
+ upTextField.type = TextFieldType.DYNAMIC;
+ downTextField.selectable = false;
+ downTextField.type = TextFieldType.DYNAMIC;
+ overTextField.selectable = false;
+ overTextField.type = TextFieldType.DYNAMIC;
+ //upTextField.autoSize = "left";
+ //downTextField.autoSize = "left";
+ //overTextField.autoSize = "left";
+
+ upArrows = new Shape();
+ overArrows = new Shape();
+ downArrows = new Shape();
+ upSprite.addChild(upArrows);
+ overSprite.addChild(overArrows);
+ downSprite.addChild(downArrows);
+ drawArrows(upArrows, 0xEEEEEE);
+ drawArrows(overArrows, 0xFFFFFF);
+ drawArrows(downArrows, 0x808080);
+
+ }
+
+ private function drawArrows(shape:Shape, color:uint):void
+ {
+ var g:Graphics = shape.graphics;
+ g.beginFill(color);
+ g.drawRect(0, 0, 16, 17);
+ g.endFill();
+ g.beginFill(0);
+ g.moveTo(8, 2);
+ g.lineTo(12, 6);
+ g.lineTo(4, 6);
+ g.lineTo(8, 2);
+ g.endFill();
+ g.beginFill(0);
+ g.moveTo(8, 14);
+ g.lineTo(12, 10);
+ g.lineTo(4, 10);
+ g.lineTo(8, 14);
+ g.endFill();
+ g.lineStyle(1, 0);
+ g.drawRect(0, 0, 16, 17);
+ }
+
+ private var selectionModel:ISelectionModel;
+
+ private var _strand:IStrand;
+
+ private var shape:Shape;
+
+ /**
+ * @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;
+ selectionModel = value.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.addEventListener("selectedIndexChanged", selectionChangeHandler);
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 10, 10);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upSprite;
+ SimpleButton(value).downState = downSprite;
+ SimpleButton(value).overState = overSprite;
+ SimpleButton(value).hitTestState = shape;
+ if (selectionModel.selectedIndex !== -1)
+ text = selectionModel.selectedItem.toString();
+ IEventDispatcher(value).addEventListener("heightChanged", changeHandler);
+ IEventDispatcher(value).addEventListener("widthChanged", changeHandler);
+ changeHandler(null);
+ }
+
+ private function selectionChangeHandler(event:Event):void
+ {
+ text = selectionModel.selectedItem.toString();
+ }
+
+ private function changeHandler(event:Event):void
+ {
+ var ww:Number = DisplayObject(_strand).width;
+ var hh:Number = DisplayObject(_strand).height;
+ upArrows.x = ww - upArrows.width;
+ overArrows.x = ww - overArrows.width;
+ downArrows.x = ww - downArrows.width;
+ upTextField.width = upArrows.x;
+ downTextField.width = downArrows.x;
+ overTextField.width = overArrows.x;
+ upTextField.height = hh;
+ downTextField.height = hh;
+ overTextField.height = hh;
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, ww, hh);
+ shape.graphics.endFill();
+ }
+
+ private var upTextField:CSSTextField;
+ private var downTextField:CSSTextField;
+ private var overTextField:CSSTextField;
+ private var upSprite:Sprite;
+ private var downSprite:Sprite;
+ private var overSprite:Sprite;
+ private var upArrows:Shape;
+ private var downArrows:Shape;
+ private var overArrows:Shape;
+
+ /**
+ * The text that is displayed in the view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return upTextField.text;
+ }
+
+ /**
+ * @private
+ */
+ public function set text(value:String):void
+ {
+ var ww:Number = DisplayObject(_strand).width;
+ var hh:Number = DisplayObject(_strand).height;
+ upTextField.text = value;
+ downTextField.text = value;
+ overTextField.text = value;
+
+ }
+
+ private var _popUp:IStrand;
+
+ /**
+ * The dropdown/popup that displays the set of choices.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get popUp():IStrand
+ {
+ return _popUp;
+ }
+
+ private var _popUpVisible:Boolean;
+
+ /**
+ * A flag that indicates whether the dropdown/popup is
+ * visible.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get popUpVisible():Boolean
+ {
+ return _popUpVisible;
+ }
+
+ /**
+ * @private
+ */
+ public function set popUpVisible(value:Boolean):void
+ {
+ if (value != _popUpVisible)
+ {
+ _popUpVisible = value;
+ if (value)
+ {
+ if (!_popUp)
+ {
+ var popUpClass:Class = ValuesManager.valuesImpl.getValue(_strand, "iPopUp") as Class;
+ _popUp = new popUpClass() as IStrand;
+ }
+ var root:Object = DisplayObject(_strand).root;
+ var host:DisplayObjectContainer = DisplayObject(_strand).parent;
+ while (host && !(host is IPopUpHost))
+ host = host.parent;
+ if (host)
+ IPopUpHost(host).addElement(popUp);
+ }
+ else
+ {
+ DisplayObject(_popUp).parent.removeChild(_popUp as DisplayObject);
+ }
+ }
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IBackgroundBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IBackgroundBead.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IBackgroundBead.as
new file mode 100644
index 0000000..921bc8a
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IBackgroundBead.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import org.apache.flex.core.IBead;
+
+ /**
+ * The IBackgroundBead interface is a marker interface for beads
+ * that draw backgrounds.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IBackgroundBead extends IBead
+ {
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IBorderBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IBorderBead.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IBorderBead.as
new file mode 100644
index 0000000..66115c8
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IBorderBead.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import org.apache.flex.core.IBead;
+
+ /**
+ * The IBackgroundBead interface is a marker interface for beads
+ * that draw backgrounds.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IBorderBead extends IBead
+ {
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IComboBoxView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IComboBoxView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IComboBoxView.as
new file mode 100644
index 0000000..dc4ceb7
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IComboBoxView.as
@@ -0,0 +1,78 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+
+ /**
+ * The IComboBoxView interface provides the protocol for any bead that
+ * creates the visual parts for a org.apache.flex.html.staticControls.ComboBox control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IComboBoxView extends IBeadView
+ {
+ /**
+ * The string appearing in the input area for the ComboBox.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get text():String;
+ function set text(value:String):void;
+
+ /**
+ * The HTML string appearing in the input area for the ComboBox.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get html():String;
+ function set html(value:String):void;
+
+ /**
+ * The component housing the selection list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get popUp():IStrand;
+
+ /**
+ * Determines whether or not the pop-up with the selection list is visible or not.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get popUpVisible():Boolean;
+ function set popUpVisible(value:Boolean):void;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IDropDownListView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IDropDownListView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IDropDownListView.as
new file mode 100644
index 0000000..ca865bc
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IDropDownListView.as
@@ -0,0 +1,57 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+
+ /**
+ * The IDropDownListView interface is the interface for views for
+ * the org.apache.flex.html.staticControls.DropDownList.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IDropDownListView extends IBeadView
+ {
+
+ /**
+ * @copy org.apache.flex.html.staticControls.beads.DropDownListView#popup
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get popUp():IStrand;
+
+ /**
+ * @copy org.apache.flex.html.staticControls.beads.DropDownListView#popupVisible
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get popUpVisible():Boolean;
+ function set popUpVisible(value:Boolean):void;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IGraphicsDrawing.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IGraphicsDrawing.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IGraphicsDrawing.as
new file mode 100644
index 0000000..e19f7f6
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IGraphicsDrawing.as
@@ -0,0 +1,36 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ /**
+ * The IGraphicsDrawing interface is a marker interface for beads
+ * that draw into the graphics layer. This helps a bead determine
+ * if it is the first of many graphics drawing beads so it can
+ * know whether or not to clear the graphics layer before drawing.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IGraphicsDrawing
+ {
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IListView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IListView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IListView.as
new file mode 100644
index 0000000..6b53e18
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IListView.as
@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.IStrand;
+
+ /**
+ * The IListView interface provides the protocol for any bead that
+ * creates the visual parts for a org.apache.flex.html.staticControls.List control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IListView
+ {
+ /**
+ * The component which parents all of the itemRenderers for each
+ * datum being displayed by the List component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get dataGroup():IItemRendererParent;
+
+ /**
+ * The host component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get strand():IStrand;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IScrollBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IScrollBarView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IScrollBarView.as
new file mode 100644
index 0000000..0ccfac2
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IScrollBarView.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.html.staticControls.beads
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+
+ /**
+ * The IScrollBarView interface is the interface for views for
+ * the org.apache.flex.html.staticControls.supportClasses.ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IScrollBarView
+ {
+ /**
+ * The down arrow button in a vertical ScrollBar or right arrow
+ * button in a horizontal ScrollBar
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get increment():DisplayObject;
+
+ /**
+ * The up arrow button in a vertical ScrollBar or left arrow
+ * button in a horizontal ScrollBar
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get decrement():DisplayObject;
+
+ /**
+ * The track in a ScrollBar
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get track():DisplayObject;
+
+ /**
+ * The thumb in a ScrollBar
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get thumb():DisplayObject;
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ISliderView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ISliderView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ISliderView.as
new file mode 100644
index 0000000..aa2b912
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ISliderView.as
@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.IBead;
+
+ /**
+ * The ISliderView interface provides the protocol for any bead that
+ * creates the visual parts for a org.apache.flex.html.staticControls.Slider control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface ISliderView extends IBead
+ {
+ /**
+ * The component used for the track area of the org.apache.flex.html.staticControls.Slider.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get track():DisplayObject;
+
+ /**
+ * The component used for the thumb button of the org.apache.flex.html.staticControls.Slider.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get thumb():DisplayObject;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ISpinnerView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ISpinnerView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ISpinnerView.as
new file mode 100644
index 0000000..4ef5f81
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ISpinnerView.as
@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.IBead;
+
+ /**
+ * The ISpinnerView interface provides the protocol for any bead that
+ * creates the visual parts for a org.apache.flex.html.staticControls.Spinner control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface ISpinnerView extends IBead
+ {
+ /**
+ * The component used to increment the org.apache.flex.html.staticControls.Spinner value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get increment():DisplayObject;
+
+ /**
+ * The component used to decrement the org.apache.flex.html.staticControls.Spinner value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get decrement():DisplayObject;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ITextFieldView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ITextFieldView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ITextFieldView.as
new file mode 100644
index 0000000..f9bff0b
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ITextFieldView.as
@@ -0,0 +1,44 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import org.apache.flex.core.CSSTextField;
+
+ /**
+ * The ITextFieldView interface is the interface for views for
+ * the use a CSSTextField to display text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface ITextFieldView
+ {
+ /**
+ * The org.apache.flex.core.CSSTextField used to display text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get textField():CSSTextField;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ITextItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ITextItemRenderer.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ITextItemRenderer.as
new file mode 100644
index 0000000..0e86593
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ITextItemRenderer.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.staticControls.beads
+{
+ import org.apache.flex.core.IItemRenderer;
+
+ /**
+ * The ITextItemRenderer interface is the interface for
+ * for org.apache.flex.core.IItemRenderer that display text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface ITextItemRenderer extends IItemRenderer
+ {
+ /**
+ * The text to be displayed in the item renderer.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get text():String;
+ function set text(value:String):void;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ImageView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ImageView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ImageView.as
new file mode 100644
index 0000000..3b12779
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ImageView.as
@@ -0,0 +1,121 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import flash.display.Bitmap;
+ import flash.display.Loader;
+ import flash.display.LoaderInfo;
+ import flash.net.URLRequest;
+
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IImageModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The ImageView class creates the visual elements of the org.apache.flex.html.staticControls.Image component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ImageView implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ImageView()
+ {
+ }
+
+ private var bitmap:Bitmap;
+ private var loader:Loader;
+
+ private var _strand:IStrand;
+ private var _model:IImageModel;
+
+ /**
+ * @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(_strand).addEventListener("widthChanged",handleSizeChange);
+ IEventDispatcher(_strand).addEventListener("heightChanged",handleSizeChange);
+
+ _model = value.getBeadByType(IImageModel) as IImageModel;
+ _model.addEventListener("urlChanged",handleUrlChange);
+
+ handleUrlChange(null);
+ }
+
+ /**
+ * @private
+ */
+ private function handleUrlChange(event:Event):void
+ {
+ if (_model.source) {
+ loader = new Loader();
+ loader.contentLoaderInfo.addEventListener("complete",onComplete);
+ loader.load(new URLRequest(_model.source));
+ }
+ }
+
+ /**
+ * @private
+ */
+ private function onComplete(event:Object):void
+ {
+ if (bitmap) {
+ UIBase(_strand).removeChild(bitmap);
+ }
+
+ bitmap = Bitmap(LoaderInfo(event.target).content);
+
+ UIBase(_strand).addChild(bitmap);
+
+ handleSizeChange(null);
+ }
+
+ /**
+ * @private
+ */
+ private function handleSizeChange(event:Object):void
+ {
+ if (bitmap) {
+ bitmap.width = UIBase(_strand).width;
+ bitmap.height = UIBase(_strand).height;
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ListView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ListView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ListView.as
new file mode 100644
index 0000000..ff86d64
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ListView.as
@@ -0,0 +1,260 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.DisplayObjectContainer;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IItemRenderer;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.ILayoutParent;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.IRollOverModel;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.Strand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.staticControls.beads.models.ScrollBarModel;
+ import org.apache.flex.html.staticControls.beads.models.SingleLineBorderModel;
+ import org.apache.flex.html.staticControls.supportClasses.Border;
+ import org.apache.flex.html.staticControls.supportClasses.NonVirtualDataGroup;
+ import org.apache.flex.html.staticControls.supportClasses.ScrollBar;
+
+ /**
+ * The List class creates the visual elements of the org.apache.flex.html.staticControls.List
+ * component. A List consists of the area to display the data (in the dataGroup), any
+ * scrollbars, and so forth.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ListView extends Strand implements IBeadView, IStrand, IListView, ILayoutParent
+ {
+ public function ListView()
+ {
+ }
+
+ private var listModel:ISelectionModel;
+
+ private var _border:Border;
+
+ /**
+ * The border surrounding the org.apache.flex.html.staticControls.List.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get border():Border
+ {
+ return _border;
+ }
+
+ private var _dataGroup:IItemRendererParent;
+
+ /**
+ * The area holding the itemRenderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataGroup():IItemRendererParent
+ {
+ return _dataGroup;
+ }
+
+ private var _vScrollBar:ScrollBar;
+
+ /**
+ * The vertical org.apache.flex.html.staticControls.ScrollBar, if needed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get vScrollBar():ScrollBar
+ {
+ if (!_vScrollBar)
+ _vScrollBar = createScrollBar();
+ return _vScrollBar;
+ }
+
+ /**
+ * The horizontal org.apache.flex.html.staticControls.ScrollBar, currently null.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get hScrollBar():ScrollBar
+ {
+ return null;
+ }
+
+ /**
+ * The contentArea includes the dataGroup and scrollBars.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get contentView():DisplayObjectContainer
+ {
+ return _dataGroup as DisplayObjectContainer;
+ }
+
+ /**
+ * @private
+ */
+ public function get resizableView():DisplayObject
+ {
+ return _strand as DisplayObject;
+ }
+
+ 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 get strand():IStrand
+ {
+ return _strand;
+ }
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ IEventDispatcher(_strand).addEventListener("widthChanged", handleSizeChange);
+ IEventDispatcher(_strand).addEventListener("heightChanged",handleSizeChange);
+
+ listModel = value.getBeadByType(ISelectionModel) as ISelectionModel;
+ listModel.addEventListener("selectedIndexChanged", selectionChangeHandler);
+ listModel.addEventListener("rollOverIndexChanged", rollOverIndexChangeHandler);
+
+ _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);
+
+ _dataGroup = new NonVirtualDataGroup();
+ IParent(_strand).addElement(_dataGroup);
+
+ if (_strand.getBeadByType(IBeadLayout) == null)
+ {
+ var mapper:IBeadLayout = new (ValuesManager.valuesImpl.getValue(_strand, "iBeadLayout")) as IBeadLayout;
+ strand.addBead(mapper);
+ }
+
+ handleSizeChange(null);
+ }
+
+ private var lastSelectedIndex:int = -1;
+
+ /**
+ * @private
+ */
+ private function selectionChangeHandler(event:Event):void
+ {
+ if (lastSelectedIndex != -1)
+ {
+ var ir:IItemRenderer = dataGroup.getItemRendererForIndex(lastSelectedIndex) as IItemRenderer;
+ ir.selected = false;
+ }
+ if (listModel.selectedIndex != -1)
+ {
+ ir = dataGroup.getItemRendererForIndex(listModel.selectedIndex);
+ ir.selected = true;
+ }
+ lastSelectedIndex = listModel.selectedIndex;
+ }
+
+ private var lastRollOverIndex:int = -1;
+
+ /**
+ * @private
+ */
+ private function rollOverIndexChangeHandler(event:Event):void
+ {
+ if (lastRollOverIndex != -1)
+ {
+ var ir:IItemRenderer = dataGroup.getItemRendererForIndex(lastRollOverIndex) as IItemRenderer;
+ ir.hovered = false;
+ }
+ if (IRollOverModel(listModel).rollOverIndex != -1)
+ {
+ ir = dataGroup.getItemRendererForIndex(IRollOverModel(listModel).rollOverIndex);
+ ir.hovered = true;
+ }
+ lastRollOverIndex = IRollOverModel(listModel).rollOverIndex;
+ }
+
+ /**
+ * @private
+ */
+ private function createScrollBar():ScrollBar
+ {
+ var vsb:ScrollBar;
+ vsb = new ScrollBar();
+ var vsbm:ScrollBarModel = new ScrollBarModel();
+ vsbm.maximum = 100;
+ vsbm.minimum = 0;
+ vsbm.pageSize = 10;
+ vsbm.pageStepSize = 10;
+ vsbm.snapInterval = 1;
+ vsbm.stepSize = 1;
+ vsbm.value = 0;
+ vsb.model = vsbm;
+ vsb.width = 16;
+ IParent(_strand).addElement(vsb);
+ return vsb;
+ }
+
+ /**
+ * @private
+ */
+ private function handleSizeChange(event:Event):void
+ {
+ UIBase(_dataGroup).x = 0;
+ UIBase(_dataGroup).y = 0;
+ UIBase(_dataGroup).width = UIBase(_strand).width;
+ UIBase(_dataGroup).height = UIBase(_strand).height;
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/NumericStepperView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/NumericStepperView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/NumericStepperView.as
new file mode 100644
index 0000000..600e50c
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/NumericStepperView.as
@@ -0,0 +1,216 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.staticControls.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.DisplayObjectContainer;
+
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.ILayoutParent;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.IRangeModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.createjs.staticControls.Label;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.staticControls.Spinner;
+ import org.apache.flex.html.staticControls.TextInput;
+ import org.apache.flex.html.staticControls.beads.layouts.NonVirtualHorizontalLayout;
+ import org.apache.flex.html.staticControls.supportClasses.Border;
+ import org.apache.flex.html.staticControls.supportClasses.ScrollBar;
+
+ /**
+ * The NumericStepperView class creates the visual elements of the
+ * org.apache.flex.html.staticControls.NumericStepper component. A NumberStepper consists of a
+ * org.apache.flex.html.staticControls.TextInput component to display the value and a
+ * org.apache.flex.html.staticControls.Spinner to change the value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class NumericStepperView implements IBeadView, ILayoutParent
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function NumericStepperView()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ private var label:Label;
+ private var input:TextInput;
+ private var spinner:Spinner;
+
+ /**
+ * @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;
+
+ // add a horizontal layout bead
+ value.addBead(new NonVirtualHorizontalLayout());
+
+ // add an input field
+ input = new TextInput();
+ IParent(value).addElement(input);
+
+ // add a spinner
+ spinner = new Spinner();
+ spinner.addBead( UIBase(value).model );
+ IParent(value).addElement(spinner);
+ spinner.width = 17;
+ input.height = spinner.height; // should be spinner.height = input.height but the spinner buttons won't get small enough
+
+ // listen for changes to the text input field which will reset the
+ // value. ideally, we should either set the input to accept only
+ // numeric values or, barring that, reject non-numeric entries. we
+ // cannot do that right now however.
+ input.model.addEventListener("textChange",inputChangeHandler);
+
+ // listen for change events on the spinner so the value can be updated as
+ // as resizing the component
+ spinner.addEventListener("valueChanged",spinnerValueChanged);
+ IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler);
+ IEventDispatcher(value).addEventListener("heightChanged",sizeChangeHandler);
+
+ // listen for changes to the model itself and update the UI accordingly
+ IEventDispatcher(UIBase(value).model).addEventListener("valueChange",modelChangeHandler);
+ IEventDispatcher(UIBase(value).model).addEventListener("minimumChange",modelChangeHandler);
+ IEventDispatcher(UIBase(value).model).addEventListener("maximumChange",modelChangeHandler);
+ IEventDispatcher(UIBase(value).model).addEventListener("stepSizeChange",modelChangeHandler);
+ IEventDispatcher(UIBase(value).model).addEventListener("snapIntervalChange",modelChangeHandler);
+
+ input.text = String(spinner.value);
+
+ // set a default size which will trigger the sizeChangeHandler
+ var minWidth:Number = Math.max(50+spinner.width,UIBase(value).width);
+
+ UIBase(value).width = minWidth;
+ UIBase(value).height = spinner.height;
+ }
+
+ /**
+ * @private
+ */
+ private function sizeChangeHandler(event:Event) : void
+ {
+ input.x = 2;
+ input.y = (UIBase(_strand).height - input.height)/2;
+ input.width = UIBase(_strand).width-spinner.width-2;
+ spinner.x = input.width+2;
+ spinner.y = 0;
+ }
+
+ /**
+ * @private
+ */
+ private function spinnerValueChanged(event:Event) : void
+ {
+ input.text = String(spinner.value);
+
+ var newEvent:Event = new Event(event.type,event.bubbles);
+ IEventDispatcher(_strand).dispatchEvent(newEvent);
+ }
+
+ /**
+ * @private
+ */
+ private function inputChangeHandler(event:Event) : void
+ {
+ var newValue:Number = Number(input.text);
+
+ if( !isNaN(newValue) ) {
+ spinner.value = newValue;
+ }
+ else {
+ input.text = String(spinner.value);
+ }
+ }
+
+ /**
+ * @private
+ */
+ private function modelChangeHandler( event:Event ) : void
+ {
+ var n:Number = IRangeModel(UIBase(_strand).model).value;
+ input.text = String(IRangeModel(UIBase(_strand).model).value);
+ }
+
+ /**
+ * The area containing the TextInput and Spinner controls.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get contentView():DisplayObjectContainer
+ {
+ return _strand as DisplayObjectContainer;
+ }
+
+ /**
+ * @private
+ */
+ public function get border():Border
+ {
+ return null;
+ }
+
+ /**
+ * @private
+ */
+ public function get vScrollBar():ScrollBar
+ {
+ return null;
+ }
+
+ /**
+ * @private
+ */
+ public function get hScrollBar():ScrollBar
+ {
+ return null;
+ }
+
+ /**
+ * @private
+ */
+ public function get resizableView():DisplayObject
+ {
+ return _strand as DisplayObject;
+ }
+ }
+}
\ No newline at end of file