You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/10/30 21:16:50 UTC
[07/13] git commit: [flex-asjs] [refs/heads/core_js_to_as] - move
asjs to as
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/DateField.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/DateField.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/DateField.as
deleted file mode 100644
index f46e453..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/DateField.as
+++ /dev/null
@@ -1,95 +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
-{
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.IDateChooserModel;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.core.ValuesManager;
-
- /**
- * The change event is dispatched when the selectedDate is changed.
- */
- [Event(name="change", type="org.apache.flex.events.Event")]
-
- /**
- * The DateField class provides an input field where a date can be entered
- * and a pop-up calendar control for picking a date as an alternative to
- * the text field.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateField extends UIBase
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateField()
- {
- super();
-
- className = "DateField";
- }
-
- /**
- * The method called when added to a parent. The DateField class uses
- * this opportunity to install additional beads.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function addedToParent():void
- {
- var klass:* = ValuesManager.valuesImpl.getValue(this,"iFormatBead");
- var bead:IBead = new klass() as IBead;
- if (bead) {
- addBead(bead);
- }
-
- super.addedToParent();
- }
-
- /**
- * The currently selected date (or null if no date has been selected).
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get selectedDate():Date
- {
- return IDateChooserModel(model).selectedDate;
- }
- public function set selectedDate(value:Date):void
- {
- IDateChooserModel(model).selectedDate = value;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/ImageButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/ImageButton.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/ImageButton.as
deleted file mode 100644
index dd92019..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/ImageButton.as
+++ /dev/null
@@ -1,60 +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
-{
- import org.apache.flex.core.SimpleCSSStyles;
-
- /**
- * The CloseButton class is Button that displays an X
- * and is commonly used in a Panel's TitleBar.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ImageButton extends Button
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ImageButton()
- {
- super();
- typeNames = "ImageButton";
- }
-
- public function get backgroundImage():String
- {
- return style.backgroundImage;
- }
-
- public function set backgroundImage(url:String):void
- {
- if (!style)
- style = new SimpleCSSStyles();
- style.backgroundImage = url;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/MXMLBeadViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/MXMLBeadViewBase.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/MXMLBeadViewBase.as
deleted file mode 100644
index 4f871a2..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/MXMLBeadViewBase.as
+++ /dev/null
@@ -1,314 +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
-{
- import org.apache.flex.states.State;
-
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.ILayoutHost;
- import org.apache.flex.core.IParent;
- import org.apache.flex.core.IParentIUIBase;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.IStatesImpl;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.html.beads.ContainerView;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.ValueChangeEvent;
- import org.apache.flex.utils.MXMLDataInterpreter;
-
- [DefaultProperty("mxmlContent")]
-
- /**
- * The MXMLBeadViewBase class extends BeadViewBase
- * and adds support for databinding and specification
- * of children in MXML.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class MXMLBeadViewBase extends ContainerView implements IStrand, ILayoutHost
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function MXMLBeadViewBase()
- {
- super();
- }
-
- [Bindable("strandChanged")]
- /**
- * An MXMLBeadViewBase doesn't create its children until it is added to
- * the 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;
- // each MXML file can also have styles in fx:Style block
- ValuesManager.valuesImpl.init(this);
-
- dispatchEvent(new Event("strandChanged"));
-
- for each (var bead:IBead in beads)
- addBead(bead);
-
- dispatchEvent(new org.apache.flex.events.Event("beadsAdded"));
-
- MXMLDataInterpreter.generateMXMLInstances(this, IParent(value), MXMLDescriptor);
-
- dispatchEvent(new Event("initBindings"))
- dispatchEvent(new Event("initComplete"))
- dispatchEvent(new Event("childrenAdded"));
- }
-
- [Bindable("__NoChangeEvent__")]
- /**
- * The model object.
- */
- public function get model():Object
- {
- return _strand["model"];
- }
-
- /**
- * @copy org.apache.flex.core.Application#MXMLDescriptor
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get MXMLDescriptor():Array
- {
- return null;
- }
-
- /**
- * @copy org.apache.flex.core.Application#generateMXMLAttributes()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function generateMXMLAttributes(data:Array):void
- {
- MXMLDataInterpreter.generateMXMLProperties(this, data);
- }
-
- /**
- * @copy org.apache.flex.core.ItemRendererClassFactory#mxmlContent
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public var mxmlContent:Array;
-
- private var _states:Array;
-
- /**
- * The array of view states. These should
- * be instances of org.apache.flex.states.State.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get states():Array
- {
- return _states;
- }
-
- /**
- * @private
- */
- public function set states(value:Array):void
- {
- _states = value;
- _currentState = _states[0].name;
-
- try{
- if (getBeadByType(IStatesImpl) == null)
- addBead(new (ValuesManager.valuesImpl.getValue(this, "iStatesImpl")) as IBead);
- }
- //TODO: Need to handle this case more gracefully
- catch(e:Error)
- {
- trace(e.message);
- }
-
- }
-
- /**
- * <code>true</code> if the array of states
- * contains a state with this name.
- *
- * @param state The state namem.
- * @return True if state in state array
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function hasState(state:String):Boolean
- {
- for each (var s:State in _states)
- {
- if (s.name == state)
- return true;
- }
- return false;
- }
-
- private var _currentState:String;
-
- [Bindable("currentStateChange")]
- /**
- * The name of the current state.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get currentState():String
- {
- return _currentState;
- }
-
- /**
- * @private
- */
- public function set currentState(value:String):void
- {
- var event:ValueChangeEvent = new ValueChangeEvent("currentStateChange", false, false, _currentState, value)
- _currentState = value;
- dispatchEvent(event);
- }
-
- private var _transitions:Array;
-
- /**
- * The array of transitions.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get transitions():Array
- {
- return _transitions;
- }
-
- /**
- * @private
- */
- public function set transitions(value:Array):void
- {
- _transitions = value;
- }
-
- /**
- * @copy org.apache.flex.core.Application#beads
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public var beads:Array;
-
- private var _beads:Array;
-
- /**
- * @copy org.apache.flex.core.IStrand#addBead()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function addBead(bead:IBead):void
- {
- if (!_beads)
- _beads = [];
- _beads.push(bead);
- bead.strand = this;
- }
-
- /**
- * @copy org.apache.flex.core.IStrand#getBeadByType()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function getBeadByType(classOrInterface:Class):IBead
- {
- for each (var bead:IBead in _beads)
- {
- if (bead is classOrInterface)
- return bead;
- }
- return null;
- }
-
- /**
- * @copy org.apache.flex.core.IStrand#removeBead()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function removeBead(value:IBead):IBead
- {
- var n:int = _beads.length;
- for (var i:int = 0; i < n; i++)
- {
- var bead:IBead = _beads[i];
- if (bead == value)
- {
- _beads.splice(i, 1);
- return bead;
- }
- }
- return null;
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/accessories/ToolTipBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/accessories/ToolTipBead.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/accessories/ToolTipBead.as
deleted file mode 100644
index 64d04bf..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/accessories/ToolTipBead.as
+++ /dev/null
@@ -1,141 +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.accessories
-{
-
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.IPopUpHost;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.IUIBase;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.events.MouseEvent;
- import org.apache.flex.events.utils.MouseUtils;
- import org.apache.flex.geom.Point;
- import org.apache.flex.html.ToolTip;
- import org.apache.flex.utils.PointUtils;
- import org.apache.flex.utils.UIUtils;
-
- /**
- * The ToolTipBead class is a specialty bead that can be used with
- * any control. The bead floats a string over a control if
- * the user hovers over the control with a mouse.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ToolTipBead implements IBead
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ToolTipBead()
- {
- }
-
- private var _toolTip:String;
-
- /**
- * The string to use as the toolTip.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get toolTip():String
- {
- return _toolTip;
- }
- public function set toolTip(value:String):void
- {
- _toolTip = value;
- }
-
- 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(MouseEvent.MOUSE_OVER, rollOverHandler, false);
- }
-
- private var tt:ToolTip;
- private var host:IPopUpHost;
-
- /**
- * @private
- */
- protected function rollOverHandler( event:MouseEvent ):void
- {
- IEventDispatcher(_strand).addEventListener(MouseEvent.MOUSE_OUT, rollOutHandler, false);
-
- var comp:IUIBase = _strand as IUIBase
- host = UIUtils.findPopUpHost(comp);
- if (tt) host.removeElement(tt);
-
- tt = new ToolTip();
- tt.text = toolTip;
- var pt:Point = determinePosition(event, event.target);
- tt.x = pt.x;
- tt.y = pt.y;
- host.addElement(tt, false); // don't trigger a layout
- }
-
- /**
- * @private
- * Determines the position of the toolTip.
- */
- protected function determinePosition(event:MouseEvent, base:Object):Point
- {
- var comp:IUIBase = _strand as IUIBase;
- var pt:Point = new Point(comp.width, comp.height);
- pt = PointUtils.localToGlobal(pt, comp);
- return pt;
- }
-
- /**
- * @private
- */
- private function rollOutHandler( event:MouseEvent ):void
- {
- if (tt) {
- host.removeElement(tt);
- }
- tt = null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridColumnView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridColumnView.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridColumnView.as
deleted file mode 100644
index 4266148..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridColumnView.as
+++ /dev/null
@@ -1,104 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.html.beads
-{
- import org.apache.flex.core.IStrand;
- import org.apache.flex.html.supportClasses.DataGridColumn;
-
- /**
- * The DataGridColumnView class extends org.apache.flex.html.beads.ListView and
- * provides properties to the org.apache.flex.html.List that makes a column in
- * the org.apache.flex.html.DataGrid.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DataGridColumnView extends ListView
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DataGridColumnView()
- {
- }
-
- 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
- {
- super.strand = value;
- _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/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridView.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridView.as
deleted file mode 100644
index d578a6e..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridView.as
+++ /dev/null
@@ -1,251 +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.IDataGridLayout;
- import org.apache.flex.core.IDataGridModel;
- import org.apache.flex.core.ISelectionModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.html.ButtonBar;
- import org.apache.flex.html.Container;
- import org.apache.flex.html.List;
- import org.apache.flex.html.beads.layouts.ButtonBarLayout;
- import org.apache.flex.html.beads.layouts.DataGridLayout;
- import org.apache.flex.html.beads.models.ArraySelectionModel;
- import org.apache.flex.html.beads.models.DataGridPresentationModel;
- import org.apache.flex.html.supportClasses.DataGridColumn;
- import org.apache.flex.html.supportClasses.Viewport;
-
- /**
- * The DataGridView class is the visual bead for the org.apache.flex.html.DataGrid.
- * This class constructs the items that make the DataGrid: Lists for each column and a
- * org.apache.flex.html.ButtonBar for the column headers.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DataGridView extends BeadViewBase implements IDataGridView
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DataGridView()
- {
- }
-
- //private var background:Shape;
- private var buttonBar:ButtonBar;
- private var buttonBarModel:ArraySelectionModel;
- private var columnContainer:Container;
- private var columns:Array;
-
- /**
- * The array of org.apache.flex.html.supportClasses.DataGridColumn instances.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function getColumnLists():Array
- {
- return columns;
- }
-
- 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;
-
- IEventDispatcher(_strand).addEventListener("sizeChanged", onSizeChanged);
- IEventDispatcher(_strand).addEventListener("widthChanged", onSizeChanged);
- IEventDispatcher(_strand).addEventListener("heightChanged", onSizeChanged);
-
- // see if there is a presentation model already in place. if not, add one.
- var modBead:IBead = _strand.getBeadByType(DataGridPresentationModel);
- var presentationModel:DataGridPresentationModel;
- if (modBead == null) {
- presentationModel = new DataGridPresentationModel();
- _strand.addBead(presentationModel);
- }
- else {
- presentationModel = modBead as DataGridPresentationModel;
- }
-
- var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
- IEventDispatcher(sharedModel).addEventListener("dataProviderChanged",onDataProviderChanged);
-
- // create an array of columnLabels for use by the ButtonBar/DataGrid header.
- 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();
-
- buttonBarModel = new ArraySelectionModel();
- buttonBarModel.dataProvider = columnLabels;
-
- buttonBar = new ButtonBar();
- buttonBar.addBead(buttonBarModel);
- buttonBar.addBead(bblayout);
- buttonBar.addBead(new Viewport());
- buttonBar.height = 25;
- buttonBar.width = UIBase(_strand).width;
- UIBase(_strand).addElement(buttonBar);
-
- // Create a List for each column, storing a reference to each List in
- // the columns property.
- columns = new Array();
- for(i=0; i < sharedModel.columns.length; i++)
- {
- // Each list shares the same dataProvider but needs its own model to
- // keep track of its own data.
- var listModel:ISelectionModel = new ArraySelectionModel();
- listModel.dataProvider = sharedModel.dataProvider;
-
- var dataGridColumn:DataGridColumn = sharedModel.columns[i] as DataGridColumn;
-
- var list:List = new List();
- list.addBead(listModel);
- list.itemRenderer = dataGridColumn.itemRenderer;
- list.labelField = dataGridColumn.dataField;
- list.addBead(presentationModel);
-
- var colWidth:Number = dataGridColumn.columnWidth;
- if (!isNaN(colWidth)) list.width = colWidth;
-
- UIBase(_strand).addElement(list);
- columns.push(list);
- list.addEventListener('change',columnListChangeHandler);
- list.addEventListener('rollover',columnListRollOverHandler);
- list.addEventListener('layoutComplete',forwardEvent);
- }
-
- // TODO: allow a developer to specify their own DataGridLayout
- // possibly by seeing if a bead already exists
-
- onSizeChanged(null);
- IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
- }
-
- private function onSizeChanged(event:Event):void
- {
- var bead:IBead = _strand.getBeadByType(IDataGridLayout);
- var layout:IDataGridLayout;
- if (bead == null) {
- // NOTE: the following line will not cross-compile correctly into JavaScript
- // so it has been commented and the class hard-coded.
- //layout = new ValuesManager.valuesImpl.getValue(_strand, "iBeadLayout")) as IDataGridLayout;
- layout = new DataGridLayout();
- _strand.addBead(layout);
- } else {
- layout = bead as IDataGridLayout;
- }
- layout.header = buttonBar;
- layout.columns = columns;
- layout.layout();
- }
-
- /**
- * @private
- * When the dataProvider is changed for the DataGrid, this updates each List (column)
- * with the new (or changed) dataProvider.
- */
- private function onDataProviderChanged(event:Event):void
- {
- var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
-
- for (var i:int=0; i < columns.length; i++)
- {
- var list:List = columns[i] as List;
- var listModel:ISelectionModel = list.getBeadByType(IBeadModel) as ISelectionModel;
- listModel.dataProvider = sharedModel.dataProvider;
- }
- }
-
- /**
- * @private
- */
- private function columnListChangeHandler(event:Event):void
- {
- var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
- var list:List = event.target as List;
- sharedModel.selectedIndex = list.selectedIndex;
-
- for(var i:int=0; i < columns.length; i++) {
- if (list != columns[i]) {
- var otherList:List = columns[i] as List;
- otherList.selectedIndex = list.selectedIndex;
- }
- }
-
- IEventDispatcher(_strand).dispatchEvent(new Event('change'));
- }
-
- /**
- * @private
- */
- private function columnListRollOverHandler(event:Event):void
- {
- var list:List = event.target as List;
- if (list == null) return;
- for(var i:int=0; i < columns.length; i++) {
- if (list != columns[i]) {
- var otherList:List = columns[i] as List;
- otherList.rollOverIndex = list.rollOverIndex;
- }
- }
-
- IEventDispatcher(_strand).dispatchEvent(new Event('rollOver'));
- }
-
- /**
- * @private
- */
- private function forwardEvent(event:Event):void
- {
- IEventDispatcher(_strand).dispatchEvent(event);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as
deleted file mode 100644
index d399cfb..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as
+++ /dev/null
@@ -1,142 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.html.beads
-{
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.IBeadView;
- import org.apache.flex.core.IDataGridModel;
- import org.apache.flex.core.IDataProviderItemRendererMapper;
- import org.apache.flex.core.IItemRendererClassFactory;
- import org.apache.flex.core.IItemRendererParent;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.html.supportClasses.DataItemRenderer;
-
- /**
- * The DataItemRendererFactoryForColumnData class implents the
- * org.apache.flex.core.IDataProviderItemRendererMapper interface and creates the itemRenderers
- * for each cell in the org.apache.flex.html.DataGrid.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DataItemRendererFactoryForColumnData implements IBead, IDataProviderItemRendererMapper
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DataItemRendererFactoryForColumnData()
- {
- }
-
- private var selectionModel:IDataGridModel;
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
- selectionModel = value.getBeadByType(IDataGridModel) as IDataGridModel;
- var listView:IListView = value.getBeadByType(IListView) as IListView;
- dataGroup = listView.dataGroup;
- selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
-
- if (!itemRendererFactory)
- {
- _itemRendererFactory = new (ValuesManager.valuesImpl.getValue(_strand, "iItemRendererClassFactory")) as IItemRendererClassFactory;
- _strand.addBead(_itemRendererFactory);
- }
-
- dataProviderChangeHandler(null);
- }
-
- private var _itemRendererFactory:IItemRendererClassFactory;
-
- /**
- * The factory used to create the itemRenderers.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get itemRendererFactory():IItemRendererClassFactory
- {
- return _itemRendererFactory
- }
- public function set itemRendererFactory(value:IItemRendererClassFactory):void
- {
- _itemRendererFactory = value;
- }
-
- /**
- * The dataGroup that is the pareent for the itemRenderers
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected var dataGroup:IItemRendererParent;
-
- /**
- * @private
- */
- private function dataProviderChangeHandler(event:Event):void
- {
- var dp:Array = selectionModel.dataProvider as Array;
- if (!dp)
- return;
-
- dataGroup.removeAllElements();
-
- var view:DataGridColumnView = _strand.getBeadByType(IBeadView) as DataGridColumnView;
- if (view == null) return;
-
- var n:int = dp.length;
- for (var i:int = 0; i < n; i++)
- {
- var tf:DataItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as DataItemRenderer;
- tf.index = i;
- tf.labelField = view.column.dataField;
- dataGroup.addElement(tf);
- tf.data = dp[i];
- }
-
- IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DateChooserView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DateChooserView.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DateChooserView.as
deleted file mode 100644
index 4baa17b..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DateChooserView.as
+++ /dev/null
@@ -1,256 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.html.beads
-{
- import org.apache.flex.html.beads.models.DateChooserModel;
- import org.apache.flex.html.supportClasses.DateChooserButton;
-
- import org.apache.flex.core.BeadViewBase;
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IBeadView;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.html.beads.layouts.TileLayout;
- import org.apache.flex.html.Container;
- import org.apache.flex.html.TextButton;
-
- /**
- * The DateChooserView class is a view bead for the DateChooser. This class
- * creates the elements for the DateChooser: the buttons to move between
- * months, the labels for the days of the week, and the buttons for each day
- * of the month.
- */
- public class DateChooserView extends BeadViewBase implements IBeadView
- {
- /**
- * constructor
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateChooserView()
- {
- }
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function set strand(value:IStrand):void
- {
- super.strand = value;
-
- // make sure there is a model.
- model = _strand.getBeadByType(IBeadModel) as DateChooserModel;
- if (model == null) {
- model = new (ValuesManager.valuesImpl.getValue(_strand,"iBeadModel")) as DateChooserModel;
- }
- model.addEventListener("displayedMonthChanged",handleModelChange);
- model.addEventListener("displayedYearChanged",handleModelChange);
-
- createChildren();
- }
-
- private var _prevMonthButton:TextButton;
- private var _nextMonthButton:TextButton;
- private var _dayButtons:Array;
- private var monthLabel:TextButton;
- private var dayContainer:Container;
-
- private var model:DateChooserModel;
-
- /**
- * The button that causes the previous month to be displayed by the DateChooser.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get prevMonthButton():TextButton
- {
- return _prevMonthButton;
- }
-
- /**
- * The button that causes the next month to be displayed by the DateChooser.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get nextMonthButton():TextButton
- {
- return _nextMonthButton;
- }
-
- /**
- * The array of DateChooserButton instances that represent each day of the month.
- */
- public function get dayButtons():Array
- {
- return _dayButtons;
- }
-
- /**
- * @private
- */
- private function createChildren():void
- {
- _prevMonthButton = new TextButton();
- _prevMonthButton.width = 40;
- _prevMonthButton.height = 20;
- _prevMonthButton.x = 0;
- _prevMonthButton.y = 0;
- _prevMonthButton.text = "<";
- UIBase(_strand).addElement(_prevMonthButton);
-
- _nextMonthButton = new TextButton();
- _nextMonthButton.width = 40;
- _nextMonthButton.height = 20;
- _nextMonthButton.x = UIBase(_strand).width - _nextMonthButton.width;
- _nextMonthButton.y = 0;
- _nextMonthButton.text = ">";
- UIBase(_strand).addElement(_nextMonthButton);
-
- monthLabel = new TextButton();
- monthLabel.text = "Month Here";
- monthLabel.width = 100;
- monthLabel.height = 20;
- monthLabel.x = (UIBase(_strand).width - monthLabel.width)/2;
- monthLabel.y = 0;
- UIBase(_strand).addElement(monthLabel);
-
- dayContainer = new Container();
- var tileLayout:TileLayout = new TileLayout();
- dayContainer.addBead(tileLayout);
- UIBase(_strand).addElement(dayContainer, false);
-
- tileLayout.numColumns = 7;
- dayContainer.x = 0;
- dayContainer.y = monthLabel.y + monthLabel.height + 5;
-
- var sw:Number = UIBase(_strand).width;
- var sh:Number = UIBase(_strand).height;
- trace("Strand's width x height is "+sw+" x "+sh);
- dayContainer.width = sw;
- dayContainer.height = sh - (monthLabel.height+5);
-
- // the calendar has 7 columns with 6 rows, the first row are the day names
- for(var i:int=0; i < 7; i++) {
- var dayName:DateChooserButton = new DateChooserButton();
- dayName.text = model.dayNames[i];
- dayName.dayOfMonth = 0;
- dayContainer.addElement(dayName, false);
- }
-
- _dayButtons = new Array();
-
- for(i=0; i < 42; i++) {
- var date:DateChooserButton = new DateChooserButton();
- date.text = String(i+1);
- dayContainer.addElement(date, false);
- dayButtons.push(date);
- }
-
- IEventDispatcher(dayContainer).dispatchEvent( new Event("itemsCreated") );
- IEventDispatcher(_strand).dispatchEvent( new Event("layoutNeeded") );
- IEventDispatcher(dayContainer).dispatchEvent( new Event("layoutNeeded") );
-
- updateCalendar();
- }
-
- /**
- * @private
- */
- private function updateCalendar():void
- {
- monthLabel.text = model.monthNames[model.displayedMonth] + " " +
- String(model.displayedYear);
-
- var firstDay:Date = new Date(model.displayedYear,model.displayedMonth,1);
-
- // blank out the labels for the first firstDay.day-1 entries.
- for(var i:int=0; i < firstDay.getDay(); i++) {
- var dateButton:DateChooserButton = dayButtons[i] as DateChooserButton;
- dateButton.dayOfMonth = -1;
- dateButton.text = "";
- }
-
- // renumber to the last day of the month
- var dayNumber:int = 1;
- var numDays:Number = numberOfDaysInMonth(model.displayedMonth, model.displayedYear);
-
- for(; i < dayButtons.length && dayNumber <= numDays; i++) {
- dateButton = dayButtons[i] as DateChooserButton;
- dateButton.dayOfMonth = dayNumber;
- dateButton.text = String(dayNumber++);
- }
-
- // blank out the rest
- for(; i < dayButtons.length; i++) {
- dateButton = dayButtons[i] as DateChooserButton;
- dateButton.dayOfMonth = -1;
- dateButton.text = "";
- }
- }
-
- /**
- * @private
- */
- private function numberOfDaysInMonth(month:Number, year:Number):Number
- {
- var n:int;
-
- if (month == 1) // Feb
- {
- if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) // leap year
- n = 29;
- else
- n = 28;
- }
-
- else if (month == 3 || month == 5 || month == 8 || month == 10)
- n = 30;
-
- else
- n = 31;
-
- return n;
- }
-
- /**
- * @private
- */
- private function handleModelChange(event:Event):void
- {
- updateCalendar();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DateFieldView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DateFieldView.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DateFieldView.as
deleted file mode 100644
index f709a1f..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DateFieldView.as
+++ /dev/null
@@ -1,192 +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.
- *
- * @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/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/IDataGridView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/IDataGridView.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/IDataGridView.as
deleted file mode 100644
index 8f04d11..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/IDataGridView.as
+++ /dev/null
@@ -1,36 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.html.beads
-{
- import org.apache.flex.core.IBeadView;
-
- /**
- * 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/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/TitleBarMeasurementBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/TitleBarMeasurementBead.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/TitleBarMeasurementBead.as
deleted file mode 100644
index 8195f70..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/TitleBarMeasurementBead.as
+++ /dev/null
@@ -1,108 +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.IMeasurementBead;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.html.TitleBar;
-
- /**
- * The TitleBarMeasurementBead class measures the overall size of a
- * org.apache.flex.html.TitleBar.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class TitleBarMeasurementBead implements IMeasurementBead
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function TitleBarMeasurementBead()
- {
- }
-
- /**
- * The overall width of the org.apache.flex.html.TitleBar.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get measuredWidth():Number
- {
- var mwidth:Number = 0;
- var titleBar:TitleBar = _strand as TitleBar;
- var titleView:TitleBarView = _strand.getBeadByType(TitleBarView) as TitleBarView;
- var labelMeasure:IMeasurementBead = titleView.titleLabel.measurementBead;
- mwidth = labelMeasure.measuredWidth;
- if( titleBar.showCloseButton ) {
- var buttonMeasure:IMeasurementBead = titleView.closeButton.measurementBead;
- mwidth += buttonMeasure.measuredWidth;
- }
- return mwidth;
- }
-
- /**
- * The overall height of the org.apache.flex.html.TitleBar.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get measuredHeight():Number
- {
- var mheight:Number = 0;
- var titleBar:TitleBar = _strand as TitleBar;
- var titleView:TitleBarView = _strand.getBeadByType(TitleBarView) as TitleBarView;
- var labelMeasure:IMeasurementBead = titleView.titleLabel.measurementBead;
- mheight = labelMeasure.measuredHeight;
- if( titleBar.showCloseButton ) {
- var buttonMeasure:IMeasurementBead = titleView.closeButton.measurementBead;
- mheight = Math.max(mheight,buttonMeasure.measuredHeight);
- }
- return mheight;
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/controllers/DateChooserMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/controllers/DateChooserMouseController.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/controllers/DateChooserMouseController.as
deleted file mode 100644
index 0aaa052..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/controllers/DateChooserMouseController.as
+++ /dev/null
@@ -1,126 +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.controllers
-{
- import org.apache.flex.html.beads.DateChooserView;
- import org.apache.flex.html.beads.models.DateChooserModel;
- import org.apache.flex.html.supportClasses.DateChooserButton;
-
- import org.apache.flex.core.IBeadController;
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IBeadView;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
-
- /**
- * The DateChooserMouseController class is responsible for listening to
- * mouse event related to the DateChooser. Events such as selecting a date
- * or changing the calendar.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateChooserMouseController implements IBeadController
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateChooserMouseController()
- {
- }
-
- 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;
-
- var view:DateChooserView = value.getBeadByType(IBeadView) as DateChooserView;
- view.prevMonthButton.addEventListener("click", prevMonthClickHandler);
- view.nextMonthButton.addEventListener("click", nextMonthClickHandler);
-
- var dayButtons:Array = view.dayButtons;
- for(var i:int=0; i < dayButtons.length; i++) {
- IEventDispatcher(dayButtons[i]).addEventListener("click", dayButtonClickHandler);
- }
- }
-
- /**
- * @private
- */
- private function prevMonthClickHandler(event:Event):void
- {
- var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
- var month:Number = model.displayedMonth - 1;
- var year:Number = model.displayedYear;
- if (month < 0) {
- month = 11;
- year--;
- }
- model.displayedMonth = month;
- model.displayedYear = year;
- }
-
- /**
- * @private
- */
- private function nextMonthClickHandler(event:Event):void
- {
- var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
- var month:Number = model.displayedMonth + 1;
- var year:Number = model.displayedYear;
- if (month >= 12) {
- month = 0;
- year++;
- }
- model.displayedMonth = month;
- model.displayedYear = year;
- }
-
- /**
- * @private
- */
- private function dayButtonClickHandler(event:Event):void
- {
- var dateButton:DateChooserButton = event.target as DateChooserButton;
- if (dateButton.dayOfMonth > 0) {
- var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
- var newDate:Date = new Date(model.displayedYear,model.displayedMonth,dateButton.dayOfMonth);
- model.selectedDate = newDate;
- IEventDispatcher(_strand).dispatchEvent( new Event("change") );
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/controllers/DateFieldMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/controllers/DateFieldMouseController.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/controllers/DateFieldMouseController.as
deleted file mode 100644
index 05b852d..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/controllers/DateFieldMouseController.as
+++ /dev/null
@@ -1,95 +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.controllers
-{
- import org.apache.flex.core.IBeadController;
- import org.apache.flex.core.IDateChooserModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.html.beads.DateFieldView;
-
- /**
- * The DateFieldMouseController class is responsible for monitoring
- * the mouse events on the elements of the DateField. A click on the
- * DateField's menu button triggers the pop-up, for example.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateFieldMouseController implements IBeadController
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateFieldMouseController()
- {
- }
-
- 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;
-
- var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
- IEventDispatcher(viewBead.menuButton).addEventListener("click", clickHandler);
- }
-
- /**
- * @private
- */
- private function clickHandler(event:Event):void
- {
- var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
- viewBead.popUpVisible = true;
- IEventDispatcher(viewBead.popUp).addEventListener("change", changeHandler);
- }
-
- /**
- * @private
- */
- private function changeHandler(event:Event):void
- {
- var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
-
- var model:IDateChooserModel = _strand.getBeadByType(IDateChooserModel) as IDateChooserModel;
- model.selectedDate = IDateChooserModel(viewBead.popUp.getBeadByType(IDateChooserModel)).selectedDate;
-
- viewBead.popUpVisible = false;
- IEventDispatcher(_strand).dispatchEvent(new Event("change"));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/DataGridLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/DataGridLayout.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/DataGridLayout.as
deleted file mode 100644
index f6849ce..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/DataGridLayout.as
+++ /dev/null
@@ -1,157 +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.layouts
-{
- import org.apache.flex.core.IBeadLayout;
- import org.apache.flex.core.IDataGridLayout;
- import org.apache.flex.core.IDataGridModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.IUIBase;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.html.ButtonBar;
- import org.apache.flex.html.supportClasses.DataGridColumn;
-
- /**
- * DataGridLayout is a class that handles the size and positioning of the
- * elements of a DataGrid. This includes the ButtonBar used for the column
- * headers and the Lists that are the columns.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DataGridLayout implements IBeadLayout, IDataGridLayout
- {
- /**
- * constructor
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DataGridLayout()
- {
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
- }
-
- private var _header:UIBase;
-
- /**
- * The element that is the header for the DataGrid
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get header():IUIBase
- {
- return _header;
- }
- public function set header(value:IUIBase):void
- {
- _header = UIBase(value);
- }
-
- private var _columns:Array;
-
- /**
- * The array of column elements.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get columns():Array
- {
- return _columns;
- }
- public function set columns(value:Array):void
- {
- _columns = value;
- }
-
- /**
- * @copy org.apache.flex.core.IBeadLayout#layout
- */
- public function layout():Boolean
- {
- var sw:Number = UIBase(_strand).width;
- var sh:Number = UIBase(_strand).height;
-
- var columnHeight:Number = Math.floor(sh - header.height);
- var columnWidth:Number = Math.floor(sw / columns.length);
-
- var xpos:Number = 0;
- var ypos:Number = Math.floor(header.height);
-
- // TODO: change the layout so that the model's DataGridColumn.columnWidth
- // isn't used blindly, but is considered in the overall width. In other words,
- // right now the width could exceed the strand's width.
- var model:IDataGridModel = _strand.getBeadByType(IDataGridModel) as IDataGridModel;
-
- var buttonWidths:Array = new Array();
-
- for(var i:int=0; i < columns.length; i++) {
- var column:UIBase = columns[i] as UIBase;
- column.x = xpos;
- column.y = ypos;
- column.height = columnHeight;
-
- var dgc:DataGridColumn = model.columns[i];
- if (!isNaN(dgc.columnWidth)) column.width = dgc.columnWidth;
- else column.width = columnWidth;
-
- xpos += column.width;
-
- buttonWidths.push(column.width);
- }
-
- var bar:ButtonBar = header as ButtonBar;
- var barLayout:ButtonBarLayout = bar.getBeadByType(ButtonBarLayout) as ButtonBarLayout;
- barLayout.buttonWidths = buttonWidths;
-
- header.x = 0;
- header.y = 0;
- header.width = sw;
- header.dispatchEvent(new Event("layoutNeeded"));
-
- return true;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
deleted file mode 100644
index 4198fea..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
+++ /dev/null
@@ -1,244 +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.layouts
-{
- import org.apache.flex.core.IBeadLayout;
- import org.apache.flex.core.ILayoutChild;
- import org.apache.flex.core.ILayoutHost;
- import org.apache.flex.core.IParentIUIBase;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.IUIBase;
- import org.apache.flex.core.IViewport;
- import org.apache.flex.core.IViewportModel;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.geom.Rectangle;
- import org.apache.flex.html.supportClasses.Viewport;
- import org.apache.flex.utils.CSSContainerUtils;
-
- /**
- * The FlexibleFirstChildHorizontalLayout class is a simple layout
- * bead. It takes the set of children and lays them out
- * horizontally in one row, separating them according to
- * CSS layout rules for margin and padding styles. But it
- * will size the first child to take up as much or little
- * room as possible.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class FlexibleFirstChildHorizontalLayout implements IBeadLayout
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function FlexibleFirstChildHorizontalLayout()
- {
- }
-
- // the strand/host container is also an ILayoutChild because
- // can have its size dictated by the host's parent which is
- // important to know for layout optimization
- private var host:ILayoutChild;
-
- /**
- * @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
- {
- host = value as ILayoutChild;
- }
-
- private var _maxWidth:Number;
-
- /**
- * @copy org.apache.flex.core.IBead#maxWidth
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get maxWidth():Number
- {
- return _maxWidth;
- }
-
- /**
- * @private
- */
- public function set maxWidth(value:Number):void
- {
- _maxWidth = value;
- }
-
- private var _maxHeight:Number;
-
- /**
- * @copy org.apache.flex.core.IBead#maxHeight
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get maxHeight():Number
- {
- return _maxHeight;
- }
-
- /**
- * @private
- */
- public function set maxHeight(value:Number):void
- {
- _maxHeight = value;
- }
-
- /**
- * @copy org.apache.flex.core.IBeadLayout#layout
- */
- public function layout():Boolean
- {
- var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
- var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase;
- var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
- var hostSizedToContent:Boolean = host.isHeightSizedToContent();
-
- var n:int = contentView.numElements;
- var marginLeft:Object;
- var marginRight:Object;
- var marginTop:Object;
- var marginBottom:Object;
- var margin:Object;
- maxHeight = 0;
- var verticalMargins:Array = [];
-
- var xx:Number = contentView.width;
- if (isNaN(xx) || xx <= 0)
- return true;
- xx -= padding.right + 1; // some browsers won't layout to the edge
-
- for (var i:int = n - 1; i >= 0; i--)
- {
- var child:IUIBase = contentView.getElementAt(i) as IUIBase;
- margin = ValuesManager.valuesImpl.getValue(child, "margin");
- if (margin is Array)
- {
- if (margin.length == 1)
- marginLeft = marginTop = marginRight = marginBottom = margin[0];
- else if (margin.length <= 3)
- {
- marginLeft = marginRight = margin[1];
- marginTop = marginBottom = margin[0];
- }
- else if (margin.length == 4)
- {
- marginLeft = margin[3];
- marginBottom = margin[2];
- marginRight = margin[1];
- marginTop = margin[0];
- }
- }
- else if (margin == null)
- {
- marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
- marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
- marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
- marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
- }
- else
- {
- marginLeft = marginTop = marginBottom = marginRight = margin;
- }
- var ml:Number;
- var mr:Number;
- var mt:Number;
- var mb:Number;
- var lastmr:Number;
- mt = Number(marginTop);
- if (isNaN(mt))
- mt = 0;
- mb = Number(marginBottom);
- if (isNaN(mb))
- mb = 0;
- if (marginLeft == "auto")
- ml = 0;
- else
- {
- ml = Number(marginLeft);
- if (isNaN(ml))
- ml = 0;
- }
- if (marginRight == "auto")
- mr = 0;
- else
- {
- mr = Number(marginRight);
- if (isNaN(mr))
- mr = 0;
- }
- child.y = mt + padding.top;
- if (i == 0)
- {
- child.x = ml + padding.left;
- child.width = xx - mr - child.x;
- }
- else
- child.x = xx - child.width - mr;
- maxHeight = Math.max(maxHeight, mt + child.height + mb);
- xx -= child.width + mr + ml;
- lastmr = mr;
- var valign:Object = ValuesManager.valuesImpl.getValue(child, "vertical-align");
- verticalMargins.push({ marginTop: mt, marginBottom: mb, valign: valign });
- }
- for (i = 0; i < n; i++)
- {
- var obj:Object = verticalMargins[0]
- child = contentView.getElementAt(i) as IUIBase;
- if (obj.valign == "middle")
- child.y = (maxHeight - child.height) / 2;
- else if (valign == "bottom")
- child.y = maxHeight - child.height - obj.marginBottom;
- else
- child.y = obj.marginTop;
- }
- if (hostSizedToContent)
- ILayoutChild(contentView).setHeight(maxHeight + padding.top + padding.bottom, true);
-
- return true;
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fab34be3/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/LayoutChangeNotifier.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/LayoutChangeNotifier.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/LayoutChangeNotifier.as
deleted file mode 100644
index 00d328b..0000000
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/layouts/LayoutChangeNotifier.as
+++ /dev/null
@@ -1,103 +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.layouts
-{
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.IBeadView;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
-
- /**
- * The LayoutChangeNotifier notifies layouts when a property
- * it is watching changes.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class LayoutChangeNotifier implements IBead
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function LayoutChangeNotifier()
- {
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
- }
-
- private var _value:* = undefined;
-
- /**
- * The value of the property being watched. This is usually
- * a data binding expression.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set initialValue(value:Object):void
- {
- _value = value;
- }
-
- /**
- * The value of the property being watched. This is usually
- * a data binding expression.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set watchedProperty(value:Object):void
- {
- if (_value !== value)
- {
- _value = value;
- if (_strand is IBeadView)
- IBeadView(_strand).host.dispatchEvent(new Event("layoutNeeded"));
- else
- IEventDispatcher(_strand).dispatchEvent(new Event("layoutNeeded"));
- }
- }
-
- }
-}