Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C9921200C24 for ; Thu, 9 Feb 2017 06:45:01 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C84CF160B67; Thu, 9 Feb 2017 05:45:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4D265160B72 for ; Thu, 9 Feb 2017 06:44:59 +0100 (CET) Received: (qmail 43045 invoked by uid 500); 9 Feb 2017 05:44:56 -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 40294 invoked by uid 99); 9 Feb 2017 05:44:54 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Feb 2017 05:44:54 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 576D2E04F3; Thu, 9 Feb 2017 05:44:54 +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: Thu, 09 Feb 2017 05:45:36 -0000 Message-Id: In-Reply-To: <9377dc2ccbd342cbbe34e3ca667c7ed0@git.apache.org> References: <9377dc2ccbd342cbbe34e3ca667c7ed0@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [44/50] [abbrv] git commit: [flex-asjs] [refs/heads/dual] - remove wrapped components from HTML to make sure we are relying on Basic archived-at: Thu, 09 Feb 2017 05:45:02 -0000 http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridColumnView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridColumnView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridColumnView.as deleted file mode 100644 index 1c8cd42..0000000 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridColumnView.as +++ /dev/null @@ -1,102 +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. - * - * @viewbead - * @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/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridLinesBead.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridLinesBead.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridLinesBead.as deleted file mode 100644 index 951f5f7..0000000 --- a/frameworks/projects/HTML/src/main/flex/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.svg.CompoundGraphic; - import org.apache.flex.graphics.IStroke; - import org.apache.flex.graphics.SolidColor; - import org.apache.flex.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 CompoundGraphic(); - - 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:CompoundGraphic; - 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.clear(); - - // 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); - } - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as deleted file mode 100644 index 9c79a3b..0000000 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as +++ /dev/null @@ -1,281 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads -{ - import org.apache.flex.core.IBead; - import org.apache.flex.core.IBeadModel; - import org.apache.flex.core.IBeadLayout; - import org.apache.flex.core.IBeadView; - import org.apache.flex.core.IDataGridModel; - import org.apache.flex.core.IDataGridPresentationModel; - 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.DataGrid; - import org.apache.flex.html.DataGridButtonBar; - import org.apache.flex.html.Container; - import org.apache.flex.html.beads.layouts.ButtonBarLayout; - import org.apache.flex.html.beads.layouts.VerticalLayout; - import org.apache.flex.html.beads.layouts.HorizontalLayout; - import org.apache.flex.html.beads.layouts.IDataGridLayout; - import org.apache.flex.html.beads.models.ArraySelectionModel; - import org.apache.flex.html.supportClasses.DataGridColumn; - import org.apache.flex.html.supportClasses.DataGridColumnList; - 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. - * - * @viewbead - * @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:DataGridButtonBar; - private var _listArea:Container; - - private var _lists:Array; - - /** - * An array of List objects the comprise the columns of the DataGrid. - */ - public function get columnLists():Array - { - return _lists; - } - - /** - * The area used to hold the columns - * - */ - public function get listArea():Container - { - return _listArea; - } - - /** - * @private - */ - public function get host():IUIBase - { - return _strand as IUIBase; - } - - /** - * Returns the component used as the header for the DataGrid. - */ - public function get header():IUIBase - { - return _header; - } - - /** - * @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; - - _header = new DataGridButtonBar(); - _header.id = "dataGridHeader"; - - var scrollPort:ScrollingViewport = new ScrollingViewport(); - - _listArea = new Container(); - _listArea.id = "dataGridListArea"; - _listArea.className = "DataGridListArea"; - _listArea.addBead(scrollPort); - - if (_strand.getBeadByType(IBeadLayout) == null) { - var c:Class = ValuesManager.valuesImpl.getValue(host, "iBeadLayout"); - if (c) - { - var layout:IBeadLayout = new c() as IBeadLayout; - _strand.addBead(layout); - } - } - - finishSetup(null); - } - - /** - * @private - */ - private function finishSetup(event:Event):void - { - var host:DataGrid = _strand as DataGrid; - - // see if there is a presentation model already in place. if not, add one. - var presentationModel:IDataGridPresentationModel = host.presentationModel; - var sharedModel:IDataGridModel = host.model as IDataGridModel; - IEventDispatcher(sharedModel).addEventListener("dataProviderChanged",handleDataProviderChanged); - IEventDispatcher(sharedModel).addEventListener("selectedIndexChanged", handleSelectedIndexChanged); - - var columnLabels: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); - } - - var bblayout:ButtonBarLayout = new ButtonBarLayout(); - var buttonBarModel:ArraySelectionModel = new ArraySelectionModel(); - buttonBarModel.dataProvider = columnLabels; - - _header.addBead(buttonBarModel); - _header.addBead(bblayout); - _header.addBead(new Viewport()); - host.addElement(_header); - - host.addElement(_listArea); - - handleDataProviderChanged(event); - } - - /** - * @private - */ - private function handleSizeChanges(event:Event):void - { - var layoutBead:IDataGridLayout = _strand.getBeadByType(IBeadLayout) as IDataGridLayout; - layoutBead.header = _header; - layoutBead.columns = _lists; - layoutBead.listArea = _listArea; - layoutBead.layout(); - } - - /** - * @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:DataGridColumnList = _lists[i] as DataGridColumnList; - var listModel:ISelectionModel = list.getBeadByType(IBeadModel) as ISelectionModel; - listModel.dataProvider = sharedModel.dataProvider; - } - - host.dispatchEvent(new Event("layoutNeeded")); - } - - /** - * @private - */ - private function handleSelectedIndexChanged(event:Event):void - { - var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel; - var newIndex:int = sharedModel.selectedIndex; - - for (var i:int=0; i < _lists.length; i++) - { - var list:DataGridColumnList = _lists[i] as DataGridColumnList; - list.selectedIndex = newIndex; - } - } - - /** - * @private - */ - private function handleColumnListChange(event:Event):void - { - var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel; - var list:DataGridColumnList = event.target as DataGridColumnList; - sharedModel.selectedIndex = list.selectedIndex; - - for(var i:int=0; i < _lists.length; i++) { - if (list != _lists[i]) { - var otherList:DataGridColumnList = _lists[i] as DataGridColumnList; - otherList.selectedIndex = list.selectedIndex; - } - } - - host.dispatchEvent(new Event('change')); - } - - /** - * @private - */ - private function createLists():void - { - var host:DataGrid = _strand as DataGrid; - - var sharedModel:IDataGridModel = host.model as IDataGridModel; - var presentationModel:IDataGridPresentationModel = host.presentationModel; - 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:DataGridColumnList = new DataGridColumnList(); - list.id = "dataGridColumn"+String(i); - list.addBead(sharedModel); - list.itemRenderer = dataGridColumn.itemRenderer; - list.labelField = dataGridColumn.dataField; - list.addEventListener('change',handleColumnListChange); - list.addBead(presentationModel); - - _listArea.addElement(list); - _lists.push(list); - } - - host.dispatchEvent(new Event("layoutNeeded")); - } - } -} - http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as deleted file mode 100644 index 6a442ae..0000000 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as +++ /dev/null @@ -1,177 +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.IDataProviderModel; - 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.EventDispatcher; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.events.ItemRendererEvent; - import org.apache.flex.html.List; - - [Event(name="itemRendererCreated",type="org.apache.flex.events.ItemRendererEvent")] - - /** - * 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 extends EventDispatcher implements IBead, IDataProviderItemRendererMapper - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function DataItemRendererFactoryForArrayData(target:Object=null) - { - super(target); - } - - protected var dataProviderModel:IDataProviderModel; - - protected 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(value).addEventListener("beadsAdded",finishSetup); - IEventDispatcher(value).addEventListener("initComplete",finishSetup); - } - - private function finishSetup(event:Event):void - { - dataProviderModel = _strand.getBeadByType(IDataProviderModel) as IDataProviderModel; - var listView:IListView = _strand.getBeadByType(IListView) as IListView; - dataGroup = listView.dataGroup; - dataProviderModel.addEventListener("dataProviderChanged", dataProviderChangeHandler); - - labelField = dataProviderModel.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; - - protected function dataProviderChangeHandler(event:Event):void - { - var dp:Array = dataProviderModel.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; - dataGroup.addElement(ir); - 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; - UIBase(ir).percentWidth = 100; - } - ir.data = dp[i]; - - var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED); - newEvent.itemRenderer = ir; - dispatchEvent(newEvent); - } - - IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated")); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as deleted file mode 100644 index 7fc7a90..0000000 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as +++ /dev/null @@ -1,194 +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.IArrayList; - 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.IDataProviderModel; - 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.events.EventDispatcher; - import org.apache.flex.events.ItemRendererEvent; - import org.apache.flex.html.List; - - [Event(name="itemRendererCreated",type="org.apache.flex.events.ItemRendererEvent")] - - /** - * 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 extends EventDispatcher implements IBead, IDataProviderItemRendererMapper - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function DataItemRendererFactoryForArrayList(target:Object=null) - { - super(target); - } - - protected var dataProviderModel:IDataProviderModel; - - protected 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 - { - dataProviderModel = _strand.getBeadByType(IDataProviderModel) as IDataProviderModel; - var listView:IListView = _strand.getBeadByType(IListView) as IListView; - dataGroup = listView.dataGroup; - dataProviderModel.addEventListener("dataProviderChanged", dataProviderChangeHandler); - - labelField = dataProviderModel.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 - */ - protected function setData(ir:ISelectableItemRenderer, data:Object, index:int):void - { - ir.index = index; - ir.labelField = labelField; - ir.data = data; - } - - /** - * @private - */ - protected function dataProviderChangeHandler(event:Event):void - { - var dp:IArrayList = dataProviderModel.dataProvider as IArrayList; - 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; - dataGroup.addElement(ir); - 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; - } - setData(ir, dp.getItemAt(i), i); - - var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED); - newEvent.itemRenderer = ir; - dispatchEvent(newEvent); - } - - IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated")); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as deleted file mode 100644 index 43c5c33..0000000 --- a/frameworks/projects/HTML/src/main/flex/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; - dataGroup.addElement(tf); - tf.index = i; - tf.labelField = view.column.dataField; - tf.data = dp[i]; - } - - IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated")); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForHierarchicalData.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForHierarchicalData.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForHierarchicalData.as deleted file mode 100644 index 1cf4f57..0000000 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForHierarchicalData.as +++ /dev/null @@ -1,113 +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.IDataProviderModel; - 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.EventDispatcher; - import org.apache.flex.events.ItemRendererEvent; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.html.List; - import org.apache.flex.html.supportClasses.TreeListData; - import org.apache.flex.collections.FlattenedList; - - [Event(name="itemRendererCreated",type="org.apache.flex.events.ItemRendererEvent")] - - /** - * The DataItemRendererFactoryForHierarchicalData class reads a - * HierarchicalData object 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 DataItemRendererFactoryForHierarchicalData extends DataItemRendererFactoryForArrayList - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function DataItemRendererFactoryForHierarchicalData() - { - 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 - */ - override public function set strand(value:IStrand):void - { - _strand = value; - - super.strand = value; - } - - /** - * Sets the itemRenderer's data with additional tree-related data. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - override protected function setData(ir:ISelectableItemRenderer, data:Object, index:int):void - { - // Set the listData with the depth of this item - var flatList:FlattenedList = dataProviderModel.dataProvider as FlattenedList; - var depth:int = flatList.getDepth(data); - var isOpen:Boolean = flatList.isOpen(data); - var hasChildren:Boolean = flatList.hasChildren(data); - - var treeData:TreeListData = new TreeListData(); - treeData.depth = depth; - treeData.isOpen = isOpen; - treeData.hasChildren = hasChildren; - - ir.listData = treeData; - - super.setData(ir, data, index); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as deleted file mode 100644 index a24810b..0000000 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as +++ /dev/null @@ -1,194 +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.IDocument; - import org.apache.flex.core.ISelectionModel; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.UIBase; - import org.apache.flex.events.IEventDispatcher; - 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 (_strand[destinationPropertyName] == null) { - var model:IBeadModel = UIBase(_strand).model as IBeadModel; - IEventDispatcher(model).addEventListener(changeEventName, destinationChangedHandler); - } - else { - destinationChangedHandler(null); - } - } - - private function destinationChangedHandler(event:Event):void - { - if (_dataProvider == null) { - var object:Object = document[sourceID]; - _dataProvider = object[propertyName] as ArrayList; - } - else { - _dataProvider.removeEventListener("itemAdded", handleItemAdded); - _dataProvider.removeEventListener("itemRemoved", handleItemRemoved); - _dataProvider.removeEventListener("itemUpdated", handleItemUpdated); - } - - _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 _destinationPropertyName:String; - - public function get destinationPropertyName():String - { - return _destinationPropertyName; - } - public function set destinationPropertyName(value:String):void - { - _destinationPropertyName = value; - } - - private var _changeEventName:String; - - public function get changeEventName():String - { - return _changeEventName; - } - public function set changeEventName(value:String):void - { - _changeEventName = value; - } - - 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")); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DateChooserView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DateChooserView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DateChooserView.as deleted file mode 100644 index d663a32..0000000 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DateChooserView.as +++ /dev/null @@ -1,213 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads -{ - import org.apache.flex.core.BeadViewBase; - import org.apache.flex.core.IBead; - import org.apache.flex.core.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.Container; - import org.apache.flex.html.List; - import org.apache.flex.html.TextButton; - import org.apache.flex.html.beads.layouts.HorizontalLayout; - import org.apache.flex.html.beads.layouts.TileLayout; - import org.apache.flex.html.beads.models.DateChooserModel; - import org.apache.flex.html.supportClasses.DateHeaderButton; - import org.apache.flex.html.supportClasses.DateChooserHeader; - import org.apache.flex.html.supportClasses.DateChooserList; - - /** - * 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. - * @viewbead - */ - 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() - { - } - - override public function set strand(value:IStrand):void - { - super.strand = value; - - 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); - - var host:UIBase = value as UIBase; - host.addEventListener("widthChanged", handleSizeChange); - host.addEventListener("heightChanged", handleSizeChange); - - createChildren(); - layoutContents(); - } - - private var model:DateChooserModel; - - private var _prevMonthButton:DateHeaderButton; - private var _nextMonthButton:DateHeaderButton; - private var monthLabel:DateHeaderButton; - private var dayNamesContainer:DateChooserHeader; - private var daysContainer:DateChooserList; - - /** - * 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():DateHeaderButton - { - 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():DateHeaderButton - { - return _nextMonthButton; - } - - public function get dayList():List - { - return daysContainer; - } - - private function handleSizeChange(event:Event):void - { - layoutContents(); - } - - - /** - * @private - */ - private function createChildren():void - { - _prevMonthButton = new DateHeaderButton(); - _prevMonthButton.width = 40; - _prevMonthButton.height = 20; - _prevMonthButton.text = "<"; - UIBase(_strand).addElement(_prevMonthButton); - - _nextMonthButton = new DateHeaderButton(); - _nextMonthButton.width = 40; - _nextMonthButton.height = 20; - _nextMonthButton.text = ">"; - UIBase(_strand).addElement(_nextMonthButton); - - monthLabel = new DateHeaderButton(); - monthLabel.text = "Month Here"; - monthLabel.width = 100; - monthLabel.height = 20; - UIBase(_strand).addElement(monthLabel); - - dayNamesContainer = new DateChooserHeader(); - UIBase(_strand).addElement(dayNamesContainer, false); - - daysContainer = new DateChooserList(); - UIBase(_strand).addElement(daysContainer, false); - - IEventDispatcher(daysContainer).dispatchEvent( new Event("itemsCreated") ); - - model.addEventListener("selectedDateChanged", selectionChangeHandler); - } - - private function layoutContents():void - { - var sw:Number = UIBase(_strand).width; - var sh:Number = UIBase(_strand).height; - - _prevMonthButton.x = 0; - _prevMonthButton.y = 0; - - _nextMonthButton.x = sw - _nextMonthButton.width; - _nextMonthButton.y = 0; - - monthLabel.x = _prevMonthButton.x + _prevMonthButton.width; - monthLabel.y = 0; - monthLabel.width = sw - _prevMonthButton.width - _nextMonthButton.width; - monthLabel.text = model.monthNames[model.displayedMonth] + " " + - String(model.displayedYear); - - dayNamesContainer.x = 0; - dayNamesContainer.y = monthLabel.y + monthLabel.height; - dayNamesContainer.width = sw; - dayNamesContainer.height = monthLabel.height; - - dayNamesContainer.dataProvider = model.dayNames; - - daysContainer.x = 0; - daysContainer.y = dayNamesContainer.y + dayNamesContainer.height; - daysContainer.width = sw; - daysContainer.height = sh - monthLabel.height - dayNamesContainer.height; - - daysContainer.dataProvider = model.days; - - IEventDispatcher(_strand).dispatchEvent( new Event("layoutNeeded") ); - IEventDispatcher(daysContainer).dispatchEvent( new Event("layoutNeeded") ); - } - - /** - * @private - */ - private function selectionChangeHandler(event:Event):void - { - layoutContents(); - - var index:Number = model.getIndexForSelectedDate(); - daysContainer.selectedIndex = index; - } - - /** - * @private - */ - private function handleModelChange(event:Event):void - { - layoutContents(); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DateFieldView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DateFieldView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DateFieldView.as deleted file mode 100644 index 0e7a27f..0000000 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DateFieldView.as +++ /dev/null @@ -1,193 +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.IBeadView; - import org.apache.flex.core.IDateChooserModel; - import org.apache.flex.core.IFormatBead; - import org.apache.flex.core.IParent; - import org.apache.flex.core.IPopUpHost; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.UIBase; - import org.apache.flex.core.ValuesManager; - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.utils.UIUtils; - import org.apache.flex.utils.PointUtils; - import org.apache.flex.geom.Point; - import org.apache.flex.html.DateChooser; - import org.apache.flex.html.TextButton; - import org.apache.flex.html.TextInput; - - /** - * The DateFieldView class is a bead for DateField that creates the - * input and button controls. This class also handles the pop-up - * mechanics. - * - * @viewbead - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class DateFieldView extends BeadViewBase implements IBeadView - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function DateFieldView() - { - } - - private var _textInput:TextInput; - private var _button:TextButton; - - /** - * The TextButton that triggers the display of the DateChooser pop-up. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get menuButton():TextButton - { - return _button; - } - - /** - * The TextInput that displays the date selected. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get textInput():TextInput - { - return _textInput; - } - - /** - * @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; - - _textInput = new TextInput(); - UIBase(_strand).addElement(_textInput); - _textInput.width = 100; - _textInput.height = 18; - - _button = new TextButton(); - _button.text = "M"; - UIBase(_strand).addElement(_button); - _button.x = _textInput.width; - _button.y = _textInput.y; - - IEventDispatcher(_strand).addEventListener("beadsAdded",handleBeadsAdded); - } - - private function handleBeadsAdded(event:Event):void - { - var formatter:IFormatBead = _strand.getBeadByType(IFormatBead) as IFormatBead; - formatter.addEventListener("formatChanged",handleFormatChanged); - } - - private function handleFormatChanged(event:Event):void - { - var formatter:IFormatBead = event.target as IFormatBead; - _textInput.text = formatter.formattedString; - } - - private var _popUp:DateChooser; - - /** - * 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():DateChooser - { - 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) - { - _popUp = new DateChooser(); - _popUp.width = 210; - _popUp.height = 220; - } - - var model:IDateChooserModel = _strand.getBeadByType(IDateChooserModel) as IDateChooserModel; - _popUp.selectedDate = model.selectedDate; - - var host:IPopUpHost = UIUtils.findPopUpHost(UIBase(_strand)); - var point:Point = new Point(_button.x, _button.y+_button.height); - var p2:Point = PointUtils.localToGlobal(point, _strand); - var p3:Point = PointUtils.globalToLocal(p2, host); - _popUp.x = p3.x; - _popUp.y = p3.y; - - host.addElement(_popUp); - } - else - { - UIUtils.removePopUp(_popUp); - } - } - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DecrementButtonView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DecrementButtonView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DecrementButtonView.as deleted file mode 100644 index 19026ce..0000000 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DecrementButtonView.as +++ /dev/null @@ -1,94 +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.IBeadView; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.UIBase; - import org.apache.flex.svg.Path; - import org.apache.flex.svg.Rect; - import org.apache.flex.graphics.SolidColor; - import org.apache.flex.graphics.SolidColorStroke; - import org.apache.flex.events.Event; - - public class DecrementButtonView extends BeadViewBase implements IBeadView - { - public function DecrementButtonView() - { - super(); - } - - private var _backRect:Rect; - private var _arrow:Path; - - /** - * @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; - _strand = value; - - var host:UIBase = _strand as UIBase; - - _backRect = new Rect(); - _backRect.fill = new SolidColor(); - (_backRect.fill as SolidColor).color = 0xFFFFFF; - _backRect.stroke = new SolidColorStroke(); - (_backRect.stroke as SolidColorStroke).color = 0x000000; - (_backRect.stroke as SolidColorStroke).weight = 1.0; - host.addElement(_backRect); - - // arrow - _arrow = new Path(); - _arrow.fill = new SolidColor(); - (_arrow.fill as SolidColor).color = 0x000000; - host.addElement(_arrow); - - host.addEventListener("widthChanged", sizeHandler); - host.addEventListener("heightChanged", sizeHandler); - - sizeHandler(null); - } - - private function sizeHandler(event:Event):void - { - var host:UIBase = _strand as UIBase; - - _backRect.x = 0; - _backRect.y = 0; - _backRect.setWidthAndHeight(host.width, host.height, true); - _backRect.drawRect(0, 0, host.width, host.height); - - var xm:Number = host.width/2; - var ym:Number = host.height - 4; - - _arrow.setWidthAndHeight(xm, ym, true); - _arrow.y = 2; - _arrow.x = 0; - _arrow.drawStringPath(0, 0, "M "+xm+" "+ym+" L "+(xm-8)+" 2 "+(xm+8)+" 2 "+xm+" "+ym+" Z"); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DownArrowButtonView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DownArrowButtonView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DownArrowButtonView.as deleted file mode 100644 index b49e7a8..0000000 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DownArrowButtonView.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.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.IChild; - import org.apache.flex.core.IStrand; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.events.Event; - - /** - * The DownArrowButtonView class is the view for - * the down arrow button in a ScrollBar and other controls. - * - * @viewbead - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class DownArrowButtonView extends BeadViewBase implements IBeadView - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function DownArrowButtonView() - { - upView = new Shape(); - downView = new Shape(); - overView = new Shape(); - - drawView(upView.graphics, 0xf8f8f8); - drawView(downView.graphics, 0xd8d8d8); - drawView(overView.graphics, 0xe8e8e8); - } - - private function drawView(g:Graphics, bgColor:uint):void - { - g.lineStyle(1); - g.beginFill(bgColor); - g.drawRoundRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize, ScrollBarView.ThirdSize); - g.endFill(); - g.lineStyle(0); - g.beginFill(0); - g.moveTo(ScrollBarView.QuarterSize, ScrollBarView.QuarterSize); - g.lineTo(ScrollBarView.ThreeQuarterSize, ScrollBarView.QuarterSize); - g.lineTo(ScrollBarView.HalfSize, ScrollBarView.ThreeQuarterSize); - g.lineTo(ScrollBarView.QuarterSize, ScrollBarView.QuarterSize); - g.endFill(); - } - - private var shape:Shape; - - /** - * @copy org.apache.flex.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - override public function set strand(value:IStrand):void - { - super.strand = value; - shape = new Shape(); - shape.graphics.beginFill(0xCCCCCC); - shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize); - shape.graphics.endFill(); - var button:SimpleButton = IChild(value).$displayObject as SimpleButton; - button.upState = upView; - button.downState = downView; - button.overState = overView; - button.hitTestState = shape; - - IEventDispatcher(_strand).addEventListener("widthChanged",sizeChangeHandler); - IEventDispatcher(_strand).addEventListener("heightChanged",sizeChangeHandler); - } - - private var upView:Shape; - private var downView:Shape; - private var overView:Shape; - - private function sizeChangeHandler(event:Event):void - { - var button:SimpleButton = IChild(_strand).$displayObject as SimpleButton; - button.scaleX = button.width / ScrollBarView.FullSize; - button.scaleY = button.height / ScrollBarView.FullSize; - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DropDownListView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DropDownListView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DropDownListView.as deleted file mode 100644 index f7d991a..0000000 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DropDownListView.as +++ /dev/null @@ -1,300 +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 flash.display.Graphics; - import flash.display.Shape; - import flash.display.SimpleButton; - import flash.display.Sprite; - import flash.text.TextFieldType; - - import org.apache.flex.core.BeadViewBase; - import org.apache.flex.core.CSSTextField; - import org.apache.flex.core.IBeadView; - import org.apache.flex.core.IChild; - import org.apache.flex.core.IPopUpHost; - import org.apache.flex.core.ISelectionModel; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.IUIBase; - import org.apache.flex.core.ValuesManager; - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.utils.SolidBorderUtil; - import org.apache.flex.utils.UIUtils; - - /** - * The DropDownListView class is the default view for - * the org.apache.flex.html.DropDownList class. - * It displays a simple text label with what appears to be a - * down arrow button on the right, but really, the entire - * view is the button that will display or dismiss the dropdown. - * - * @viewbead - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class DropDownListView extends BeadViewBase implements IDropDownListView, IBeadView - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function DropDownListView() - { - upSprite = new Sprite(); - downSprite = new Sprite(); - overSprite = new Sprite(); - upTextField = new CSSTextField(); - downTextField = new CSSTextField(); - overTextField = new CSSTextField(); - upSprite.addChild(upTextField); - overSprite.addChild(overTextField); - downSprite.addChild(downTextField); - upTextField.parentDrawsBackground = true; - downTextField.parentDrawsBackground = true; - overTextField.parentDrawsBackground = true; - upTextField.selectable = false; - upTextField.type = TextFieldType.DYNAMIC; - downTextField.selectable = false; - downTextField.type = TextFieldType.DYNAMIC; - overTextField.selectable = false; - overTextField.type = TextFieldType.DYNAMIC; - // auto-size collapses if no text - //upTextField.autoSize = "left"; - //downTextField.autoSize = "left"; - //overTextField.autoSize = "left"; - - upArrows = new Shape(); - overArrows = new Shape(); - downArrows = new Shape(); - upSprite.addChild(upArrows); - overSprite.addChild(overArrows); - downSprite.addChild(downArrows); - drawArrows(upArrows); - drawArrows(overArrows); - drawArrows(downArrows); - - } - - - private var selectionModel:ISelectionModel; - - 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; - selectionModel = value.getBeadByType(ISelectionModel) as ISelectionModel; - selectionModel.addEventListener("selectedIndexChanged", selectionChangeHandler); - selectionModel.addEventListener("dataProviderChanged", selectionChangeHandler); - shape = new Shape(); - shape.graphics.beginFill(0xCCCCCC); - shape.graphics.drawRect(0, 0, 10, 10); - shape.graphics.endFill(); - var button:SimpleButton = IChild(value).$displayObject as SimpleButton; - button.upState = upSprite; - button.downState = downSprite; - button.overState = overSprite; - button.hitTestState = shape; - if (selectionModel.selectedIndex !== -1) - text = selectionModel.selectedItem.toString(); - else - text = "^W_"; - upTextField.height = upTextField.textHeight + 4; - downTextField.height = downTextField.textHeight + 4; - overTextField.height = overTextField.textHeight + 4; - if (selectionModel.selectedIndex == -1) - text = ""; - - IEventDispatcher(value).addEventListener("heightChanged", changeHandler); - IEventDispatcher(value).addEventListener("widthChanged", changeHandler); - changeHandler(null); - } - - private function selectionChangeHandler(event:Event):void - { - if (selectionModel.selectedItem == null) - text = ""; - else if (selectionModel.labelField != null) - text = selectionModel.selectedItem[selectionModel.labelField].toString(); - else - text = selectionModel.selectedItem.toString(); - } - - private function changeHandler(event:Event):void - { - var ww:Number = IUIBase(_strand).width; - var hh:Number = IUIBase(_strand).height; - - upArrows.x = ww - upArrows.width - 6; - overArrows.x = ww - overArrows.width - 6; - downArrows.x = ww - downArrows.width - 6; - upArrows.y = (hh - upArrows.height) / 2; - overArrows.y = (hh - overArrows.height) / 2; - downArrows.y = (hh - downArrows.height) / 2; - - upTextField.width = upArrows.x; - downTextField.width = downArrows.x; - overTextField.width = overArrows.x; - upTextField.height = hh; - downTextField.height = hh; - overTextField.height = hh; - - drawBorder(upSprite, 0xf8f8f8, ww, hh); - drawBorder(overSprite, 0xe8e8e8, ww, hh); - drawBorder(downSprite, 0xd8d8d8, ww, hh); - - shape.graphics.clear(); - shape.graphics.beginFill(0xCCCCCC); - shape.graphics.drawRect(0, 0, ww, hh); - shape.graphics.endFill(); - } - - private var upTextField:CSSTextField; - private var downTextField:CSSTextField; - private var overTextField:CSSTextField; - private var upSprite:Sprite; - private var downSprite:Sprite; - private var overSprite:Sprite; - private var upArrows:Shape; - private var downArrows:Shape; - private var overArrows:Shape; - - private function drawBorder(sprite:Sprite, color:uint, ww:Number, hh:Number):void - { - SolidBorderUtil.drawBorder(sprite.graphics, 0, 0, - ww, hh, - 0x808080, color, 1, 1, 4); - } - - private function drawArrows(shape:Shape):void - { - var g:Graphics = shape.graphics; - g.beginFill(0); - g.moveTo(8, 0); - g.lineTo(12, 4); - g.lineTo(4, 4); - g.lineTo(8, 0); - g.endFill(); - g.beginFill(0); - g.moveTo(8, 10); - g.lineTo(12, 6); - g.lineTo(4, 6); - g.lineTo(8, 10); - g.endFill(); - } - - /** - * The text that is displayed in the view. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get text():String - { - return upTextField.text; - } - - /** - * @private - */ - public function set text(value:String):void - { - upTextField.text = value; - downTextField.text = value; - overTextField.text = value; - } - - private var _popUp:IStrand; - - /** - * The dropdown/popup that displays the set of choices. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get popUp():IStrand - { - if (!_popUp) - { - var popUpClass:Class = ValuesManager.valuesImpl.getValue(_strand, "iPopUp") as Class; - _popUp = new popUpClass() as IStrand; - } - return _popUp; - } - - private var _popUpVisible:Boolean; - - /** - * A flag that indicates whether the dropdown/popup is - * visible. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get popUpVisible():Boolean - { - return _popUpVisible; - } - - /** - * @private - */ - public function set popUpVisible(value:Boolean):void - { - var host:IPopUpHost; - if (value != _popUpVisible) - { - _popUpVisible = value; - if (value) - { - host = UIUtils.findPopUpHost(_strand as IUIBase); - IPopUpHost(host).addElement(popUp as IChild); - } - else - { - host = UIUtils.findPopUpHost(_strand as IUIBase); - IPopUpHost(host).removeElement(popUp as IChild); - } - } - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/HRuleView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/HRuleView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/HRuleView.as deleted file mode 100644 index e72c4ee..0000000 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/HRuleView.as +++ /dev/null @@ -1,88 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads -{ - import flash.display.Bitmap; - import flash.display.Loader; - import flash.display.LoaderInfo; - import flash.net.URLRequest; - - import org.apache.flex.core.BeadViewBase; - import org.apache.flex.core.IBeadView; - import org.apache.flex.core.IImageModel; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.UIBase; - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - - /** - * The ImageView class creates the visual elements of the org.apache.flex.html.Image component. - * - * @viewbead - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class HRuleView extends BeadViewBase implements IBeadView - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function HRuleView() - { - } - - /** - * @copy org.apache.flex.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - override public function set strand(value:IStrand):void - { - super.strand = value; - - IEventDispatcher(_strand).addEventListener("widthChanged",handleSizeChange); - IEventDispatcher(_strand).addEventListener("heightChanged",handleSizeChange); - IEventDispatcher(_strand).addEventListener("sizeChanged",handleSizeChange); - - handleSizeChange(null); - } - - /** - * @private - */ - private function handleSizeChange(event:Object):void - { - var ui:UIBase = _strand as UIBase; - ui.$sprite.graphics.clear(); - ui.$sprite.graphics.beginFill(0); - ui.$sprite.graphics.drawRect(0, 0, ui.width, 1); - ui.$sprite.graphics.endFill(); - } - } -}