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:47 UTC
[15/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/TextInputWithBorderView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextInputWithBorderView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextInputWithBorderView.as
new file mode 100644
index 0000000..4fd1566
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextInputWithBorderView.as
@@ -0,0 +1,79 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.html.staticControls.supportClasses.Border;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The TextInputWithBorderView class is the default view for
+ * the org.apache.flex.html.staticControls.TextInput.
+ * It displays text using a TextField, so there is no
+ * right-to-left text support in this view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextInputWithBorderView extends TextInputView
+ {
+ public function TextInputWithBorderView()
+ {
+ super();
+ }
+
+ private var _border:Border;
+
+ /**
+ * @private
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ // add a border to this
+ _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);
+
+ IEventDispatcher(strand).addEventListener("widthChanged", sizeChangedHandler);
+ IEventDispatcher(strand).addEventListener("heightChanged", sizeChangedHandler);
+ sizeChangedHandler(null);
+ }
+
+ private function sizeChangedHandler(event:Event):void
+ {
+ var ww:Number = DisplayObject(strand).width;
+ _border.width = ww;
+
+ var hh:Number = DisplayObject(strand).height;
+ _border.height = hh;
+ }
+ }
+}
\ 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/TextItemRendererFactoryForArrayData.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextItemRendererFactoryForArrayData.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextItemRendererFactoryForArrayData.as
new file mode 100644
index 0000000..7f3ecb0
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextItemRendererFactoryForArrayData.as
@@ -0,0 +1,141 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.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 TextItemRendererFactoryForArrayData class is the
+ * IDataProviderItemRendererMapper for creating
+ * ITextItemRenderers and assigning them data from an array.
+ * Other IDataProviderItemRendererMapper implementations
+ * assign specific array or vector types to item
+ * renderers expecting those types.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextItemRendererFactoryForArrayData implements IBead, IDataProviderItemRendererMapper
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextItemRendererFactoryForArrayData()
+ {
+ }
+
+ 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;
+
+ /**
+ * An IItemRendererClassFactory that should generate ITextItemRenderers
+ *
+ * @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 IItemRendererParent that should parent the ITextItemRenderers
+ *
+ * @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 tf:ITextItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ITextItemRenderer;
+ tf.index = i;
+ dataGroup.addElement(tf);
+ tf.text = 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/TextItemRendererFactoryForStringVectorData.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextItemRendererFactoryForStringVectorData.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextItemRendererFactoryForStringVectorData.as
new file mode 100644
index 0000000..7e5f41f
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextItemRendererFactoryForStringVectorData.as
@@ -0,0 +1,128 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.IItemRendererClassFactory;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The TextItemRendererFactoryForStringVectorData class is the
+ * IDataProviderItemRendererMapper for creating
+ * ITextItemRenderers and assigning them data from an vector
+ * of Strings. Other IDataProviderItemRendererMapper implementations
+ * assign specific array or vector types to item
+ * renderers expecting those types.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextItemRendererFactoryForStringVectorData implements IBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextItemRendererFactoryForStringVectorData()
+ {
+ }
+
+ 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("dataProviderChange", dataProviderChangeHandler);
+ dataProviderChangeHandler(null);
+ }
+
+ private var _itemRendererFactory:IItemRendererClassFactory;
+
+ /**
+ * An IItemRendererClassFactory that should generate ITextItemRenderers
+ *
+ * @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 IItemRendererParent that should parent the ITextItemRenderers
+ *
+ * @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:Vector.<String> = selectionModel.dataProvider as Vector.<String>;
+
+ dataGroup.removeAllElements();
+
+ var n:int = dp.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var tf:ITextItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ITextItemRenderer;
+ tf.index = i;
+ dataGroup.addElement(tf);
+ tf.text = dp[i];
+ }
+ }
+
+ }
+}
\ 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/TitleBarMeasurementBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TitleBarMeasurementBead.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TitleBarMeasurementBead.as
new file mode 100644
index 0000000..9976ea6
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TitleBarMeasurementBead.as
@@ -0,0 +1,106 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.IMeasurementBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.html.staticControls.TitleBar;
+
+ /**
+ * The TitleBarMeasurementBead class measures the overall size of a
+ * org.apache.flex.html.staticControls.TitleBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TitleBarMeasurementBead implements IMeasurementBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TitleBarMeasurementBead()
+ {
+ }
+
+ /**
+ * The overall width of the org.apache.flex.html.staticControls.TitleBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measuredWidth():Number
+ {
+ var mwidth:Number = 0;
+ var titleBar:TitleBar = _strand as TitleBar;
+ var labelMeasure:IMeasurementBead = titleBar.titleLabel.measurementBead;
+ mwidth = labelMeasure.measuredWidth;
+ if( titleBar.showCloseButton ) {
+ var buttonMeasure:IMeasurementBead = titleBar.closeButton.measurementBead;
+ mwidth += buttonMeasure.measuredWidth;
+ }
+ return mwidth;
+ }
+
+ /**
+ * The overall height of the org.apache.flex.html.staticControls.TitleBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measuredHeight():Number
+ {
+ var mheight:Number = 0;
+ var titleBar:TitleBar = _strand as TitleBar;
+ var labelMeasure:IMeasurementBead = titleBar.titleLabel.measurementBead;
+ mheight = labelMeasure.measuredHeight;
+ if( titleBar.showCloseButton ) {
+ var buttonMeasure:IMeasurementBead = titleBar.closeButton.measurementBead;
+ mheight = Math.max(mheight,buttonMeasure.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/UpArrowButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/UpArrowButtonView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/UpArrowButtonView.as
new file mode 100644
index 0000000..6ef6efb
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/UpArrowButtonView.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 UpArrowButtonView class is the view for
+ * the up 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 UpArrowButtonView implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function UpArrowButtonView()
+ {
+ 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, 12);
+ g.lineTo(12, 12);
+ g.lineTo(8, 4);
+ g.lineTo(4, 12);
+ 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/VScrollBarThumbView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/VScrollBarThumbView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/VScrollBarThumbView.as
new file mode 100644
index 0000000..c147a50
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/VScrollBarThumbView.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.staticControls.beads
+{
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The VScrollBarThumbView class is the view for
+ * the thumb button in a Vertical ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VScrollBarThumbView implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VScrollBarThumbView()
+ {
+ }
+
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ var hh:Number = DisplayObject(_strand).height;
+ g.clear();
+ g.lineStyle(1);
+ g.beginFill(bgColor);
+ g.drawRect(0, 0, 16, hh);
+ g.endFill();
+ hh = Math.round(hh / 2);
+ g.moveTo(4, hh);
+ g.lineTo(12, hh);
+ g.moveTo(4, hh - 4);
+ g.lineTo(12, hh - 4);
+ g.moveTo(4, hh + 4);
+ g.lineTo(12, hh + 4);
+ }
+
+ 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;
+
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ drawView(upView.graphics, 0xCCCCCC);
+ drawView(downView.graphics, 0x808080);
+ drawView(overView.graphics, 0xEEEEEE);
+
+ 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;
+ IEventDispatcher(_strand).addEventListener("heightChanged", heightChangedHandler);
+ }
+
+ private function heightChangedHandler(event:Event):void
+ {
+ DisplayObject(_strand).scaleY = 1.0;
+ DisplayObject(_strand).scaleX = 1.0;
+
+ var hh:Number = DisplayObject(_strand).height;
+ drawView(upView.graphics, 0xCCCCCC);
+ drawView(downView.graphics, 0x808080);
+ drawView(overView.graphics, 0xEEEEEE);
+
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 16, hh);
+ shape.graphics.endFill();
+ }
+
+ 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/VScrollBarTrackView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/VScrollBarTrackView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/VScrollBarTrackView.as
new file mode 100644
index 0000000..7f9dc8d
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/VScrollBarTrackView.as
@@ -0,0 +1,112 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.staticControls.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The VScrollBarTrackView class is the view for
+ * the track in a Vertical ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VScrollBarTrackView implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VScrollBarTrackView()
+ {
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ }
+
+ private function drawView(g:Graphics, bgColor:uint, h:Number):void
+ {
+ g.clear();
+ g.lineStyle(1);
+ g.beginFill(bgColor);
+ g.drawRect(0, 0, 16, h);
+ g.endFill();
+ g.lineStyle(0);
+ }
+
+ private function heightChangeHandler(event:Event):void
+ {
+ DisplayObject(_strand).scaleY = 1.0;
+ DisplayObject(_strand).scaleX = 1.0;
+
+ var h:Number = SimpleButton(_strand).height;
+
+ drawView(upView.graphics, 0xCCCCCC, h);
+ drawView(downView.graphics, 0x808080, h);
+ drawView(overView.graphics, 0xEEEEEE, h);
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 16, h);
+ shape.graphics.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;
+ SimpleButton(value).addEventListener("heightChanged", heightChangeHandler);
+ shape = new Shape();
+ 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/controllers/AlertController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/AlertController.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/AlertController.as
new file mode 100644
index 0000000..7622b54
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/AlertController.as
@@ -0,0 +1,88 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.controllers
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The AlertControler class bead handles the close event on the org.apache.flex.html.staticControls.Alert
+ * by removing the org.apache.flex.html.staticControls.Alert from the display.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class AlertController implements IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function AlertController()
+ {
+ }
+
+ 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;
+ }
+
+ /**
+ * @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("close",handleAlertClose);
+ }
+
+ /**
+ * @private
+ */
+ private function handleAlertClose(event:Event):void
+ {
+ DisplayObject(_strand).parent.removeChild(DisplayObject(_strand));
+ }
+ }
+}
\ 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/controllers/ButtonAutoRepeatController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ButtonAutoRepeatController.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ButtonAutoRepeatController.as
new file mode 100644
index 0000000..70b2348
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ButtonAutoRepeatController.as
@@ -0,0 +1,147 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.controllers
+{
+ import flash.events.MouseEvent;
+ import flash.utils.clearInterval;
+ import flash.utils.clearTimeout;
+ import flash.utils.setInterval;
+ import flash.utils.setTimeout;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The ButtonAutoRepeatController class adds autorepeat
+ * functionality to a button. This version is simply waits
+ * a specified amount of time (default is 250ms), then repeats the button
+ * event at a specified interval, which defaults to
+ * 125 milliseconds. Alternate implementations could
+ * have non-linear repeat timing, look for keyboard modifiers to choose
+ * different rates, etc.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ButtonAutoRepeatController implements IBead, IBeadController
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ButtonAutoRepeatController()
+ {
+ }
+
+ 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(MouseEvent.MOUSE_DOWN, mouseDownHandler);
+ }
+
+ /**
+ * The number of milliseconds to wait before repeating the event
+ * for the first time.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var delay:int = 250;
+
+ /**
+ * The number of milliseconds to wait before repeating the event
+ * after the first time. This value is not checked for
+ * changes after the events start repeating.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var interval:int = 100;
+
+ private var timeout:uint;
+ private var repeater:uint;
+
+ private function mouseDownHandler(event:MouseEvent):void
+ {
+ event.target.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
+ event.target.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ timeout = setTimeout(sendFirstRepeat, delay);
+ }
+
+ private function mouseOutHandler(event:MouseEvent):void
+ {
+ event.target.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
+ event.target.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ if (repeater > 0)
+ clearInterval(repeater);
+ repeater = 0;
+ if (timeout > 0)
+ clearTimeout(timeout);
+ timeout = 0;
+ }
+
+ private function mouseUpHandler(event:MouseEvent):void
+ {
+ event.target.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
+ event.target.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ if (repeater > 0)
+ clearInterval(repeater);
+ repeater = 0;
+ if (timeout > 0)
+ clearTimeout(timeout);
+ timeout = 0;
+ }
+
+ private function sendFirstRepeat():void
+ {
+ clearTimeout(timeout);
+ timeout = 0;
+ repeater = setInterval(sendRepeats, interval);
+ IEventDispatcher(_strand).dispatchEvent(new Event("buttonRepeat"));
+ }
+
+ private function sendRepeats():void
+ {
+ IEventDispatcher(_strand).dispatchEvent(new Event("buttonRepeat"));
+ }
+ }
+}
\ 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/controllers/ComboBoxController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ComboBoxController.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ComboBoxController.as
new file mode 100644
index 0000000..1f333ef
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ComboBoxController.as
@@ -0,0 +1,104 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.controllers
+{
+ import flash.display.DisplayObject;
+ import flash.events.MouseEvent;
+
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.staticControls.beads.IComboBoxView;
+
+ /**
+ * The ComboBoxController class bead handles mouse events on the elements of
+ * the org.apache.flex.html.staticControls.ComboBox. This includes selecting the
+ * button to display the selection list pop-up as well as selecting an item from the
+ * pop-up list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ComboBoxController implements IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ComboBoxController()
+ {
+ }
+
+ 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(MouseEvent.CLICK, clickHandler);
+ }
+
+ /**
+ * @private
+ */
+ private function clickHandler(event:MouseEvent):void
+ {
+ var viewBead:IComboBoxView = _strand.getBeadByType(IComboBoxView) as IComboBoxView;
+ viewBead.popUpVisible = true;
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ var popUpModel:ISelectionModel = viewBead.popUp.getBeadByType(ISelectionModel) as ISelectionModel;
+ popUpModel.dataProvider = selectionModel.dataProvider;
+ popUpModel.selectedIndex = selectionModel.selectedIndex;
+ DisplayObject(viewBead.popUp).width = DisplayObject(_strand).width;
+ DisplayObject(viewBead.popUp).height = 200;
+ DisplayObject(viewBead.popUp).x = DisplayObject(_strand).x;
+ DisplayObject(viewBead.popUp).y = DisplayObject(_strand).y;
+ IEventDispatcher(viewBead.popUp).addEventListener("change", changeHandler);
+ }
+
+ /**
+ * @private
+ */
+ private function changeHandler(event:Event):void
+ {
+ var viewBead:IComboBoxView = _strand.getBeadByType(IComboBoxView) as IComboBoxView;
+ viewBead.popUpVisible = false;
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ var popUpModel:ISelectionModel = viewBead.popUp.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.selectedIndex = popUpModel.selectedIndex;
+ IEventDispatcher(_strand).dispatchEvent(new Event("change"));
+ }
+
+ }
+}
\ 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/controllers/DropDownListController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/DropDownListController.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/DropDownListController.as
new file mode 100644
index 0000000..47287be
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/DropDownListController.as
@@ -0,0 +1,104 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.controllers
+{
+ import flash.display.DisplayObject;
+ import flash.geom.Point;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.staticControls.beads.IDropDownListView;
+
+ /**
+ * The DropDownListController class is the controller for
+ * org.apache.flex.html.staticControls.DropDownList. Controllers
+ * watch for events from the interactive portions of a View and
+ * update the data model or dispatch a semantic event.
+ * This controller watches for the click event and displays the
+ * dropdown/popup, and watches the dropdown/popup for change events
+ * and updates the selection model accordingly.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DropDownListController implements IBead, IBeadController
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DropDownListController()
+ {
+ }
+
+ 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("click", clickHandler);
+ }
+
+ private function clickHandler(event:Event):void
+ {
+ var viewBead:IDropDownListView = _strand.getBeadByType(IDropDownListView) as IDropDownListView;
+ viewBead.popUpVisible = true;
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ var popUpModel:ISelectionModel = viewBead.popUp.getBeadByType(ISelectionModel) as ISelectionModel;
+ popUpModel.dataProvider = selectionModel.dataProvider;
+ popUpModel.selectedIndex = selectionModel.selectedIndex;
+ DisplayObject(viewBead.popUp).width = DisplayObject(_strand).width;
+ DisplayObject(viewBead.popUp).height = 200;
+ var pt:Point = new Point(DisplayObject(_strand).x, DisplayObject(_strand).y);
+ pt = DisplayObject(_strand).parent.localToGlobal(pt);
+ DisplayObject(viewBead.popUp).x = pt.x;
+ DisplayObject(viewBead.popUp).y = pt.y;
+ IEventDispatcher(viewBead.popUp).addEventListener("change", changeHandler);
+ }
+
+ private function changeHandler(event:Event):void
+ {
+ var viewBead:IDropDownListView = _strand.getBeadByType(IDropDownListView) as IDropDownListView;
+ viewBead.popUpVisible = false;
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ var popUpModel:ISelectionModel = viewBead.popUp.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.selectedIndex = popUpModel.selectedIndex;
+ IEventDispatcher(_strand).dispatchEvent(new Event("change"));
+ }
+
+ }
+}
\ 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/controllers/EditableTextKeyboardController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/EditableTextKeyboardController.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/EditableTextKeyboardController.as
new file mode 100644
index 0000000..01f8e9f
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/EditableTextKeyboardController.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.staticControls.beads.controllers
+{
+ import org.apache.flex.core.CSSTextField;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.html.staticControls.beads.ITextFieldView;
+
+ /**
+ * The EditableTextKeyboardController class bead intercepts keyboard events on the
+ * component's text field and emits change events.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class EditableTextKeyboardController implements IBead, IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function EditableTextKeyboardController()
+ {
+ }
+
+ private var model:ITextModel;
+ private var textField:CSSTextField;
+
+ 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;
+
+ model = UIBase(_strand).model as ITextModel;
+
+ var viewBead:ITextFieldView = _strand.getBeadByType(ITextFieldView) as ITextFieldView;
+ textField = viewBead.textField;
+ textField.addEventListener("change", inputChangeHandler);
+ }
+
+ /**
+ * @private
+ */
+ private function inputChangeHandler( event:Object ) : void
+ {
+ // this will otherwise bubble an event of flash.events.Event
+ event.stopImmediatePropagation();
+ model.text = textField.text;
+ }
+ }
+}
\ 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/controllers/ItemRendererMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
new file mode 100644
index 0000000..d72bbdb
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
@@ -0,0 +1,126 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.controllers
+{
+ import flash.events.MouseEvent;
+
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IItemRenderer;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The ItemRendererMouseController class bead handles mouse events in itemRenderers. This
+ * includes roll-overs, mouse down, and mouse up. These platform-specific events are then
+ * re-dispatched as FlexJS events.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ItemRendererMouseController implements IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ItemRendererMouseController()
+ {
+ }
+
+ private var renderer:IItemRenderer;
+ 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;
+ renderer = value as IItemRenderer;
+ renderer.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler);
+ renderer.addEventListener(MouseEvent.ROLL_OUT, rollOutHandler);
+ renderer.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
+ }
+
+ /**
+ * @private
+ */
+ protected function rollOverHandler(event:MouseEvent):void
+ {
+ var target:IItemRenderer = event.target as IItemRenderer;
+ if (target)
+ {
+ target.hovered = true;
+ target.dispatchEvent(new Event("rollover",true));
+ }
+ }
+
+ /**
+ * @private
+ */
+ protected function rollOutHandler(event:MouseEvent):void
+ {
+ var target:IItemRenderer = event.target as IItemRenderer;
+ if (target)
+ {
+ target.hovered = false;
+ target.down = false;
+ }
+ }
+
+ /**
+ * @private
+ */
+ protected function mouseDownHandler(event:MouseEvent):void
+ {
+ var target:IItemRenderer = event.currentTarget as IItemRenderer;
+ if (target)
+ {
+ target.down = true;
+ target.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ }
+ }
+
+ /**
+ * @private
+ */
+ protected function mouseUpHandler(event:MouseEvent):void
+ {
+ var target:IItemRenderer = event.currentTarget as IItemRenderer;
+ if (target)
+ {
+ target.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ target.selected = true;
+ target.dispatchEvent(new Event("selected"));
+ }
+ }
+
+ }
+}
\ 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/controllers/ListSingleSelectionMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as
new file mode 100644
index 0000000..fe5dfa1
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as
@@ -0,0 +1,124 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.controllers
+{
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IItemRenderer;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.IRollOverModel;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.staticControls.beads.IListView;
+
+
+ /**
+ * The ListSingleSelectionMouseController class is a controller for
+ * org.apache.flex.html.staticControls.List. Controllers
+ * watch for events from the interactive portions of a View and
+ * update the data model or dispatch a semantic event.
+ * This controller watches for events from the item renderers
+ * and updates an ISelectionModel (which only supports single
+ * selection). Other controller/model pairs would support
+ * various kinds of multiple selection.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ListSingleSelectionMouseController implements IBeadController
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ListSingleSelectionMouseController()
+ {
+ }
+
+ /**
+ * The model.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var listModel:ISelectionModel;
+
+ /**
+ * The view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var listView:IListView;
+
+ /**
+ * The parent of the item renderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var dataGroup:IItemRendererParent;
+
+ 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;
+ listModel = value.getBeadByType(ISelectionModel) as ISelectionModel;
+ listView = value.getBeadByType(IListView) as IListView;
+ dataGroup = listView.dataGroup;
+ dataGroup.addEventListener("selected", selectedHandler, true);
+ dataGroup.addEventListener("rollover", rolloverHandler, true);
+ }
+
+ private function selectedHandler(event:Event):void
+ {
+ listModel.selectedIndex = IItemRenderer(event.target).index;
+ IEventDispatcher(listView.strand).dispatchEvent(new Event("change"));
+ }
+
+ private function rolloverHandler(event:Event):void
+ {
+ IRollOverModel(listModel).rollOverIndex = IItemRenderer(event.target).index;
+ IEventDispatcher(listView.strand).dispatchEvent(new Event("rollover"));
+ }
+
+ }
+}
\ 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/controllers/ScrollBarMouseControllerBase.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ScrollBarMouseControllerBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ScrollBarMouseControllerBase.as
new file mode 100644
index 0000000..de4f73c
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ScrollBarMouseControllerBase.as
@@ -0,0 +1,185 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.controllers
+{
+ import flash.events.MouseEvent;
+
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.staticControls.beads.IScrollBarView;
+
+ /**
+ * The ScrollBarMouseControllerBase class is the base class
+ * for ScrollBarMouseControllers such as VScrollBarMouseController.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ScrollBarMouseControllerBase implements IBeadController
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ScrollBarMouseControllerBase()
+ {
+ }
+
+ /**
+ * The data model
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var sbModel:IScrollBarModel;
+
+ /**
+ * The view
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var sbView:IScrollBarView;
+
+ private var _strand:IStrand;
+
+ /**
+ * @private
+ */
+ public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * @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;
+ sbModel = value.getBeadByType(IScrollBarModel) as IScrollBarModel;
+ sbView = value.getBeadByType(IScrollBarView) as IScrollBarView;
+ sbView.decrement.addEventListener(MouseEvent.CLICK, decrementClickHandler);
+ sbView.increment.addEventListener(MouseEvent.CLICK, incrementClickHandler);
+ sbView.decrement.addEventListener("buttonRepeat", decrementClickHandler);
+ sbView.increment.addEventListener("buttonRepeat", incrementClickHandler);
+ sbView.track.addEventListener(MouseEvent.CLICK, trackClickHandler);
+ sbView.thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbMouseDownHandler);
+ }
+
+ /**
+ * Force the input number to be "snapped" to the snapInterval.
+ *
+ * @param value The input number.
+ * @return The input number "snapped" to the snapInterval.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function snap(value:Number):Number
+ {
+ var si:Number = sbModel.snapInterval;
+ var n:Number = Math.round((value - sbModel.minimum) / si) * si + sbModel.minimum;
+ if (value > 0)
+ {
+ if (value - n < n + si - value)
+ return n;
+ return n + si;
+
+ }
+ if (value - n > n + si - value)
+ return n + si;
+ return n;
+ }
+
+ /**
+ * Updates the model when the decrement button is clicked.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function decrementClickHandler(event:Event):void
+ {
+ sbModel.value = snap(Math.max(sbModel.minimum, sbModel.value - sbModel.stepSize));
+ IEventDispatcher(_strand).dispatchEvent(new Event("scroll"));
+ }
+
+ /**
+ * Updates the model when the increment button is clicked.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function incrementClickHandler(event:Event):void
+ {
+ sbModel.value = snap(Math.min(sbModel.maximum - sbModel.pageSize, sbModel.value + sbModel.stepSize));
+ IEventDispatcher(_strand).dispatchEvent(new Event("scroll"));
+ }
+
+ /**
+ * Handles a click in the track. Must be overridden.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function trackClickHandler(event:MouseEvent):void
+ {
+ }
+
+ /**
+ * Handles a mouse down on the thumb. Must be overridden.
+ * Subclasses process the mouseMove and mouseUp events.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function thumbMouseDownHandler(event:MouseEvent):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/controllers/SliderMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/SliderMouseController.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/SliderMouseController.as
new file mode 100644
index 0000000..3b6e295
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/SliderMouseController.as
@@ -0,0 +1,148 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.controllers
+{
+ import flash.events.MouseEvent;
+ import flash.geom.Point;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IRangeModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.staticControls.beads.ISliderView;
+
+ /**
+ * The SliderMouseController class bead handles mouse events on the
+ * org.apache.flex.html.staticControls.Slider's component parts (thumb and track) and
+ * dispatches change events on behalf of the Slider (as well as co-ordinating visual
+ * changes (such as moving the thumb when the track has been tapped or clicked).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SliderMouseController implements IBead, IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SliderMouseController()
+ {
+ }
+
+ private var rangeModel:IRangeModel;
+
+ 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;
+
+ rangeModel = UIBase(value).model as IRangeModel;
+
+ var sliderView:ISliderView = value.getBeadByType(ISliderView) as ISliderView;
+ sliderView.thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbDownHandler);
+
+ // add handler to detect click on track
+ sliderView.track.addEventListener(MouseEvent.CLICK, trackClickHandler, false, 99999);
+ }
+
+ /**
+ * @private
+ */
+ private function thumbDownHandler( event:MouseEvent ) : void
+ {
+ UIBase(_strand).stage.addEventListener(MouseEvent.MOUSE_MOVE, thumbMoveHandler);
+ UIBase(_strand).stage.addEventListener(MouseEvent.MOUSE_UP, thumbUpHandler);
+
+ var sliderView:ISliderView = _strand.getBeadByType(ISliderView) as ISliderView;
+
+ origin = new Point(event.stageX, event.stageY);
+ thumb = new Point(sliderView.thumb.x,sliderView.thumb.y);
+ }
+
+ /**
+ * @private
+ */
+ private function thumbUpHandler( event:MouseEvent ) : void
+ {
+ UIBase(_strand).stage.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMoveHandler);
+ UIBase(_strand).stage.removeEventListener(MouseEvent.MOUSE_UP, thumbUpHandler);
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("valueChanged"));
+ }
+
+ private var origin:Point;
+ private var thumb:Point;
+
+ /**
+ * @private
+ */
+ private function thumbMoveHandler( event:MouseEvent ) : void
+ {
+ var sliderView:ISliderView = _strand.getBeadByType(ISliderView) as ISliderView;
+
+ var deltaX:Number = event.stageX - origin.x;
+ var thumbW:Number = sliderView.thumb.width/2;
+ var newX:Number = thumb.x + deltaX;
+
+ var p:Number = newX/UIBase(_strand).width;
+ var n:Number = p*(rangeModel.maximum - rangeModel.minimum) + rangeModel.minimum;
+
+ rangeModel.value = n;
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("valueChanged"));
+ }
+
+ /**
+ * @private
+ */
+ private function trackClickHandler( event:MouseEvent ) : void
+ {
+ event.stopImmediatePropagation();
+
+ var sliderView:ISliderView = _strand.getBeadByType(ISliderView) as ISliderView;
+
+ var xloc:Number = event.localX;
+ var p:Number = xloc/UIBase(_strand).width;
+ var n:Number = p*(rangeModel.maximum - rangeModel.minimum) + rangeModel.minimum;
+
+ rangeModel.value = n;
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("valueChanged"));
+ }
+ }
+}
\ 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/controllers/SpinnerMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/SpinnerMouseController.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/SpinnerMouseController.as
new file mode 100644
index 0000000..9823184
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/SpinnerMouseController.as
@@ -0,0 +1,98 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.controllers
+{
+ import flash.events.MouseEvent;
+
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IRangeModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.staticControls.beads.ISpinnerView;
+
+ /**
+ * The SpinnerMouseController class bead handles mouse events on the
+ * org.apache.flex.html.staticControls.Spinner's component buttons, changing the
+ * value of the Spinner.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SpinnerMouseController implements IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SpinnerMouseController()
+ {
+ }
+
+ private var rangeModel:IRangeModel;
+
+ 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;
+
+ rangeModel = UIBase(value).model as IRangeModel;
+
+ var spinnerBead:ISpinnerView = value.getBeadByType(ISpinnerView) as ISpinnerView;
+ spinnerBead.decrement.addEventListener(MouseEvent.CLICK, decrementClickHandler);
+ spinnerBead.decrement.addEventListener("buttonRepeat", decrementClickHandler);
+ spinnerBead.increment.addEventListener(MouseEvent.CLICK, incrementClickHandler);
+ spinnerBead.increment.addEventListener("buttonRepeat", incrementClickHandler);
+ }
+
+ /**
+ * @private
+ */
+ private function decrementClickHandler( event:Event ) : void
+ {
+ rangeModel.value = Math.max(rangeModel.minimum, rangeModel.value - rangeModel.stepSize);
+ IEventDispatcher(_strand).dispatchEvent(new Event("valueChanged"));
+ }
+
+ /**
+ * @private
+ */
+ private function incrementClickHandler( event:Event ) : void
+ {
+ rangeModel.value = Math.min(rangeModel.maximum, rangeModel.value + rangeModel.stepSize);
+ IEventDispatcher(_strand).dispatchEvent(new Event("valueChanged"));
+ }
+ }
+}
\ 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/controllers/VScrollBarMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/VScrollBarMouseController.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/VScrollBarMouseController.as
new file mode 100644
index 0000000..cc8d29f
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/VScrollBarMouseController.as
@@ -0,0 +1,101 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.controllers
+{
+ import flash.display.DisplayObject;
+ import flash.events.MouseEvent;
+
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The VScrollBarMouseController class is the controller for
+ * org.apache.flex.html.staticControls.supportClasses.ScrollBar
+ * that acts as the Vertical ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VScrollBarMouseController extends ScrollBarMouseControllerBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VScrollBarMouseController()
+ {
+ }
+
+ /**
+ * @private
+ */
+ override protected function trackClickHandler(event:MouseEvent):void
+ {
+ if (sbView.thumb.visible)
+ {
+ if (event.localY < sbView.thumb.y)
+ {
+ sbModel.value = snap(Math.max(sbModel.minimum, sbModel.value - sbModel.pageStepSize));
+ IEventDispatcher(strand).dispatchEvent(new Event("scroll"));
+ }
+ else
+ {
+ sbModel.value = snap(Math.min(sbModel.maximum - sbModel.pageSize, sbModel.value + sbModel.pageStepSize));
+ IEventDispatcher(strand).dispatchEvent(new Event("scroll"));
+ }
+ }
+ }
+
+ private var thumbDownY:Number;
+ private var lastThumbY:Number;
+
+ /**
+ * @private
+ */
+ override protected function thumbMouseDownHandler(event:MouseEvent):void
+ {
+ sbView.thumb.stage.addEventListener(MouseEvent.MOUSE_MOVE, thumbMouseMoveHandler);
+ sbView.thumb.stage.addEventListener(MouseEvent.MOUSE_UP, thumbMouseUpHandler);
+ thumbDownY = event.stageY;
+ lastThumbY = sbView.thumb.y;
+ }
+
+ private function thumbMouseMoveHandler(event:MouseEvent):void
+ {
+ var thumb:DisplayObject = sbView.thumb;
+ var track:DisplayObject = sbView.track;
+ thumb.y = Math.max(track.y, Math.min(lastThumbY + (event.stageY - thumbDownY), track.y + track.height - thumb.height));
+ var newValue:Number = snap((thumb.y - track.y) / (track.height - thumb.height) * (sbModel.maximum - sbModel.minimum - sbModel.pageSize));
+ sbModel.value = newValue;
+ IEventDispatcher(strand).dispatchEvent(new Event("scroll"));
+ }
+
+ private function thumbMouseUpHandler(event:MouseEvent):void
+ {
+ sbView.thumb.stage.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMouseMoveHandler);
+ sbView.thumb.stage.removeEventListener(MouseEvent.MOUSE_UP, thumbMouseUpHandler);
+ }
+ }
+}
\ 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/layouts/ButtonBarLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.as
new file mode 100644
index 0000000..d27b2dd
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.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.layouts
+{
+ import flash.display.DisplayObject;
+ import flash.display.DisplayObjectContainer;
+
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.ILayoutParent;
+ 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 ButtonBarLayout class bead sizes and positions the org.apache.flex.html.staticControls.Button
+ * elements that make up a org.apache.flex.html.staticControls.ButtonBar. This bead arranges the Buttons
+ * horizontally and makes them all the same width unless the buttonWidths property has been set in which case
+ * the values stored in that array are used.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ButtonBarLayout implements IBeadLayout
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ButtonBarLayout()
+ {
+ }
+
+ 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("childrenAdded", changeHandler);
+ IEventDispatcher(value).addEventListener("itemsCreated", changeHandler);
+ }
+
+ private var _buttonWidths:Array = null;
+
+ /**
+ * An array of widths (Number), one per button. These values supersede the
+ * default of equally-sized buttons.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get buttonWidths():Array
+ {
+ return _buttonWidths;
+ }
+ public function set buttonWidths(value:Array):void
+ {
+ _buttonWidths = value;
+ }
+
+ /**
+ * @private
+ */
+ private function changeHandler(event:Event):void
+ {
+ var layoutParent:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent;
+ var contentView:DisplayObjectContainer = layoutParent.contentView;
+
+ var n:int = contentView.numChildren;
+ var xpos:Number = 0;
+ var useWidth:Number = DisplayObject(_strand).width / n;
+ var useHeight:Number = DisplayObject(_strand).height;
+
+ for (var i:int = 0; i < n; i++)
+ {
+ var child:DisplayObject = contentView.getChildAt(i);
+
+ child.y = 0;
+ child.height = useHeight;
+ child.x = xpos;
+
+ if (buttonWidths) child.width = Number(buttonWidths[i]);
+ else child.width = useWidth;
+ xpos += child.width;
+ }
+ }
+ }
+}
\ No newline at end of file