Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E87AB1035A for ; Tue, 25 Mar 2014 21:04:22 +0000 (UTC) Received: (qmail 86106 invoked by uid 500); 25 Mar 2014 21:03:57 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 86004 invoked by uid 500); 25 Mar 2014 21:03:53 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 85365 invoked by uid 99); 25 Mar 2014 21:03:35 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Mar 2014 21:03:35 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 6256692352B; Tue, 25 Mar 2014 21:03:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aharui@apache.org To: commits@flex.apache.org Date: Tue, 25 Mar 2014 21:03:46 -0000 Message-Id: <7ec1d148bf9247748b707b35f8a4764e@git.apache.org> In-Reply-To: <88b37b013ed7405ca4834ff234912bba@git.apache.org> References: <88b37b013ed7405ca4834ff234912bba@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [14/35] remove staticControls folders and move components up a level. Next commit will rename packages inside the files http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualHorizontalLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualHorizontalLayout.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualHorizontalLayout.as new file mode 100644 index 0000000..58bec68 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualHorizontalLayout.as @@ -0,0 +1,172 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.layouts +{ + import flash.display.DisplayObject; + import flash.display.DisplayObjectContainer; + + import org.apache.flex.core.IBeadLayout; + import org.apache.flex.core.ILayoutParent; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.ValuesManager; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + + /** + * The NonVirtualHorizontalLayout class is a simple layout + * bead. It takes the set of children and lays them out + * horizontally in one row, separating them according to + * CSS layout rules for margin and vertical-align styles. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class NonVirtualHorizontalLayout implements IBeadLayout + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function NonVirtualHorizontalLayout() + { + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + _strand = value; + IEventDispatcher(value).addEventListener("widthChanged", changeHandler); + IEventDispatcher(value).addEventListener("childrenAdded", changeHandler); + IEventDispatcher(value).addEventListener("itemsCreated", changeHandler); + } + + private function changeHandler(event:Event):void + { + var layoutParent:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent; + var contentView:DisplayObjectContainer = layoutParent.contentView; + + var n:int = contentView.numChildren; + var marginLeft:Object; + var marginRight:Object; + var marginTop:Object; + var marginBottom:Object; + var margin:Object; + var maxHeight:Number = 0; + var verticalMargins:Array = []; + + for (var i:int = 0; i < n; i++) + { + var child:DisplayObject = contentView.getChildAt(i); + margin = ValuesManager.valuesImpl.getValue(child, "margin"); + if (margin is Array) + { + if (margin.length == 1) + marginLeft = marginTop = marginRight = marginBottom = margin[0]; + else if (margin.length <= 3) + { + marginLeft = marginRight = margin[1]; + marginTop = marginBottom = margin[0]; + } + else if (margin.length == 4) + { + marginLeft = margin[3]; + marginBottom = margin[2]; + marginRight = margin[1]; + marginTop = margin[0]; + } + } + else if (margin == null) + { + marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left"); + marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top"); + marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right"); + marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom"); + } + else + { + marginLeft = marginTop = marginBottom = marginRight = margin; + } + var ml:Number; + var mr:Number; + var mt:Number; + var mb:Number; + var lastmr:Number; + mt = Number(marginTop); + if (isNaN(mt)) + mt = 0; + mb = Number(marginBottom); + if (isNaN(mb)) + mb = 0; + if (marginLeft == "auto") + ml = 0; + else + { + ml = Number(marginLeft); + if (isNaN(ml)) + ml = 0; + } + if (marginRight == "auto") + mr = 0; + else + { + mr = Number(marginRight); + if (isNaN(mr)) + mr = 0; + } + child.y = mt; + maxHeight = Math.max(maxHeight, ml + child.height + mr); + var xx:Number; + if (i == 0) + child.x = ml; + else + child.x = xx + ml + lastmr; + xx = child.x + child.width; + lastmr = mr; + var valign:Object = ValuesManager.valuesImpl.getValue(child, "vertical-align"); + verticalMargins.push({ marginTop: marginTop, marginBottom: marginBottom, valign: valign }); + } + for (i = 0; i < n; i++) + { + var obj:Object = verticalMargins[0] + child = contentView.getChildAt(i); + if (obj.valign == "middle") + child.y = maxHeight - child.height / 2; + else if (valign == "bottom") + child.y = maxHeight - child.height - obj.marginBottom; + else + child.y = obj.marginTop; + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualHorizontalScrollingLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualHorizontalScrollingLayout.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualHorizontalScrollingLayout.as new file mode 100644 index 0000000..32e3597 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualHorizontalScrollingLayout.as @@ -0,0 +1,136 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.layouts +{ + import flash.display.DisplayObject; + import flash.display.DisplayObjectContainer; + + import org.apache.flex.core.IBeadLayout; + import org.apache.flex.core.IBorderModel; + import org.apache.flex.core.ILayoutParent; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + import org.apache.flex.html.staticControls.supportClasses.Border; + import org.apache.flex.html.staticControls.supportClasses.ScrollBar; + + /** + * The NonVirtualHorizontalScrollingLayout class is a layout + * bead that displays a set of children horizontally in one row, + * separating them according to CSS layout rules for margin and + * vertical-align styles and lays out a horizontal ScrollBar + * below the children. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class NonVirtualHorizontalScrollingLayout implements IBeadLayout + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function NonVirtualHorizontalScrollingLayout() + { + } + + private var hScrollBar:ScrollBar; + + 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("heightChanged", changeHandler); + IEventDispatcher(value).addEventListener("widthChanged", changeHandler); + IEventDispatcher(value).addEventListener("itemsCreated", changeHandler); + } + + private function changeHandler(event:Event):void + { + var layoutParent:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent; + var contentView:DisplayObjectContainer = layoutParent.contentView; + var border:Border = layoutParent.border; + var borderModel:IBorderModel = border.model as IBorderModel; + + var ww:Number = layoutParent.resizableView.width; + var hh:Number = layoutParent.resizableView.height; + border.width = ww; + border.height = hh; + + contentView.width = ww - borderModel.offsets.left - borderModel.offsets.right; + contentView.height = hh - borderModel.offsets.top - borderModel.offsets.bottom; + contentView.x = borderModel.offsets.left; + contentView.y = borderModel.offsets.top; + + var n:int = contentView.numChildren; + var xx:Number = 0; + for (var i:int = 0; i < n; i++) + { + var ir:DisplayObject = contentView.getChildAt(i); + ir.x = xx; + ir.height = contentView.height; + xx += ir.width; + } + /* + if (xx > dataGroup.width) + { + hScrollBar = listView.hScrollBar; + dataGroup.height -= hScrollBar.height; + IScrollBarModel(hScrollBar.model).maximum = xx; + IScrollBarModel(hScrollBar.model).pageSize = dataGroup.width; + IScrollBarModel(hScrollBar.model).pageStepSize = dataGroup.width; + hScrollBar.visible = true; + hScrollBar.width = dataGroup.width; + hScrollBar.x = dataGroup.x; + hScrollBar.y = dataGroup.height; + var xpos:Number = IScrollBarModel(hScrollBar.model).value; + dataGroup.scrollRect = new Rectangle(xpos, 0, xpos + dataGroup.width, dataGroup.height); + hScrollBar.addEventListener("scroll", scrollHandler); + } + else if (hScrollBar) + { + dataGroup.scrollRect = null; + hScrollBar.visible = false; + } + */ + } + + /*private function scrollHandler(event:Event):void + { + var xpos:Number = IScrollBarModel(hScrollBar.model).value; + dataGroup.scrollRect = new Rectangle(xpos, 0, xpos + dataGroup.width, dataGroup.height); + }*/ + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalLayout.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalLayout.as new file mode 100644 index 0000000..33f48e8 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalLayout.as @@ -0,0 +1,191 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.layouts +{ + import flash.display.DisplayObject; + import flash.display.DisplayObjectContainer; + + import org.apache.flex.core.IBead; + import org.apache.flex.core.ILayoutParent; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.ValuesManager; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + + /** + * The NonVirtualVerticalLayout class is a simple layout + * bead. It takes the set of children and lays them out + * vertically in one column, separating them according to + * CSS layout rules for margin and horizontal-align styles. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class NonVirtualVerticalLayout implements IBead + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function NonVirtualVerticalLayout() + { + } + + 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("heightChanged", changeHandler); + IEventDispatcher(value).addEventListener("childrenAdded", changeHandler); + IEventDispatcher(value).addEventListener("itemsCreated", changeHandler); + IEventDispatcher(value).addEventListener("beadsAdded", changeHandler); + } + + private function changeHandler(event:Event):void + { + var layoutParent:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent; + var contentView:DisplayObjectContainer = layoutParent.contentView; + + var n:int = contentView.numChildren; + var hasHorizontalFlex:Boolean; + var flexibleHorizontalMargins:Array = []; + var marginLeft:Object; + var marginRight:Object; + var marginTop:Object; + var marginBottom:Object; + var margin:Object; + var maxWidth:Number = 0; + for (var i:int = 0; i < n; i++) + { + var child:DisplayObject = contentView.getChildAt(i); + margin = ValuesManager.valuesImpl.getValue(child, "margin"); + if (margin is Array) + { + if (margin.length == 1) + marginLeft = marginTop = marginRight = marginBottom = margin[0]; + else if (margin.length <= 3) + { + marginLeft = marginRight = margin[1]; + marginTop = marginBottom = margin[0]; + } + else if (margin.length == 4) + { + marginLeft = margin[3]; + marginBottom = margin[2]; + marginRight = margin[1]; + marginTop = margin[0]; + } + } + else if (margin == null) + { + marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left"); + marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top"); + marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right"); + marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom"); + } + else + { + marginLeft = marginTop = marginBottom = marginRight = margin; + } + var ml:Number; + var mr:Number; + var mt:Number; + var mb:Number; + var lastmb:Number; + mt = Number(marginTop); + if (isNaN(mt)) + mt = 0; + mb = Number(marginBottom); + if (isNaN(mb)) + mb = 0; + var yy:Number; + if (i == 0) + child.y = mt; + else + child.y = yy + Math.max(mt, lastmb); + yy = child.y + child.height; + lastmb = mb; + flexibleHorizontalMargins[i] = {}; + if (marginLeft == "auto") + { + ml = 0; + flexibleHorizontalMargins[i].marginLeft = marginLeft; + hasHorizontalFlex = true; + } + else + { + ml = Number(marginLeft); + if (isNaN(ml)) + { + ml = 0; + flexibleHorizontalMargins[i].marginLeft = marginLeft; + } + else + flexibleHorizontalMargins[i].marginLeft = ml; + } + if (marginRight == "auto") + { + mr = 0; + flexibleHorizontalMargins[i].marginRight = marginRight; + hasHorizontalFlex = true; + } + else + { + mr = Number(marginRight); + if (isNaN(mr)) + { + mr = 0; + flexibleHorizontalMargins[i].marginRight = marginRight; + } + else + flexibleHorizontalMargins[i].marginRight = mr; + } + child.x = ml; + maxWidth = Math.max(maxWidth, ml + child.width + mr); + } + if (hasHorizontalFlex) + { + for (i = 0; i < n; i++) + { + child = contentView.getChildAt(i); + var obj:Object = flexibleHorizontalMargins[i]; + if (obj.marginLeft == "auto" && obj.marginRight == "auto") + child.x = maxWidth - child.width / 2; + else if (obj.marginLeft == "auto") + child.x = maxWidth - child.width - obj.marginRight; + } + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalScrollingLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalScrollingLayout.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalScrollingLayout.as new file mode 100644 index 0000000..6f2f424 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalScrollingLayout.as @@ -0,0 +1,140 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.layouts +{ + import flash.display.DisplayObject; + import flash.display.DisplayObjectContainer; + import flash.geom.Rectangle; + + import org.apache.flex.core.IBeadLayout; + import org.apache.flex.core.IBorderModel; + import org.apache.flex.core.ILayoutParent; + import org.apache.flex.core.IScrollBarModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + import org.apache.flex.html.staticControls.supportClasses.Border; + import org.apache.flex.html.staticControls.supportClasses.ScrollBar; + + /** + * The NonVirtualVerticalScrollingLayout class is a layout + * bead that displays a set of children vertically in one row, + * separating them according to CSS layout rules for margin and + * vertical-align styles and lays out a vertical ScrollBar + * to the right of the children. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class NonVirtualVerticalScrollingLayout implements IBeadLayout + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function NonVirtualVerticalScrollingLayout() + { + } + + private var vScrollBar:ScrollBar; + + 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("heightChanged", changeHandler); + IEventDispatcher(value).addEventListener("widthChanged", changeHandler); + IEventDispatcher(value).addEventListener("itemsCreated", changeHandler); + IEventDispatcher(value).addEventListener("layoutNeeded", changeHandler); + } + + private function changeHandler(event:Event):void + { + var layoutParent:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent; + var contentView:DisplayObjectContainer = layoutParent.contentView; + var border:Border = layoutParent.border; + var borderModel:IBorderModel = border.model as IBorderModel; + + var ww:Number = DisplayObject(layoutParent.resizableView).width; + var hh:Number = DisplayObject(layoutParent.resizableView).height; + border.width = ww; + border.height = hh; + + contentView.width = ww - borderModel.offsets.left - borderModel.offsets.right; + contentView.height = hh - borderModel.offsets.top - borderModel.offsets.bottom; + contentView.x = borderModel.offsets.left; + contentView.y = borderModel.offsets.top; + + var n:int = contentView.numChildren; + var yy:Number = 0; + for (var i:int = 0; i < n; i++) + { + var ir:DisplayObject = contentView.getChildAt(i); + ir.y = yy; + ir.width = contentView.width; + yy += ir.height; + } + if (yy > contentView.height) + { + vScrollBar = layoutParent.vScrollBar; + contentView.width -= vScrollBar.width; + IScrollBarModel(vScrollBar.model).maximum = yy; + IScrollBarModel(vScrollBar.model).pageSize = contentView.height; + IScrollBarModel(vScrollBar.model).pageStepSize = contentView.height; + vScrollBar.visible = true; + vScrollBar.height = contentView.height; + vScrollBar.y = contentView.y; + vScrollBar.x = contentView.width; + var vpos:Number = IScrollBarModel(vScrollBar.model).value; + contentView.scrollRect = new Rectangle(0, vpos, contentView.width, vpos + contentView.height); + vScrollBar.addEventListener("scroll", scrollHandler); + } + else if (vScrollBar) + { + contentView.scrollRect = null; + vScrollBar.visible = false; + } + } + + private function scrollHandler(event:Event):void + { + var layoutParent:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent; + var contentView:DisplayObjectContainer = layoutParent.contentView; + + var vpos:Number = IScrollBarModel(vScrollBar.model).value; + contentView.scrollRect = new Rectangle(0, vpos, contentView.width, vpos + contentView.height); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/TileLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/TileLayout.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/TileLayout.as new file mode 100644 index 0000000..b43457a --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/TileLayout.as @@ -0,0 +1,184 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.layouts +{ + import org.apache.flex.core.IBeadLayout; + import org.apache.flex.core.ILayoutParent; + 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 TileLayout class bead sizes and positions the elements it manages into rows and columns. + * The size of each element is determined either by setting TileLayout's columnWidth and rowHeight + * properties, or having the tile size determined by factoring the numColumns into the area assigned + * for the layout. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class TileLayout implements IBeadLayout + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function TileLayout() + { + } + + 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(_strand).addEventListener("itemsCreated",handleCreated); + IEventDispatcher(_strand).addEventListener("childrenAdded",handleCreated); + } + + private var _numColumns:Number = 4; + private var _columnWidth:Number = Number.NaN; + private var _rowHeight:Number = Number.NaN; + + /** + * The number of tiles to fit horizontally into the layout. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get numColumns():Number + { + return _numColumns; + } + public function set numColumns(value:Number):void + { + _numColumns = value; + } + + /** + * The width of each column, in pixels. If left unspecified, the + * columnWidth is determined by dividing the numColumns into the + * strand's bounding box width. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get columnWidth():Number + { + return _columnWidth; + } + public function set columnWidth(value:Number):void + { + _columnWidth = value; + } + + /** + * The height of each row, in pixels. If left unspecified, the + * rowHeight is determine by dividing the possible number of rows + * into the strand's bounding box height. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get rowHeight():Number + { + return _rowHeight; + } + public function set rowHeight(value:Number):void + { + _rowHeight = value; + } + + /** + * @private + */ + private function handleCreated(event:Event):void + { + // this is where we know the strand has things in it and we want to + // get the part of the strand that holds the items for the layout + updateLayout(); + } + + /** + * @private + */ + protected function updateLayout():void + { + // this is where the layout is calculated + var p:ILayoutParent = _strand.getBeadByType(ILayoutParent) as ILayoutParent; + var area:UIBase = p.contentView as UIBase; + if (area == null) return; + + var xpos:Number = 0; + var ypos:Number = 0; + var useWidth:Number = columnWidth; + var useHeight:Number = rowHeight; + var n:Number = area.numChildren; + if (n == 0) return; + + if (isNaN(useWidth)) useWidth = Math.floor(area.width / numColumns); // + gap + if (isNaN(useHeight)) { + // given the width and total number of items, how many rows? + var numRows:Number = Math.floor(n/numColumns); + useHeight = Math.floor(area.height / numRows); + } + + for(var i:int=0; i < n; i++) + { + var child:IUIBase = area.getChildAt(i) as IUIBase; + child.width = useWidth; + child.height = useHeight; + child.x = xpos; + child.y = ypos; + + xpos += useWidth; + + var test:Number = (i+1)%numColumns; + + if (test == 0) { + xpos = 0; + ypos += useHeight; + } + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/VScrollBarLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/VScrollBarLayout.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/VScrollBarLayout.as new file mode 100644 index 0000000..7642379 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/VScrollBarLayout.as @@ -0,0 +1,111 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.layouts +{ + import flash.display.DisplayObject; + + import org.apache.flex.core.IBeadLayout; + import org.apache.flex.core.IScrollBarModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + import org.apache.flex.html.staticControls.beads.IScrollBarView; + + /** + * The VScrollBarLayout class is a layout + * bead that displays lays out the pieces of a + * vertical ScrollBar like the thumb, track + * and arrow buttons. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class VScrollBarLayout implements IBeadLayout + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function VScrollBarLayout() + { + } + + private var sbModel:IScrollBarModel; + private var sbView:IScrollBarView; + + 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; + sbView = _strand.getBeadByType(IScrollBarView) as IScrollBarView; + 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); + IEventDispatcher(_strand).addEventListener("heightChanged", changeHandler); + changeHandler(null); + } + + private function changeHandler(event:Event):void + { + var h:Number = DisplayObject(_strand).height; + var increment:DisplayObject = sbView.increment; + var decrement:DisplayObject = sbView.decrement; + var track:DisplayObject = sbView.track; + var thumb:DisplayObject = sbView.thumb; + + decrement.x = 0; + decrement.y = 0; + increment.x = 0; + increment.y = h - increment.height; + track.x = 0; + track.y = decrement.height; + track.height = increment.y - decrement.height; + thumb.height = sbModel.pageSize / (sbModel.maximum - sbModel.minimum) * track.height; + if (track.height > thumb.height) + { + thumb.visible = true; + thumb.y = (sbModel.value / (sbModel.maximum - sbModel.minimum - sbModel.pageSize) * (track.height - thumb.height)) + track.y; + } + else + { + thumb.visible = false; + } + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/AlertModel.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/AlertModel.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/AlertModel.as new file mode 100644 index 0000000..7ad8f11 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/AlertModel.as @@ -0,0 +1,288 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.models +{ + import org.apache.flex.core.IAlertModel; + import org.apache.flex.core.IBead; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + + /** + * The AlertModel class bead implements the org.apache.flex.core.IAlertModel and holds the properties + * for an org.apache.flex.html.staticControls.Alert such the buttons to use and message to display. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class AlertModel extends EventDispatcher implements IAlertModel, IBead + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function AlertModel() + { + super(); + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + _strand = value; + } + + private var _title:String; + + /** + * The title for the Alert. + * + * @copy org.apache.flex.core.IAlertModel#title + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get title():String + { + return _title; + } + public function set title(value:String):void + { + if( value != _title ) { + _title = value; + dispatchEvent( new Event("titleChange") ); + } + } + + private var _htmlTitle:String; + + /** + * The HTML title for the Alert. + * + * @copy org.apache.flex.core.IAlertModel#htmlTitle + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get htmlTitle():String + { + return _htmlTitle; + } + public function set htmlTitle(value:String):void + { + if( value != _htmlTitle ) { + _htmlTitle = value; + dispatchEvent( new Event("htmlTitleChange") ); + } + } + + private var _message:String; + + /** + * The message to display. + * + * @copy org.apache.flex.core.IAlertModel#message + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get message():String + { + return _message; + } + public function set message(value:String):void + { + if( value != _message ) { + _message = value; + dispatchEvent( new Event("messageChange") ); + } + } + + private var _htmlMessage:String; + + /** + * The HTML message to display. + * + * @copy org.apache.flex.core.IAlertModel#htmlMessage + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get htmlMessage():String + { + return _htmlMessage; + } + public function set htmlMessage(value:String):void + { + if( value != _htmlMessage ) + { + _htmlMessage = value; + dispatchEvent( new Event("htmlMessageChange") ); + } + } + + private var _flags:uint; + + /** + * Which buttons to display (see Alert for details). + * + * @copy org.apache.flex.core.IAlertModel#flags + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get flags():uint + { + return _flags; + } + public function set flags(value:uint):void + { + if( value != _flags ) + { + _flags = value; + dispatchEvent( new Event("flagsChange") ); + } + } + + private var _okLabel:String = "OK"; + + /** + * The label to use for the OK button. + * + * @copy org.apache.flex.core.IAlertModel#okLabel + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get okLabel():String + { + return _okLabel; + } + public function set okLabel(value:String):void + { + if( value != _okLabel ) + { + _okLabel = value; + dispatchEvent( new Event("okLabelChange") ); + } + } + + private var _cancelLabel:String = "Cancel"; + + /** + * The label to use for the Cancel button. + * + * @copy org.apache.flex.core.IAlertModel#cancelLabel + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get cancelLabel():String + { + return _cancelLabel; + } + public function set cancelLabel(value:String):void + { + if( value != _cancelLabel ) + { + _cancelLabel = value; + dispatchEvent( new Event("cancelLabelChange") ); + } + } + + private var _yesLabel:String = "YES"; + + /** + * The label to use for the Yes button. + * + * @copy org.apache.flex.core.IAlertModel#yesLabel + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get yesLabel():String + { + return _yesLabel; + } + public function set yesLabel(value:String):void + { + if( value != _yesLabel ) + { + _yesLabel = value; + dispatchEvent( new Event("yesLabelChange") ); + } + } + + private var _noLabel:String = "NO"; + + /** + * The label to use for the NO button. + * + * @copy org.apache.flex.core.IAlertModel#noLabel + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get noLabel():String + { + return _noLabel; + } + public function set noLabel(value:String):void + { + if( value != _noLabel ) + { + _noLabel = value; + dispatchEvent( new Event("noLabelChange") ); + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ArraySelectionModel.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ArraySelectionModel.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ArraySelectionModel.as new file mode 100644 index 0000000..8859ab8 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ArraySelectionModel.as @@ -0,0 +1,234 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.models +{ + import org.apache.flex.core.IRollOverModel; + import org.apache.flex.core.ISelectionModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + + /** + * The ArraySelectionModel class is a selection model for + * a dataProvider that is an array. It assumes that items + * can be fetched from the dataProvider + * dataProvider[index]. Other selection models + * would support other kinds of data providers. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ArraySelectionModel extends EventDispatcher implements ISelectionModel, IRollOverModel + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ArraySelectionModel() + { + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + _strand = value; + } + + private var _dataProvider:Object; + + /** + * @copy org.apache.flex.core.ISelectionModel#dataProvider + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get dataProvider():Object + { + return _dataProvider; + } + + /** + * @private + */ + public function set dataProvider(value:Object):void + { + _dataProvider = value; + dispatchEvent(new Event("dataProviderChanged")); + } + + private var _selectedIndex:int = -1; + private var _rollOverIndex:int = -1; + private var _labelField:String = null; + + /** + * @copy org.apache.flex.core.ISelectionModel#labelField + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get labelField():String + { + return _labelField; + } + + /** + * @private + */ + public function set labelField(value:String):void + { + if (value != _labelField) { + _labelField = value; + dispatchEvent(new Event("labelFieldChanged")); + } + } + + /** + * @copy org.apache.flex.core.ISelectionModel#selectedIndex + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get selectedIndex():int + { + return _selectedIndex; + } + + /** + * @private + */ + public function set selectedIndex(value:int):void + { + _selectedIndex = value; + _selectedItem = (value == -1) ? null : (value < _dataProvider.length) ? _dataProvider[value] : null; + dispatchEvent(new Event("selectedIndexChanged")); + } + + /** + * @copy org.apache.flex.core.IRollOverModel#rollOverIndex + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get rollOverIndex():int + { + return _rollOverIndex; + } + + /** + * @private + */ + public function set rollOverIndex(value:int):void + { + _rollOverIndex = value; + dispatchEvent(new Event("rollOverIndexChanged")); + } + + private var _selectedItem:Object; + + /** + * @copy org.apache.flex.core.ISelectionModel#selectedItem + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get selectedItem():Object + { + return _selectedItem; + } + + /** + * @private + */ + public function set selectedItem(value:Object):void + { + _selectedItem = value; + var n:int = _dataProvider.length; + for (var i:int = 0; i < n; i++) + { + if (_dataProvider[i] == value) + { + _selectedIndex = i; + break; + } + } + dispatchEvent(new Event("selectedItemChanged")); + dispatchEvent(new Event("selectedIndexChanged")); + } + + private var _selectedString:String; + + /** + * An alternative to selectedItem for strongly typing the + * the selectedItem if the Array is an Array of Strings. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get selectedString():String + { + return String(_selectedItem); + } + + /** + * @private + */ + public function set selectedString(value:String):void + { + _selectedString = value; + var n:int = _dataProvider.length; + for (var i:int = 0; i < n; i++) + { + if (String(_dataProvider[i]) == value) + { + _selectedIndex = i; + break; + } + } + dispatchEvent(new Event("selectedItemChanged")); + dispatchEvent(new Event("selectedIndexChanged")); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ComboBoxModel.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ComboBoxModel.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ComboBoxModel.as new file mode 100644 index 0000000..0699c1d --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ComboBoxModel.as @@ -0,0 +1,100 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.models +{ + import org.apache.flex.core.IBead; + import org.apache.flex.core.IComboBoxModel; + import org.apache.flex.events.Event; + + /** + * The ComboBoxModel class bead extends org.apache.flex.html.staticControls.beads.models.ArraySelectionModel + * and adds the text being displayed by the org.apache.flex.html.staticControls.ComboBox's input field. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ComboBoxModel extends ArraySelectionModel implements IBead, IComboBoxModel + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ComboBoxModel() + { + } + + private var _text:String; + + /** + * The string to display in the org.apache.flex.html.staticControls.ComboBox input field. + * + * @copy org.apache.flex.core.IComboBoxModel#text + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get text():String + { + return _text; + } + + public function set text(value:String):void + { + if (value != _text) + { + _text = value; + dispatchEvent(new Event("textChange")); + } + } + + private var _html:String; + + /** + * The HTML string to display in the org.apache.flex.html.staticControls.ComboBox input field. + * + * @copy org.apache.flex.core.IComboBoxModel#html + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get html():String + { + return _html; + } + + public function set html(value:String):void + { + if (value != _html) + { + _html = value; + dispatchEvent(new Event("htmlChange")); + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ImageModel.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ImageModel.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ImageModel.as new file mode 100644 index 0000000..1973b09 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ImageModel.as @@ -0,0 +1,89 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.models +{ + import org.apache.flex.core.IImageModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + + /** + * The ImageModel class bead defines the data associated with an org.apache.flex.html.staticControls.Image + * component, namely the source of the image. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ImageModel extends EventDispatcher implements IImageModel + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ImageModel() + { + super(); + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + _strand = value; + } + + private var _source:String; + + /** + * The source of the image. + * + * @copy org.apache.flex.core.IImageModel#source + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get source():String + { + return _source; + } + public function set source(value:String):void + { + if (value != _source) { + _source = value; + dispatchEvent( new Event("urlChanged") ); + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/PanelModel.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/PanelModel.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/PanelModel.as new file mode 100644 index 0000000..02716c9 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/PanelModel.as @@ -0,0 +1,138 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.models +{ + import org.apache.flex.core.IBead; + import org.apache.flex.core.IPanelModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + + /** + * The PanelModel bead class holds the values for a org.apache.flex.html.staticControls.Panel, such as its + * title. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class PanelModel extends EventDispatcher implements IBead, IPanelModel + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function PanelModel() + { + super(); + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + _strand = value; + } + + private var _title:String; + + /** + * The title string for the org.apache.flex.html.staticControls.Panel. + * + * @copy org.apache.flex.core.ITitleBarModel#title + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get title():String + { + return _title; + } + public function set title(value:String):void + { + if( value != _title ) { + _title = value; + dispatchEvent( new Event('titleChange') ); + } + } + + private var _htmlTitle:String; + + /** + * The HTML string for the title. + * + * @copy org.apache.flex.core.ITitleBarModel#htmlTitle + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get htmlTitle():String + { + return _htmlTitle; + } + public function set htmlTitle(value:String):void + { + if( value != _htmlTitle ) { + _htmlTitle = value; + dispatchEvent( new Event('htmlTitleChange') ); + } + } + + private var _showCloseButton:Boolean = false; + + /** + * Indicates whether or not there is a Close button for the org.apache.flex.html.staticControls.Panel. + * + * @copy org.apache.flex.core.ITitleBarModel#showCloseButton + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get showCloseButton():Boolean + { + return _showCloseButton; + } + public function set showCloseButton(value:Boolean):void + { + if( value != _showCloseButton ) { + _showCloseButton = value; + dispatchEvent( new Event('showCloseButtonChange') ); + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/RangeModel.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/RangeModel.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/RangeModel.as new file mode 100644 index 0000000..9a5e421 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/RangeModel.as @@ -0,0 +1,222 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.models +{ + import org.apache.flex.core.IBead; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.IRangeModel; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + + /** + * The RangeModel class bead defines a set of for a numeric range of values + * which includes a minimum, maximum, and current value. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class RangeModel extends EventDispatcher implements IBead, IRangeModel + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function RangeModel() + { + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + _strand = value; + } + + private var _maximum:Number = 100; + + /** + * The maximum value for the range (defaults to 100). + * + * @copy org.apache.flex.core.IRangeModel#maximum + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get maximum():Number + { + return _maximum; + } + + public function set maximum(value:Number):void + { + if (value != _maximum) + { + _maximum = value; + dispatchEvent(new Event("maximumChange")); + } + } + + private var _minimum:Number = 0; + + /** + * The minimum value for the range (defaults to 0). + * + * @copy org.apache.flex.core.IRangeModel#minimum + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get minimum():Number + { + return _minimum; + } + + public function set minimum(value:Number):void + { + if (value != _minimum) + { + _minimum = value; + dispatchEvent(new Event("minimumChange")); + } + } + + private var _snapInterval:Number = 1; + + /** + * The modulus value for the range. + * + * @copy org.apache.flex.core.IRangeModel#snapInterval + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get snapInterval():Number + { + return _snapInterval; + } + + public function set snapInterval(value:Number):void + { + if (value != _snapInterval) + { + _snapInterval = value; + dispatchEvent(new Event("snapIntervalChange")); + } + } + + private var _stepSize:Number = 1; + + /** + * The amount to adjust the value either up or down toward the edge of the range. + * + * @copy org.apache.flex.core.IRangeModel#stepSize + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get stepSize():Number + { + return _stepSize; + } + + public function set stepSize(value:Number):void + { + if (value != _stepSize) + { + _stepSize = value; + dispatchEvent(new Event("stepSizeChange")); + } + } + + private var _value:Number = 0; + + /** + * The current value of the range, between the minimum and maximum values. Attempting + * to set the value outside of the minimum-maximum range changes the value to still be + * within the range. Note that the value is adjusted by the stepSize. + * + * @copy org.apache.flex.core.IRangeModel#value + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get value():Number + { + return _value; + } + + public function set value(newValue:Number):void + { + if (newValue != _value) + { + // value must lie within the boundaries of minimum & maximum + // and be on a step interval, so the value is adjusted to + // what is coming in. + newValue = Math.max(minimum, newValue - stepSize); + newValue = Math.min(maximum, newValue + stepSize); + _value = snap(newValue); + dispatchEvent(new Event("valueChange")); + } + } + + /** + * @private + */ + protected function snap(value:Number):Number + { + var si:Number = snapInterval; + var n:Number = Math.round((value - minimum) / si) * si + 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; + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ScrollBarModel.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ScrollBarModel.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ScrollBarModel.as new file mode 100644 index 0000000..27fbef0 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ScrollBarModel.as @@ -0,0 +1,98 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.models +{ + + import org.apache.flex.core.IScrollBarModel; + import org.apache.flex.events.Event; + + /** + * The ScrollBarModel class bead extends the org.apache.flex.html.staticControls.beads.models.RangeModel + * and adds page size and page step sizes. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ScrollBarModel extends RangeModel implements IScrollBarModel + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ScrollBarModel() + { + } + + private var _pageSize:Number; + + /** + * The amount represented by the thumb control of the org.apache.flex.html.staticControls.ScrollBar. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get pageSize():Number + { + return _pageSize; + } + + public function set pageSize(value:Number):void + { + if (value != _pageSize) + { + _pageSize = value; + dispatchEvent(new Event("pageSizeChange")); + } + } + + private var _pageStepSize:Number; + + /** + * The amount to adjust the org.apache.flex.html.staticControls.ScrollBar if the scroll bar's + * track area is selected. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get pageStepSize():Number + { + return _pageStepSize; + } + + public function set pageStepSize(value:Number):void + { + if (value != _pageStepSize) + { + _pageStepSize = value; + dispatchEvent(new Event("pageStepSizeChange")); + } + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/SingleLineBorderModel.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/SingleLineBorderModel.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/SingleLineBorderModel.as new file mode 100644 index 0000000..64eb045 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/SingleLineBorderModel.as @@ -0,0 +1,85 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.models +{ + import flash.geom.Rectangle; + + import org.apache.flex.core.IBead; + import org.apache.flex.core.IBorderModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.EventDispatcher; + + /** + * The SingleLineBorderModel class is a data model for + * a single line border. This model is very simple, + * it only stores the offsets from the edges of the + * component. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class SingleLineBorderModel extends EventDispatcher implements IBead, IBorderModel + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function SingleLineBorderModel() + { + } + + 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; + } + + static private var rect:Rectangle = new Rectangle(1, 1, 1, 1); + + /** + * The offsets of the border from the edges of the + * component. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get offsets():Rectangle + { + return rect; + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/StringSelectionModel.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/StringSelectionModel.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/StringSelectionModel.as new file mode 100644 index 0000000..a72dc64 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/StringSelectionModel.as @@ -0,0 +1,221 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.models +{ + + import org.apache.flex.core.ISelectionModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + + /** + * The StringSelectionModel class is a selection model for + * selecting a single string from a vector of strings. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class StringSelectionModel extends EventDispatcher implements ISelectionModel + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function StringSelectionModel() + { + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + _strand = value; + } + + private var _strings:Vector.; + + /** + * The vector of strings. This is the same + * as the dataProvider property but is + * strongly typed. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get strings():Vector. + { + return _strings; + } + + /** + * @private + */ + public function set strings(value:Vector.):void + { + _strings = value; + dispatchEvent(new Event("dataProviderChanged")); + } + + /** + * The dataProvider, which is a + * Vector.<String>. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get dataProvider():Object + { + return _strings; + } + + /** + * @private + */ + public function set dataProvider(value:Object):void + { + _strings = value as Vector.; + dispatchEvent(new Event("dataProviderChanged")); + } + + private var _selectedIndex:int = -1; + + /** + * @copy org.apache.flex.core.ISelectionModel#selectedIndex + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get selectedIndex():int + { + return _selectedIndex; + } + + /** + * @private + */ + public function set selectedIndex(value:int):void + { + _selectedIndex = value; + _selectedString = (value == -1) ? null : (value < _strings.length) ? _strings[value] : null; + dispatchEvent(new Event("selectedIndexChanged")); + } + private var _selectedString:String; + + /** + * @copy org.apache.flex.core.ISelectionModel#selectedItem + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get selectedItem():Object + { + return _selectedString; + } + + /** + * @private + */ + public function set selectedItem(value:Object):void + { + selectedString = String(value); + } + + /** + * The selected string. This is the same as the + * selectedItem, but is strongly-typed. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get selectedString():String + { + return _selectedString; + } + + /** + * @private + */ + public function set selectedString(value:String):void + { + _selectedString = value; + var n:int = _strings.length; + for (var i:int = 0; i < n; i++) + { + if (_strings[i] == value) + { + _selectedIndex = i; + break; + } + } + dispatchEvent(new Event("selectedItemChanged")); + } + + + private var _labelField:String; + + /** + * The labelField, which is not used in this + * implementation. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get labelField():String + { + return _labelField; + } + + /** + * @private + */ + public function set labelField(value:String):void + { + if (value != _labelField) { + _labelField = value; + dispatchEvent(new Event("labelFieldChanged")); + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5759d50b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/TextModel.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/TextModel.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/TextModel.as new file mode 100644 index 0000000..3adf825 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/TextModel.as @@ -0,0 +1,122 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.staticControls.beads.models +{ + import org.apache.flex.core.IBead; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.ITextModel; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + + /** + * The TextModel class is most basic data model for a + * component that displays text. All FlexJS components + * that display text should also support HTML, although + * the Flash Player implementations may only support + * a subset of HTML. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class TextModel extends EventDispatcher implements IBead, ITextModel + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function TextModel() + { + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + _strand = value; + } + + private var _text:String; + + /** + * @copy org.apache.flex.core.ITextModel#text + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get text():String + { + return _text; + } + + /** + * @private + */ + public function set text(value:String):void + { + if (value != _text) + { + _text = value; + dispatchEvent(new Event("textChange")); + } + } + + private var _html:String; + + /** + * @copy org.apache.flex.core.ITextModel#html + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get html():String + { + return _html; + } + + /** + * @private + */ + public function set html(value:String):void + { + if (value != _html) + { + _html = value; + dispatchEvent(new Event("htmlChange")); + } + } + } +} \ No newline at end of file