http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VRuleView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VRuleView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VRuleView.as deleted file mode 100644 index 5eb6c4c..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VRuleView.as +++ /dev/null @@ -1,87 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads -{ - import flash.display.Bitmap; - import flash.display.Loader; - import flash.display.LoaderInfo; - import flash.net.URLRequest; - - import org.apache.flex.core.BeadViewBase; - 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.Image component. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class VRuleView extends BeadViewBase implements IBeadView - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function VRuleView() - { - } - - /** - * @copy org.apache.flex.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - override public function set strand(value:IStrand):void - { - super.strand = value; - - IEventDispatcher(_strand).addEventListener("widthChanged",handleSizeChange); - IEventDispatcher(_strand).addEventListener("heightChanged",handleSizeChange); - IEventDispatcher(_strand).addEventListener("sizeChanged",handleSizeChange); - - handleSizeChange(null); - } - - /** - * @private - */ - private function handleSizeChange(event:Object):void - { - var ui:UIBase = _strand as UIBase; - ui.graphics.clear(); - ui.graphics.beginFill(0); - ui.graphics.drawRect(0, 0, 1, ui.height); - ui.graphics.endFill(); - } - } -}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VScrollBarThumbView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VScrollBarThumbView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VScrollBarThumbView.as deleted file mode 100644 index 0f70b37..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VScrollBarThumbView.as +++ /dev/null @@ -1,119 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads -{ - import flash.display.Graphics; - import flash.display.Shape; - import flash.display.SimpleButton; - import flash.display.DisplayObject; - - import org.apache.flex.core.BeadViewBase; - 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 extends BeadViewBase 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.drawRoundRect(0, 0, ScrollBarView.FullSize, hh, ScrollBarView.HalfSize); - g.endFill(); - } - - 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 - */ - override public function set strand(value:IStrand):void - { - super.strand = value; - - upView = new Shape(); - downView = new Shape(); - overView = new Shape(); - - drawView(upView.graphics, 0xc8c8c8); - drawView(downView.graphics, 0xc8c8c8); - drawView(overView.graphics, 0xb8b8b8); - - shape = new Shape(); - shape.graphics.beginFill(0xCCCCCC); - shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize); - 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, 0xc8c8c8); - drawView(downView.graphics, 0xc8c8c8); - drawView(overView.graphics, 0xb8b8b8); - - shape.graphics.clear(); - shape.graphics.beginFill(0xCCCCCC); - shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, hh); - shape.graphics.endFill(); - } - - private var upView:Shape; - private var downView:Shape; - private var overView:Shape; - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VScrollBarTrackView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VScrollBarTrackView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VScrollBarTrackView.as deleted file mode 100644 index 3510251..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VScrollBarTrackView.as +++ /dev/null @@ -1,118 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads -{ - import flash.display.DisplayObject; - import flash.display.Graphics; - import flash.display.Shape; - import flash.display.SimpleButton; - - import org.apache.flex.core.BeadViewBase; - 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 extends BeadViewBase implements IBeadView - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function VScrollBarTrackView() - { - } - - private function drawView(g:Graphics, bgColor:uint):void - { - var h:Number = SimpleButton(_strand).height; - - g.clear(); - g.lineStyle(1, 0x808080); - g.beginFill(bgColor); - g.drawRect(0, 0, ScrollBarView.FullSize, 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, 0xf8f8f8); - drawView(downView.graphics, 0xd8d8d8); - drawView(overView.graphics, 0xe8e8e8); - shape.graphics.clear(); - shape.graphics.beginFill(0xCCCCCC); - shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, h); - shape.graphics.endFill(); - - } - - 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 - */ - override public function set strand(value:IStrand):void - { - super.strand = value; - - upView = new Shape(); - downView = new Shape(); - overView = new Shape(); - - drawView(upView.graphics, 0xf8f8f8); - drawView(downView.graphics, 0xd8d8d8); - drawView(overView.graphics, 0xe8e8e8); - - 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; - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VScrollBarView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VScrollBarView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VScrollBarView.as deleted file mode 100644 index 840f7bf..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/VScrollBarView.as +++ /dev/null @@ -1,99 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads -{ - import flash.display.DisplayObject; - - import org.apache.flex.core.IBead; - import org.apache.flex.core.IBeadLayout; - import org.apache.flex.core.IBeadView; - import org.apache.flex.core.IScrollBarModel; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.IUIBase; - import org.apache.flex.core.Strand; - import org.apache.flex.core.UIBase; - import org.apache.flex.core.ValuesManager; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.events.Event; - import org.apache.flex.html.Button; - import org.apache.flex.html.beads.controllers.ButtonAutoRepeatController; - - /** - * The ScrollBarView class is the default view for - * the org.apache.flex.html.supportClasses.VScrollBar class. - * It implements the classic desktop-like VScrollBar. - * A different view would implement more modern scrollbars that hide themselves - * until hovered over with the mouse. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class VScrollBarView extends ScrollBarView implements IBeadView, IStrand, IScrollBarView - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function VScrollBarView() - { - } - - /** - * @copy org.apache.flex.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - override public function set strand(value:IStrand):void - { - super.strand = value; - - UIBase(value).setWidth(ScrollBarView.FullSize, true); - - // TODO: (aharui) put in values impl - _increment = new Button(); - Button(_increment).addBead(new DownArrowButtonView()); - Button(_increment).addBead(new ButtonAutoRepeatController()); - _decrement = new Button(); - Button(_decrement).addBead(new UpArrowButtonView()); - Button(_decrement).addBead(new ButtonAutoRepeatController()); - _track = new Button(); - Button(_track).addBead(new VScrollBarTrackView()); - _thumb = new Button(); - Button(_thumb).addBead(new VScrollBarThumbView()); - - UIBase(value).addChild(_decrement); - UIBase(value).addChild(_increment); - UIBase(value).addChild(_track); - UIBase(value).addChild(_thumb); - - IEventDispatcher(_strand).addEventListener("heightChanged", changeHandler); - - layout.layout(); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/AlertController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/AlertController.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/AlertController.as deleted file mode 100644 index 3982d0f..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/AlertController.as +++ /dev/null @@ -1,88 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.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.Alert - * by removing the org.apache.flex.html.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)); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ButtonAutoRepeatController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ButtonAutoRepeatController.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ButtonAutoRepeatController.as deleted file mode 100644 index 4100a28..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ButtonAutoRepeatController.as +++ /dev/null @@ -1,147 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads.controllers -{ - 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.MouseEvent; - 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")); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ComboBoxController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ComboBoxController.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ComboBoxController.as deleted file mode 100644 index 12fb59c..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ComboBoxController.as +++ /dev/null @@ -1,104 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads.controllers -{ - import flash.display.DisplayObject; - - 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.events.MouseEvent; - import org.apache.flex.html.beads.IComboBoxView; - - /** - * The ComboBoxController class bead handles mouse events on the elements of - * the org.apache.flex.html.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")); - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/DateChooserMouseController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/DateChooserMouseController.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/DateChooserMouseController.as deleted file mode 100644 index 0aaa052..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/DateChooserMouseController.as +++ /dev/null @@ -1,126 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads.controllers -{ - import org.apache.flex.html.beads.DateChooserView; - import org.apache.flex.html.beads.models.DateChooserModel; - import org.apache.flex.html.supportClasses.DateChooserButton; - - import org.apache.flex.core.IBeadController; - import org.apache.flex.core.IBeadModel; - 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 DateChooserMouseController class is responsible for listening to - * mouse event related to the DateChooser. Events such as selecting a date - * or changing the calendar. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class DateChooserMouseController implements IBeadController - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function DateChooserMouseController() - { - } - - 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 view:DateChooserView = value.getBeadByType(IBeadView) as DateChooserView; - view.prevMonthButton.addEventListener("click", prevMonthClickHandler); - view.nextMonthButton.addEventListener("click", nextMonthClickHandler); - - var dayButtons:Array = view.dayButtons; - for(var i:int=0; i < dayButtons.length; i++) { - IEventDispatcher(dayButtons[i]).addEventListener("click", dayButtonClickHandler); - } - } - - /** - * @private - */ - private function prevMonthClickHandler(event:Event):void - { - var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel; - var month:Number = model.displayedMonth - 1; - var year:Number = model.displayedYear; - if (month < 0) { - month = 11; - year--; - } - model.displayedMonth = month; - model.displayedYear = year; - } - - /** - * @private - */ - private function nextMonthClickHandler(event:Event):void - { - var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel; - var month:Number = model.displayedMonth + 1; - var year:Number = model.displayedYear; - if (month >= 12) { - month = 0; - year++; - } - model.displayedMonth = month; - model.displayedYear = year; - } - - /** - * @private - */ - private function dayButtonClickHandler(event:Event):void - { - var dateButton:DateChooserButton = event.target as DateChooserButton; - if (dateButton.dayOfMonth > 0) { - var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel; - var newDate:Date = new Date(model.displayedYear,model.displayedMonth,dateButton.dayOfMonth); - model.selectedDate = newDate; - IEventDispatcher(_strand).dispatchEvent( new Event("change") ); - } - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/DateFieldMouseController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/DateFieldMouseController.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/DateFieldMouseController.as deleted file mode 100644 index 05b852d..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/DateFieldMouseController.as +++ /dev/null @@ -1,95 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads.controllers -{ - import org.apache.flex.core.IBeadController; - import org.apache.flex.core.IDateChooserModel; - 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.beads.DateFieldView; - - /** - * The DateFieldMouseController class is responsible for monitoring - * the mouse events on the elements of the DateField. A click on the - * DateField's menu button triggers the pop-up, for example. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class DateFieldMouseController implements IBeadController - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function DateFieldMouseController() - { - } - - 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 viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView; - IEventDispatcher(viewBead.menuButton).addEventListener("click", clickHandler); - } - - /** - * @private - */ - private function clickHandler(event:Event):void - { - var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView; - viewBead.popUpVisible = true; - IEventDispatcher(viewBead.popUp).addEventListener("change", changeHandler); - } - - /** - * @private - */ - private function changeHandler(event:Event):void - { - var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView; - - var model:IDateChooserModel = _strand.getBeadByType(IDateChooserModel) as IDateChooserModel; - model.selectedDate = IDateChooserModel(viewBead.popUp.getBeadByType(IDateChooserModel)).selectedDate; - - viewBead.popUpVisible = false; - IEventDispatcher(_strand).dispatchEvent(new Event("change")); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/DropDownListController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/DropDownListController.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/DropDownListController.as deleted file mode 100644 index 29f58e1..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/DropDownListController.as +++ /dev/null @@ -1,116 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.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.core.IUIBase; - import org.apache.flex.core.UIBase; - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.html.beads.IDropDownListView; - - /** - * The DropDownListController class is the controller for - * org.apache.flex.html.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; - var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel; - var popUpModel:ISelectionModel = UIBase(viewBead.popUp).model as ISelectionModel; - DisplayObject(viewBead.popUp).width = DisplayObject(_strand).width; - popUpModel.dataProvider = selectionModel.dataProvider; - popUpModel.labelField = selectionModel.labelField; - viewBead.popUpVisible = true; // adds to display list as well - popUpModel.selectedIndex = selectionModel.selectedIndex; - var pt:Point = new Point(DisplayObject(_strand).x, DisplayObject(_strand).y + DisplayObject(_strand).height); - pt = DisplayObject(_strand).parent.localToGlobal(pt); - DisplayObject(viewBead.popUp).x = pt.x; - DisplayObject(viewBead.popUp).y = pt.y; - IEventDispatcher(viewBead.popUp).addEventListener("change", changeHandler); - IUIBase(_strand).topMostEventDispatcher.addEventListener("click", dismissHandler); - } - - private function dismissHandler(event:Event):void - { - if (event.target == _strand) return; - - IUIBase(_strand).topMostEventDispatcher.removeEventListener("click", dismissHandler); - var viewBead:IDropDownListView = _strand.getBeadByType(IDropDownListView) as IDropDownListView; - viewBead.popUpVisible = false; - } - - 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 = UIBase(viewBead.popUp).model as ISelectionModel; - selectionModel.selectedIndex = popUpModel.selectedIndex; - IEventDispatcher(_strand).dispatchEvent(new Event("change")); - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/EditableTextKeyboardController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/EditableTextKeyboardController.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/EditableTextKeyboardController.as deleted file mode 100644 index 4a8115f..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/EditableTextKeyboardController.as +++ /dev/null @@ -1,86 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.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.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; - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/HScrollBarMouseController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/HScrollBarMouseController.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/HScrollBarMouseController.as deleted file mode 100644 index 4abaffe..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/HScrollBarMouseController.as +++ /dev/null @@ -1,101 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads.controllers -{ - import flash.display.DisplayObject; - - import org.apache.flex.events.Event; - import org.apache.flex.events.MouseEvent; - import org.apache.flex.events.IEventDispatcher; - - /** - * The HScrollBarMouseController class is the controller for - * org.apache.flex.html.supportClasses.HScrollBar - * that acts as the Horizontal ScrollBar. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class HScrollBarMouseController extends ScrollBarMouseControllerBase - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function HScrollBarMouseController() - { - } - - /** - * @private - */ - override protected function trackClickHandler(event:MouseEvent):void - { - if (sbView.thumb.visible) - { - if (event.localX < sbView.thumb.x) - { - 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 thumbDownX:Number; - private var lastThumbX: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); - thumbDownX = event.screenX; - lastThumbX = sbView.thumb.x; - } - - private function thumbMouseMoveHandler(event:MouseEvent):void - { - var thumb:DisplayObject = sbView.thumb; - var track:DisplayObject = sbView.track; - thumb.x = Math.max(track.x, Math.min(lastThumbX + (event.screenX - thumbDownX), track.x + track.width - thumb.width)); - var newValue:Number = snap((thumb.x - track.x) / (track.width - thumb.width) * (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); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as deleted file mode 100644 index ca06c77..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as +++ /dev/null @@ -1,203 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads.controllers -{ - import org.apache.flex.core.IBeadController; - import org.apache.flex.core.ISelectableItemRenderer; - import org.apache.flex.core.IStrand; -COMPILE::AS3 { - import org.apache.flex.events.Event; - import org.apache.flex.events.MouseEvent; -} -COMPILE::JS { - import org.apache.flex.core.UIBase; - import org.apache.flex.core.WrappedHTMLElement; - import org.apache.flex.events.BrowserEvent; - import goog.events.Event; - import goog.events.EventType; - import goog.events; -} - - /** - * 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 - * @flexjsignoreimport goog.events.Event - */ - 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:ISelectableItemRenderer; - 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 ISelectableItemRenderer; - - COMPILE::AS3 { - renderer.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler); - renderer.addEventListener(MouseEvent.ROLL_OUT, rollOutHandler); - renderer.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); - } - - COMPILE::JS { - var element:WrappedHTMLElement = (_strand as UIBase).element; - - goog.events.listen(element, goog.events.EventType.MOUSEOVER, this.handleMouseOver); - goog.events.listen(element, goog.events.EventType.MOUSEOUT, this.handleMouseOut); - goog.events.listen(element, goog.events.EventType.MOUSEDOWN, this.handleMouseDown); - goog.events.listen(element, goog.events.EventType.MOUSEUP, this.handleMouseUp); - } - } - - /** - * @private - */ - COMPILE::AS3 - protected function rollOverHandler(event:MouseEvent):void - { - var target:ISelectableItemRenderer = event.target as ISelectableItemRenderer; - if (target) - { - target.hovered = true; - target.dispatchEvent(new Event("itemRendererRollOver",true)); - } - } - - COMPILE::JS - protected function handleMouseOver(event:BrowserEvent):void - { - var target:ISelectableItemRenderer = event.target as ISelectableItemRenderer; - if (target) { - target.hovered = true; - target.dispatchEvent(new Event("itemRendererRollOver",true)); - } - } - - /** - * @private - */ - COMPILE::AS3 - protected function rollOutHandler(event:MouseEvent):void - { - var target:ISelectableItemRenderer = event.target as ISelectableItemRenderer; - if (target) - { - target.hovered = false; - target.down = false; - target.dispatchEvent(new Event("itemRendererRollOut",true)); - } - } - - COMPILE::JS - protected function handleMouseOut(event:BrowserEvent):void - { - var target:ISelectableItemRenderer = event.target as ISelectableItemRenderer; - if (target) - { - target.hovered = false; - target.down = false; - target.dispatchEvent(new Event("itemRendererRollOut",true)); - } - } - - /** - * @private - */ - COMPILE::AS3 - protected function mouseDownHandler(event:MouseEvent):void - { - var target:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer; - if (target) - { - target.down = true; - target.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); - } - } - - /** - * @private - */ - COMPILE::JS - protected function handleMouseDown(event:BrowserEvent):void - { - var target:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer; - if (target) - { - target.down = true; - target.hovered = false; - } - } - - /** - * @private - */ - COMPILE::AS3 - protected function mouseUpHandler(event:MouseEvent):void - { - var target:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer; - if (target) - { - target.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); - target.selected = true; - target.dispatchEvent(new Event("selected")); - } - } - - /** - * @private - */ - COMPILE::JS - protected function handleMouseUp(event:BrowserEvent):void - { - var target:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer; - if (target) - { - target.selected = true; - target.dispatchEvent(new Event("selected")); - } - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as deleted file mode 100644 index 9760591..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as +++ /dev/null @@ -1,127 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads.controllers -{ - import org.apache.flex.core.IBeadController; - import org.apache.flex.core.IItemRendererParent; - import org.apache.flex.core.IRollOverModel; - import org.apache.flex.core.ISelectableItemRenderer; - 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.events.MouseEvent; - import org.apache.flex.html.beads.IListView; - - /** - * The ListSingleSelectionMouseController class is a controller for - * org.apache.flex.html.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); - IEventDispatcher(_strand).addEventListener(MouseEvent.ROLL_OVER, rolloverHandler); - } - - private function selectedHandler(event:Event):void - { - listModel.selectedIndex = ISelectableItemRenderer(event.target).index; - listView.host.dispatchEvent(new Event("change")); - } - - private function rolloverHandler(event:Event):void - { - var renderer:ISelectableItemRenderer = event.target as ISelectableItemRenderer; - if (renderer) { - //trace("ListSingleSelectionMouseController.ROLL_OVER"); - IRollOverModel(listModel).rollOverIndex = renderer.index; - } - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ScrollBarMouseControllerBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ScrollBarMouseControllerBase.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ScrollBarMouseControllerBase.as deleted file mode 100644 index 8d9d27b..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ScrollBarMouseControllerBase.as +++ /dev/null @@ -1,184 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads.controllers -{ - 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.events.MouseEvent; - import org.apache.flex.html.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 - { - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/SliderMouseController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/SliderMouseController.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/SliderMouseController.as deleted file mode 100644 index 6469fd0..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/SliderMouseController.as +++ /dev/null @@ -1,286 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads.controllers -{ - 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.events.MouseEvent; - import org.apache.flex.geom.Point; - import org.apache.flex.html.beads.ISliderView; - import org.apache.flex.html.beads.SliderTrackView; - - COMPILE::JS - { - import goog.events; - import goog.events.EventType; - import org.apache.flex.events.BrowserEvent; - import org.apache.flex.html.Slider; - import org.apache.flex.html.beads.SliderThumbView; - import org.apache.flex.html.beads.SliderTrackView; - } - - /** - * The SliderMouseController class bead handles mouse events on the - * org.apache.flex.html.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; - - COMPILE::AS3 - { - 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); - - } - COMPILE::JS - { - track = value.getBeadByType( - SliderTrackView) as SliderTrackView; - thumb = value.getBeadByType( - SliderThumbView) as SliderThumbView; - - goog.events.listen(track.element, goog.events.EventType.CLICK, - handleTrackClick, false, this); - - goog.events.listen(thumb.element, goog.events.EventType.MOUSEDOWN, - handleThumbDown, false, this); - - } - } - - COMPILE::JS - private var track:SliderTrackView; - - COMPILE::JS - private var thumb:SliderThumbView; - - /** - * @private - */ - COMPILE::AS3 - private function thumbDownHandler( event:MouseEvent ) : void - { - UIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_MOVE, thumbMoveHandler); - UIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_UP, thumbUpHandler); - - var sliderView:ISliderView = _strand.getBeadByType(ISliderView) as ISliderView; - - origin = new Point(event.screenX, event.screenY); - thumb = new Point(sliderView.thumb.x,sliderView.thumb.y); - } - - /** - * @private - */ - COMPILE::AS3 - private function thumbUpHandler( event:MouseEvent ) : void - { - UIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMoveHandler); - UIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_UP, thumbUpHandler); - - IEventDispatcher(_strand).dispatchEvent(new Event("valueChange")); - } - - COMPILE::AS3 - private var origin:Point; - COMPILE::AS3 - private var thumb:Point; - - /** - * @private - */ - COMPILE::AS3 - private function thumbMoveHandler( event:MouseEvent ) : void - { - var sliderView:ISliderView = _strand.getBeadByType(ISliderView) as ISliderView; - - var deltaX:Number = event.screenX - 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("valueChange")); - } - - /** - * @private - */ - COMPILE::AS3 - 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("valueChange")); - } - - /** - */ - COMPILE::JS - private function handleTrackClick(event:BrowserEvent):void - { - var host:Slider = _strand as Slider; - var xloc:Number = event.clientX; - var p:Number = Math.min(1, xloc / parseInt(track.element.style.width, 10)); - var n:Number = p * (host.maximum - host.minimum) + - host.minimum; - - host.value = n; - - origin = parseInt(thumb.element.style.left, 10); - position = parseInt(thumb.element.style.left, 10); - - calcValFromMousePosition(event, true); - - host.dispatchEvent(new org.apache.flex.events.Event('valueChange')); - } - - - /** - */ - COMPILE::JS - private function handleThumbDown(event:BrowserEvent):void - { - var host:Slider = _strand as Slider; - goog.events.listen(host.element, goog.events.EventType.MOUSEUP, - handleThumbUp, false, this); - goog.events.listen(host.element, goog.events.EventType.MOUSEMOVE, - handleThumbMove, false, this); - - origin = event.clientX; - position = parseInt(thumb.element.style.left, 10); - } - - COMPILE::JS - private var origin:Number; - COMPILE::JS - private var position:int; - - /** - */ - COMPILE::JS - private function handleThumbUp(event:BrowserEvent):void - { - var host:Slider = _strand as Slider; - goog.events.unlisten(host.element, goog.events.EventType.MOUSEUP, - handleThumbUp, false, this); - goog.events.unlisten(host.element, goog.events.EventType.MOUSEMOVE, - handleThumbMove, false, this); - - calcValFromMousePosition(event, false); - - host.dispatchEvent(new org.apache.flex.events.Event('valueChange')); - } - - - /** - */ - COMPILE::JS - private function handleThumbMove(event:BrowserEvent):void - { - var host:Slider = _strand as Slider; - calcValFromMousePosition(event, false); - - host.dispatchEvent(new org.apache.flex.events.Event('valueChange')); - } - - - /** - */ - COMPILE::JS - private function calcValFromMousePosition(event:BrowserEvent, useOffset:Boolean):void - { - var host:Slider = _strand as Slider; - var deltaX:Number = (useOffset ? event.offsetX : event.clientX) - origin; - var thumbW:int = parseInt(thumb.element.style.width, 10) / 2; - var newX:Number = position + deltaX; - - var p:Number = newX / parseInt(track.element.style.width, 10); - var n:Number = p * (host.maximum - host.minimum) + - host.minimum; - n = host.snap(n); - if (n < host.minimum) n = host.minimum; - else if (n > host.maximum) n = host.maximum; - - p = (n - host.minimum) / (host.maximum - - host.minimum); - newX = p * parseInt(track.element.style.width, 10); - - thumb.element.style.left = String(newX - - parseInt(thumb.element.style.width, 10) / 2) + 'px'; - - host.value = n; - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/SpinnerMouseController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/SpinnerMouseController.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/SpinnerMouseController.as deleted file mode 100644 index 53309df..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/SpinnerMouseController.as +++ /dev/null @@ -1,125 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads.controllers -{ - 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.events.MouseEvent; - import org.apache.flex.html.TextButton; - import org.apache.flex.html.beads.ISpinnerView; - COMPILE::JS - { - import org.apache.flex.html.Spinner; - import goog.events; - import goog.events.EventType; - } - - /** - * The SpinnerMouseController class bead handles mouse events on the - * org.apache.flex.html.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 - * - * @flexjsignorecoercion org.apache.flex.html.Spinner - * @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; - - COMPILE::AS3 - { - 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); - } - - COMPILE::JS - { - var host:Spinner = value as Spinner; - incrementButton = host.incrementButton; - decrementButton = host.decrementButton; - - goog.events.listen(incrementButton.element, goog.events.EventType.CLICK, - incrementClickHandler); - - goog.events.listen(decrementButton.element, goog.events.EventType.CLICK, - decrementClickHandler); - - } - } - - private var incrementButton:TextButton; - private var decrementButton:TextButton; - - /** - * @private - */ - private function decrementClickHandler( event:Event ) : void - { - rangeModel.value = Math.max(rangeModel.minimum, rangeModel.value - rangeModel.stepSize); - IEventDispatcher(_strand).dispatchEvent(new Event("valueChange")); - } - - /** - * @private - */ - private function incrementClickHandler( event:Event ) : void - { - rangeModel.value = Math.min(rangeModel.maximum, rangeModel.value + rangeModel.stepSize); - IEventDispatcher(_strand).dispatchEvent(new Event("valueChange")); - } - } -}