http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ImageView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ImageView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ImageView.as deleted file mode 100644 index 9c4875c..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ImageView.as +++ /dev/null @@ -1,223 +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 -{ - COMPILE::AS3 - { - import flash.display.Bitmap; - import flash.display.Loader; - import flash.display.LoaderInfo; - import flash.events.IOErrorEvent; - import flash.net.URLRequest; - } - COMPILE::JS - { - import goog.events; - } - - 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.IUIBase; - 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 ImageView extends BeadViewBase implements IBeadView - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function ImageView() - { - } - - COMPILE::AS3 - private var bitmap:Bitmap; - COMPILE::AS3 - private var loader:Loader; - - private var _model:IImageModel; - - /** - * @copy org.apache.flex.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - override public function set strand(value:IStrand):void - { - super.strand = value; - - COMPILE::AS3 - { - IEventDispatcher(_strand).addEventListener("widthChanged",handleSizeChange); - IEventDispatcher(_strand).addEventListener("heightChanged",handleSizeChange); - } - - _model = value.getBeadByType(IImageModel) as IImageModel; - _model.addEventListener("urlChanged",handleUrlChange); - - handleUrlChange(null); - } - - /** - * @private - */ - private function handleUrlChange(event:Event):void - { - COMPILE::AS3 - { - if (_model.source) { - loader = new Loader(); - loader.contentLoaderInfo.addEventListener("complete",onComplete); - loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void { - trace(e); - e.preventDefault(); - }); - loader.load(new URLRequest(_model.source)); - } - } - COMPILE::JS - { - if (_model.source) { - var host:IUIBase = _strand as IUIBase; - host.element.addEventListener('load', - loadHandler, false); - host.addEventListener('sizeChanged', - sizeChangedHandler); - (host.element as HTMLImageElement).src = _model.source; - } - } - } - - /** - * @private - */ - COMPILE::AS3 - private function onComplete(event:Object):void - { - var host:UIBase = UIBase(_strand); - if (bitmap) { - host.removeChild(bitmap); - } - - bitmap = Bitmap(LoaderInfo(event.target).content); - - host.addChild(bitmap); - - if (host.isWidthSizedToContent()) - { - host.dispatchEvent(new Event("widthChanged")); - if (host.parent) - host.parent.dispatchEvent(new Event("layoutNeeded")); - } - else - bitmap.width = UIBase(_strand).width; - - if (host.isHeightSizedToContent()) - { - host.dispatchEvent(new Event("heightChanged")); - if (host.parent) - host.parent.dispatchEvent(new Event("layoutNeeded")); - } - else - bitmap.height = UIBase(_strand).height; - - } - - /** - * @private - */ - COMPILE::AS3 - private function handleSizeChange(event:Object):void - { - var host:UIBase = UIBase(_strand); - if (bitmap) { - if (!isNaN(host.explicitWidth) || !isNaN(host.percentWidth)) - bitmap.width = UIBase(_strand).width; - if (!isNaN(host.explicitHeight) || !isNaN(host.percentHeight)) - bitmap.height = UIBase(_strand).height; - } - } - - COMPILE::JS - private function loadHandler(event:Object):void - { - var host:UIBase = UIBase(_strand); - host.parent.dispatchEvent(new Event("layoutNeeded")); - } - - /** - * @flexjsignorecoercion HTMLElement - */ - COMPILE::JS - private function sizeChangedHandler(event:Object):void - { - var host:UIBase = _strand as UIBase; - var s:Object = host.positioner.style; - var l:Number = NaN; - var ls:String = s.left; - if (typeof(ls) === 'string' && ls.length > 0) - l = parseFloat(ls.substring(0, ls.length - 2)); - var r:Number = NaN; - var rs:String = s.right; - if (typeof(rs) === 'string' && rs.length > 0) - r = parseFloat(rs.substring(0, rs.length - 2)); - if (!isNaN(l) && - !isNaN(r)) { - // if just using size constraints and image will not shrink or grow - var computedWidth:Number = (host.positioner.offsetParent as HTMLElement).offsetWidth - - l - r; - s.width = computedWidth.toString() + 'px'; - } - var t:Number = NaN; - var ts:String = s.top; - if (typeof(ts) === 'string' && ts.length > 0) - t = parseFloat(ts.substring(0, ts.length - 2)); - var b:Number = NaN; - var bs:String = s.right; - if (typeof(bs) === 'string' && bs.length > 0) - b = parseFloat(bs.substring(0, bs.length - 2)); - if (!isNaN(t) && - !isNaN(b)) { - // if just using size constraints and image will not shrink or grow - var computedHeight:Number = (host.positioner.offsetParent as HTMLElement).offsetHeight - - t - b; - s.height = computedHeight.toString() + 'px'; - } - } - } -}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/LeftArrowButtonView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/LeftArrowButtonView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/LeftArrowButtonView.as deleted file mode 100644 index 9fca051..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/LeftArrowButtonView.as +++ /dev/null @@ -1,112 +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 LeftArrowButtonView class is the view for - * the left 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 LeftArrowButtonView extends BeadViewBase implements IBeadView - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function LeftArrowButtonView() - { - upView = new Shape(); - downView = new Shape(); - overView = new Shape(); - - drawView(upView.graphics, 0xf8f8f8); - drawView(downView.graphics, 0xd8d8d8); - drawView(overView.graphics, 0xe8e8e8); - } - - private function drawView(g:Graphics, bgColor:uint):void - { - g.lineStyle(1, 0x808080); - g.beginFill(bgColor); - g.drawRoundRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize, ScrollBarView.ThirdSize); - g.endFill(); - g.lineStyle(0); - g.beginFill(0); - g.moveTo(ScrollBarView.QuarterSize, ScrollBarView.HalfSize); - g.lineTo(ScrollBarView.ThreeQuarterSize, ScrollBarView.ThreeQuarterSize); - g.lineTo(ScrollBarView.ThreeQuarterSize, ScrollBarView.QuarterSize); - g.lineTo(ScrollBarView.QuarterSize, 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; - 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; - - SimpleButton(_strand).addEventListener("widthChanged",sizeChangeHandler); - SimpleButton(_strand).addEventListener("heightChanged",sizeChangeHandler); - } - - private var upView:Shape; - private var downView:Shape; - private var overView:Shape; - - private function sizeChangeHandler(event:Event):void - { - SimpleButton(_strand).scaleX = SimpleButton(_strand).width / ScrollBarView.FullSize; - SimpleButton(_strand).scaleY = SimpleButton(_strand).height / ScrollBarView.FullSize; - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ListView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ListView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ListView.as deleted file mode 100644 index a38afec..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ListView.as +++ /dev/null @@ -1,210 +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 org.apache.flex.core.BeadViewBase; - import org.apache.flex.core.ContainerBase; - import org.apache.flex.core.IBead; - import org.apache.flex.core.IBeadLayout; - import org.apache.flex.core.IBeadModel; - import org.apache.flex.core.IBeadView; - import org.apache.flex.core.ISelectableItemRenderer; - import org.apache.flex.core.IItemRenderer; - import org.apache.flex.core.IItemRendererParent; - import org.apache.flex.core.IParent; - import org.apache.flex.core.IParentIUIBase; - import org.apache.flex.core.IRollOverModel; - import org.apache.flex.core.ISelectionModel; - 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.Event; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.html.beads.models.ArraySelectionModel; - import org.apache.flex.html.beads.models.ScrollBarModel; - import org.apache.flex.html.beads.models.SingleLineBorderModel; - import org.apache.flex.html.supportClasses.Border; - import org.apache.flex.html.supportClasses.DataGroup; - import org.apache.flex.html.supportClasses.ScrollBar; - - /** - * The List class creates the visual elements of the org.apache.flex.html.List - * component. A List consists of the area to display the data (in the dataGroup), any - * scrollbars, and so forth. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class ListView extends ContainerView implements IListView - { - public function ListView() - { - } - - private var listModel:ISelectionModel; - - private var _border:Border; - - /** - * The border surrounding the org.apache.flex.html.List. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get border():Border - { - return _border; - } - - /** - * The area holding the itemRenderers. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get dataGroup():IItemRendererParent - { - return contentView as IItemRendererParent; - } - - /** - * @private - */ - override public function get resizableView():IUIBase - { - return _strand as IUIBase; - } - - /** - * @private - */ - override public function get host():IUIBase - { - return _strand as IUIBase; - } - - /** - * @copy org.apache.flex.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - override public function set strand(value:IStrand):void - { - _strand = value; - super.strand = value; - } - - override protected function completeSetup():void - { - super.completeSetup(); - - // list is not interested in UI children, it wants to know when new items - // have been added or the dataProvider has changed. - - host.removeEventListener("childrenAdded", childrenChangedHandler); - host.removeEventListener("childrenAdded", performLayout); - host.addEventListener("itemsCreated", itemsCreatedHandler); - - listModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel; - listModel.addEventListener("selectedIndexChanged", selectionChangeHandler); - listModel.addEventListener("rollOverIndexChanged", rollOverIndexChangeHandler); - listModel.addEventListener("dataProviderChanged", dataProviderChangeHandler); - } - - private var lastSelectedIndex:int = -1; - - /** - * @private - */ - protected function itemsCreatedHandler(event:Event):void - { - performLayout(event); - } - - /** - * @private - */ - protected function dataProviderChangeHandler(event:Event):void - { - performLayout(event); - } - - /** - * @private - */ - private function selectionChangeHandler(event:Event):void - { - if (lastSelectedIndex != -1) - { - var ir:ISelectableItemRenderer = dataGroup.getItemRendererForIndex(lastSelectedIndex) as ISelectableItemRenderer; - ir.selected = false; - } - if (listModel.selectedIndex != -1) - { - ir = dataGroup.getItemRendererForIndex(listModel.selectedIndex) as ISelectableItemRenderer; - ir.selected = true; - } - lastSelectedIndex = listModel.selectedIndex; - } - - private var lastRollOverIndex:int = -1; - - /** - * @private - */ - private function rollOverIndexChangeHandler(event:Event):void - { - if (lastRollOverIndex != -1) - { - var ir:ISelectableItemRenderer = dataGroup.getItemRendererForIndex(lastRollOverIndex) as ISelectableItemRenderer; - ir.hovered = false; - } - if (IRollOverModel(listModel).rollOverIndex != -1) - { - ir = dataGroup.getItemRendererForIndex(IRollOverModel(listModel).rollOverIndex) as ISelectableItemRenderer; - ir.hovered = true; - } - lastRollOverIndex = IRollOverModel(listModel).rollOverIndex; - } - - /** - * respond to a change in size or request to re-layout everything - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - override protected function resizeHandler(event:Event):void - { - super.resizeHandler(event); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/MultilineTextFieldView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/MultilineTextFieldView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/MultilineTextFieldView.as deleted file mode 100644 index 72dc588..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/MultilineTextFieldView.as +++ /dev/null @@ -1,56 +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.text.TextFieldType; - - /** - * The TextFieldView class is the default view for - * the org.apache.flex.html.Label class. - * 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 MultilineTextFieldView extends TextFieldViewBase - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function MultilineTextFieldView() - { - super(); - - textField.selectable = false; - textField.type = TextFieldType.DYNAMIC; - textField.mouseEnabled = false; - textField.autoSize = "left"; - textField.multiline = true; - textField.wordWrap = true; - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/NumericStepperView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/NumericStepperView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/NumericStepperView.as deleted file mode 100644 index 6ebdbf4..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/NumericStepperView.as +++ /dev/null @@ -1,186 +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 org.apache.flex.core.BeadViewBase; - import org.apache.flex.core.IBead; - import org.apache.flex.core.IBeadView; - import org.apache.flex.core.ILayoutChild; - import org.apache.flex.core.IParent; - import org.apache.flex.core.IParentIUIBase; - import org.apache.flex.core.IRangeModel; - 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.Label; - import org.apache.flex.html.Spinner; - import org.apache.flex.html.TextInput; - import org.apache.flex.html.supportClasses.Border; - import org.apache.flex.html.supportClasses.ScrollBar; - - /** - * The NumericStepperView class creates the visual elements of the - * org.apache.flex.html.NumericStepper component. A NumberStepper consists of a - * org.apache.flex.html.TextInput component to display the value and a - * org.apache.flex.html.Spinner to change the value. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class NumericStepperView extends BeadViewBase implements IBeadView - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function NumericStepperView() - { - } - - private var label:Label; - private var input:TextInput; - private var spinner:Spinner; - - /** - * @copy org.apache.flex.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - override public function set strand(value:IStrand):void - { - super.strand = value; - - // add an input field - input = new TextInput(); - IParent(value).addElement(input); - - // add a spinner - spinner = new Spinner(); - spinner.addBead( UIBase(value).model as IBead ); - IParent(value).addElement(spinner); - spinner.height = input.height; - - // listen for changes to the text input field which will reset the - // value. ideally, we should either set the input to accept only - // numeric values or, barring that, reject non-numeric entries. we - // cannot do that right now however. - input.model.addEventListener("textChange",inputChangeHandler); - - // listen for change events on the spinner so the value can be updated as - // as resizing the component - spinner.addEventListener("valueChange",spinnerValueChanged); - IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler); - IEventDispatcher(value).addEventListener("heightChanged",sizeChangeHandler); - IEventDispatcher(value).addEventListener("sizeChanged",sizeChangeHandler); - - // listen for changes to the model itself and update the UI accordingly - IEventDispatcher(UIBase(value).model).addEventListener("valueChange",modelChangeHandler); - IEventDispatcher(UIBase(value).model).addEventListener("minimumChange",modelChangeHandler); - IEventDispatcher(UIBase(value).model).addEventListener("maximumChange",modelChangeHandler); - IEventDispatcher(UIBase(value).model).addEventListener("stepSizeChange",modelChangeHandler); - IEventDispatcher(UIBase(value).model).addEventListener("snapIntervalChange",modelChangeHandler); - - input.text = String(spinner.value); - - var host:ILayoutChild = ILayoutChild(value); - if ((host.isWidthSizedToContent() || isNaN(host.explicitWidth)) && - (host.isHeightSizedToContent() || isNaN(host.explicitHeight))) - sizeChangeHandler(null); - } - - /** - * @private - */ - private function sizeChangeHandler(event:Event) : void - { - input.x = 2; - input.y = (UIBase(_strand).height - input.height)/2; - input.width = UIBase(_strand).width-spinner.width-2; - spinner.x = input.width+2; - spinner.y = 0; - } - - /** - * @private - */ - private function spinnerValueChanged(event:Event) : void - { - input.text = String(spinner.value); - - var newEvent:Event = new Event(event.type,event.bubbles); - IEventDispatcher(_strand).dispatchEvent(newEvent); - } - - /** - * @private - */ - private function inputChangeHandler(event:Event) : void - { - var newValue:Number = Number(input.text); - - if( !isNaN(newValue) ) { - spinner.value = newValue; - } - else { - input.text = String(spinner.value); - } - } - - /** - * @private - */ - private function modelChangeHandler( event:Event ) : void - { - var n:Number = IRangeModel(UIBase(_strand).model).value; - input.text = String(IRangeModel(UIBase(_strand).model).value); - } - - /** - * The area containing the TextInput and Spinner controls. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get contentView():IParentIUIBase - { - return _strand as IParentIUIBase; - } - - /** - * @private - */ - public function get resizableView():IUIBase - { - return _strand as IUIBase; - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as deleted file mode 100644 index c52fe93..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as +++ /dev/null @@ -1,168 +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 org.apache.flex.core.IBeadView; - import org.apache.flex.core.ILayoutChild; - import org.apache.flex.core.IContentViewHost; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.IUIBase; - import org.apache.flex.core.IViewportModel; - import org.apache.flex.core.UIBase; - import org.apache.flex.core.ValuesManager; - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.geom.Rectangle; - import org.apache.flex.geom.Size; - import org.apache.flex.html.Container; - import org.apache.flex.html.Panel; - import org.apache.flex.html.TitleBar; - import org.apache.flex.utils.CSSContainerUtils; - import org.apache.flex.utils.CSSUtils; - - /** - * The Panel class creates the visual elements of the org.apache.flex.html.Panel - * component. A Panel has a org.apache.flex.html.TitleBar, and content. A - * different View, PanelWithControlBarView, can display a ControlBar. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class PanelView extends ContainerView implements IBeadView - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function PanelView() - { - super(); - } - - private var _titleBar:TitleBar; - - /** - * The org.apache.flex.html.TitleBar component of the - * org.apache.flex.html.Panel. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get titleBar():TitleBar - { - return _titleBar; - } - - /** - * @private - */ - public function set titleBar(value:TitleBar):void - { - _titleBar = value; - } - - /** - * @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 - { - var host:UIBase = UIBase(value); - - if (!_titleBar) { - _titleBar = new TitleBar(); - _titleBar.id = "panelTitleBar"; - _titleBar.height = 30; - } - // replace the TitleBar's model with the Panel's model (it implements ITitleBarModel) so that - // any changes to values in the Panel's model that correspond values in the TitleBar will - // be picked up automatically by the TitleBar. - titleBar.model = host.model; - - super.strand = value; - } - - override protected function completeSetup():void - { - (host as IContentViewHost).strandChildren.addElement(titleBar); - super.completeSetup(); - } - - /** - * Calculate the space taken up by non-content children like a TItleBar in a Panel. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - override protected function getChromeMetrics():Rectangle - { - return new Rectangle(0, titleBar.height, 0, 0 - titleBar.height); - } - - override protected function layoutViewBeforeContentLayout():void - { - var vm:IViewportModel = viewportModel; - var host:ILayoutChild = this.host as ILayoutChild; - vm.borderMetrics = CSSContainerUtils.getBorderMetrics(host); - titleBar.x = vm.borderMetrics.left; - titleBar.y = vm.borderMetrics.top; - if (!host.isWidthSizedToContent()) - titleBar.width = host.width - vm.borderMetrics.left - vm.borderMetrics.right; - vm.chromeMetrics = getChromeMetrics(); - viewport.setPosition(vm.borderMetrics.left + vm.chromeMetrics.left, - vm.borderMetrics.top + vm.chromeMetrics.top); - viewport.layoutViewportBeforeContentLayout( - !host.isWidthSizedToContent() ? - host.width - vm.borderMetrics.left - vm.borderMetrics.right - - vm.chromeMetrics.left - vm.chromeMetrics.right : NaN, - !host.isHeightSizedToContent() ? - host.height - vm.borderMetrics.top - vm.borderMetrics.bottom - - vm.chromeMetrics.top - vm.chromeMetrics.bottom : NaN); - } - - override protected function layoutViewAfterContentLayout():void - { - var vm:IViewportModel = viewportModel; - var viewportSize:Size = this.viewport.layoutViewportAfterContentLayout(); - var host:ILayoutChild = this.host as ILayoutChild; - var hasWidth:Boolean = !host.isWidthSizedToContent(); - var hasHeight:Boolean = !host.isHeightSizedToContent(); - if (!hasWidth) { - titleBar.width = viewportSize.width; // should get titlebar to layout and get new height - vm.chromeMetrics = this.getChromeMetrics(); - vm.chromeMetrics.top = titleBar.height; - } - super.layoutViewAfterContentLayout(); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as deleted file mode 100644 index 8dfcd42..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as +++ /dev/null @@ -1,207 +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.Sprite; - - import org.apache.flex.core.IBeadView; - import org.apache.flex.core.IContentViewHost; - import org.apache.flex.core.ILayoutChild; - import org.apache.flex.core.IPanelModel; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.ITitleBarModel; - import org.apache.flex.core.IUIBase; - import org.apache.flex.core.IViewportModel; - import org.apache.flex.core.UIBase; - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.geom.Rectangle; - import org.apache.flex.geom.Size; - import org.apache.flex.html.Container; - import org.apache.flex.html.ControlBar; - import org.apache.flex.html.TitleBar; - import org.apache.flex.utils.CSSContainerUtils; - - /** - * The Panel class creates the visual elements of the org.apache.flex.html.Panel - * component. A Panel has a org.apache.flex.html.TitleBar, content, and an - * optional org.apache.flex.html.ControlBar. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class PanelWithControlBarView extends ContainerView implements IBeadView - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function PanelWithControlBarView() - { - } - - private var _titleBar:TitleBar; - - /** - * The org.apache.flex.html.TitleBar component of the - * org.apache.flex.html.Panel. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get titleBar():TitleBar - { - return _titleBar; - } - - private var _controlBar:ControlBar; - - /** - * The org.apache.flex.html.ControlBar for the Panel; may be null. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get controlBar():ControlBar - { - return _controlBar; - } - - /** - * @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 - { - var host:UIBase = UIBase(value); - - // TODO: (aharui) get class to instantiate from CSS - if (!_titleBar) { - _titleBar = new TitleBar(); - _titleBar.id = "panelTitleBar"; - _titleBar.height = 30; - } - // replace the TitleBar's model with the Panel's model (it implements ITitleBarModel) so that - // any changes to values in the Panel's model that correspond values in the TitleBar will - // be picked up automatically by the TitleBar. - _titleBar.model = host.model; - - var controlBarItems:Array = (host.model as IPanelModel).controlBar; - if( controlBarItems && controlBarItems.length > 0 ) { - _controlBar = new ControlBar(); - _controlBar.id = "panelControlBar"; - _controlBar.height = 30; - - for each(var comp:IUIBase in controlBarItems) { - _controlBar.addElement(comp, false); - } - } - - super.strand = value; - } - - override protected function completeSetup():void - { - super.completeSetup(); - - (_strand as IContentViewHost).strandChildren.addElement(titleBar, false); - - if (controlBar) { - (_strand as IContentViewHost).strandChildren.addElement(_controlBar, false); - } - } - - /** - * Calculate the space taken up by non-content children like a TItleBar in a Panel. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - override protected function getChromeMetrics():Rectangle - { - return new Rectangle(0, titleBar.height, 0, controlBar.height - titleBar.height); - } - - override protected function layoutViewBeforeContentLayout():void - { - var vm:IViewportModel = viewportModel; - var host:ILayoutChild = this.host as ILayoutChild; - var hasHeight:Boolean = !host.isHeightSizedToContent(); - var hasWidth:Boolean = !host.isWidthSizedToContent(); - vm.borderMetrics = CSSContainerUtils.getBorderMetrics(host); - titleBar.x = vm.borderMetrics.left; - titleBar.y = vm.borderMetrics.top; - if (hasWidth) - { - titleBar.width = host.width - vm.borderMetrics.left - vm.borderMetrics.right; - controlBar.width = host.width - vm.borderMetrics.left - vm.borderMetrics.right; - } - vm.chromeMetrics = getChromeMetrics(); - controlBar.x = vm.borderMetrics.left; - if (hasHeight && hasWidth) - controlBar.y = host.height - vm.borderMetrics.bottom - controlBar.height; - - viewport.setPosition(vm.borderMetrics.left + vm.chromeMetrics.left, - vm.borderMetrics.top + vm.chromeMetrics.top); - viewport.layoutViewportBeforeContentLayout( - hasWidth ? - host.width - vm.borderMetrics.left - vm.borderMetrics.right - - vm.chromeMetrics.left - vm.chromeMetrics.right : NaN, - hasHeight ? - host.height - vm.borderMetrics.top - vm.borderMetrics.bottom - - vm.chromeMetrics.top - vm.chromeMetrics.bottom : NaN); - } - - override protected function layoutViewAfterContentLayout():void - { - var vm:IViewportModel = viewportModel; - var viewportSize:Size = this.viewport.layoutViewportAfterContentLayout(); - var host:ILayoutChild = this.host as ILayoutChild; - var hasWidth:Boolean = !host.isWidthSizedToContent(); - var hasHeight:Boolean = !host.isHeightSizedToContent(); - if (!hasWidth) { - titleBar.width = viewportSize.width; // should get titlebar to layout and get new height - vm.chromeMetrics = this.getChromeMetrics(); - vm.chromeMetrics.top = titleBar.height; - controlBar.width = viewportSize.width; // should get controlbar to layout and get new height - vm.chromeMetrics.bottom = controlBar.height; - } - super.layoutViewAfterContentLayout(); - if (!hasHeight) { - controlBar.y = host.height - vm.borderMetrics.bottom - controlBar.height; - } - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/RadioButtonView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/RadioButtonView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/RadioButtonView.as deleted file mode 100644 index 245c3d3..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/RadioButtonView.as +++ /dev/null @@ -1,281 +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.Shape; - import flash.display.SimpleButton; - import flash.display.Sprite; - import flash.text.TextFieldAutoSize; - import flash.text.TextFieldType; - - import org.apache.flex.core.BeadViewBase; - import org.apache.flex.core.CSSTextField; - import org.apache.flex.core.IBeadView; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.IValueToggleButtonModel; - import org.apache.flex.events.Event; - - /** - * The RadioButtonView class creates the visual elements of the org.apache.flex.html.RadioButton - * component. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class RadioButtonView extends BeadViewBase implements IBeadView - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function RadioButtonView() - { - sprites = [ upSprite = new Sprite(), - downSprite = new Sprite(), - overSprite = new Sprite(), - upAndSelectedSprite = new Sprite(), - downAndSelectedSprite = new Sprite(), - overAndSelectedSprite = new Sprite() ]; - - for each( var s:Sprite in sprites ) - { - var tf:CSSTextField = new CSSTextField(); - tf.type = TextFieldType.DYNAMIC; - tf.autoSize = TextFieldAutoSize.LEFT; - tf.name = "textField"; - var icon:Shape = new Shape(); - icon.name = "icon"; - s.addChild(icon); - s.addChild(tf); - } - } - - private var upSprite:Sprite; - private var downSprite:Sprite; - private var overSprite:Sprite; - private var upAndSelectedSprite:Sprite; - private var downAndSelectedSprite:Sprite; - private var overAndSelectedSprite:Sprite; - - private var sprites:Array; - - private var _toggleButtonModel:IValueToggleButtonModel; - - /** - * The model used for the RadioButton. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get toggleButtonModel() : IValueToggleButtonModel - { - return _toggleButtonModel; - } - - /** - * @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; - _toggleButtonModel = value.getBeadByType(IValueToggleButtonModel) as IValueToggleButtonModel; - _toggleButtonModel.addEventListener("textChange", textChangeHandler); - _toggleButtonModel.addEventListener("htmlChange", htmlChangeHandler); - _toggleButtonModel.addEventListener("selectedValueChange", selectedValueChangeHandler); - if (_toggleButtonModel.text != null) - text = _toggleButtonModel.text; - if (_toggleButtonModel.html != null) - html = _toggleButtonModel.html; - - layoutControl(); - - var hitArea:Shape = new Shape(); - hitArea.graphics.beginFill(0x000000); - hitArea.graphics.drawRect(0,0,upSprite.width, upSprite.height); - hitArea.graphics.endFill(); - - SimpleButton(value).upState = upSprite; - SimpleButton(value).downState = downSprite; - SimpleButton(value).overState = overSprite; - SimpleButton(value).hitTestState = hitArea; - - if (toggleButtonModel.text !== null) - text = toggleButtonModel.text; - if (toggleButtonModel.html !== null) - html = toggleButtonModel.html; - - if (toggleButtonModel.selected && toggleButtonModel.value == value) { - selected = true; - } - } - - /** - * The string label for the org.apache.flex.html.RadioButton. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get text():String - { - var tf:CSSTextField = upSprite.getChildByName('textField') as CSSTextField; - return tf.text; - } - public function set text(value:String):void - { - for each( var s:Sprite in sprites ) - { - var tf:CSSTextField = s.getChildByName('textField') as CSSTextField; - tf.text = value; - } - - layoutControl(); - } - - /** - * The HTML string for the org.apache.flex.html.RadioButton. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get html():String - { - var tf:CSSTextField = upSprite.getChildByName('textField') as CSSTextField; - return tf.htmlText; - } - public function set html(value:String):void - { - for each(var s:Sprite in sprites) - { - var tf:CSSTextField = s.getChildByName('textField') as CSSTextField; - tf.htmlText = value; - } - - layoutControl(); - } - - /** - * @private - */ - private function textChangeHandler(event:Event):void - { - text = toggleButtonModel.text; - } - - /** - * @private - */ - private function htmlChangeHandler(event:Event):void - { - html = toggleButtonModel.html; - } - - private var _selected:Boolean; - - /** - * The selection state of the RadioButton - */ - public function get selected():Boolean - { - return _selected; - } - public function set selected(value:Boolean):void - { - _selected = value; - - if( value ) { - SimpleButton(_strand).upState = upAndSelectedSprite; - SimpleButton(_strand).downState = downAndSelectedSprite; - SimpleButton(_strand).overState = overAndSelectedSprite; - - } else { - SimpleButton(_strand).upState = upSprite; - SimpleButton(_strand).downState = downSprite; - SimpleButton(_strand).overState = overSprite; - } - - layoutControl(); - } - - /** - * @private - */ - private function selectedValueChangeHandler(event:Event):void - { - selected = _toggleButtonModel.value == _toggleButtonModel.selectedValue; - } - - /** - * @private - */ - protected function layoutControl() : void - { - for each(var s:Sprite in sprites) - { - var icon:Shape = s.getChildByName("icon") as Shape; - var tf:CSSTextField = s.getChildByName("textField") as CSSTextField; - - drawRadioButton(icon); - - var mh:Number = Math.max(icon.height,tf.height); - - icon.x = 0; - icon.y = (mh - icon.height)/2; - - tf.x = icon.x + icon.width + 1; - tf.y = (mh - tf.height)/2; - } - - } - - /** - * @private - */ - protected function drawRadioButton(icon:Shape) : void - { - icon.graphics.clear(); - icon.graphics.beginFill(0xf8f8f8); - icon.graphics.lineStyle(1,0x808080); - icon.graphics.drawEllipse(0,0,10,10); - icon.graphics.endFill(); - - if( selected ) { - icon.graphics.beginFill(0); - icon.graphics.drawEllipse(3,3,4,4); - icon.graphics.endFill(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/RightArrowButtonView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/RightArrowButtonView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/RightArrowButtonView.as deleted file mode 100644 index 225c37c..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/RightArrowButtonView.as +++ /dev/null @@ -1,112 +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 RightArrowButtonView class is the view for - * the right 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 RightArrowButtonView extends BeadViewBase implements IBeadView - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function RightArrowButtonView() - { - upView = new Shape(); - downView = new Shape(); - overView = new Shape(); - - drawView(upView.graphics, 0xf8f8f8); - drawView(downView.graphics, 0xd8d8d8); - drawView(overView.graphics, 0xe8e8e8); - } - - private function drawView(g:Graphics, bgColor:uint):void - { - g.lineStyle(1, 0x808080); - g.beginFill(bgColor); - g.drawRoundRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize, ScrollBarView.ThirdSize); - g.endFill(); - g.lineStyle(0); - g.beginFill(0); - g.moveTo(ScrollBarView.QuarterSize, ScrollBarView.QuarterSize); - g.lineTo(ScrollBarView.ThreeQuarterSize, ScrollBarView.HalfSize); - g.lineTo(ScrollBarView.QuarterSize, ScrollBarView.ThreeQuarterSize); - g.lineTo(ScrollBarView.QuarterSize, ScrollBarView.QuarterSize); - 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; - 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; - - SimpleButton(_strand).addEventListener("widthChanged",sizeChangeHandler); - SimpleButton(_strand).addEventListener("heightChanged",sizeChangeHandler); - } - - private var upView:Shape; - private var downView:Shape; - private var overView:Shape; - - private function sizeChangeHandler(event:Event):void - { - SimpleButton(_strand).scaleX = SimpleButton(_strand).width / ScrollBarView.FullSize; - SimpleButton(_strand).scaleY = SimpleButton(_strand).height / ScrollBarView.FullSize; - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ScrollBarView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ScrollBarView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ScrollBarView.as deleted file mode 100644 index e3f8c50..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ScrollBarView.as +++ /dev/null @@ -1,216 +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.ScrollBar class. - * It implements the classic desktop-like ScrollBar. - * 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 ScrollBarView extends Strand implements IBeadView, IStrand, IScrollBarView - { - public static const FullSize:int = 12; - public static const ThreeQuarterSize:int = 9; - public static const HalfSize:int = 6; - public static const ThirdSize:int = 4; - public static const QuarterSize:int = 3; - - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function ScrollBarView() - { - } - - protected var sbModel:IScrollBarModel; - - protected var _strand:IStrand; - - /** - * The layout. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - protected var layout:IBeadLayout; - - /** - * The host component. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get host():IUIBase - { - return _strand as IUIBase; - } - - /** - * @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; - - for each (var bead:IBead in beads) - addBead(bead); - - sbModel = value.getBeadByType(IScrollBarModel) as IScrollBarModel; - sbModel = _strand.getBeadByType(IScrollBarModel) as IScrollBarModel; - sbModel.addEventListener("maximumChange", changeHandler); - sbModel.addEventListener("minimumChange", changeHandler); - sbModel.addEventListener("snapIntervalChange", changeHandler); - sbModel.addEventListener("stepSizeChange", changeHandler); - sbModel.addEventListener("pageSizeChange", changeHandler); - sbModel.addEventListener("valueChange", changeHandler); - - if( _strand.getBeadByType(IBeadLayout) == null ) { - layout = new (ValuesManager.valuesImpl.getValue(_strand, "iBeadLayout")) as IBeadLayout; - _strand.addBead(layout); - } - } - - protected function changeHandler(event:Event):void - { - layout.layout(); - } - - protected var _decrement:DisplayObject; - protected var _increment:DisplayObject; - protected var _track:DisplayObject; - protected var _thumb:DisplayObject; - - /** - * @copy org.apache.flex.html.beads.IScrollBarView#decrement - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get decrement():DisplayObject - { - return _decrement; - } - - /** - * @copy org.apache.flex.html.beads.IScrollBarView#increment - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get increment():DisplayObject - { - return _increment; - } - - /** - * @copy org.apache.flex.html.beads.IScrollBarView#track - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get track():DisplayObject - { - return _track; - } - - /** - * @copy org.apache.flex.html.beads.IScrollBarView#thumb - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get thumb():DisplayObject - { - return _thumb; - } - - /** - * @copy org.apache.flex.core.IBeadView#viewHeight - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get viewHeight():Number - { - // don't want to put $height in an interface - return _strand["$height"]; - } - - /** - * @copy org.apache.flex.core.IBeadView#viewWidth - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get viewWidth():Number - { - // don't want to put $width in an interface - return _strand["$width"]; - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SimpleAlertView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SimpleAlertView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SimpleAlertView.as deleted file mode 100644 index 949f9c9..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SimpleAlertView.as +++ /dev/null @@ -1,149 +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 org.apache.flex.core.BeadViewBase; - import org.apache.flex.core.IAlertModel; - import org.apache.flex.core.IBead; - import org.apache.flex.core.IBeadView; - import org.apache.flex.core.IMeasurementBead; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.IParent; - import org.apache.flex.core.UIBase; - import org.apache.flex.core.ValuesManager; - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.geom.Rectangle; - import org.apache.flex.html.Label; - import org.apache.flex.html.TextButton; - import org.apache.flex.utils.CSSContainerUtils; - - /** - * The SimpleAlertView class creates the visual elements of the - * org.apache.flex.html.SimpleAlert component. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class SimpleAlertView extends BeadViewBase implements IBeadView - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function SimpleAlertView() - { - } - - private var messageLabel:Label; - private var okButton:TextButton; - - /** - * @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; - - var backgroundColor:Object = ValuesManager.valuesImpl.getValue(value, "background-color"); - var backgroundImage:Object = ValuesManager.valuesImpl.getValue(value, "background-image"); - if (backgroundColor != null || backgroundImage != null) - { - if (value.getBeadByType(IBackgroundBead) == null) - value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBackgroundBead")) as IBead); - } - - var borderStyle:String; - var borderStyles:Object = ValuesManager.valuesImpl.getValue(value, "border"); - if (borderStyles is Array) - { - borderStyle = borderStyles[1]; - } - if (borderStyle == null) - { - borderStyle = ValuesManager.valuesImpl.getValue(value, "border-style") as String; - } - if (borderStyle != null && borderStyle != "none") - { - if (value.getBeadByType(IBorderBead) == null) - value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead); - } - - var model:IAlertModel = _strand.getBeadByType(IAlertModel) as IAlertModel; - model.addEventListener("messageChange",handleMessageChange); - model.addEventListener("htmlMessageChange",handleMessageChange); - - messageLabel = new Label(); - messageLabel.text = model.message; - messageLabel.html = model.htmlMessage; - IParent(_strand).addElement(messageLabel); - - okButton = new TextButton(); - okButton.text = model.okLabel; - IParent(_strand).addElement(okButton); - okButton.addEventListener("click",handleOK); - - handleMessageChange(null); - } - - /** - * @private - */ - private function handleMessageChange(event:Event):void - { - var ruler:IMeasurementBead = messageLabel.getBeadByType(IMeasurementBead) as IMeasurementBead; - if( ruler == null ) { - messageLabel.addBead(ruler = new (ValuesManager.valuesImpl.getValue(messageLabel, "iMeasurementBead")) as IMeasurementBead); - } - var maxWidth:Number = Math.max(UIBase(_strand).width,ruler.measuredWidth); - - var metrics:Rectangle = CSSContainerUtils.getBorderAndPaddingMetrics(_strand); - - messageLabel.x = metrics.left; - messageLabel.y = metrics.top; - messageLabel.width = maxWidth; - - okButton.x = (maxWidth - okButton.width)/2; - okButton.y = messageLabel.y + messageLabel.height + 20; - - UIBase(_strand).width = maxWidth + metrics.left + metrics.right; - UIBase(_strand).height = okButton.y + okButton.height + metrics.bottom; - } - - /** - * @private - */ - private function handleOK(event:Event):void - { - var newEvent:Event = new Event("close"); - IEventDispatcher(_strand).dispatchEvent(newEvent); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SingleLineBorderBead.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SingleLineBorderBead.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SingleLineBorderBead.as deleted file mode 100644 index 49f3608..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SingleLineBorderBead.as +++ /dev/null @@ -1,91 +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 org.apache.flex.core.IBead; - import org.apache.flex.core.IStatesObject; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.UIBase; - import org.apache.flex.core.ValuesManager; - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.utils.CSSBorderUtils; - - /** - * The SingleLineBorderBead class draws a single line solid border. - * The color and thickness can be specified in CSS. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class SingleLineBorderBead implements IBead, IBorderBead, IGraphicsDrawing - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function SingleLineBorderBead() - { - } - - 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("layoutNeeded", changeHandler); - IEventDispatcher(value).addEventListener("heightChanged", changeHandler); - IEventDispatcher(value).addEventListener("widthChanged", changeHandler); - IEventDispatcher(value).addEventListener("sizeChanged", changeHandler); - changeHandler(null); - } - - private function changeHandler(event:Event):void - { - var host:UIBase = UIBase(_strand); - var g:Graphics = host.graphics; - var w:Number = host.width; - var h:Number = host.height; - var state:String; - if (host is IStatesObject) - state = IStatesObject(host).currentState; - - var gd:IGraphicsDrawing = _strand.getBeadByType(IGraphicsDrawing) as IGraphicsDrawing; - if( this == gd ) g.clear(); - - CSSBorderUtils.draw(g, w, h, host, state, false, false); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SliderThumbView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SliderThumbView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SliderThumbView.as deleted file mode 100644 index c20c781..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SliderThumbView.as +++ /dev/null @@ -1,156 +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 -{ - COMPILE::AS3 - { - 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; - COMPILE::JS - { - import org.apache.flex.core.WrappedHTMLElement; - } - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - - /** - * The SliderThumbView class creates the draggable input element for the - * org.apache.flex.html.Slider component. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class SliderThumbView extends BeadViewBase implements IBeadView - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function SliderThumbView() - { - COMPILE::AS3 - { - hitArea = new Shape(); - upView = new Shape(); - downView = new Shape(); - overView = new Shape(); - } - } - - /** - * @private - */ - COMPILE::AS3 - private function drawView(g:Graphics, bgColor:uint):void - { - g.clear(); - g.lineStyle(1,0x000000); - g.beginFill(bgColor); - g.drawCircle(SimpleButton(_strand).width/2, SimpleButton(_strand).height/2, 10); - g.endFill(); - } - - COMPILE::AS3 - private var hitArea:Shape; - - /** - * @copy org.apache.flex.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignoreimport org.apache.flex.core.WrappedHTMLElement - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - */ - override public function set strand(value:IStrand):void - { - super.strand = value; - - COMPILE::AS3 - { - drawView(hitArea.graphics, 0xDD0000); - drawView(upView.graphics, 0xFFFFFF); - drawView(downView.graphics, 0x999999); - drawView(overView.graphics, 0xDDDDDD); - - SimpleButton(value).upState = upView; - SimpleButton(value).downState = downView; - SimpleButton(value).overState = overView; - SimpleButton(value).hitTestState = hitArea; - - IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler); - IEventDispatcher(value).addEventListener("heightChanged",sizeChangeHandler); - } - COMPILE::JS - { - - element = document.createElement('div') as WrappedHTMLElement; - element.className = 'SliderThumb'; - element.id = 'thumb'; - element.style.backgroundColor = '#949494'; - element.style.border = 'thin solid #747474'; - element.style.position = 'relative'; - element.style.height = '30px'; - element.style.width = '10px'; - element.style.zIndex = '2'; - element.style.top = '-10px'; - element.style.left = '20px'; - - host.element.appendChild(element); - - element.flexjs_wrapper = this; - - } - } - - COMPILE::AS3 - private var upView:Shape; - COMPILE::AS3 - private var downView:Shape; - COMPILE::AS3 - private var overView:Shape; - - COMPILE::JS - public var element:WrappedHTMLElement; - - /** - * @private - */ - COMPILE::AS3 - private function sizeChangeHandler( event:Event ) : void - { - drawView(hitArea.graphics, 0xDD0000); - drawView(upView.graphics, 0xFFFFFF); - drawView(downView.graphics, 0x999999); - drawView(overView.graphics, 0xDDDDDD); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SliderTrackView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SliderTrackView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SliderTrackView.as deleted file mode 100644 index 6752347..0000000 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/SliderTrackView.as +++ /dev/null @@ -1,153 +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 -{ - COMPILE::AS3 - { - 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.core.UIBase; - COMPILE::JS - { - import org.apache.flex.core.WrappedHTMLElement; - } - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - - /** - * The SliderTrackView class creates the track area for the org.apache.flex.html.Slider - * component. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class SliderTrackView extends BeadViewBase implements IBeadView - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function SliderTrackView() - { - COMPILE::AS3 - { - hitArea = new Shape(); - upView = new Shape(); - downView = new Shape(); - overView = new Shape(); - } - } - - /** - * @private - */ - COMPILE::AS3 - private function drawView(g:Graphics, bgColor:uint):void - { - g.clear(); - g.lineStyle(1,0x000000); - g.beginFill(bgColor); - g.drawRect(0, 0, SimpleButton(_strand).width, SimpleButton(_strand).height); - g.endFill(); - } - - COMPILE::AS3 - private var hitArea: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; - - COMPILE::AS3 - { - drawView(hitArea.graphics, 0xDD0000); - drawView(upView.graphics, 0xCCCCCC); - drawView(downView.graphics, 0x808080); - drawView(overView.graphics, 0xEEEEEE); - - SimpleButton(value).upState = upView; - SimpleButton(value).downState = downView; - SimpleButton(value).overState = overView; - SimpleButton(value).hitTestState = hitArea; - - IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler); - IEventDispatcher(value).addEventListener("heightChanged",sizeChangeHandler); - } - COMPILE::JS - { - element = document.createElement('div') as WrappedHTMLElement; - element.className = 'SliderTrack'; - element.id = 'track'; - element.style.backgroundColor = '#E4E4E4'; - element.style.height = '10px'; - element.style.width = '200px'; - element.style.border = 'thin solid #C4C4C4'; - element.style.position = 'relative'; - element.style.left = '0px'; - element.style.top = '10px'; - element.style.zIndex = '1'; - - var host:UIBase = value as UIBase; - host.element.appendChild(element); - } - } - - COMPILE::JS - public var element:WrappedHTMLElement; - - COMPILE::AS3 - private var upView:Shape; - COMPILE::AS3 - private var downView:Shape; - COMPILE::AS3 - private var overView:Shape; - - /** - * @private - */ - COMPILE::AS3 - private function sizeChangeHandler( event:Event ) : void - { - drawView(hitArea.graphics, 0xDD0000); - drawView(upView.graphics, 0xCCCCCC); - drawView(downView.graphics, 0x808080); - drawView(overView.graphics, 0xEEEEEE); - } - } -}
