http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as new file mode 100644 index 0000000..42b159c --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as @@ -0,0 +1,194 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.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.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 selectionModel:ISelectionModel; + + 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 + { + 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 + */ + 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 = selectionModel.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; + 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); + 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/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as new file mode 100644 index 0000000..d399cfb --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as @@ -0,0 +1,142 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForHierarchicalData.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForHierarchicalData.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForHierarchicalData.as new file mode 100644 index 0000000..5c9c59c --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForHierarchicalData.as @@ -0,0 +1,113 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.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 = selectionModel.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/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as new file mode 100644 index 0000000..a24810b --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as @@ -0,0 +1,194 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateChooserView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateChooserView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateChooserView.as new file mode 100644 index 0000000..54b2550 --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateChooserView.as @@ -0,0 +1,328 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.TextButton; + import org.apache.flex.html.beads.layouts.TileLayout; + import org.apache.flex.html.beads.models.DateChooserModel; + import org.apache.flex.html.supportClasses.DateChooserButton; + import org.apache.flex.html.supportClasses.DateHeaderButton; + + /** + * 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; + _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); + + var host:UIBase = value as UIBase; + host.addEventListener("widthChanged", handleSizeChange); + host.addEventListener("heightChanged", handleSizeChange); + + createChildren(); + layoutContents(); + } + + private var _prevMonthButton:DateHeaderButton; + private var _nextMonthButton:DateHeaderButton; + private var _dayButtons:Array; + private var monthLabel:DateHeaderButton; + 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():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; + } + + /** + * The array of DateChooserButton instances that represent each day of the month. + */ + public function get dayButtons():Array + { + return _dayButtons; + } + + private function handleSizeChange(event:Event):void + { + layoutContents(); + } + + 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 = (sw - monthLabel.width)/2; + monthLabel.y = 0; + + dayContainer.x = 0; + dayContainer.y = monthLabel.y + monthLabel.height + 5; + dayContainer.width = sw; + dayContainer.height = sh - (monthLabel.height+5); + + COMPILE::SWF { + displayBackgroundAndBorder(_strand as UIBase); + } + + IEventDispatcher(_strand).dispatchEvent( new Event("layoutNeeded") ); + IEventDispatcher(dayContainer).dispatchEvent( new Event("layoutNeeded") ); + } + + /** + * @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); + + dayContainer = new Container(); + var tileLayout:TileLayout = new TileLayout(); + dayContainer.addBead(tileLayout); + UIBase(_strand).addElement(dayContainer, false); + + tileLayout.numColumns = 7; + + // 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") ); + + 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 = ""; + } + + // flag today + var today:Date = new Date(); + + // 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++); + + if (model.displayedMonth == today.getMonth() && + model.displayedYear == today.getFullYear() && + (dayNumber-1) == today.getDate()) { + dateButton.id = "todayDateChooserButton"; + } else { + dateButton.id = ""; + } + } + + // 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(); + } + + /** + * @private + */ + COMPILE::SWF + 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 ); + } + } + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateFieldView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateFieldView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateFieldView.as new file mode 100644 index 0000000..f709a1f --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateFieldView.as @@ -0,0 +1,192 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. + * + * @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/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DecrementButtonView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DecrementButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DecrementButtonView.as new file mode 100644 index 0000000..19026ce --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DecrementButtonView.as @@ -0,0 +1,94 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DownArrowButtonView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DownArrowButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DownArrowButtonView.as new file mode 100644 index 0000000..c68a633 --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DownArrowButtonView.as @@ -0,0 +1,111 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.beads +{ + import flash.display.Graphics; + import flash.display.Shape; + import flash.display.SimpleButton; + + import org.apache.flex.core.BeadViewBase; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.IBeadView; + import org.apache.flex.events.Event; + + /** + * The DownArrowButtonView 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 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(); + SimpleButton(value).upState = upView; + SimpleButton(value).downState = downView; + SimpleButton(value).overState = overView; + SimpleButton(value).hitTestState = shape; + + SimpleButton(_strand).addEventListener("widthChanged",sizeChangeHandler); + SimpleButton(_strand).addEventListener("heightChanged",sizeChangeHandler); + } + + private var upView:Shape; + private var downView:Shape; + private var overView:Shape; + + private function sizeChangeHandler(event:Event):void + { + SimpleButton(_strand).scaleX = SimpleButton(_strand).width / ScrollBarView.FullSize; + SimpleButton(_strand).scaleY = SimpleButton(_strand).height / ScrollBarView.FullSize; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DropDownListView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DropDownListView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DropDownListView.as new file mode 100644 index 0000000..1334227 --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DropDownListView.as @@ -0,0 +1,300 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.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.IPopUpHost; + import org.apache.flex.core.ISelectionModel; + 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.utils.SolidBorderUtil; + + /** + * 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. + * + * @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(); + SimpleButton(value).upState = upSprite; + SimpleButton(value).downState = downSprite; + SimpleButton(value).overState = overSprite; + SimpleButton(value).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 = DisplayObject(_strand).width; + var hh:Number = DisplayObject(_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 + { + var ww:Number = DisplayObject(_strand).width; + var hh:Number = DisplayObject(_strand).height; + 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 + { + if (value != _popUpVisible) + { + _popUpVisible = value; + if (value) + { + 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); + } + } + } + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HRuleView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HRuleView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HRuleView.as new file mode 100644 index 0000000..3c7e092 --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HRuleView.as @@ -0,0 +1,87 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.beads +{ + import flash.display.Bitmap; + import flash.display.Loader; + import flash.display.LoaderInfo; + import flash.net.URLRequest; + + import org.apache.flex.core.BeadViewBase; + import org.apache.flex.core.IBeadView; + import org.apache.flex.core.IImageModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.UIBase; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + + /** + * The ImageView class creates the visual elements of the org.apache.flex.html.Image component. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class 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.graphics.clear(); + ui.graphics.beginFill(0); + ui.graphics.drawRect(0, 0, ui.width, 1); + ui.graphics.endFill(); + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarThumbView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarThumbView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarThumbView.as new file mode 100644 index 0000000..05a41b6 --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarThumbView.as @@ -0,0 +1,120 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.beads +{ + import flash.display.DisplayObject; + import flash.display.Graphics; + import flash.display.Shape; + import flash.display.SimpleButton; + + import org.apache.flex.core.BeadViewBase; + import org.apache.flex.core.IBeadView; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + import org.apache.flex.html.supportClasses.ScrollBar; + + /** + * The HScrollBarThumbView class is the view for + * the thumb button in a Horizontal ScrollBar. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class HScrollBarThumbView extends BeadViewBase implements IBeadView + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function HScrollBarThumbView() + { + } + + private function drawView(g:Graphics, bgColor:uint):void + { + var ww:Number = DisplayObject(_strand).width; + g.clear(); + g.lineStyle(1); + g.beginFill(bgColor); + g.drawRoundRect(0, 0, ww, ScrollBarView.FullSize, ScrollBarView.HalfSize); + g.endFill(); + } + + private var shape:Shape; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + override public function set strand(value:IStrand):void + { + super.strand = value; + + upView = new Shape(); + downView = new Shape(); + overView = new Shape(); + + drawView(upView.graphics, 0xc8c8c8); + drawView(downView.graphics, 0xc8c8c8); + drawView(overView.graphics, 0xb8b8b8); + + shape = new Shape(); + shape.graphics.beginFill(0xCCCCCC); + shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize); + shape.graphics.endFill(); + SimpleButton(value).upState = upView; + SimpleButton(value).downState = downView; + SimpleButton(value).overState = overView; + SimpleButton(value).hitTestState = shape; + IEventDispatcher(_strand).addEventListener("widthChanged", widthChangedHandler); + } + + private function widthChangedHandler(event:Event):void + { + DisplayObject(_strand).scaleY = 1.0; + DisplayObject(_strand).scaleX = 1.0; + + var ww:Number = DisplayObject(_strand).width; + drawView(upView.graphics, 0xc8c8c8); + drawView(downView.graphics, 0xc8c8c8); + drawView(overView.graphics, 0xb8b8b8); + + shape.graphics.clear(); + shape.graphics.beginFill(0xCCCCCC); + shape.graphics.drawRect(0, 0, ww, ScrollBarView.FullSize); + shape.graphics.endFill(); + } + + private var upView:Shape; + private var downView:Shape; + private var overView:Shape; + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarTrackView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarTrackView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarTrackView.as new file mode 100644 index 0000000..de6a3af --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarTrackView.as @@ -0,0 +1,118 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.beads +{ + import flash.display.DisplayObject; + import flash.display.Graphics; + import flash.display.Shape; + import flash.display.SimpleButton; + + import org.apache.flex.core.BeadViewBase; + import org.apache.flex.core.IBeadView; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + + /** + * The HScrollBarTrackView class is the view for + * the track in a Horizontal ScrollBar. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class HScrollBarTrackView extends BeadViewBase implements IBeadView + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function HScrollBarTrackView() + { + } + + private function drawView(g:Graphics, bgColor:uint):void + { + var w:Number = SimpleButton(_strand).width; + + g.clear(); + g.lineStyle(1, 0x808080); + g.beginFill(bgColor); + g.drawRect(0, 0, w, ScrollBarView.FullSize); + g.endFill(); + g.lineStyle(0); + } + + private function widthChangeHandler(event:Event):void + { + DisplayObject(_strand).scaleY = 1.0; + DisplayObject(_strand).scaleX = 1.0; + + var w:Number = SimpleButton(_strand).width; + + drawView(upView.graphics, 0xf8f8f8); + drawView(downView.graphics, 0xd8d8d8); + drawView(overView.graphics, 0xe8e8e8); + shape.graphics.clear(); + shape.graphics.beginFill(0xCCCCCC); + shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, w); + shape.graphics.endFill(); + + } + + private var shape:Shape; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + override public function set strand(value:IStrand):void + { + super.strand = value; + + upView = new Shape(); + downView = new Shape(); + overView = new Shape(); + + drawView(upView.graphics, 0xf8f8f8); + drawView(downView.graphics, 0xd8d8d8); + drawView(overView.graphics, 0xe8e8e8); + + SimpleButton(value).addEventListener("widthChanged", widthChangeHandler); + shape = new Shape(); + SimpleButton(value).upState = upView; + SimpleButton(value).downState = downView; + SimpleButton(value).overState = overView; + SimpleButton(value).hitTestState = shape; + } + + private var upView:Shape; + private var downView:Shape; + private var overView:Shape; + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarView.as new file mode 100644 index 0000000..68fe11f --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarView.as @@ -0,0 +1,99 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.beads +{ + import flash.display.DisplayObject; + + import org.apache.flex.core.IBead; + import org.apache.flex.core.IBeadLayout; + import org.apache.flex.core.IBeadView; + import org.apache.flex.core.IScrollBarModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.IUIBase; + import org.apache.flex.core.Strand; + import org.apache.flex.core.UIBase; + import org.apache.flex.core.ValuesManager; + import org.apache.flex.events.IEventDispatcher; + import org.apache.flex.events.Event; + import org.apache.flex.html.Button; + import org.apache.flex.html.beads.controllers.ButtonAutoRepeatController; + + /** + * The HScrollBarView class is the default view for + * the org.apache.flex.html.supportClasses.HScrollBar class. + * It implements the classic desktop-like HScrollBar. + * A different view would implement more modern scrollbars that hide themselves + * until hovered over with the mouse. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class HScrollBarView extends ScrollBarView implements IBeadView, IStrand, IScrollBarView + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function HScrollBarView() + { + } + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + override public function set strand(value:IStrand):void + { + super.strand = value; + + UIBase(value).setHeight(ScrollBarView.FullSize, true); + + // TODO: (aharui) put in values impl + _increment = new Button(); + Button(_increment).addBead(new RightArrowButtonView()); + Button(_increment).addBead(new ButtonAutoRepeatController()); + _decrement = new Button(); + Button(_decrement).addBead(new LeftArrowButtonView()); + Button(_decrement).addBead(new ButtonAutoRepeatController()); + _track = new Button(); + Button(_track).addBead(new HScrollBarTrackView()); + _thumb = new Button(); + Button(_thumb).addBead(new HScrollBarThumbView()); + + UIBase(value).addChild(_decrement); + UIBase(value).addChild(_increment); + UIBase(value).addChild(_track); + UIBase(value).addChild(_thumb); + + IEventDispatcher(_strand).addEventListener("widthChanged", changeHandler); + + layout.layout(); + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBackgroundBead.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBackgroundBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBackgroundBead.as new file mode 100644 index 0000000..2590a9a --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBackgroundBead.as @@ -0,0 +1,35 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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; + + /** + * The IBackgroundBead interface is a marker interface for beads + * that draw backgrounds. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public interface IBackgroundBead extends IBead + { + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBorderBead.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBorderBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBorderBead.as new file mode 100644 index 0000000..3e4fc39 --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBorderBead.as @@ -0,0 +1,35 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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; + + /** + * The IBackgroundBead interface is a marker interface for beads + * that draw backgrounds. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public interface IBorderBead extends IBead + { + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IComboBoxView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IComboBoxView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IComboBoxView.as new file mode 100644 index 0000000..650d300 --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IComboBoxView.as @@ -0,0 +1,78 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.beads +{ + import org.apache.flex.core.IBeadView; + import org.apache.flex.core.IStrand; + + /** + * The IComboBoxView interface provides the protocol for any bead that + * creates the visual parts for a org.apache.flex.html.ComboBox control. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public interface IComboBoxView extends IBeadView + { + /** + * The string appearing in the input area for the ComboBox. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + function get text():String; + function set text(value:String):void; + + /** + * The HTML string appearing in the input area for the ComboBox. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + function get html():String; + function set html(value:String):void; + + /** + * The component housing the selection list. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + function get popUp():IStrand; + + /** + * Determines whether or not the pop-up with the selection list is visible or not. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + function get popUpVisible():Boolean; + function set popUpVisible(value:Boolean):void; + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDataGridView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDataGridView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDataGridView.as new file mode 100644 index 0000000..8f04d11 --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDataGridView.as @@ -0,0 +1,36 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.beads +{ + import org.apache.flex.core.IBeadView; + + /** + * The IDataGridView interface marks as a component as being the bead that + * can create the visual pieces for a org.apache.flex.html.DataGrid. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public interface IDataGridView extends IBeadView + { + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDropDownListView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDropDownListView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDropDownListView.as new file mode 100644 index 0000000..688bcc5 --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDropDownListView.as @@ -0,0 +1,57 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.beads +{ + import org.apache.flex.core.IBeadView; + import org.apache.flex.core.IStrand; + + /** + * The IDropDownListView interface is the interface for views for + * the org.apache.flex.html.DropDownList. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public interface IDropDownListView extends IBeadView + { + + /** + * @copy org.apache.flex.html.beads.DropDownListView#popup + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + function get popUp():IStrand; + + /** + * @copy org.apache.flex.html.beads.DropDownListView#popupVisible + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + function get popUpVisible():Boolean; + function set popUpVisible(value:Boolean):void; + } +}