You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2016/01/11 21:55:49 UTC
[05/20] git commit: [flex-asjs] [refs/heads/mavenfolders] -
rename/restructure folders for maven
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IViewportModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IViewportModel.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IViewportModel.as
new file mode 100644
index 0000000..6de0cb8
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IViewportModel.as
@@ -0,0 +1,50 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.geom.Rectangle;
+
+ /**
+ * A Viewport is the area of a Container set aside for displaying
+ * content and any scrolling controls.
+ * The ViewportModel caches the offsets required to compute the size
+ * of the Viewport.
+ */
+ public interface IViewportModel extends IBead
+ {
+ /**
+ * Size of the borders.
+ */
+ function get borderMetrics():Rectangle;
+ function set borderMetrics(value:Rectangle):void;
+
+ /**
+ * Size of the chrome. A plain container doesn't have any chrome
+ * but a Panel's TitleBar and any ControlBar or StatusBar is
+ * considered chrome. Scrollbars used to scroll content are
+ * not factored into the viewport calculation. The Viewport
+ * is responsible for displaying any scrolling controls and
+ * deciding whether to further shrink the content area or
+ * have the scrollbars overlay the content.
+ */
+ function get chromeMetrics():Rectangle;
+ function set chromeMetrics(value:Rectangle):void;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IViewportScroller.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IViewportScroller.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IViewportScroller.as
new file mode 100644
index 0000000..5b0a4cb
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IViewportScroller.as
@@ -0,0 +1,36 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ /**
+ * The IViewportScroller interface describes an object that can be used to scroll
+ * or navigate around a system that uses an IViewport. This may be a traditional
+ * scroll bar, or it could be something completely different.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::AS3
+ public interface IViewportScroller
+ {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ItemRendererClassFactory.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ItemRendererClassFactory.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ItemRendererClassFactory.as
new file mode 100644
index 0000000..7401282
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ItemRendererClassFactory.as
@@ -0,0 +1,194 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+
+ import org.apache.flex.core.ClassFactory;
+ import org.apache.flex.core.IFactory;
+ import org.apache.flex.core.IItemRendererProvider;
+
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ [DefaultProperty("mxmlContent")]
+
+ /**
+ * The ItemRendererClassFactory class is the default implementation of
+ * IItemRendererClassFactory. This implementation checks for an itemRenderer
+ * property on the strand, then looks for a default definition in CSS, but
+ * also handles the renderer being defined in MXML in sub tags of the
+ * ItemRendererClassFactory. Other more advanced implementations could
+ * return different renderers based on the data item's type.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ItemRendererClassFactory extends Strand implements IItemRendererClassFactory, IDocument, IBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ItemRendererClassFactory()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion Class
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ if (_strand is IItemRendererProvider && (_strand as IItemRendererProvider).hasItemRenderer) {
+ itemRendererFactory = (_strand as IItemRendererProvider).itemRenderer;
+ createFunction = createFromClass;
+ }
+ else {
+ var itemRendererClass:Class = ValuesManager.valuesImpl.getValue(_strand, "iItemRenderer") as Class;
+ if (itemRendererClass) {
+ itemRendererFactory = new ClassFactory(itemRendererClass);
+ createFunction = createFromClass;
+ }
+ }
+ }
+
+ /**
+ * @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;
+ }
+
+ /**
+ * The default property. Child tags in MXML documents get assigned
+ * to this property, but are actually encoded by the compiler into the MXMLDescriptor
+ * array. Therefore, setting this property from ActionScript will have no
+ * effect at runtime.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var mxmlContent:Array;
+
+ /**
+ * @copy org.apache.flex.core.IItemRendererClassFactory#createItemRenderer()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function createItemRenderer(parent:IItemRendererParent):IItemRenderer
+ {
+ return createFunction(parent);
+ }
+
+ /**
+ * This is the method that actually does the work for createItemRenderer. It
+ * defaults to creating an instance from child MXML tags, but if the strand
+ * has an item renderer property or style, it switches to generating instances
+ * of the item renderer specified by that property or style. And yes, since
+ * it is public, you could theoretically assign some other method that generates
+ * item renderer instances.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var createFunction:Function = createFromMXMLContent;
+
+ /**
+ * Creates an instance of an item renderer from child MXML tags.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function createFromMXMLContent(parent:IItemRendererParent):IItemRenderer
+ {
+ return MXMLDataInterpreter.generateMXMLArray(document, parent as IParent, MXMLDescriptor)[0];
+ }
+
+ /**
+ * Stores the IFactory that will be used to generate item renderer instances if
+ * createFromClass is the createFunction.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var itemRendererFactory:IFactory;
+
+ /**
+ * Creates an instance of an item renderer from itemRendererFactory.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function createFromClass(parent:IItemRendererParent):IItemRenderer
+ {
+ var renderer:IItemRenderer = itemRendererFactory.newInstance();
+ renderer.itemRendererParent = parent;
+ return renderer;
+ }
+
+ private var document:Object;
+
+ /**
+ * @copy org.apache.flex.core.IDocument#setDocument()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setDocument(document:Object, id:String = null):void
+ {
+ this.document = document;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as
new file mode 100644
index 0000000..6380f2f
--- /dev/null
+++ b/frameworks/projects/Core/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:Object, dispatchEvent:Boolean = true):void
+ {
+ super.addElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ {
+ super.addElementAt(c, index, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $removeElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ super.removeElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $getElementIndex(c:Object):int
+ {
+ return super.getElementIndex(c);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $getElementAt(index:int):Object
+ {
+ return super.getElementAt(index);
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
new file mode 100644
index 0000000..3f77774
--- /dev/null
+++ b/frameworks/projects/Core/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:Object, dispatchEvent:Boolean = true):void
+ {
+ owner.$addElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ {
+ owner.$addElementAt(c, index, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ owner.$removeElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function getElementIndex(c:Object):int
+ {
+ return owner.$getElementIndex(c);
+ }
+
+ /**
+ * @private
+ */
+ public function getElementAt(index:int):Object
+ {
+ return owner.$getElementAt(index);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/core/MXMLDragInitiator.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/MXMLDragInitiator.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/MXMLDragInitiator.as
new file mode 100644
index 0000000..cb20f01
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/MXMLDragInitiator.as
@@ -0,0 +1,131 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * Indicates that acceptingDrop API has been called.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="acceptingDrop", type="org.apache.flex.events.Event")]
+
+ /**
+ * Indicates that acceptedDrop API has been called.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="acceptedDrop", type="org.apache.flex.events.Event")]
+
+ /**
+ * The MXMLDragInitiator is an IDragInitiator that
+ * dispatches events when the IDragInitiator methods
+ * are called to make it easier to handle in MXML.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class MXMLDragInitiator extends EventDispatcher implements IBead, IDragInitiator
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function MXMLDragInitiator()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+ /**
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ /**
+ * The dropTarget
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var dropTarget:Object;
+
+ /**
+ * The DropType
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var dropType:String;
+
+ /**
+ * Handles the acceptingDrop API
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function acceptingDrop(dropTarget:Object, type:String):void
+ {
+ dispatchEvent(new Event("acceptingDrop"));
+ }
+
+ /**
+ * Handles the acceptedDrop API
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function acceptedDrop(dropTarget:Object, type:String):void
+ {
+ dispatchEvent(new Event("acceptedDrop"));
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ParentDocumentBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ParentDocumentBead.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ParentDocumentBead.as
new file mode 100644
index 0000000..1b0b0e7
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ParentDocumentBead.as
@@ -0,0 +1,127 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.IBead;
+ import org.apache.flex.core.IChild;
+ import org.apache.flex.core.IMXMLDocument;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The ParentDocumentBead class looks up the parent
+ * chain to find a parent that was written in MXML.
+ * Because it is usually rare for an application
+ * to need to know this information, an optional bead
+ * is used to compute it, instead of baking in the
+ * overhead of a recursive infrastucture to store
+ * this information. It is intended to be used
+ * as a bead in the top-level tag of an MXML document.
+ *
+ * @flexjsignoreimport org.apache.flex.core.IChild
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ParentDocumentBead extends EventDispatcher implements IBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ParentDocumentBead()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ //TODO (aharui) watch for re-parenting
+ }
+
+ private var _id:String;
+
+ /**
+ * An id property for MXML documents.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get id():String
+ {
+ return _id;
+ }
+
+ /**
+ * @private
+ */
+ public function set id(value:String):void
+ {
+ if (_id != value)
+ {
+ _id = value;
+ dispatchEvent(new org.apache.flex.events.Event("idChanged"));
+ }
+ }
+
+ [Bindable("parentDocumentChange")]
+ /**
+ * @private
+ * @flexjsignorecoercion org.apache.flex.core.IChild
+ */
+ public function get parentDocument():Object
+ {
+ var child:IChild = _strand as IChild;
+ child = child.parent as IChild;
+ while (child)
+ {
+ if (child is IMXMLDocument)
+ {
+ var doc:IMXMLDocument = child as IMXMLDocument;
+ if (doc.MXMLDescriptor != null)
+ return doc;
+ }
+ child = child.parent as IChild;
+ }
+ return null;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleApplication.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleApplication.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleApplication.as
new file mode 100644
index 0000000..5d4d918
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleApplication.as
@@ -0,0 +1,102 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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::AS3
+ {
+ import flash.display.DisplayObject;
+ import flash.display.Sprite;
+ import flash.display.StageAlign;
+ import flash.display.StageQuality;
+ import flash.display.StageScaleMode;
+ import flash.events.Event;
+ import flash.system.ApplicationDomain;
+ import flash.utils.getQualifiedClassName;
+ }
+
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.utils.MouseEventConverter;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ /**
+ * The SimpleApplication class can be used as the main class and entry point
+ * for low-level ActionScript-only FlexJS
+ * applications. It is not indended for use in MXML applications or most
+ * of the FlexJS components as they expect a certain application lifecycle
+ * in the org.apache.flex.core.Application class.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SimpleApplication extends ApplicationBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SimpleApplication()
+ {
+ super();
+ COMPILE::AS3
+ {
+ if (stage)
+ {
+ stage.align = StageAlign.TOP_LEFT;
+ stage.scaleMode = StageScaleMode.NO_SCALE;
+ // should be opt-in
+ //stage.quality = StageQuality.HIGH_16X16_LINEAR;
+ }
+
+ loaderInfo.addEventListener(flash.events.Event.INIT, initHandler);
+ }
+ }
+
+ COMPILE::AS3
+ private function initHandler(event:flash.events.Event):void
+ {
+ start();
+ }
+
+ /**
+ * The entry point. Override this and put all of your code in here.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function start():void
+ {
+ COMPILE::JS
+ {
+ this.element = document.getElementsByTagName('body')[0];
+ this.element.flexjs_wrapper = this;
+ this.element.className = 'SimpleApplication';
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSStyles.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSStyles.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSStyles.as
new file mode 100644
index 0000000..6e83b2d
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSStyles.as
@@ -0,0 +1,106 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The SimpleCSSStyles class contains CSS style
+ * properties supported by SimpleCSSValuesImpl.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SimpleCSSStyles
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SimpleCSSStyles()
+ {
+ super();
+ }
+
+ public var styleList:Object = {
+ "top": 1,
+ "bottom": 1,
+ "left": 1,
+ "right": 1,
+ "padding": 1,
+ "paddingLeft": 1,
+ "paddingRight": 1,
+ "paddingTop": 1,
+ "paddingBottom": 1,
+ "margin": 1,
+ "marginLeft": 1,
+ "marginRight": 1,
+ "marginTop": 1,
+ "marginBottom": 1,
+ "verticalAlign": 1,
+ "fontFamily": 1,
+ "fontSize": 1,
+ "color": 1,
+ "fontWeight": 1,
+ "fontStyle": 1,
+ "backgroundAlpha": 1,
+ "backgroundColor": 1,
+ "backgroundImage": 1,
+ "borderColor": 1,
+ "borderStyle": 1,
+ "borderRadius": 1,
+ "borderWidth": 1
+ };
+
+ public var top:*;
+ public var bottom:*;
+ public var left:*;
+ public var right:*;
+ public var padding:*;
+ public var paddingLeft:*;
+ public var paddingRight:*;
+ public var paddingTop:*;
+ public var paddingBottom:*;
+ public var margin:*;
+ public var marginLeft:*;
+ public var marginRight:*;
+ public var marginTop:*;
+ public var marginBottom:*;
+ public var verticalAlign:*;
+ public var fontFamily:*;
+ public var fontSize:*;
+ public var color:*;
+ public var fontWeight:*;
+ public var fontStyle:*;
+ public var backgroundAlpha:*;
+ public var backgroundColor:*;
+ public var backgroundImage:*;
+ public var borderColor:*;
+ public var borderStyle:*;
+ public var borderRadius:*;
+ public var borderWidth:*;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSValuesImpl.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSValuesImpl.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSValuesImpl.as
new file mode 100644
index 0000000..e64a517
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSValuesImpl.as
@@ -0,0 +1,765 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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::AS3
+ {
+ import flash.system.ApplicationDomain;
+ import flash.utils.getDefinitionByName;
+ import flash.utils.getQualifiedClassName;
+ import flash.utils.getQualifiedSuperclassName;
+ }
+
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.events.ValueChangeEvent;
+ import org.apache.flex.events.ValueEvent;
+ import org.apache.flex.utils.CSSUtils;
+
+ /**
+ * The SimpleCSSValuesImpl class implements a minimal set of
+ * CSS lookup rules that is sufficient for most applications.
+ * It does not support attribute selectors or descendant selectors
+ * or id selectors. It will filter on a custom -flex-flash
+ * media query but not other media queries. It can be
+ * replaced with other implementations that handle more complex
+ * selector lookups.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SimpleCSSValuesImpl extends EventDispatcher implements IValuesImpl
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SimpleCSSValuesImpl()
+ {
+ super();
+ }
+
+ private var mainClass:Object;
+
+ private var conditionCombiners:Object;
+
+ /**
+ * @copy org.apache.flex.core.IValuesImpl#init()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::AS3
+ public function init(mainClass:Object):void
+ {
+ var styleClassName:String;
+ var c:Class;
+ if (!values)
+ {
+ values = {};
+ this.mainClass = mainClass;
+ var mainClassName:String = getQualifiedClassName(mainClass);
+ styleClassName = "_" + mainClassName + "_Styles";
+ c = ApplicationDomain.currentDomain.getDefinition(styleClassName) as Class;
+ generateCSSStyleDeclarations(c["factoryFunctions"], c["data"]);
+ }
+ c = mainClass.constructor as Class;
+ generateCSSStyleDeclarations(c["factoryFunctions"], c["data"]);
+ if (hasEventListener("init"))
+ dispatchEvent(new ValueEvent("init", false, false, c["fontFaces"]));
+
+ var i:int = 1;
+ while (true)
+ {
+ var ffName:String = "factoryFunctions" + i.toString();
+ var ff:Object = c[ffName];
+ if (ff == null)
+ break;
+ generateCSSStyleDeclarations(c[ffName], c["data" + i.toString()]);
+ if (hasEventListener("init"))
+ dispatchEvent(new ValueEvent("init", false, false, c["fontFaces" + i.toString()]));
+ i++;
+ }
+ }
+
+ COMPILE::JS
+ public function init(mainClass:Object):void
+ {
+ var cssData:Array = mainClass.cssData;
+ var values:Object = this.values;
+ if (values == null)
+ values = {};
+
+ if (cssData) {
+ var n:int = cssData.length;
+ var i:int = 0;
+ while (i < n)
+ {
+ var numMQ:int = cssData[i++];
+ if (numMQ > 0)
+ {
+ // skip MediaQuery tests for now
+ i += numMQ;
+ }
+ var numSel:int = cssData[i++];
+ var props:Object = {};
+ for (var j:int = 0; j < numSel; j++)
+ {
+ var selName:String = cssData[i++];
+ if (values[selName])
+ props = values[selName];
+ values[selName] = props;
+ }
+ var numProps:int = cssData[i++];
+ for (j = 0; j < numProps; j++)
+ {
+ var propName:String = cssData[i++];
+ var propValue:Object = cssData[i++];
+ props[propName] = propValue;
+ }
+ }
+ }
+
+ this.values = values;
+ }
+
+ /**
+ * Process the encoded CSS data into data structures. Usually not called
+ * directly by application developers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::AS3
+ public function generateCSSStyleDeclarations(factoryFunctions:Object, arr:Array):void
+ {
+ if (factoryFunctions == null)
+ return;
+ if (arr == null)
+ return;
+
+ var declarationName:String = "";
+ var segmentName:String = "";
+ var n:int = arr.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var className:int = arr[i];
+ if (className == CSSClass.CSSSelector)
+ {
+ var selectorName:String = arr[++i];
+ segmentName = selectorName + segmentName;
+ if (declarationName != "")
+ declarationName += " ";
+ declarationName += segmentName;
+ segmentName = "";
+ }
+ else if (className == CSSClass.CSSCondition)
+ {
+ if (!conditionCombiners)
+ {
+ conditionCombiners = {};
+ conditionCombiners["class"] = ".";
+ conditionCombiners["id"] = "#";
+ conditionCombiners["pseudo"] = ':';
+ }
+ var conditionType:String = arr[++i];
+ var conditionName:String = arr[++i];
+ segmentName = segmentName + conditionCombiners[conditionType] + conditionName;
+ }
+ else if (className == CSSClass.CSSStyleDeclaration)
+ {
+ var factoryName:int = arr[++i]; // defaultFactory or factory
+ var defaultFactory:Boolean = factoryName == CSSFactory.DefaultFactory;
+ /*
+ if (defaultFactory)
+ {
+ mergedStyle = styleManager.getMergedStyleDeclaration(declarationName);
+ style = new CSSStyleDeclaration(selector, styleManager, mergedStyle == null);
+ }
+ else
+ {
+ style = styleManager.getStyleDeclaration(declarationName);
+ if (!style)
+ {
+ style = new CSSStyleDeclaration(selector, styleManager, mergedStyle == null);
+ if (factoryName == CSSFactory.Override)
+ newSelectors.push(style);
+ }
+ }
+ */
+ var mq:String = null;
+ var o:Object;
+ if (i < n - 2)
+ {
+ // peek ahead to see if there is a media query
+ if (arr[i + 1] == CSSClass.CSSMediaQuery)
+ {
+ mq = arr[i + 2];
+ i += 2;
+ declarationName = mq + "_" + declarationName;
+ }
+ }
+ var finalName:String;
+ var valuesFunction:Function;
+ var valuesObject:Object;
+ if (defaultFactory)
+ {
+ valuesFunction = factoryFunctions[declarationName];
+ valuesObject = new valuesFunction();
+ }
+ else
+ {
+ valuesFunction = factoryFunctions[declarationName];
+ valuesObject = new valuesFunction();
+ }
+ if (isValidStaticMediaQuery(mq))
+ {
+ finalName = fixNames(declarationName, mq);
+ o = values[finalName];
+ if (o == null)
+ values[finalName] = valuesObject;
+ else
+ {
+ valuesFunction["prototype"] = o;
+ values[finalName] = new valuesFunction();
+ }
+ }
+ declarationName = "";
+ }
+ }
+
+ }
+
+ private function isValidStaticMediaQuery(mq:String):Boolean
+ {
+ if (mq == null)
+ return true;
+
+ if (mq == "-flex-flash")
+ return true;
+
+ // TODO: (aharui) other media query
+
+ return false;
+ }
+
+ private function fixNames(s:String, mq:String):String
+ {
+ if (mq != null)
+ s = s.substr(mq.length + 1); // 1 more for the hyphen
+
+ if (s == "")
+ return "*";
+
+ var arr:Array = s.split(" ");
+ var n:int = arr.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var segmentName:String = arr[i];
+ if (segmentName.charAt(0) == "#" || segmentName.charAt(0) == ".")
+ continue;
+
+ var c:int = segmentName.lastIndexOf(".");
+ if (c > -1) // it is 0 for class selectors
+ {
+ segmentName = segmentName.substr(0, c) + "::" + segmentName.substr(c + 1);
+ arr[i] = segmentName;
+ }
+ }
+ return arr.join(" ");
+ }
+
+ /**
+ * The map of values. The format is not documented and it is not recommended
+ * to manipulate this structure directly.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var values:Object;
+
+ /**
+ * @copy org.apache.flex.core.IValuesImpl#getValue()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getValue(thisObject:Object, valueName:String, state:String = null, attrs:Object = null):*
+ {
+ var c:int = valueName.indexOf("-");
+ while (c != -1)
+ {
+ valueName = valueName.substr(0, c) +
+ valueName.charAt(c + 1).toUpperCase() +
+ valueName.substr(c + 2);
+ c = valueName.indexOf("-");
+ }
+
+ var value:*;
+ var o:Object;
+ var className:String;
+ var selectorName:String;
+
+ if (thisObject is IStyleableObject)
+ {
+ var styleable:IStyleableObject = IStyleableObject(thisObject);
+ if (styleable.style != null)
+ {
+ try {
+ value = styleable.style[valueName];
+ }
+ catch (e:Error) {
+ value = undefined;
+ }
+ if (value == "inherit")
+ return getInheritingValue(thisObject, valueName, state, attrs);
+ if (value !== undefined)
+ return value;
+ }
+ if (styleable.id != null)
+ {
+ o = values["#" + styleable.id];
+ if (o)
+ {
+ value = o[valueName];
+ if (value == "inherit")
+ return getInheritingValue(thisObject, valueName, state, attrs);
+ if (value !== undefined)
+ return value;
+ }
+ }
+ var classNames:String = styleable.className;
+ if (classNames)
+ {
+ var classNameList:Array = classNames.split(" ");
+ for each (className in classNameList)
+ {
+ if (state)
+ {
+ selectorName = className + ":" + state;
+ o = values["." + selectorName];
+ if (o)
+ {
+ value = o[valueName];
+ if (value == "inherit")
+ return getInheritingValue(thisObject, valueName, state, attrs);
+ if (value !== undefined)
+ return value;
+ }
+ }
+
+ o = values["." + className];
+ if (o)
+ {
+ value = o[valueName];
+ if (value == "inherit")
+ return getInheritingValue(thisObject, valueName, state, attrs);
+ if (value !== undefined)
+ return value;
+ }
+ }
+ }
+ }
+
+ COMPILE::AS3
+ {
+ className = getQualifiedClassName(thisObject);
+ }
+ COMPILE::JS
+ {
+ className = thisObject.FLEXJS_CLASS_INFO.names[0].qName;
+ }
+ var thisInstance:Object = thisObject;
+ while (className != "Object")
+ {
+ if (state)
+ {
+ selectorName = className + ":" + state;
+ o = values[selectorName];
+ if (o)
+ {
+ value = o[valueName];
+ if (value == "inherit")
+ return getInheritingValue(thisObject, valueName, state, attrs);
+ if (value !== undefined)
+ return value;
+ }
+ }
+
+ o = values[className];
+ if (o)
+ {
+ value = o[valueName];
+ if (value == "inherit")
+ return getInheritingValue(thisObject, valueName, state, attrs);
+ if (value !== undefined)
+ return value;
+ }
+ COMPILE::AS3
+ {
+ className = getQualifiedSuperclassName(thisInstance);
+ thisInstance = getDefinitionByName(className);
+ }
+ COMPILE::JS
+ {
+ var constructorAsObject:Object = thisInstance["constructor"];
+ thisInstance = constructorAsObject.superClass_;
+ if (!thisInstance || !thisInstance.FLEXJS_CLASS_INFO)
+ break;
+
+ className = thisInstance.FLEXJS_CLASS_INFO.names[0].qName;
+ }
+ }
+
+ if (inheritingStyles[valueName] != null &&
+ thisObject is IChild)
+ {
+ var parentObject:Object = IChild(thisObject).parent;
+ if (parentObject)
+ return getValue(parentObject, valueName, state, attrs);
+ }
+
+ o = values["global"];
+ if (o)
+ {
+ value = o[valueName];
+ if (value !== undefined)
+ return value;
+ }
+ o = values["*"];
+ if(o)
+ {
+ return o[valueName];
+ }
+ return undefined;
+ }
+
+ private function getInheritingValue(thisObject:Object, valueName:String, state:String = null, attrs:Object = null):*
+ {
+ var value:*;
+ if (thisObject is IChild)
+ {
+ var parentObject:Object = IChild(thisObject).parent;
+ if (parentObject)
+ {
+ value = getValue(parentObject, valueName, state, attrs);
+ if (value == "inherit" || value === undefined)
+ return getInheritingValue(parentObject, valueName, state, attrs);
+ if (value !== undefined)
+ return value;
+ }
+ return undefined;
+ }
+ return "inherit";
+ }
+
+ /**
+ * A method that stores a value to be shared with other objects.
+ * It is global, not per instance. Fancier implementations
+ * may store shared values per-instance.
+ *
+ * @param thisObject An object associated with this value. Thiis
+ * parameter is ignored.
+ * @param valueName The name or key of the value being stored.
+ * @param The value to be stored.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setValue(thisObject:Object, valueName:String, value:*):void
+ {
+ var c:int = valueName.indexOf("-");
+ while (c != -1)
+ {
+ valueName = valueName.substr(0, c) +
+ valueName.charAt(c + 1).toUpperCase() +
+ valueName.substr(c + 2);
+ c = valueName.indexOf("-");
+ }
+ var oldValue:Object = values[valueName];
+ if (oldValue != value)
+ {
+ values[valueName] = value;
+ dispatchEvent(new ValueChangeEvent(ValueChangeEvent.VALUE_CHANGE, false, false, oldValue, value));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IValuesImpl#newInstance()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function newInstance(thisObject:Object, valueName:String, state:String = null, attrs:Object = null):*
+ {
+ var c:Class = getValue(thisObject, valueName, state, attrs);
+ if (c)
+ return new c();
+ return null;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IValuesImpl#getInstance()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion Function
+ */
+ public function getInstance(valueName:String):Object
+ {
+ var o:Object = values["global"];
+ o = o[valueName];
+ COMPILE::AS3
+ {
+ var i:Class = o as Class;
+ }
+ COMPILE::JS
+ {
+ var i:Function = null;
+ if (typeof(o) === "function")
+ i = o as Function;
+ }
+ if (i)
+ {
+ o[valueName] = new i();
+ var d:IDocument = o[valueName] as IDocument;
+ if (d)
+ d.setDocument(mainClass);
+ }
+ return o;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IValuesImpl#convertColor()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function convertColor(value:Object):uint
+ {
+ return CSSUtils.toColor(value);
+ }
+
+ /**
+ * @copy org.apache.flex.core.IValuesImpl#parseStyles()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function parseStyles(styles:String):Object
+ {
+ var obj:Object = {};
+ var parts:Array = styles.split(";");
+ for each (var part:String in parts)
+ {
+ var pieces:Array = part.split(":");
+ var value:String = pieces[1];
+ if (value == "null")
+ obj[pieces[0]] = null;
+ else if (value == "true")
+ obj[pieces[0]] = true;
+ else if (value == "false")
+ obj[pieces[0]] = false;
+ else
+ {
+ var n:Number = Number(value);
+ if (isNaN(n))
+ {
+ if (value.charAt(0) == "#")
+ {
+ obj[pieces[0]] = CSSUtils.toColor(value);
+ }
+ else
+ {
+ if (value.charAt(0) == "'")
+ value = value.substr(1, value.length - 2);
+ else if (value.charAt(0) == '"')
+ value = value.substr(1, value.length - 2);
+ obj[pieces[0]] = value;
+ }
+ }
+ else
+ obj[pieces[0]] = n;
+ }
+ }
+ return obj;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IValuesImpl#addRule()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function addRule(ruleName:String, values:Object):void
+ {
+ var asValues:Object = {};
+ for (var valueName:String in values)
+ {
+ var v:* = values[valueName];
+ var c:int = valueName.indexOf("-");
+ while (c != -1)
+ {
+ valueName = valueName.substr(0, c) +
+ valueName.charAt(c + 1).toUpperCase() +
+ valueName.substr(c + 2);
+ c = valueName.indexOf("-");
+ }
+ asValues[valueName] = v;
+ }
+ this.values[ruleName] = asValues;
+ }
+
+ /**
+ * A map of inheriting styles
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public static var inheritingStyles:Object = {
+ "color" : 1,
+ "fontFamily" : 1,
+ "fontSize" : 1,
+ "fontStyle" : 1,
+ "textAlign" : 1
+ }
+
+ /**
+ * The styles that apply to each UI widget
+ */
+ COMPILE::JS
+ public static var perInstanceStyles:Object = {
+ 'backgroundColor': 1,
+ 'backgroundImage': 1,
+ 'color': 1,
+ 'fontFamily': 1,
+ 'fontWeight': 1,
+ 'fontSize': 1,
+ 'fontStyle': 1
+ }
+
+
+ /**
+ * The styles that use color format #RRGGBB
+ */
+ COMPILE::JS
+ public static var colorStyles:Object = {
+ 'backgroundColor': 1,
+ 'borderColor': 1,
+ 'color': 1
+ }
+
+
+ /**
+ * The properties that enumerate that we skip
+ */
+ COMPILE::JS
+ public static var skipStyles:Object = {
+ 'constructor': 1
+ }
+
+
+
+ /**
+ * @param thisObject The object to apply styles to;
+ * @param styles The styles.
+ */
+ COMPILE::JS
+ public function applyStyles(thisObject:IUIBase, styles:Object):void
+ {
+ var styleList:Object = SimpleCSSValuesImpl.perInstanceStyles;
+ var colorStyles:Object = SimpleCSSValuesImpl.colorStyles;
+ var skipStyles:Object = SimpleCSSValuesImpl.skipStyles;
+ var listObj:Object = styles;
+ if (styles.styleList)
+ listObj = styles.styleList;
+ for (var p:String in listObj)
+ {
+ //if (styleList[p])
+ if (skipStyles[p])
+ continue;
+ var value:* = styles[p];
+ if (value === undefined)
+ continue;
+ if (typeof(value) == 'number') {
+ if (colorStyles[p])
+ value = '#' + value.toString(16);
+ else
+ value = value.toString() + 'px';
+ }
+ else if (p == 'backgroundImage') {
+ if (p.indexOf('url') !== 0)
+ value = 'url(' + value + ')';
+ }
+ thisObject.element.style[p] = value;
+ }
+ }
+ }
+}
+
+COMPILE::AS3
+class CSSClass
+{
+ public static const CSSSelector:int = 0;
+ public static const CSSCondition:int = 1;
+ public static const CSSStyleDeclaration:int = 2;
+ public static const CSSMediaQuery:int = 3;
+}
+
+COMPILE::AS3
+class CSSFactory
+{
+ public static const DefaultFactory:int = 0;
+ public static const Factory:int = 1;
+ public static const Override:int = 2;
+}
+
+COMPILE::AS3
+class CSSDataType
+{
+ public static const Native:int = 0;
+ public static const Definition:int = 1;
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleStatesImpl.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleStatesImpl.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleStatesImpl.as
new file mode 100644
index 0000000..4a27318
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleStatesImpl.as
@@ -0,0 +1,222 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.states.AddItems;
+ import org.apache.flex.states.SetEventHandler;
+ import org.apache.flex.states.SetProperty;
+ import org.apache.flex.states.State;
+
+ import org.apache.flex.core.IChild;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.IStatesObject;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.ValueChangeEvent;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ /**
+ * The SimpleStatesImpl class implements a minimal set of
+ * view state functionality that is sufficient for most applications.
+ * It only supports AddItems and SetProperty changes at this time.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SimpleStatesImpl extends EventDispatcher implements IStatesImpl, IBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SimpleStatesImpl()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ private var sawInitComplete:Boolean;
+
+ /**
+ * @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("currentStateChange", stateChangeHandler);
+ IEventDispatcher(_strand).addEventListener("initComplete", initialStateHandler);
+ }
+
+ private function initialStateHandler(event:org.apache.flex.events.Event):void
+ {
+ sawInitComplete = true;
+ stateChangeHandler(new ValueChangeEvent("currentStateChange", false, false, null,
+ IStatesObject(_strand).currentState));
+ }
+
+ private function stateChangeHandler(event:ValueChangeEvent):void
+ {
+ if (!sawInitComplete)
+ return;
+
+ var doc:IStatesObject = _strand as IStatesObject;
+ var arr:Array = doc.states;
+ for each (var s:State in arr)
+ {
+ if (s.name == event.oldValue)
+ {
+ revert(s);
+ break;
+ }
+ }
+ for each (s in arr)
+ {
+ if (s.name == event.newValue)
+ {
+ apply(s);
+ break;
+ }
+ }
+ doc.dispatchEvent(new Event("stateChangeComplete"));
+ }
+
+ private function revert(s:State):void
+ {
+ var arr:Array = s.overrides;
+ for each (var o:Object in arr)
+ {
+ if (o is AddItems)
+ {
+ var ai:AddItems = AddItems(o);
+ for each (var item:IChild in ai.items)
+ {
+ var parent:IParent = item.parent as IParent;
+ parent.removeElement(item);
+ }
+ if (parent is IContainer)
+ IContainer(parent).childrenAdded();
+ }
+ else if (o is SetProperty)
+ {
+ var sp:SetProperty = SetProperty(o);
+ if (sp.target != null)
+ sp.document[sp.target][sp.name] = sp.previousValue;
+ else
+ sp.document[sp.name] = sp.previousValue;
+ }
+ else if (o is SetEventHandler)
+ {
+ var seh:SetEventHandler = SetEventHandler(o);
+ if (seh.target != null)
+ {
+ seh.document[seh.target].removeEventListener(seh.name, seh.handlerFunction);
+ }
+ else
+ {
+ seh.document.removeEventListener(seh.name, seh.handlerFunction);
+ }
+ }
+ }
+ }
+
+ private function apply(s:State):void
+ {
+ var arr:Array = s.overrides;
+ for each (var o:Object in arr)
+ {
+ if (o is AddItems)
+ {
+ var ai:AddItems = AddItems(o);
+ if (ai.items == null)
+ {
+ ai.items = ai.itemsDescriptor.items as Array;
+ if (ai.items == null)
+ {
+ ai.items =
+ MXMLDataInterpreter.generateMXMLArray(ai.document,
+ null, ai.itemsDescriptor.descriptor);
+ ai.itemsDescriptor.items = ai.items;
+ }
+ }
+ for each (var item:IChild in ai.items)
+ {
+ var parent:IParent = ai.document as IParent;
+ if (ai.destination != null)
+ parent = parent[ai.destination] as IParent;
+ if (ai.relativeTo != null)
+ {
+ var child:Object = ai.document[ai.relativeTo];
+ if (ai.destination == null)
+ parent = child.parent as IParent;
+ var index:int = parent.getElementIndex(child);
+ if (ai.position == "after")
+ index++;
+ parent.addElementAt(item, index);
+ }
+ else
+ {
+ parent.addElement(item);
+ }
+ }
+ if (parent is IContainer)
+ IContainer(parent).childrenAdded();
+ }
+ else if (o is SetProperty)
+ {
+ var sp:SetProperty = SetProperty(o);
+ if (sp.target != null)
+ {
+ sp.previousValue = sp.document[sp.target][sp.name];
+ sp.document[sp.target][sp.name] = sp.value;
+ }
+ else
+ {
+ sp.previousValue = sp.document[sp.name];
+ sp.document[sp.name] = sp.value;
+ }
+ }
+ else if (o is SetEventHandler)
+ {
+ var seh:SetEventHandler = SetEventHandler(o);
+ if (seh.target != null)
+ {
+ seh.document[seh.target].addEventListener(seh.name, seh.handlerFunction);
+ }
+ else
+ {
+ seh.document.addEventListener(seh.name, seh.handlerFunction);
+ }
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleValuesImpl.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleValuesImpl.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleValuesImpl.as
new file mode 100644
index 0000000..527f59e
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleValuesImpl.as
@@ -0,0 +1,188 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.EventDispatcher;
+ import org.apache.flex.events.ValueChangeEvent;
+
+ /**
+ * The SimpleValuesImpl class implements a simple lookup rules that is
+ * sufficient for many very simple applications. Every value
+ * is essential global and shared by other instances. Values
+ * are set via calls to setValue.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SimpleValuesImpl extends EventDispatcher implements IValuesImpl
+ {
+ public function SimpleValuesImpl()
+ {
+ super();
+ }
+
+ /**
+ * The map of values. The format is not documented and it is not recommended
+ * to manipulate this structure directly.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var values:Object;
+
+ /**
+ * @copy org.apache.flex.core.IValuesImpl#getValue()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getValue(thisObject:Object, valueName:String, state:String = null, attrs:Object = null):*
+ {
+ return values[valueName];
+ }
+
+ /**
+ * @copy org.apache.flex.core.IValuesImpl#newInstance()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function newInstance(thisObject:Object, valueName:String, state:String = null, attrs:Object = null):*
+ {
+ var c:Class = values[valueName];
+ if (c)
+ return new c();
+ return null;
+ }
+
+ /**
+ * A method that stores a value to be shared with other objects.
+ * It is global, not per instance. Fancier implementations
+ * may store shared values per-instance.
+ *
+ * @param thisObject An object associated with this value. Thiis
+ * parameter is ignored.
+ * @param valueName The name or key of the value being stored.
+ * @param value The value to be stored.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setValue(thisObject:Object, valueName:String, value:Object):void
+ {
+ var oldValue:Object = values[valueName];
+ if (oldValue != value)
+ {
+ values[valueName] = value;
+ dispatchEvent(new ValueChangeEvent(ValueChangeEvent.VALUE_CHANGE, false, false, oldValue, value));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IValuesImpl#getInstance()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getInstance(valueName:String):Object
+ {
+ return values[valueName];
+ }
+
+ /**
+ * @copy org.apache.flex.core.IValuesImpl#init()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function init(mainClass:Object):void
+ {
+ // do nothing
+ }
+
+ /**
+ * @copy org.apache.flex.core.IValuesImpl#convertColor()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function convertColor(value:Object):uint
+ {
+ if (!(value is String))
+ return uint(value);
+
+ var stringValue:String = value as String;
+ if (stringValue.charAt(0) == '#')
+ return uint(stringValue.substr(1));
+ return uint(stringValue);
+ }
+
+ /**
+ * @copy org.apache.flex.core.IValuesImpl#parseStyles()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function parseStyles(value:String):Object
+ {
+ value = value.replace(/;/g, ",");
+ return JSON.parse("{" + value + "}");
+ }
+
+ /**
+ * @copy org.apache.flex.core.IValuesImpl#addRule()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function addRule(ruleName:String, values:Object):void
+ {
+ // ignore ruleName since all values are global
+ for (var p:String in values)
+ values[p] = values[p];
+ }
+
+ COMPILE::JS
+ public function applyStyles(thisObject:IUIBase, styles:Object):void
+ {
+ // to do or not needed?
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/core/StageProxy.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/StageProxy.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/StageProxy.as
new file mode 100644
index 0000000..1afe763
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/StageProxy.as
@@ -0,0 +1,127 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 flash.display.Stage;
+ import flash.events.Event;
+
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The StageProxy class wraps the stage and
+ * presents it as a FlexJS IEventDispatcher.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::AS3
+ public class StageProxy implements IEventDispatcher
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function StageProxy(stage:Stage)
+ {
+ super();
+ _stage = stage;
+ _stage.addEventListener("removedFromStage", removedFromStageHandler);
+ }
+
+ private var _stage:Stage;
+
+ private function removedFromStageHandler(event:flash.events.Event):void
+ {
+ _stage.removeEventListener("removedFromStage", removedFromStageHandler);
+ dispatchEvent(new org.apache.flex.events.Event("removedFromStage"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.IEventDispatcher#addEventListener()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReferences:Boolean = false):void
+ {
+ _stage.addEventListener(type, listener, useCapture);
+ }
+
+ /**
+ * @copy org.apache.flex.core.IEventDispatcher#removeEventListener()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
+ {
+ _stage.removeEventListener(type, listener, useCapture);
+ }
+
+ /**
+ * @copy org.apache.flex.core.IEventDispatcher#removeEventListener()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function dispatchEvent(event:flash.events.Event):Boolean
+ {
+ return _stage.dispatchEvent(event);
+ }
+
+ /**
+ * @copy org.apache.flex.core.IEventDispatcher#willTriger()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function willTrigger(eventName:String):Boolean
+ {
+ return _stage.willTrigger(eventName);
+ }
+
+ /**
+ * @copy org.apache.flex.core.IEventDispatcher#hasEventListener()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function hasEventListener(eventName:String):Boolean
+ {
+ return _stage.hasEventListener(eventName);
+ }
+ }
+}