You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2016/01/11 23:23:11 UTC
[22/29] git commit: [flex-asjs] [refs/heads/mavenfolders] -
rename/refactor folders to be more maven-friendly
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/CloseButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/CloseButtonView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/CloseButtonView.as
deleted file mode 100644
index 7d3fb19..0000000
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/CloseButtonView.as
+++ /dev/null
@@ -1,101 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.html.beads
-{
- 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.html.Button;
- import org.apache.flex.html.TitleBar;
-
- /**
- * The CloseButtonView class is the view for
- * the down arrow button in a ScrollBar and other controls.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class CloseButtonView extends BeadViewBase implements IBeadView
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function CloseButtonView()
- {
- upView = new Shape();
- downView = new Shape();
- overView = new Shape();
-
- drawView(upView.graphics, 0xCCCCCC);
- drawView(downView.graphics, 0x666666);
- drawView(overView.graphics, 0x999999);
- }
-
- private function drawView(g:Graphics, bgColor:uint):void
- {
- g.beginFill(bgColor);
- g.drawRect(0, 0, 11, 11);
- g.endFill();
- g.lineStyle(2);
- g.moveTo(3,3);
- g.lineTo(8,8);
- g.moveTo(3,8);
- g.lineTo(8,3);
- }
-
- 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, 11, 11);
- shape.graphics.endFill();
- SimpleButton(value).upState = upView;
- SimpleButton(value).downState = downView;
- SimpleButton(value).overState = overView;
- SimpleButton(value).hitTestState = shape;
- }
-
- private var upView:Shape;
- private var downView:Shape;
- private var overView:Shape;
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ComboBoxView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ComboBoxView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ComboBoxView.as
deleted file mode 100644
index e725517..0000000
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ComboBoxView.as
+++ /dev/null
@@ -1,247 +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.DisplayObjectContainer;
- import flash.display.Sprite;
-
- import org.apache.flex.core.BeadViewBase;
- import org.apache.flex.core.IBeadView;
- import org.apache.flex.core.IComboBoxModel;
- import org.apache.flex.core.IPopUpHost;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.core.IParent;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.html.Button;
- import org.apache.flex.html.TextInput;
-
- /**
- * The ComboBoxView class creates the visual elements of the org.apache.flex.html.ComboBox
- * component. The job of the view bead is to put together the parts of the ComboBox such as the TextInput
- * control and org.apache.flex.html.Button to trigger the pop-up.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ComboBoxView extends BeadViewBase implements IBeadView, IComboBoxView
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ComboBoxView()
- {
- }
-
- private var textInput:TextInput;
- private var button:Button;
- private var selectionModel:IComboBoxModel;
-
- /**
- * The value of the TextInput component of the ComboBox.
- *
- * @copy org.apache.flex.html.beads.IComboBoxView#text
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get text():String
- {
- return textInput.text;
- }
- public function set text(value:String):void
- {
- textInput.text = value;
- }
-
- /**
- * The HTML value of the TextInput component of the ComboBox.
- *
- * @copy org.apache.flex.html.beads.IComboBoxView#html
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get html():String
- {
- return textInput.html;
- }
- public function set html(value:String):void
- {
- textInput.html = value;
- }
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get strand():IStrand
- {
- return _strand;
- }
- override public function set strand(value:IStrand):void
- {
- super.strand = value;
-
- selectionModel = value.getBeadByType(IComboBoxModel) as IComboBoxModel;
- selectionModel.addEventListener("selectedIndexChanged", selectionChangeHandler);
-
- textInput = new TextInput();
- IParent(strand).addElement(textInput);
- textInput.width = 100;
- textInput.height = 18;
-
- upSprite = new Sprite();
- drawButton( upSprite, "up", 18, 18 );
- overSprite = new Sprite();
- drawButton( overSprite, "over", 18, 18 );
- downSprite = new Sprite();
- drawButton( downSprite, "down", 18, 18 );
-
- button = new Button();
- button.upState = upSprite;
- button.overState = overSprite;
- button.downState = downSprite;
- DisplayObjectContainer(strand).addChild(button);
- button.width = 18;
- button.height = 18;
- button.x = textInput.width;
- button.y = textInput.y;
-
- // listen for events on the text input and modify the list and selection
- textInput.addEventListener("change", textChangeHandler,false,0,true);
- }
-
- private var upSprite:Sprite;
- private var overSprite:Sprite;
- private var downSprite:Sprite;
-
- /**
- * @private
- */
- private function drawButton( sprite:Sprite, mode:String, width:Number, height:Number ) : void
- {
- sprite.graphics.clear();
- sprite.graphics.lineStyle(1,0xFFFFFF);
- sprite.graphics.drawRect(0, 0, width-1, height-1);
- sprite.graphics.lineStyle(-1);
-
- if( mode == "over" ) sprite.graphics.beginFill(0xCCCCCC);
- else if( mode == "down" ) sprite.graphics.beginFill(0x888888);
- sprite.graphics.drawRect(0, 0, width-1, height-1);
- sprite.graphics.endFill();
-
- sprite.graphics.beginFill(0x333333);
- sprite.graphics.moveTo(4,4);
- sprite.graphics.lineTo(width-4,4);
- sprite.graphics.lineTo(int(width/2),height-4);
- sprite.graphics.lineTo(4,4);
- sprite.graphics.endFill();
- }
-
- private var _popUp:IStrand;
-
- /**
- * The pop-up component that holds the selection list.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get popUp():IStrand
- {
- return _popUp;
- }
-
- private var _popUpVisible:Boolean;
-
- /**
- * This property is true if the pop-up selection list is currently visible.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get popUpVisible():Boolean
- {
- return _popUpVisible;
- }
- public function set popUpVisible(value:Boolean):void
- {
- if (value != _popUpVisible)
- {
- _popUpVisible = value;
- if (value)
- {
- if (!_popUp)
- {
- var popUpClass:Class = ValuesManager.valuesImpl.getValue(_strand, "iPopUp") as Class;
- _popUp = new popUpClass() as IStrand;
- }
- var root:Object = DisplayObject(_strand).root;
- var host:DisplayObjectContainer = DisplayObject(_strand).parent;
- while (host && !(host is IPopUpHost))
- host = host.parent;
- if (host)
- IPopUpHost(host).addElement(popUp);
- }
- else
- {
- DisplayObject(_popUp).parent.removeChild(_popUp as DisplayObject);
- }
- }
- }
-
- /**
- * @private
- */
- private function selectionChangeHandler(event:Event):void
- {
- text = selectionModel.selectedItem.toString();
- }
-
- /**
- * @private
- */
- private function textChangeHandler(event:Event):void
- {
- var newEvent:Event = new Event("change");
- IEventDispatcher(strand).dispatchEvent(newEvent);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as
deleted file mode 100644
index 26e78be..0000000
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as
+++ /dev/null
@@ -1,553 +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.IBeadView;
- import org.apache.flex.core.IContainer;
- import org.apache.flex.core.IContainerView;
- import org.apache.flex.core.IContentViewHost;
- import org.apache.flex.core.ILayoutChild;
- import org.apache.flex.core.ILayoutHost;
- import org.apache.flex.core.IParentIUIBase;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.IUIBase;
- import org.apache.flex.core.IViewport;
- 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.beads.models.ViewportModel;
- import org.apache.flex.html.supportClasses.Border;
- import org.apache.flex.html.supportClasses.ContainerContentArea;
- import org.apache.flex.html.supportClasses.Viewport;
- import org.apache.flex.utils.CSSContainerUtils;
-
- /**
- * This class creates and manages the contents of a Container. On the ActionScript
- * side, a Container has a contentView into which the offical children can be
- * placed. When adding an element that implements IChrome, that element is not
- * placed into the contentView, but is made a child of the Container directly.
- *
- * Containers also have a layout associated with them which controls the size and
- * placement of the elements in the contentView. When a Container does not have an
- * explicit size (including a percent size), the content dictates the size of the
- * Container.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ContainerView extends BeadViewBase implements IBeadView, IContainerView, ILayoutHost
- {
- /**
- * The ContainerView class is the default view for
- * the org.apache.flex.core.ContainerBase classes.
- * It lets you use some CSS styles to manage the border, background
- * and padding around the content area.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ContainerView()
- {
- super();
-
- layoutRunning = false;
- }
-
- /**
- * The sub-element used as the parent of the container's elements. This does not
- * include the chrome elements.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get contentView():IParentIUIBase
- {
- return viewport.contentView as IParentIUIBase;
- }
-
- /**
- * The view that can be resized.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get resizableView():IUIBase
- {
- return host;
- }
-
- /**
- * The viewport used to present the content and may display
- * scroll bars (depending on the actual type of viewport).
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected function get viewport():IViewport
- {
- return _viewport;
- }
-
- /**
- * The data model used by the viewport to determine how it should
- * present the content area.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get viewportModel():IViewportModel
- {
- return _viewportModel;
- }
-
- private var _viewportModel:IViewportModel;
- private var _viewport:IViewport;
- private var layoutRunning:Boolean;
-
- /**
- * @private
- */
- public function addElement(c:Object, dispatchEvent:Boolean = true):void
- {
- contentView.addElement(c, dispatchEvent);
- }
-
- /**
- * @private
- */
- public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
- {
- contentView.addElementAt(c, index, dispatchEvent);
- }
-
- /**
- * @private
- */
- public function getElementIndex(c:Object):int
- {
- return contentView.getElementIndex(c);
- }
-
- /**
- * @private
- */
- public function removeElement(c:Object, dispatchEvent:Boolean = true):void
- {
- contentView.removeElement(c, dispatchEvent);
- }
-
- /**
- * @private
- */
- public function get numElements():int
- {
- return contentView.numElements;
- }
-
- /**
- * @private
- */
- public function getElementAt(index:int):Object
- {
- return contentView.getElementAt(index);
- }
-
- /**
- * Strand setter.
- *
- * @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;
-
- createViewport();
-
- (host as IContentViewHost).strandChildren.addElement(viewport.contentView, false);
-
- displayBackgroundAndBorder(host as UIBase);
-
- // listen for initComplete to signal that the strand is set with its size
- // and beads.
- host.addEventListener("initComplete", initCompleteHandler);
- }
-
- /**
- * Handles the initComplete event by completing the setup and kicking off the
- * presentation of the Container.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected function initCompleteHandler(event:Event):void
- {
- var ilc:ILayoutChild = host as ILayoutChild;
- // Complete the setup if the height is sized to content or has been explicitly set
- // and the width is sized to content or has been explicitly set
- if ((ilc.isHeightSizedToContent() || !isNaN(ilc.explicitHeight)) &&
- (ilc.isWidthSizedToContent() || !isNaN(ilc.explicitWidth))) {
- completeSetup();
-
- var num:Number = contentView.numElements;
- if (num > 0) performLayout(event);
- }
- else {
- // otherwise, wait until the unknown sizes have been set and then finish
- host.addEventListener("sizeChanged", deferredSizeHandler);
- host.addEventListener("widthChanged", deferredSizeHandler);
- host.addEventListener("heightChanged", deferredSizeHandler);
- }
- }
-
- /**
- * Handles the case where the size of the host is not immediately known, usually do
- * to one of its dimensions being indicated as a percent size.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- private function deferredSizeHandler(event:Event):void
- {
- host.removeEventListener("sizeChanged", deferredSizeHandler);
- host.removeEventListener("widthChanged", deferredSizeHandler);
- host.removeEventListener("heightChanged", deferredSizeHandler);
- completeSetup();
-
- var num:Number = contentView.numElements;
- if (num > 0)
- {
- performLayout(event);
- }
- }
-
- /**
- * Called when the host is ready to complete its setup (usually after its size has been
- * determined).
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected function completeSetup():void
- {
- // when the first layout is complete, set up listeners for changes
- // to the childrens' sizes.
- host.addEventListener("layoutComplete", childrenChangedHandler);
-
- host.addEventListener("childrenAdded", performLayout);
- host.addEventListener("layoutNeeded", performLayout);
- host.addEventListener("widthChanged", resizeHandler);
- host.addEventListener("heightChanged", resizeHandler);
- host.addEventListener("sizeChanged", resizeHandler);
- host.addEventListener("viewCreated", viewCreatedHandler);
- }
-
- /**
- * Handles the viewCreated event by performing the first layout if
- * there are children already present (ie, from MXML).
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected function viewCreatedHandler(event:Event):void
- {
- if ((host as UIBase).numElements > 0) {
- performLayout(null);
- }
- }
-
- /**
- * 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
- */
- protected function getChromeMetrics():Rectangle
- {
- return new Rectangle(0, 0, 0, 0);
- }
-
- /**
- * Creates the Viewport (or ScrollableViewport) through which the content
- * area is presented.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected function createViewport():void
- {
- var c:Class;
- if (viewportModel == null) {
- _viewportModel = _strand.getBeadByType(IViewportModel) as IViewportModel;
- if (viewportModel == null) {
- c = ValuesManager.valuesImpl.getValue(host, "iViewportModel");
- if (c)
- {
- _viewportModel = new c() as IViewportModel;
- _strand.addBead(_viewportModel);
- }
- }
- }
-
- if (viewport == null) {
- _viewport = _strand.getBeadByType(IViewport) as IViewport;
- if (viewport == null) {
- c = ValuesManager.valuesImpl.getValue(host, "iViewport");
- if (c)
- {
- _viewport = new c() as IViewport;
- _strand.addBead(viewport);
- }
- }
- }
- }
-
- /**
- * Positions the viewport, then sets any known sizes of the Viewport prior
- * to laying out its content.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected function layoutViewBeforeContentLayout():void
- {
- var host:ILayoutChild = this.host as ILayoutChild;
- var vm:IViewportModel = viewportModel;
- vm.borderMetrics = CSSContainerUtils.getBorderMetrics(host);
- 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);
-
- }
-
- /**
- * Executes the layout associated with this container. Once the layout has been
- * run, it may affect the size of the host or may cause the host to present scroll
- * bars view its viewport.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected function performLayout(event:Event):void
- {
- layoutRunning = true;
-
- layoutViewBeforeContentLayout();
-
- var host:UIBase = _strand as UIBase;
-
- var layout:IBeadLayout = _strand.getBeadByType(IBeadLayout) as IBeadLayout;
- if (layout == null) {
- var c:Class = ValuesManager.valuesImpl.getValue(host, "iBeadLayout");
- if (c) {
- layout = new c() as IBeadLayout;
- _strand.addBead(layout);
- }
- }
-
- if (layout) {
- layout.layout();
- }
-
- layoutViewAfterContentLayout();
-
- layoutRunning = false;
- }
-
- /**
- * @private
- */
- private var adjusting:Boolean = false;
-
- /**
- * Adjusts the size of the host, or adds scrollbars to the viewport, after
- * the layout has been run.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected function layoutViewAfterContentLayout():void
- {
- var host:UIBase = _strand as UIBase;
- var vm:IViewportModel = viewportModel;
-
- adjusting = true;
-
- var viewportSize:Size = viewport.layoutViewportAfterContentLayout();
-
- if (host.isWidthSizedToContent() && host.isHeightSizedToContent()) {
- host.setWidthAndHeight(viewportSize.width + vm.borderMetrics.left + vm.borderMetrics.right +
- vm.chromeMetrics.left + vm.chromeMetrics.right,
- viewportSize.height + vm.borderMetrics.top + vm.borderMetrics.bottom +
- vm.chromeMetrics.top + vm.chromeMetrics.bottom,
- false);
- }
- else if (!host.isWidthSizedToContent() && host.isHeightSizedToContent())
- {
- host.setHeight(viewportSize.height + vm.borderMetrics.top + vm.borderMetrics.bottom +
- vm.chromeMetrics.top + vm.chromeMetrics.bottom, false);
- }
- else if (host.isWidthSizedToContent() && !host.isHeightSizedToContent())
- {
- host.setWidth(viewportSize.width + vm.borderMetrics.left + vm.borderMetrics.right +
- vm.chromeMetrics.left + vm.chromeMetrics.right, false);
- }
- adjusting = false;
- }
-
- /**
- * Handles dynamic changes to the host's size by running the layout once
- * the viewport has been adjusted.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected function resizeHandler(event:Event):void
- {
- if (!adjusting) {
- performLayout(event);
- }
- }
-
- /**
- * Whenever children are added, listeners are added to detect changes
- * in their size.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected function childrenChangedHandler(event:Event):void
- {
- var host:UIBase = _strand as UIBase;
- host.removeEventListener(event.type, childrenChangedHandler);
-
- var n:Number = contentView.numElements;
- for (var i:int=0; i < n; i++) {
- var child:IUIBase = contentView.getElementAt(i) as IUIBase;
- child.addEventListener("widthChanged", childResizeHandler);
- child.addEventListener("heightChanged", childResizeHandler);
- child.addEventListener("sizeChanged", childResizeHandler);
- }
- }
-
- /**
- * This event handles changes to the size of children of the container by running
- * the layout again and adjusting the size of the container or viewport as necessary.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected function childResizeHandler(event:Event):void
- {
- // during this process we don't want the layout to trigger
- // an endless event chain should any children get resized
- // by the layout.
- if (layoutRunning) return;
- performLayout(event);
- }
-
- protected function displayBackgroundAndBorder(host:UIBase) : void
- {
- var backgroundColor:Object = ValuesManager.valuesImpl.getValue(host, "background-color");
- var backgroundImage:Object = ValuesManager.valuesImpl.getValue(host, "background-image");
- if (backgroundColor != null || backgroundImage != null)
- {
- if (host.getBeadByType(IBackgroundBead) == null)
- var c:Class = ValuesManager.valuesImpl.getValue(host, "iBackgroundBead");
- if (c) {
- host.addBead( new c() as IBead );
- }
- }
-
- var borderStyle:String;
- var borderStyles:Object = ValuesManager.valuesImpl.getValue(host, "border");
- if (borderStyles is Array)
- {
- borderStyle = borderStyles[1];
- }
- if (borderStyle == null)
- {
- borderStyle = ValuesManager.valuesImpl.getValue(host, "border-style") as String;
- }
- if (borderStyle != null && borderStyle != "none")
- {
- if (host.getBeadByType(IBorderBead) == null) {
- c = ValuesManager.valuesImpl.getValue(host, "iBorderBead");
- if (c) {
- host.addBead( new c() as IBead );
- }
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ControlBarMeasurementBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ControlBarMeasurementBead.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ControlBarMeasurementBead.as
deleted file mode 100644
index 18d19dd..0000000
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ControlBarMeasurementBead.as
+++ /dev/null
@@ -1,116 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.html.beads
-{
- import flash.display.DisplayObjectContainer;
-
- import org.apache.flex.core.IMeasurementBead;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.IUIBase;
- import org.apache.flex.html.Container;
-
- /**
- * The ControlBarMeasurementBead class measures the size of a org.apache.flex.html.ControlBar
- * component.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ControlBarMeasurementBead implements IMeasurementBead
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ControlBarMeasurementBead()
- {
- }
-
- /**
- * Returns the overall width of the ControlBar.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get measuredWidth():Number
- {
- // Note: the measurement should problably be done by the ControlBar's layout manager bead
- // since it would know the arrangement of the items and how far apart they are and if
- // there are margins and paddings and gaps involved.
- var mwidth:Number = 0;
- var container:Container = Container(_strand);
- var n:int = container.numElements;
- for(var i:int=0; i < n; i++) {
- var child:IUIBase = container.getElementAt(i) as IUIBase;
- if( child == null ) continue;
- var childMeasure:IMeasurementBead = child.getBeadByType(IMeasurementBead) as IMeasurementBead;
- if (childMeasure)
- mwidth += childMeasure.measuredWidth;
- }
- return mwidth;
- }
-
- /**
- * Returns the overall height of the ControlBar.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get measuredHeight():Number
- {
- // Note: the measurement should problably be done by the ControlBar's layout manager bead
- // since it would know the arrangement of the items and how far apart they are and if
- // there are margins and paddings and gaps involved.
- var mheight:Number = 0;
- var n:int = DisplayObjectContainer(_strand).numChildren;
- for(var i:int=0; i < n; i++) {
- var child:IUIBase = DisplayObjectContainer(_strand).getChildAt(i) as IUIBase;
- if( child == null ) continue;
- var childMeasure:IMeasurementBead = child.getBeadByType(IMeasurementBead) as IMeasurementBead;
- mheight += childMeasure.measuredHeight;
- }
- return mheight;
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridColumnView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridColumnView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridColumnView.as
deleted file mode 100644
index 7efa3ee..0000000
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridColumnView.as
+++ /dev/null
@@ -1,101 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.html.beads
-{
- import org.apache.flex.core.IStrand;
- import org.apache.flex.html.supportClasses.DataGridColumn;
-
- /**
- * The DataGridColumnView class extends org.apache.flex.html.beads.ListView and
- * provides properties to the org.apache.flex.html.List that makes a column in
- * the org.apache.flex.html.DataGrid.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DataGridColumnView extends ListView
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DataGridColumnView()
- {
- }
-
- /**
- * @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;
- }
-
- private var _columnIndex:uint;
-
- /**
- * The zero-based index for the column.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get columnIndex():uint
- {
- return _columnIndex;
- }
- public function set columnIndex(value:uint):void
- {
- _columnIndex = value;
- }
-
- private var _column:DataGridColumn;
-
- /**
- * The org.apache.flex.html.support.DataGridColumn containing information used to
- * present the org.apache.flex.html.List as a column in the
- * org.apache.flex.html.DataGrid.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get column():DataGridColumn
- {
- return _column;
- }
- public function set column(value:DataGridColumn):void
- {
- _column = value;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridLinesBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridLinesBead.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridLinesBead.as
deleted file mode 100644
index b4e5b1d..0000000
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridLinesBead.as
+++ /dev/null
@@ -1,199 +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.collections.ArrayList;
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IDataGridModel;
- import org.apache.flex.core.ILayoutHost;
- import org.apache.flex.core.IParentIUIBase;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.core.graphics.GraphicsContainer;
- import org.apache.flex.core.graphics.IStroke;
- import org.apache.flex.core.graphics.SolidColor;
- import org.apache.flex.core.graphics.SolidColorStroke;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.html.beads.models.DataGridPresentationModel;
- import org.apache.flex.html.supportClasses.DataGridColumn;
-
- /**
- * The DataGridLinesBead is an add on bead for the DataGrid. This bead
- * adds horizontal and vertical grid lines to a DataGrid. The size and
- * color of the lines is specified by the stroke property (defaults to
- * a thin dark line).
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DataGridLinesBead implements IBead
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DataGridLinesBead()
- {
- // Set default separator line stroke.
- var lineStroke:SolidColorStroke = new SolidColorStroke();
- lineStroke.color = 0x333333;
- lineStroke.alpha = 1.0;
- lineStroke.weight = 1;
- stroke = lineStroke;
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.UIBase#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;
-
- _overlay = new GraphicsContainer();
-
- IEventDispatcher(_strand).addEventListener("beadsAdded", handleBeadsAdded);
- }
-
- private var _stroke:IStroke;
-
- /**
- * Describes the line style used to separate the rows and columns.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get stroke():IStroke
- {
- return _stroke;
- }
- public function set stroke(value:IStroke):void
- {
- _stroke = value;
- }
-
- private var _overlay:GraphicsContainer;
- private var _area:UIBase;
-
- /**
- * Invoked when all of the beads have been added to the DataGrid. This
- * function seeks the Container that parents the lists that are the DataGrid's
- * columns. An overlay GraphicContainer is added to this Container so that the
- * grid lines will scroll with the rows.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- private function handleBeadsAdded(event:Event):void
- {
- var host:UIBase = _strand as UIBase;
- var n:int = host.numElements;
- for (var i:int=0; i < n; i++) {
- var child:UIBase = host.getElementAt(i) as UIBase;
- if (child.id == "dataGridListArea") {
- _area = child;
- _area.addElement(_overlay);
- break;
- }
- }
-
- // Now set up listeners to handle changes in the size of the DataGrid.
- IEventDispatcher(_strand).addEventListener("sizeChanged", drawLines);
- IEventDispatcher(_strand).addEventListener("widthChanged", drawLines);
- IEventDispatcher(_strand).addEventListener("heightChanged", drawLines);
-
- // Also set up a listener on the model to know when the dataProvider has
- // changed which might affect the number of rows/columns and thus the
- // grid lines.
- var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel;
- IEventDispatcher(model).addEventListener("dataProviderChanged", drawLines);
- }
-
- /**
- * This event handler is invoked whenever something happens to the DataGrid. This
- * function draws the lines either using a default stroke or the one specified by
- * the stroke property.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- private function drawLines(event:Event):void
- {
- var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
- var presentationModel:DataGridPresentationModel = _strand.getBeadByType(DataGridPresentationModel) as DataGridPresentationModel;
- var layoutParent:ILayoutHost = _area.getBeadByType(ILayoutHost) as ILayoutHost;
- var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase;
-
- var columns:Array = sharedModel.columns;
- var arrayList:ArrayList = sharedModel.dataProvider as ArrayList;
- var rowHeight:Number = presentationModel.rowHeight;
-
- var totalHeight:Number = arrayList.length * rowHeight;
- var columnWidth:Number = _area.width / columns.length;
-
- // translate the stroke to a fill since rectangles are used for the grid
- // lines and not lines.
- var lineFill:SolidColor = new SolidColor();
- var weight:Number = 1;
- lineFill.color = (stroke as SolidColorStroke).color;
- lineFill.alpha = (stroke as SolidColorStroke).alpha;
- weight = (stroke as SolidColorStroke).weight;
- _overlay.fill = lineFill;
-
- columnWidth = (columns[0] as DataGridColumn).columnWidth;
- var xpos:Number = isNaN(columnWidth) ? _area.width / columns.length : columnWidth;
-
- _overlay.removeAllElements();
-
- // draw the verticals
- for (var i:int=1; i < columns.length; i++) {
- _overlay.drawRect(xpos, 0, weight, totalHeight);
- columnWidth = (columns[i] as DataGridColumn).columnWidth;
- xpos += isNaN(columnWidth) ? _area.width / columns.length : columnWidth;
- }
-
- var n:int = arrayList.length;
-
- // draw the horizontals
- for (i=1; i < n+1; i++) {
- _overlay.drawRect(0, i*rowHeight, _area.width, weight);
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridView.as
deleted file mode 100644
index 582a1e7..0000000
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridView.as
+++ /dev/null
@@ -1,294 +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.IBead;
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IBeadView;
- import org.apache.flex.core.IDataGridModel;
- import org.apache.flex.core.ISelectableItemRenderer;
- import org.apache.flex.core.ISelectionModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.IUIBase;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.html.ButtonBar;
- import org.apache.flex.html.Container;
- import org.apache.flex.html.List;
- import org.apache.flex.html.beads.layouts.ButtonBarLayout;
- import org.apache.flex.html.beads.layouts.VerticalLayout;
- import org.apache.flex.html.beads.models.ArraySelectionModel;
- import org.apache.flex.html.beads.models.DataGridPresentationModel;
- import org.apache.flex.html.supportClasses.DataGridColumn;
- import org.apache.flex.html.supportClasses.ScrollingViewport;
- import org.apache.flex.html.supportClasses.Viewport;
-
- /**
- * The DataGridView class is the visual bead for the org.apache.flex.html.DataGrid.
- * This class constructs the items that make the DataGrid: Lists for each column and a
- * org.apache.flex.html.ButtonBar for the column headers.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DataGridView implements IBeadView
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DataGridView()
- {
- }
-
- private var _strand:IStrand;
- private var _header:ButtonBar;
- private var _listArea:Container;
-
- private var _lists:Array;
-
- /**
- * An array of List objects the comprise the columns of the DataGrid.
- */
- public function get getColumnLists():Array
- {
- return _lists;
- }
-
- /**
- * @private
- */
- 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;
-
- var host:UIBase = value as UIBase;
- host.addEventListener("widthChanged", handleSizeChanges);
- host.addEventListener("heightChanged", handleSizeChanges);
-
- _header = new ButtonBar();
- _header.id = "dataGridHeader";
-
- var scrollPort:ScrollingViewport = new ScrollingViewport();
-// scrollPort.showsHorizontalScrollBar = false;
-
- _listArea = new Container();
- _listArea.id = "dataGridListArea";
- _listArea.className = "DataGridListArea";
- _listArea.addBead(scrollPort);
-
- finishSetup(null);
- }
-
- /**
- * @private
- */
- private function finishSetup(event:Event):void
- {
- var host:UIBase = _strand as UIBase;
-
- // see if there is a presentation model already in place. if not, add one.
- var presentationModel:DataGridPresentationModel = _strand.getBeadByType(DataGridPresentationModel) as DataGridPresentationModel;
- if (presentationModel == null) {
- presentationModel = new DataGridPresentationModel();
- _strand.addBead(presentationModel);
- }
-
- var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
- IEventDispatcher(sharedModel).addEventListener("dataProviderChanged",handleDataProviderChanged);
-
- var columnLabels:Array = new Array();
- var buttonWidths:Array = new Array();
-
- for(var i:int=0; i < sharedModel.columns.length; i++) {
- var dgc:DataGridColumn = sharedModel.columns[i] as DataGridColumn;
- columnLabels.push(dgc.label);
- if (!isNaN(dgc.columnWidth)) buttonWidths.push(dgc.columnWidth);
- }
-
- var bblayout:ButtonBarLayout = new ButtonBarLayout();
- if (buttonWidths.length == sharedModel.columns.length) {
- bblayout.buttonWidths = buttonWidths;
- }
-
- var buttonBarModel:ArraySelectionModel = new ArraySelectionModel();
- buttonBarModel.dataProvider = columnLabels;
-
- _header.addBead(buttonBarModel);
- _header.addBead(bblayout);
- _header.addBead(new Viewport());
- host.addElement(_header);
-
- host.addElement(_listArea);
-
- // do we know what the size is? If not, wait to be sized
-
- if (host.isHeightSizedToContent() || host.isWidthSizedToContent()) {
- host.addEventListener("sizeChanged", handleSizeChanges);
- }
-
- // else size now
- else {
- handleDataProviderChanged(event);
- }
- }
-
- /**
- * @private
- */
- private function handleSizeChanges(event:Event):void
- {
- var useWidth:Number = _listArea.width;
- var useHeight:Number = _listArea.height;
-
- if (host.width > 0) {
- useWidth = host.width;
- }
-
- _header.x = 0;
- _header.y = 0;
- _header.width = useWidth;
- _header.height = 25;
-
- if (host.height > 0) {
- useHeight = host.height - _header.height;
- }
-
- _listArea.x = 0;
- _listArea.y = 26;
- _listArea.width = useWidth;
- _listArea.height = useHeight;
-
- var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
-
- if (_lists != null && _lists.length > 0) {
- var xpos:Number = 0;
- var listWidth:Number = host.width / _lists.length;
- for (var i:int=0; i < _lists.length; i++) {
- var list:List = _lists[i] as List;
- list.x = xpos;
- list.y = 0;
-
- var dataGridColumn:DataGridColumn = sharedModel.columns[i] as DataGridColumn;
- var colWidth:Number = dataGridColumn.columnWidth;
- if (!isNaN(colWidth)) list.width = colWidth;
- else list.width = listWidth;
-
- xpos += list.width;
- }
- }
- }
-
- /**
- * @private
- */
- private function handleDataProviderChanged(event:Event):void
- {
- var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
-
- if (_lists == null || _lists.length == 0) {
- createLists();
- }
-
- for (var i:int=0; i < _lists.length; i++)
- {
- var list:List = _lists[i] as List;
- var listModel:ISelectionModel = list.getBeadByType(IBeadModel) as ISelectionModel;
- listModel.dataProvider = sharedModel.dataProvider;
- }
-
- handleSizeChanges(event);
- }
-
- /**
- * @private
- */
- private function handleColumnListChange(event:Event):void
- {
- var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
- var list:List = event.target as List;
- sharedModel.selectedIndex = list.selectedIndex;
-
- for(var i:int=0; i < _lists.length; i++) {
- if (list != _lists[i]) {
- var otherList:List = _lists[i] as List;
- otherList.selectedIndex = list.selectedIndex;
- }
- }
-
- IEventDispatcher(_strand).dispatchEvent(new Event('change'));
- }
-
- /**
- * @private
- */
- private function createLists():void
- {
- var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
- var presentationModel:DataGridPresentationModel = _strand.getBeadByType(DataGridPresentationModel) as DataGridPresentationModel;
- var listWidth:Number = host.width / sharedModel.columns.length;
-
- _lists = new Array();
-
- for (var i:int=0; i < sharedModel.columns.length; i++) {
- var dataGridColumn:DataGridColumn = sharedModel.columns[i] as DataGridColumn;
-
- var list:List = new List();
- list.id = "dataGridColumn"+String(i);
- list.className = "DataGridColumn";
- list.addBead(sharedModel);
- list.itemRenderer = dataGridColumn.itemRenderer;
- list.labelField = dataGridColumn.dataField;
- list.addEventListener('change',handleColumnListChange);
- list.addBead(presentationModel);
-
- var colWidth:Number = dataGridColumn.columnWidth;
- if (!isNaN(colWidth)) list.width = colWidth;
- else list.width = listWidth;
-
- _listArea.addElement(list);
- _lists.push(list);
- }
-
- _listArea.dispatchEvent(new Event("layoutNeeded"));
- }
- }
-}
-
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
deleted file mode 100644
index 609bfbc..0000000
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
+++ /dev/null
@@ -1,161 +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.IBead;
- import org.apache.flex.core.IDataProviderItemRendererMapper;
- import org.apache.flex.core.IItemRendererClassFactory;
- import org.apache.flex.core.IItemRendererParent;
- import org.apache.flex.core.IListPresentationModel;
- import org.apache.flex.core.ISelectableItemRenderer;
- import org.apache.flex.core.ISelectionModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.IUIBase;
- import org.apache.flex.core.SimpleCSSStyles;
- 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.List;
-
- /**
- * The DataItemRendererFactoryForArrayData class reads an
- * array of data and creates an item renderer for every
- * item in the array. Other implementations of
- * IDataProviderItemRendererMapper map different data
- * structures or manage a virtual set of renderers.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DataItemRendererFactoryForArrayData implements IBead, IDataProviderItemRendererMapper
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DataItemRendererFactoryForArrayData()
- {
- }
-
- private var selectionModel:ISelectionModel;
-
- private var labelField:String;
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
- selectionModel = value.getBeadByType(ISelectionModel) as ISelectionModel;
- var listView:IListView = value.getBeadByType(IListView) as IListView;
- dataGroup = listView.dataGroup;
- selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
-
- labelField = (listView.host as List).labelField;
-
- if (!itemRendererFactory)
- {
- _itemRendererFactory = new (ValuesManager.valuesImpl.getValue(_strand, "iItemRendererClassFactory")) as IItemRendererClassFactory;
- _strand.addBead(_itemRendererFactory);
- }
-
- dataProviderChangeHandler(null);
- }
-
- private var _itemRendererFactory:IItemRendererClassFactory;
-
- /**
- * The org.apache.flex.core.IItemRendererClassFactory used
- * to generate instances of item renderers.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get itemRendererFactory():IItemRendererClassFactory
- {
- return _itemRendererFactory;
- }
-
- /**
- * @private
- */
- public function set itemRendererFactory(value:IItemRendererClassFactory):void
- {
- _itemRendererFactory = value;
- }
-
- /**
- * The org.apache.flex.core.IItemRendererParent that will
- * parent the item renderers.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected var dataGroup:IItemRendererParent;
-
- private function dataProviderChangeHandler(event:Event):void
- {
- var dp:Array = selectionModel.dataProvider as Array;
- if (!dp)
- return;
-
- dataGroup.removeAllElements();
-
- var listView:IListView = _strand.getBeadByType(IListView) as IListView;
- var presentationModel:IListPresentationModel = _strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
-
- var n:int = dp.length;
- for (var i:int = 0; i < n; i++)
- {
- var ir:ISelectableItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ISelectableItemRenderer;
- ir.index = i;
- ir.labelField = labelField;
- if (presentationModel) {
- var style:SimpleCSSStyles = new SimpleCSSStyles();
- style.marginBottom = presentationModel.separatorThickness;
- UIBase(ir).style = style;
- UIBase(ir).height = presentationModel.rowHeight;
- }
- dataGroup.addElement(ir);
- ir.data = dp[i];
- }
-
- IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as
deleted file mode 100644
index 9895394..0000000
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as
+++ /dev/null
@@ -1,174 +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.collections.ArrayList;
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.IDataProviderItemRendererMapper;
- import org.apache.flex.core.IItemRendererClassFactory;
- import org.apache.flex.core.IItemRendererParent;
- import org.apache.flex.core.IListPresentationModel;
- import org.apache.flex.core.ISelectableItemRenderer;
- import org.apache.flex.core.ISelectionModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.IUIBase;
- import org.apache.flex.core.SimpleCSSStyles;
- 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.List;
-
- /**
- * The DataItemRendererFactoryForArrayList class uses an ArrayList
- * and creates an item renderer for every
- * item in the collection. Other implementations of
- * IDataProviderItemRendererMapper map different data
- * structures or manage a virtual set of renderers.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DataItemRendererFactoryForArrayList implements IBead, IDataProviderItemRendererMapper
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DataItemRendererFactoryForArrayList()
- {
- }
-
- private var selectionModel:ISelectionModel;
-
- private var labelField:String;
-
- 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("beadsAdded", finishSetup);
- IEventDispatcher(_strand).addEventListener("initComplete", finishSetup);
- }
-
- private function finishSetup(event:Event):void
- {
- selectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
- var listView:IListView = _strand.getBeadByType(IListView) as IListView;
- dataGroup = listView.dataGroup;
- selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
-
- labelField = (listView.host as List).labelField;
-
- if (!itemRendererFactory)
- {
- _itemRendererFactory = _strand.getBeadByType(IItemRendererClassFactory) as IItemRendererClassFactory;
- if (_itemRendererFactory == null) {
- _itemRendererFactory = new (ValuesManager.valuesImpl.getValue(_strand, "iItemRendererClassFactory")) as IItemRendererClassFactory;
- _strand.addBead(_itemRendererFactory);
- }
- }
-
- dataProviderChangeHandler(null);
- }
-
- private var _itemRendererFactory:IItemRendererClassFactory;
-
- /**
- * The org.apache.flex.core.IItemRendererClassFactory used
- * to generate instances of item renderers.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get itemRendererFactory():IItemRendererClassFactory
- {
- return _itemRendererFactory;
- }
-
- /**
- * @private
- */
- public function set itemRendererFactory(value:IItemRendererClassFactory):void
- {
- _itemRendererFactory = value;
- }
-
- /**
- * The org.apache.flex.core.IItemRendererParent that will
- * parent the item renderers.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected var dataGroup:IItemRendererParent;
-
- private function dataProviderChangeHandler(event:Event):void
- {
- var dp:ArrayList = selectionModel.dataProvider as ArrayList;
- if (!dp)
- return;
-
- dataGroup.removeAllElements();
-
- var listView:IListView = _strand.getBeadByType(IListView) as IListView;
- var presentationModel:IListPresentationModel = _strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
-
- var n:int = dp.length;
- for (var i:int = 0; i < n; i++)
- {
- var ir:ISelectableItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ISelectableItemRenderer;
- ir.index = i;
- ir.labelField = labelField;
- if (presentationModel) {
- UIBase(ir).height = presentationModel.rowHeight;
-
- // ensure that the IR spans the width of its column
- var style:SimpleCSSStyles = new SimpleCSSStyles();
- style.right = 0;
- style.left = 0;
- UIBase(ir).style = style;
- }
- dataGroup.addElement(ir);
- ir.data = dp.getItemAt(i);
- }
-
- IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as
deleted file mode 100644
index d399cfb..0000000
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as
+++ /dev/null
@@ -1,142 +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.IBead;
- import org.apache.flex.core.IBeadView;
- import org.apache.flex.core.IDataGridModel;
- import org.apache.flex.core.IDataProviderItemRendererMapper;
- import org.apache.flex.core.IItemRendererClassFactory;
- import org.apache.flex.core.IItemRendererParent;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.html.supportClasses.DataItemRenderer;
-
- /**
- * The DataItemRendererFactoryForColumnData class implents the
- * org.apache.flex.core.IDataProviderItemRendererMapper interface and creates the itemRenderers
- * for each cell in the org.apache.flex.html.DataGrid.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DataItemRendererFactoryForColumnData implements IBead, IDataProviderItemRendererMapper
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DataItemRendererFactoryForColumnData()
- {
- }
-
- private var selectionModel:IDataGridModel;
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
- selectionModel = value.getBeadByType(IDataGridModel) as IDataGridModel;
- var listView:IListView = value.getBeadByType(IListView) as IListView;
- dataGroup = listView.dataGroup;
- selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
-
- if (!itemRendererFactory)
- {
- _itemRendererFactory = new (ValuesManager.valuesImpl.getValue(_strand, "iItemRendererClassFactory")) as IItemRendererClassFactory;
- _strand.addBead(_itemRendererFactory);
- }
-
- dataProviderChangeHandler(null);
- }
-
- private var _itemRendererFactory:IItemRendererClassFactory;
-
- /**
- * The factory used to create the itemRenderers.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get itemRendererFactory():IItemRendererClassFactory
- {
- return _itemRendererFactory
- }
- public function set itemRendererFactory(value:IItemRendererClassFactory):void
- {
- _itemRendererFactory = value;
- }
-
- /**
- * The dataGroup that is the pareent for the itemRenderers
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected var dataGroup:IItemRendererParent;
-
- /**
- * @private
- */
- private function dataProviderChangeHandler(event:Event):void
- {
- var dp:Array = selectionModel.dataProvider as Array;
- if (!dp)
- return;
-
- dataGroup.removeAllElements();
-
- var view:DataGridColumnView = _strand.getBeadByType(IBeadView) as DataGridColumnView;
- if (view == null) return;
-
- var n:int = dp.length;
- for (var i:int = 0; i < n; i++)
- {
- var tf:DataItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as DataItemRenderer;
- tf.index = i;
- tf.labelField = view.column.dataField;
- dataGroup.addElement(tf);
- tf.data = dp[i];
- }
-
- IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataProviderChangeNotifier.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataProviderChangeNotifier.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataProviderChangeNotifier.as
deleted file mode 100644
index 8905fb9..0000000
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataProviderChangeNotifier.as
+++ /dev/null
@@ -1,154 +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.IBead;
- import org.apache.flex.core.IDocument;
- import org.apache.flex.core.ISelectionModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.collections.ArrayList;
-
- /**
- * The DataProviderChangeNotifier notifies listeners when a selection model's
- * ArrayList dataProvider has changed.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DataProviderChangeNotifier implements IBead, IDocument
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DataProviderChangeNotifier()
- {
- }
-
- protected var _dataProvider:ArrayList;
-
- 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;
-
- if (_dataProvider == null) {
- var object:Object = document[sourceID];
- _dataProvider = object[propertyName] as ArrayList;
- }
-
- _dataProvider.addEventListener("itemAdded", handleItemAdded);
- _dataProvider.addEventListener("itemRemoved", handleItemRemoved);
- _dataProvider.addEventListener("itemUpdated", handleItemUpdated);
-
- }
-
- protected var document:Object;
-
- /**
- * @private
- */
- public function setDocument(document:Object, id:String = null):void
- {
- this.document = document;
- }
-
- private var _sourceID:String;
-
- /**
- * The ID of the object holding the ArrayList, usually a model.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get sourceID():String
- {
- return _sourceID;
- }
- public function set sourceID(value:String):void
- {
- _sourceID = value;
- }
-
- private var _propertyName:String;
-
- /**
- * The property in the sourceID that is the ArrayList.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get propertyName():String
- {
- return _propertyName;
- }
-
- public function set propertyName(value:String):void
- {
- _propertyName = value;
- }
-
- /**
- * @private
- */
- private function handleItemAdded(event:Event):void
- {
- var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
- selectionModel.dispatchEvent(new Event("dataProviderChanged"));
- }
-
- /**
- * @private
- */
- private function handleItemRemoved(event:Event):void
- {
- var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
- selectionModel.dispatchEvent(new Event("dataProviderChanged"));
- }
-
- /**
- * @private
- */
- private function handleItemUpdated(event:Event):void
- {
- var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
- selectionModel.dispatchEvent(new Event("dataProviderChanged"));
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7853ef15/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DateChooserView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DateChooserView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DateChooserView.as
deleted file mode 100644
index 5abf4c4..0000000
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DateChooserView.as
+++ /dev/null
@@ -1,256 +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.html.beads.models.DateChooserModel;
- import org.apache.flex.html.supportClasses.DateChooserButton;
-
- import org.apache.flex.core.BeadViewBase;
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IBeadView;
- 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.html.beads.layouts.TileLayout;
- import org.apache.flex.html.Container;
- import org.apache.flex.html.TextButton;
-
- /**
- * The DateChooserView class is a view bead for the DateChooser. This class
- * creates the elements for the DateChooser: the buttons to move between
- * months, the labels for the days of the week, and the buttons for each day
- * of the month.
- */
- public class DateChooserView extends BeadViewBase implements IBeadView
- {
- /**
- * constructor
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateChooserView()
- {
- }
-
- /**
- * @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;
-
- // make sure there is a model.
- model = _strand.getBeadByType(IBeadModel) as DateChooserModel;
- if (model == null) {
- model = new (ValuesManager.valuesImpl.getValue(_strand,"iBeadModel")) as DateChooserModel;
- }
- model.addEventListener("displayedMonthChanged",handleModelChange);
- model.addEventListener("displayedYearChanged",handleModelChange);
-
- createChildren();
- }
-
- private var _prevMonthButton:TextButton;
- private var _nextMonthButton:TextButton;
- private var _dayButtons:Array;
- private var monthLabel:TextButton;
- private var dayContainer:Container;
-
- private var model:DateChooserModel;
-
- /**
- * The button that causes the previous month to be displayed by the DateChooser.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get prevMonthButton():TextButton
- {
- return _prevMonthButton;
- }
-
- /**
- * The button that causes the next month to be displayed by the DateChooser.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get nextMonthButton():TextButton
- {
- return _nextMonthButton;
- }
-
- /**
- * The array of DateChooserButton instances that represent each day of the month.
- */
- public function get dayButtons():Array
- {
- return _dayButtons;
- }
-
- /**
- * @private
- */
- private function createChildren():void
- {
- _prevMonthButton = new TextButton();
- _prevMonthButton.width = 40;
- _prevMonthButton.height = 20;
- _prevMonthButton.x = 0;
- _prevMonthButton.y = 0;
- _prevMonthButton.text = "<";
- UIBase(_strand).addElement(_prevMonthButton);
-
- _nextMonthButton = new TextButton();
- _nextMonthButton.width = 40;
- _nextMonthButton.height = 20;
- _nextMonthButton.x = UIBase(_strand).width - _nextMonthButton.width;
- _nextMonthButton.y = 0;
- _nextMonthButton.text = ">";
- UIBase(_strand).addElement(_nextMonthButton);
-
- monthLabel = new TextButton();
- monthLabel.text = "Month Here";
- monthLabel.width = 100;
- monthLabel.height = 20;
- monthLabel.x = (UIBase(_strand).width - monthLabel.width)/2;
- monthLabel.y = 0;
- UIBase(_strand).addElement(monthLabel);
-
- dayContainer = new Container();
- var tileLayout:TileLayout = new TileLayout();
- dayContainer.addBead(tileLayout);
- UIBase(_strand).addElement(dayContainer, false);
-
- tileLayout.numColumns = 7;
- dayContainer.x = 0;
- dayContainer.y = monthLabel.y + monthLabel.height + 5;
-
- var sw:Number = UIBase(_strand).width;
- var sh:Number = UIBase(_strand).height;
- //trace("Strand's width x height is "+sw+" x "+sh);
- dayContainer.width = sw;
- dayContainer.height = sh - (monthLabel.height+5);
-
- // the calendar has 7 columns with 6 rows, the first row are the day names
- for(var i:int=0; i < 7; i++) {
- var dayName:DateChooserButton = new DateChooserButton();
- dayName.text = model.dayNames[i];
- dayName.dayOfMonth = 0;
- dayContainer.addElement(dayName, false);
- }
-
- _dayButtons = new Array();
-
- for(i=0; i < 42; i++) {
- var date:DateChooserButton = new DateChooserButton();
- date.text = String(i+1);
- dayContainer.addElement(date, false);
- dayButtons.push(date);
- }
-
- IEventDispatcher(dayContainer).dispatchEvent( new Event("itemsCreated") );
- IEventDispatcher(_strand).dispatchEvent( new Event("layoutNeeded") );
- IEventDispatcher(dayContainer).dispatchEvent( new Event("layoutNeeded") );
-
- updateCalendar();
- }
-
- /**
- * @private
- */
- private function updateCalendar():void
- {
- monthLabel.text = model.monthNames[model.displayedMonth] + " " +
- String(model.displayedYear);
-
- var firstDay:Date = new Date(model.displayedYear,model.displayedMonth,1);
-
- // blank out the labels for the first firstDay.day-1 entries.
- for(var i:int=0; i < firstDay.getDay(); i++) {
- var dateButton:DateChooserButton = dayButtons[i] as DateChooserButton;
- dateButton.dayOfMonth = -1;
- dateButton.text = "";
- }
-
- // renumber to the last day of the month
- var dayNumber:int = 1;
- var numDays:Number = numberOfDaysInMonth(model.displayedMonth, model.displayedYear);
-
- for(; i < dayButtons.length && dayNumber <= numDays; i++) {
- dateButton = dayButtons[i] as DateChooserButton;
- dateButton.dayOfMonth = dayNumber;
- dateButton.text = String(dayNumber++);
- }
-
- // blank out the rest
- for(; i < dayButtons.length; i++) {
- dateButton = dayButtons[i] as DateChooserButton;
- dateButton.dayOfMonth = -1;
- dateButton.text = "";
- }
- }
-
- /**
- * @private
- */
- private function numberOfDaysInMonth(month:Number, year:Number):Number
- {
- var n:int;
-
- if (month == 1) // Feb
- {
- if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) // leap year
- n = 29;
- else
- n = 28;
- }
-
- else if (month == 3 || month == 5 || month == 8 || month == 10)
- n = 30;
-
- else
- n = 31;
-
- return n;
- }
-
- /**
- * @private
- */
- private function handleModelChange(event:Event):void
- {
- updateCalendar();
- }
- }
-}