http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBase.as new file mode 100644 index 0000000..047b635 --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBase.as @@ -0,0 +1,453 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core +{ + import org.apache.flex.core.IMXMLDocument; + import org.apache.flex.core.ValuesManager; + import org.apache.flex.events.Event; + import org.apache.flex.events.ValueChangeEvent; + import org.apache.flex.states.State; + import org.apache.flex.utils.MXMLDataInterpreter; + + /** + * Indicates that the state change has completed. All properties + * that need to change have been changed, and all transitinos + * that need to run have completed. However, any deferred work + * may not be completed, and the screen may not be updated until + * code stops executing. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="stateChangeComplete", type="org.apache.flex.events.Event")] + + /** + * Indicates that the initialization of the container is complete. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="initComplete", type="org.apache.flex.events.Event")] + + /** + * Indicates that the children of the container is have been added. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="childrenAdded", type="org.apache.flex.events.Event")] + + [DefaultProperty("mxmlContent")] + + /** + * The ContainerBase class is the base class for most containers + * in FlexJS. It is usable as the root tag of MXML + * documents and UI controls and containers are added to it. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ContainerBase extends UIBase implements IMXMLDocument, IStatesObject, IContainer, IContentViewHost + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ContainerBase() + { + super(); + + _strandChildren = new ContainerBaseStrandChildren(this); + } + + private var _strandChildren:ContainerBaseStrandChildren; + + /** + * @private + */ + public function get strandChildren():IParent + { + return _strandChildren; + } + + /** + * @copy org.apache.flex.core.IParent#getElementAt() + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + override public function getElementAt(index:int):IChild + { + var contentView:IParent = view as IParent; + if (contentView != null) { + return contentView.getElementAt(index); + } else { + return super.getElementAt(index); + } + } + + /** + * @private + */ + override public function getElementIndex(c:IChild):int + { + var contentView:IParent = view as IParent; + if (contentView != null) { + return contentView.getElementIndex(c); + } else { + return super.getElementIndex(c); + } + } + + /** + * @private + */ + override public function addElement(c:IChild, dispatchEvent:Boolean = true):void + { + var contentView:IParent = view as IParent; + if (contentView != null) { + contentView.addElement(c, dispatchEvent); + if (dispatchEvent) + this.dispatchEvent(new Event("childrenAdded")); + } + else { + super.addElement(c); + } + } + + /** + * @private + */ + override public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void + { + var contentView:IParent = view as IParent; + if (contentView != null) { + contentView.addElementAt(c, index, dispatchEvent); + if (dispatchEvent) + this.dispatchEvent(new Event("childrenAdded")); + } + else { + super.addElementAt(c, index); + } + } + + /** + * @private + */ + override public function removeElement(c:IChild, dispatchEvent:Boolean = true):void + { + var contentView:IParent = view as IParent; + if (contentView != null) { + contentView.removeElement(c, dispatchEvent); + if (dispatchEvent) + this.dispatchEvent(new Event("childrenRemoved")); + } + else { + super.removeElement(c); + } + } + + /** + * @private + */ + public function childrenAdded():void + { + dispatchEvent(new Event("childrenAdded")); + } + + /** + * A ContainerBase doesn't create its children until it is added to + * a parent. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + override public function addedToParent():void + { + if (!_initialized) + { + // each MXML file can also have styles in fx:Style block + ValuesManager.valuesImpl.init(this); + } + + super.addedToParent(); + + if (!_initialized) + { + MXMLDataInterpreter.generateMXMLInstances(_mxmlDocument, this, MXMLDescriptor); + + dispatchEvent(new Event("initBindings")); + dispatchEvent(new Event("initComplete")); + _initialized = true; + } + } + + /** + * @private + */ + override public function get numElements():int + { + var contentView:IParent = view as IParent; + return contentView != null ? contentView.numElements : super.numElements; + } + + + /** + * @private + * @suppress {undefinedNames} + * Support strandChildren. + */ + public function $numElements():int + { + return super.numElements(); + } + + /** + * @private + * @suppress {undefinedNames} + * Support strandChildren. + */ + public function $addElement(c:IChild, dispatchEvent:Boolean = true):void + { + super.addElement(c, dispatchEvent); + } + + /** + * @private + * @suppress {undefinedNames} + * Support strandChildren. + */ + public function $addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void + { + super.addElementAt(c, index, dispatchEvent); + } + + /** + * @private + * @suppress {undefinedNames} + * Support strandChildren. + */ + public function $removeElement(c:IChild, dispatchEvent:Boolean = true):void + { + super.removeElement(c, dispatchEvent); + } + + /** + * @private + * @suppress {undefinedNames} + * Support strandChildren. + */ + public function $getElementIndex(c:IChild):int + { + return super.getElementIndex(c); + } + + /** + * @private + * @suppress {undefinedNames} + * Support strandChildren. + */ + public function $getElementAt(index:int):IChild + { + return super.getElementAt(index); + } + + private var _mxmlDescriptor:Array; + private var _mxmlDocument:Object = this; + private var _initialized:Boolean; + + /** + * @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 _mxmlDescriptor; + } + + /** + * @private + */ + public function setMXMLDescriptor(document:Object, value:Array):void + { + _mxmlDocument = document; + _mxmlDescriptor = value; + } + + /** + * @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 + * @flexjsignorecoercion Class + * @flexjsignorecoercion org.apache.flex.core.IBead + */ + public function set states(value:Array):void + { + _states = value; + _currentState = _states[0].name; + + try{ + if (getBeadByType(IStatesImpl) == null) + { + var c:Class = ValuesManager.valuesImpl.getValue(this, "iStatesImpl") as Class; + var b:Object = new c(); + addBead(b as IBead); + } + } + //TODO: Need to handle this case more gracefully + catch(e:Error) + { + COMPILE::SWF + { + 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; + } + + } +}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as new file mode 100644 index 0000000..e961c1f --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.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.core +{ + /** + * The ContainerBaseStrandChildren class the provides a way for advanced + * components to place children directly into the strand unlike the + * addElement() APIs on the Container which place children into the contentView. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ContainerBaseStrandChildren implements IParent + { + /** + * Constructor. + * + * @flexjsignorecoercion org.apache.flex.core.ContainerBase + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ContainerBaseStrandChildren(owner:IParent) + { + super(); + + this.owner = owner as ContainerBase; + } + + public var owner:ContainerBase; + + /** + * @private + */ + public function get numElements():int + { + return owner.$numElements(); + } + + /** + * @private + */ + public function addElement(c:IChild, dispatchEvent:Boolean = true):void + { + owner.$addElement(c, dispatchEvent); + } + + /** + * @private + */ + public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void + { + owner.$addElementAt(c, index, dispatchEvent); + } + + /** + * @private + */ + public function removeElement(c:IChild, dispatchEvent:Boolean = true):void + { + owner.$removeElement(c, dispatchEvent); + } + + /** + * @private + */ + public function getElementIndex(c:IChild):int + { + return owner.$getElementIndex(c); + } + + /** + * @private + */ + public function getElementAt(index:int):IChild + { + return owner.$getElementAt(index); + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/FilledRectangle.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/FilledRectangle.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/FilledRectangle.as new file mode 100644 index 0000000..5888a94 --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/FilledRectangle.as @@ -0,0 +1,125 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core +{ + COMPILE::SWF + { + import flash.display.Shape; + } + + import org.apache.flex.core.UIBase; + + /** + * The FilledRectangle class draws a simple filled + * rectangle without a border and with square corners. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class FilledRectangle extends UIBase + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function FilledRectangle() + { + super(); + + COMPILE::SWF + { + _shape = new flash.display.Shape(); + $displayObjectContainer.addChild(_shape); + } + } + + COMPILE::SWF + private var _shape:flash.display.Shape; + + private var _fillColor:uint = 0x000000; + + /** + * The color of the rectangle. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get fillColor():uint + { + return _fillColor; + } + + /** + * @private + */ + public function set fillColor(value:uint):void + { + _fillColor = value; + } + + /** + * @private + */ + override public function addedToParent():void + { + super.addedToParent(); + drawRect(0, 0, this.width, this.height); + } + + /** + * Draw the rectangle. + * @param x The x position of the top-left corner of the rectangle. + * @param y The y position of the top-left corner. + * @param width The width of the rectangle. + * @param height The height of the rectangle. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function drawRect(x:Number, y:Number, width:Number, height:Number):void + { + COMPILE::SWF + { + _shape.graphics.clear(); + _shape.graphics.beginFill(_fillColor); + _shape.graphics.drawRect(x, y, width, height); + _shape.graphics.endFill(); + } + COMPILE::JS + { + element.style.position = 'absolute'; + element.style.backgroundColor = '#' + _fillColor.toString(16); + if (!isNaN(x)) this.x = x; + if (!isNaN(y)) this.y = y; + if (!isNaN(width)) this.width = width; + if (!isNaN(height)) this.height = height; + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBase.as new file mode 100644 index 0000000..f9c0aaa --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBase.as @@ -0,0 +1,126 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core +{ + import org.apache.flex.core.IMXMLDocument; + import org.apache.flex.core.ValuesManager; + import org.apache.flex.events.Event; + import org.apache.flex.events.ValueChangeEvent; + import org.apache.flex.states.State; + import org.apache.flex.utils.MXMLDataInterpreter; + + /** + * The ListBase class is the base class for most lists + * in FlexJS. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ListBase extends UIBase implements IContentViewHost + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ListBase() + { + super(); + + _strandChildren = new ListBaseStrandChildren(this); + } + + private var _strandChildren:ListBaseStrandChildren; + + /** + * @private + */ + public function get strandChildren():IParent + { + return _strandChildren; + } + + /** + * @private + * @suppress {undefinedNames} + * Support strandChildren. + */ + public function $numElements():int + { + return super.numElements(); + } + + + /** + * @private + * @suppress {undefinedNames} + * Support strandChildren. + */ + public function $addElement(c:IChild, dispatchEvent:Boolean = true):void + { + super.addElement(c, dispatchEvent); + } + + /** + * @private + * @suppress {undefinedNames} + * Support strandChildren. + */ + public function $addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void + { + super.addElementAt(c, index, dispatchEvent); + } + + /** + * @private + * @suppress {undefinedNames} + * Support strandChildren. + */ + public function $removeElement(c:IChild, dispatchEvent:Boolean = true):void + { + super.removeElement(c, dispatchEvent); + } + + /** + * @private + * @suppress {undefinedNames} + * Support strandChildren. + */ + public function $getElementIndex(c:IChild):int + { + return super.getElementIndex(c); + } + + /** + * @private + * @suppress {undefinedNames} + * Support strandChildren. + */ + public function $getElementAt(index:int):IChild + { + return super.getElementAt(index); + } + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as new file mode 100644 index 0000000..b1748f9 --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as @@ -0,0 +1,100 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.core +{ + + + /** + * The ListBaseStrandChildren exists so that Lists are compatible with + * the ListView/ContainerView beads. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ListBaseStrandChildren implements IParent + { + /** + * Constructor. + * + * @flexjsignorecoercion org.apache.flex.core.ListBase + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ListBaseStrandChildren(owner:IParent) + { + super(); + + this.owner = owner as ListBase; + } + + public var owner:ListBase; + + /** + * @private + */ + public function get numElements():int + { + return owner.$numElements(); + } + + /** + * @private + */ + public function addElement(c:IChild, dispatchEvent:Boolean = true):void + { + owner.$addElement(c, dispatchEvent); + } + + /** + * @private + */ + public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void + { + owner.$addElementAt(c, index, dispatchEvent); + } + + /** + * @private + */ + public function removeElement(c:IChild, dispatchEvent:Boolean = true):void + { + owner.$removeElement(c, dispatchEvent); + } + + /** + * @private + */ + public function getElementIndex(c:IChild):int + { + return owner.$getElementIndex(c); + } + + /** + * @private + */ + public function getElementAt(index:int):IChild + { + return owner.$getElementAt(index); + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/View.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/View.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/View.as new file mode 100644 index 0000000..2d0f2c4 --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/View.as @@ -0,0 +1,34 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core +{ + /** + * The View class is the class for most views in a FlexJS + * application. It is generally used as the root tag of MXML + * documents and UI controls and containers are added to it. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class View extends ViewBase + { + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ViewBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ViewBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ViewBase.as new file mode 100644 index 0000000..7e4b65e --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ViewBase.as @@ -0,0 +1,97 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core +{ + import org.apache.flex.events.Event; + + //-------------------------------------- + // Events + //-------------------------------------- + + /** + * Dispatched at startup. Attributes and sub-instances of + * the MXML document have been created and assigned. + * The component lifecycle is different + * than the Flex SDK. There is no creationComplete event. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="initComplete", type="org.apache.flex.events.Event")] + + [DefaultProperty("mxmlContent")] + + /** + * The ViewBase class is the base class for most views in a FlexJS + * application. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ViewBase extends ContainerBase implements IPopUpHost, IApplicationView + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ViewBase() + { + super(); + + className = "flexjs"; + } + + private var _applicationModel:Object; + + [Bindable("modelChanged")] + + /** + * A reference to the Application's model. Usually, + * a view is displaying the main model for an + * application. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get applicationModel():Object + { + return _applicationModel; + } + + /** + * @private + */ + public function set applicationModel(value:Object):void + { + _applicationModel = value; + dispatchEvent(new Event("modelChanged")); + } + + } +}