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 2013/01/11 21:27:45 UTC
svn commit: r1432268 - in /flex/asjs/branches/develop/frameworks: as/
as/src/ as/src/org/apache/flex/binding/ as/src/org/apache/flex/core/
as/src/org/apache/flex/utils/ js/src/org/apache/flex/binding/
js/src/org/apache/flex/core/ js/src/org/apache/flex...
Author: aharui
Date: Fri Jan 11 20:27:44 2013
New Revision: 1432268
URL: http://svn.apache.org/viewvc?rev=1432268&view=rev
Log:
Upgrade AS framework to create a legitimate SWC that can be used in MXML. Run build.xml to create the SWC.
Modify AS framework to handle Falcon MXML output. You must use the -compiler.mxml.children-as-data flag to get the right output
Modify JS framework to handle FalconJS MXML output.
Modify SimpleBinding to be a bead and implement is binding logic as a bead. Databinding syntax is not supported in FalconJS yet.
Added:
flex/asjs/branches/develop/frameworks/as/build.properties (with props)
flex/asjs/branches/develop/frameworks/as/build.xml (with props)
flex/asjs/branches/develop/frameworks/as/compile-config.xml (with props)
flex/asjs/branches/develop/frameworks/as/manifest.xml (with props)
flex/asjs/branches/develop/frameworks/as/src/FlexJSUIClasses.as (with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IDocument.as (with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/utils/
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/utils/MXMLDataInterpreter.as (with props)
flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/IDocument.js (with props)
flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/
flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/TextButtonBead.js (with props)
flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/TextFieldBead.js (with props)
flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/models/
flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/models/TextModel.js (with props)
flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/utils/
flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/utils/MXMLDataInterpreter.js (with props)
Modified:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/binding/SimpleBinding.as
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/Application.as
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IBeadModel.as
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/UIBase.as
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/ViewBase.as
flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/binding/SimpleBinding.js
flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/Application.js
flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/UIBase.js
flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/ViewBase.js
Added: flex/asjs/branches/develop/frameworks/as/build.properties
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/build.properties?rev=1432268&view=auto
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/build.properties (added)
+++ flex/asjs/branches/develop/frameworks/as/build.properties Fri Jan 11 20:27:44 2013
@@ -0,0 +1,60 @@
+################################################################################
+##
+## 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.
+##
+################################################################################
+
+# flex-sdk-description values
+release = Apache Flex ASJS 0.0.1
+release.version = 0.0.1
+
+# override on command line with -Dbuild.number=999 or in local.properties
+build.number = 0
+
+playerglobal.version = 11.1
+
+# locale = en_US
+
+qa.dir = ${basedir}/../qa
+asc = ${basedir}/bin/asc
+
+# TextLayoutFormat version. This is a sub-directory in frameworks/textLayout.
+tlf.version = 3.0.33
+
+# For Java 7 on Mac OS X, you need an Intel-based Mac running Mac OS X version 10.7.3
+# (Lion) and above. Only the 64-bit data model is available so leave this blank.
+# Since ant properties are immutable, if this property is set in the build file before
+# this file is included, setting it to nothing here is a no-op.
+local.d32 =
+
+src.depend = true
+src.debug = on
+
+# JVM options for <compc> and <mxmlc> tasks
+jvm.args = ${local.d32} -Xms64m -Xmx384m -ea -Dapple.awt.UIElement=true
+ # -d32/-d64 for 32-bit/64-bit code model (or don't specify for the default)
+ # -Xms64m: start out with a 64 MB heap
+ # -Xmx384m: allow the heap to grow to 384 MB
+ # -ea: enable Java assertions
+compc.jvm.args = ${jvm.args}
+mxmlc.jvm.args = ${jvm.args}
+
+# JAR Manifest Entries
+manifest.sealed=false
+manifest.Implementation-Title=Apache Flex ASJS
+manifest.Implementation-Version=${release.version}
+manifest.Implementation-Vendor=The Apache Software Foundation
+manifest.Implementation-Vendor-Id=org.apache
Propchange: flex/asjs/branches/develop/frameworks/as/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: flex/asjs/branches/develop/frameworks/as/build.xml
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/build.xml?rev=1432268&view=auto
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/build.xml (added)
+++ flex/asjs/branches/develop/frameworks/as/build.xml Fri Jan 11 20:27:44 2013
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+
+<project name="framework" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="."/>
+
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${env.FLEX_HOME}"/>
+
+ <target name="main" depends="clean,compile" description="Clean build of FlexJSUI.swc">
+ </target>
+
+ <target name="clean">
+ <delete failonerror="false">
+ <fileset dir="${FLEXJS_HOME}/libs">
+ <include name="FlexJSUI.swc"/>
+ </fileset>
+ </delete>
+ </target>
+
+ <target name="compile" description="Compiles FlexJSUI.swc">
+ <echo message="Compiling libs/FlexJSUI.swc"/>
+ <echo message="FLEX_HOME: ${FLEX_HOME}"/>
+
+ <!-- Load the <compc> task. We can't do this at the <project> level -->
+ <!-- because targets that run before flexTasks.jar gets built would fail. -->
+ <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/lib/flexTasks.jar"/>
+ <!--
+ Link in the classes (and their dependencies) for the MXML tags
+ listed in this project's manifest.xml.
+ Also link the additional classes (and their dependencies)
+ listed in FlexJSUIClasses.as,
+ because these aren't referenced by the manifest classes.
+ Keep the standard metadata when compiling.
+ Include the appropriate CSS files and assets in the SWC.
+ Don't include any resources in the SWC.
+ Write a bundle list of referenced resource bundles
+ into the file bundles.properties in this directory.
+ -->
+ <compc fork="true"
+ output="${FLEXJS_HOME}/libs/FlexJSUI.swc">
+ <jvmarg line="${compc.jvm.args}"/>
+ <load-config filename="compile-config.xml" />
+ <arg value="+playerglobal.version=${playerglobal.version}" />
+ <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
+ </compc>
+ </target>
+
+</project>
Propchange: flex/asjs/branches/develop/frameworks/as/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: flex/asjs/branches/develop/frameworks/as/compile-config.xml
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/compile-config.xml?rev=1432268&view=auto
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/compile-config.xml (added)
+++ flex/asjs/branches/develop/frameworks/as/compile-config.xml Fri Jan 11 20:27:44 2013
@@ -0,0 +1,55 @@
+<!--
+
+ 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.
+
+-->
+<flex-config>
+
+ <compiler>
+ <accessible>false</accessible>
+
+ <external-library-path>
+ <path-element>${env.PLAYERGLOBAL_HOME}/${playerglobal.version}/playerglobal.swc</path-element>
+ </external-library-path>
+
+ <locale/>
+
+ <library-path/>
+
+ <namespaces>
+ <namespace>
+ <uri>library://ns.apache.org/flexjs/basic</uri>
+ <manifest>manifest.xml</manifest>
+ </namespace>
+ </namespaces>
+
+ <source-path>
+ <path-element>src</path-element>
+ </source-path>
+
+ <warn-no-constructor>false</warn-no-constructor>
+ </compiler>
+
+ <include-classes>
+ <class>FlexJSUIClasses</class>
+ </include-classes>
+
+ <include-namespaces>
+ <uri>library://ns.apache.org/flexjs/basic</uri>
+ </include-namespaces>
+
+ <target-player>${playerglobal.version}</target-player>
+</flex-config>
Propchange: flex/asjs/branches/develop/frameworks/as/compile-config.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: flex/asjs/branches/develop/frameworks/as/manifest.xml
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/manifest.xml?rev=1432268&view=auto
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/manifest.xml (added)
+++ flex/asjs/branches/develop/frameworks/as/manifest.xml Fri Jan 11 20:27:44 2013
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+
+<componentPackage>
+
+ <component id="Application" class="org.apache.flex.core.Application"/>
+ <component id="SimpleValuesImpl" class="org.apache.flex.core.SimpleValuesImpl"/>
+ <component id="ViewBase" class="org.apache.flex.core.ViewBase"/>
+ <component id="SimpleBinding" class="org.apache.flex.binding.SimpleBinding"/>
+ <component id="Button" class="org.apache.flex.html.staticControls.Button"/>
+ <component id="Label" class="org.apache.flex.html.staticControls.Label"/>
+ <component id="TextButton" class="org.apache.flex.html.staticControls.TextButton"/>
+
+</componentPackage>
Propchange: flex/asjs/branches/develop/frameworks/as/manifest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: flex/asjs/branches/develop/frameworks/as/src/FlexJSUIClasses.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/FlexJSUIClasses.as?rev=1432268&view=auto
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/FlexJSUIClasses.as (added)
+++ flex/asjs/branches/develop/frameworks/as/src/FlexJSUIClasses.as Fri Jan 11 20:27:44 2013
@@ -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
+{
+
+/**
+ * @private
+ * This class is used to link additional classes into rpc.swc
+ * beyond those that are found by dependecy analysis starting
+ * from the classes specified in manifest.xml.
+ */
+internal class FlexJSUIClasses
+{
+ import org.apache.flex.html.staticControls.beads.IButtonBead; IButtonBead;
+ import org.apache.flex.html.staticControls.beads.TextButtonBead; TextButtonBead;
+ import org.apache.flex.html.staticControls.beads.TextFieldBead; TextFieldBead;
+ import org.apache.flex.html.staticControls.beads.models.TextModel; TextModel;
+}
+
+}
Propchange: flex/asjs/branches/develop/frameworks/as/src/FlexJSUIClasses.as
------------------------------------------------------------------------------
svn:eol-style = native
Modified: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/binding/SimpleBinding.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/binding/SimpleBinding.as?rev=1432268&r1=1432267&r2=1432268&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/binding/SimpleBinding.as (original)
+++ flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/binding/SimpleBinding.as Fri Jan 11 20:27:44 2013
@@ -20,25 +20,39 @@ package org.apache.flex.binding
{
import flash.events.Event;
import flash.events.IEventDispatcher;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IDocument;
- public class SimpleBinding
+ public class SimpleBinding implements IBead, IDocument
{
public function SimpleBinding()
{
}
- public var source:IEventDispatcher;
+ protected var source:IEventDispatcher;
+ protected var document:IEventDispatcher;
+ protected var destination:Object;
+
+ public var sourceID:String;
public var sourcePropertyName:String;
public var eventName:String;
- public var destination:Object;
public var destinationPropertyName:String;
- public function initialize():void
+ public function set strand(value:IStrand):void
{
+ destination = value;
+ source = document[sourceID] as IEventDispatcher;
source.addEventListener(eventName, changeHandler);
destination[destinationPropertyName] = source[sourcePropertyName];
}
+ public function setDocument(document:Object, id:String = null):void
+ {
+ this.document = document as IEventDispatcher;
+ }
+
private function changeHandler(event:Event):void
{
destination[destinationPropertyName] = source[sourcePropertyName];
Modified: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/Application.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/Application.as?rev=1432268&r1=1432267&r2=1432268&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/Application.as (original)
+++ flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/Application.as Fri Jan 11 20:27:44 2013
@@ -18,33 +18,57 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.core
{
- import flash.display.Sprite;
- import flash.events.Event;
-
- public class Application extends Sprite
- {
- public function Application()
- {
- super();
- loaderInfo.addEventListener(Event.INIT, initHandler);
- }
-
- private function initHandler(event:Event):void
- {
- valuesImpl = new valuesImplClass as IValuesImpl;
- ValuesManager.valuesImpl = valuesImpl;
-
- initialView = new initialViewClass as ViewBase;
- initialView.addToParent(this);
- initialView.initUI(this);
- dispatchEvent(new Event("viewChanged"));
- }
-
- public var valuesImplClass:Class;
- public var valuesImpl:IValuesImpl;
-
- public var initialViewClass:Class;
- public var initialView:ViewBase;
-
- }
+ import flash.display.Sprite;
+ import flash.events.Event;
+
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ //--------------------------------------
+ // Events
+ //--------------------------------------
+
+ /**
+ * Dispatched at startup.
+ */
+ [Event(name="initialize", type="flash.events.Event")]
+
+ public class Application extends Sprite
+ {
+ public function Application()
+ {
+ super();
+ loaderInfo.addEventListener(Event.INIT, initHandler);
+ }
+
+ private function initHandler(event:Event):void
+ {
+ MXMLDataInterpreter.generateMXMLProperties(this, MXMLProperties);
+
+ ValuesManager.valuesImpl = valuesImpl;
+
+ dispatchEvent(new Event("initialize"));
+
+ initialView.addToParent(this);
+ initialView.initUI(model);
+ dispatchEvent(new Event("viewChanged"));
+ }
+
+ public var valuesImpl:IValuesImpl;
+
+ public var initialView:ViewBase;
+
+ public var model:Object;
+
+ public var controller:Object;
+
+ public function get MXMLDescriptor():Array
+ {
+ return null;
+ }
+
+ public function get MXMLProperties():Array
+ {
+ return null;
+ }
+ }
}
\ No newline at end of file
Modified: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IBeadModel.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IBeadModel.as?rev=1432268&r1=1432267&r2=1432268&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IBeadModel.as (original)
+++ flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IBeadModel.as Fri Jan 11 20:27:44 2013
@@ -23,7 +23,7 @@ package org.apache.flex.core
/**
* Marker interface for models
*/
- public interface IBeadModel extends IEventDispatcher
+ public interface IBeadModel extends IBead, IEventDispatcher
{
}
Added: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IDocument.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IDocument.as?rev=1432268&view=auto
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IDocument.as (added)
+++ flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IDocument.as Fri Jan 11 20:27:44 2013
@@ -0,0 +1,25 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+ public interface IDocument
+ {
+ function setDocument(document:Object, id:String = null):void
+ }
+}
\ No newline at end of file
Propchange: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IDocument.as
------------------------------------------------------------------------------
svn:eol-style = native
Modified: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/UIBase.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/UIBase.as?rev=1432268&r1=1432267&r2=1432268&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/UIBase.as (original)
+++ flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/UIBase.as Fri Jan 11 20:27:44 2013
@@ -66,10 +66,36 @@ package org.apache.flex.core
}
private var _model:IBeadModel;
- protected function get model():IBeadModel
+ public function get model():IBeadModel
{
return _model;
}
+ public function set model(value:IBeadModel):void
+ {
+ if (_model != value)
+ {
+ addBead(value as IBead);
+ dispatchEvent(new Event("modelChanged"));
+ }
+ }
+
+ private var _id:String;
+ public function get id():String
+ {
+ return _id;
+ }
+ public function set id(value:String):void
+ {
+ if (_id != value)
+ {
+ _id = value;
+ dispatchEvent(new Event("idChanged"));
+ }
+ }
+
+ // beads declared in MXML are added to the strand.
+ // from AS, just call addBead()
+ public var beads:Array;
private var strand:Vector.<IBead>;
public function addBead(bead:IBead):void
Modified: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/ViewBase.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/ViewBase.as?rev=1432268&r1=1432267&r2=1432268&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/ViewBase.as (original)
+++ flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/ViewBase.as Fri Jan 11 20:27:44 2013
@@ -22,7 +22,9 @@ package org.apache.flex.core
import org.apache.flex.binding.SimpleBinding;
import org.apache.flex.core.IStrand;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+ [DefaultProperty("mxmlContent")]
public class ViewBase extends UIBase
{
public function ViewBase()
@@ -30,87 +32,25 @@ package org.apache.flex.core
super();
}
- public function get uiDescriptors():Array
+ public function initUI(model:Object):void
+ {
+ applicationModel = model;
+ MXMLDataInterpreter.generateMXMLProperties(this, MXMLProperties);
+ MXMLDataInterpreter.generateMXMLInstances(this, this, MXMLDescriptor);
+ }
+
+ public function get MXMLDescriptor():Array
{
return null;
}
- public function initUI(app:Application):void
+ public function get MXMLProperties():Array
{
- // cache this for speed
- var descriptors:Array = uiDescriptors;
-
- var n:int = descriptors.length;
- var i:int = 0;
-
- while (i < n)
- {
- var valueName:String;
- var value:Object;
-
- var c:Class = descriptors[i++]; // class
- var o:DisplayObject = new c() as DisplayObject;
- if (o is UIBase)
- UIBase(o).addToParent(this);
- else
- addChild(o);
- c = descriptors[i++]; // model
- if (c)
- {
- value = new c();
- IStrand(o).addBead(value as IBead);
- }
- if (o is IInitModel)
- IInitModel(o).initModel();
- var j:int;
- var m:int;
- valueName = descriptors[i++]; // id
- if (valueName)
- this[valueName] = o;
-
- m = descriptors[i++]; // num props
- for (j = 0; j < m; j++)
- {
- valueName = descriptors[i++];
- value = descriptors[i++];
- o[valueName] = value;
- }
- m = descriptors[i++]; // num beads
- for (j = 0; j < m; j++)
- {
- c = descriptors[i++];
- value = new c();
- IStrand(o).addBead(value as IBead);
- }
- if (o is IInitSkin)
- {
- IInitSkin(o).initSkin();
- }
- m = descriptors[i++]; // num events
- for (j = 0; j < m; j++)
- {
- valueName = descriptors[i++];
- value = descriptors[i++];
- o.addEventListener(valueName, value as Function);
- }
- m = descriptors[i++]; // num bindings
- for (j = 0; j < m; j++)
- {
- valueName = descriptors[i++];
- var bindingType:int = descriptors[i++];
- switch (bindingType)
- {
- case 0:
- var sb:SimpleBinding = new SimpleBinding();
- sb.destination = o;
- sb.destinationPropertyName = valueName;
- sb.source = app[descriptors[i++]];
- sb.sourcePropertyName = descriptors[i++];
- sb.eventName = descriptors[i++];
- sb.initialize();
- }
- }
- }
+ return null;
}
+
+ public var mxmlContent:Array;
+
+ public var applicationModel:Object;
}
}
\ No newline at end of file
Added: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/utils/MXMLDataInterpreter.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/utils/MXMLDataInterpreter.as?rev=1432268&view=auto
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/utils/MXMLDataInterpreter.as (added)
+++ flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/utils/MXMLDataInterpreter.as Fri Jan 11 20:27:44 2013
@@ -0,0 +1,297 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.utils
+{
+import flash.display.DisplayObject;
+import flash.display.DisplayObjectContainer;
+
+import org.apache.flex.binding.SimpleBinding;
+import org.apache.flex.core.IStrand;
+import org.apache.flex.core.IBead;
+import org.apache.flex.core.IDocument;
+import org.apache.flex.core.IInitModel;
+import org.apache.flex.core.IInitSkin;
+import org.apache.flex.core.UIBase;
+
+public class MXMLDataInterpreter
+{
+ public function MXMLDataInterpreter()
+ {
+ super();
+ }
+
+
+ public static function generateMXMLObject(document:Object, data:Array):Object
+ {
+ var i:int = 0;
+ var cls:Class = data[i++];
+ var comp:Object = new cls();
+
+ var m:int;
+ var j:int;
+ var name:String;
+ var simple:*;
+ var value:Object;
+ var id:String;
+
+ m = data[i++]; // num props
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(document, null, value as Array);
+ else if (simple == false)
+ value = generateMXMLObject(document, value as Array);
+ if (name == "id")
+ {
+ document[value] = comp;
+ id = value as String;
+ }
+ else if (name == "_id")
+ {
+ document[value] = comp;
+ id = value as String;
+ continue; // skip assignment to comp
+ }
+ comp[name] = value;
+ }
+ if (comp is IDocument)
+ comp.setDocument(document, id);
+ return comp;
+ }
+
+ public static function generateMXMLArray(document:Object, parent:DisplayObjectContainer, data:Array, recursive:Boolean = true):Array
+ {
+ var comps:Array = [];
+
+ var n:int = data.length;
+ var i:int = 0;
+ while (i < n)
+ {
+ var cls:Class = data[i++];
+ var comp:Object = new cls();
+
+ if (parent)
+ {
+ if (comp is UIBase)
+ comp.addToParent(parent);
+ else
+ parent.addChild(comp as DisplayObject);
+ }
+
+ var m:int;
+ var j:int;
+ var name:String;
+ var simple:*;
+ var value:Object;
+ var id:String = null;
+
+ m = data[i++]; // num props
+ if (m > 0 && data[0] == "model")
+ {
+ m--;
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(document, parent, value as Array, recursive);
+ else if (simple == false)
+ value = generateMXMLObject(document, value as Array);
+ comp[name] = value;
+ if (value is IBead && comp is IStrand)
+ IStrand(comp).addBead(value as IBead);
+ }
+ if (comp is IInitModel)
+ IInitModel(comp).initModel();
+ var beadOffset:int = i + (m - 1) * 3;
+ if (beadOffset >= -1)
+ trace(beadOffset, data[beadOffset]);
+ if (m > 0 && data[beadOffset] == "beads")
+ {
+ m--;
+ }
+ else
+ beadOffset = -1;
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(document, null, value as Array, recursive);
+ else if (simple == false)
+ value = generateMXMLObject(document, value as Array);
+ if (name == "id")
+ id = value as String;
+ if (name == "document" && !comp.document)
+ comp.document = document;
+ else if (name == "_id")
+ id = value as String; // and don't assign to comp
+ else
+ comp[name] = value;
+ }
+ if (beadOffset > -1)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(document, null, value as Array, recursive);
+ else if (simple == false)
+ value = generateMXMLObject(document, value as Array);
+ else
+ comp[name] = value;
+ var beads:Array = value as Array;
+ var l:int = beads.length;
+ for (var k:int = 0; k < l; k++)
+ {
+ var bead:IBead = beads[k] as IBead;
+ IStrand(comp).addBead(bead);
+ bead.strand = comp as IStrand;
+ }
+ }
+ m = data[i++]; // num styles
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(document, null, value as Array, recursive);
+ else if (simple == false)
+ value = generateMXMLObject(document, value as Array);
+ comp.setStyle(name, value);
+ }
+ if (comp is IInitSkin)
+ {
+ IInitSkin(comp).initSkin();
+ }
+
+
+ m = data[i++]; // num effects
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(document, null, value as Array, recursive);
+ else if (simple == false)
+ value = generateMXMLObject(document, value as Array);
+ comp.setStyle(name, value);
+ }
+
+ m = data[i++]; // num events
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ value = data[i++];
+ comp.addEventListener(name, value);
+ }
+
+ var children:Array = data[i++];
+ if (children)
+ {
+ if (recursive)
+ generateMXMLInstances(document, comp as DisplayObjectContainer, children, recursive);
+ else
+ comp.setMXMLDescriptor(children);
+ }
+
+ if (id)
+ document[id] = comp;
+
+ if (comp is IDocument)
+ comp.setDocument(document, id);
+ comps.push(comp);
+ }
+ return comps;
+ }
+
+ public static function generateMXMLInstances(document:Object, parent:DisplayObjectContainer, data:Array, recursive:Boolean = true):void
+ {
+ generateMXMLArray(document, parent, data, recursive);
+ }
+
+ public static function generateMXMLProperties(host:Object, data:Array):void
+ {
+ var i:int = 0;
+ var m:int;
+ var j:int;
+ var name:String;
+ var simple:*;
+ var value:Object;
+ var id:String = null;
+
+ m = data[i++]; // num props
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(host, null, value as Array, false);
+ else if (simple == false)
+ value = generateMXMLObject(host, value as Array);
+ if (name == "id")
+ id = value as String;
+ if (name == "_id")
+ id = value as String; // and don't assign
+ else
+ host[name] = value;
+ }
+ m = data[i++]; // num styles
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(host, null, value as Array, false);
+ else if (simple == false)
+ value = generateMXMLObject(host, value as Array);
+ host[name] = value;
+ }
+
+ m = data[i++]; // num effects
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(host, null, value as Array, false);
+ else if (simple == false)
+ value = generateMXMLObject(host, value as Array);
+ host[name] = value;
+ }
+
+ m = data[i++]; // num events
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ value = data[i++];
+ host.addEventListener(name, value as Function);
+ }
+ }
+
+}
+}
Propchange: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/utils/MXMLDataInterpreter.as
------------------------------------------------------------------------------
svn:eol-style = native
Modified: flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/binding/SimpleBinding.js
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/binding/SimpleBinding.js?rev=1432268&r1=1432267&r2=1432268&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/binding/SimpleBinding.js (original)
+++ flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/binding/SimpleBinding.js Fri Jan 11 20:27:44 2013
@@ -38,13 +38,13 @@ org.apache.flex.binding.SimpleBinding.pr
* @expose
* @type {string}
*/
-org.apache.flex.binding.SimpleBinding.prototype.destinationPropertyName = "";
+org.apache.flex.binding.SimpleBinding.prototype.destinationPropertyName = '';
/**
* @expose
* @type {string}
*/
-org.apache.flex.binding.SimpleBinding.prototype.eventName = "";
+org.apache.flex.binding.SimpleBinding.prototype.eventName = '';
/**
* @expose
@@ -56,7 +56,7 @@ org.apache.flex.binding.SimpleBinding.pr
* @expose
* @type {string}
*/
-org.apache.flex.binding.SimpleBinding.prototype.sourcePropertyName = "";
+org.apache.flex.binding.SimpleBinding.prototype.sourcePropertyName = '';
/**
* @this {org.apache.flex.binding.SimpleBinding}
@@ -69,8 +69,11 @@ org.apache.flex.binding.SimpleBinding.pr
/**
* @this {org.apache.flex.binding.SimpleBinding}
+ * @param {object} value The strand (owner) of the bead.
*/
-org.apache.flex.binding.SimpleBinding.prototype.initialize = function() {
+org.apache.flex.binding.SimpleBinding.prototype.set_strand = function(value) {
+ this.destination = value;
+ this.source = this.document[this.sourceID];
this.source.addEventListener(
this.eventName, org.apache.flex.FlexGlobal.createProxy(
this, this.changeHandler
@@ -79,3 +82,13 @@ org.apache.flex.binding.SimpleBinding.pr
this.changeHandler();
};
+
+/**
+ * @this {org.apache.flex.binding.SimpleBinding}
+ * @param {object} document The MXML object.
+ * @param {string} id The id for the instance.
+ */
+org.apache.flex.binding.SimpleBinding.prototype.setDocument =
+ function(document, id) {
+ this.document = document;
+};
Modified: flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/Application.js
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/Application.js?rev=1432268&r1=1432267&r2=1432268&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/Application.js (original)
+++ flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/Application.js Fri Jan 11 20:27:44 2013
@@ -20,6 +20,7 @@ goog.require('org.apache.flex.FlexObject
goog.require('org.apache.flex.core.SimpleValuesImpl');
goog.require('org.apache.flex.core.ValuesManager');
goog.require('org.apache.flex.core.ViewBase');
+goog.require('org.apache.flex.utils.MXMLDataInterpreter');
/**
* @constructor
@@ -101,12 +102,37 @@ org.apache.flex.core.Application.prototy
}
}
+ org.apache.flex.utils.MXMLDataInterpreter.generateMXMLProperties(this,
+ this.get_MXMLProperties());
+
org.apache.flex.core.ValuesManager.valuesImpl = this.valuesImpl;
+ evt = document.createEvent('Event');
+ evt.initEvent('initialize', true, true);
+ this.element.dispatchEvent(evt);
+
this.initialView.addToParent(this.element);
- this.initialView.initUI(this);
+ this.initialView.initUI(this.model);
evt = document.createEvent('Event');
evt.initEvent('viewChanged', true, true);
this.element.dispatchEvent(evt);
};
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.Application}
+ * @return {Array} The array of descriptors.
+ */
+org.apache.flex.core.Application.prototype.get_MXMLDescriptor = function() {
+ return null;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.Application}
+ * @return {Array} The array of properties.
+ */
+org.apache.flex.core.Application.prototype.get_MXMLProperties = function() {
+ return null;
+};
Added: flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/IDocument.js
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/IDocument.js?rev=1432268&view=auto
==============================================================================
--- flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/IDocument.js (added)
+++ flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/IDocument.js Fri Jan 11 20:27:44 2013
@@ -0,0 +1,28 @@
+/**
+ * Licensed 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.
+ */
+
+goog.provide('org.apache.flex.core.IDocument');
+
+goog.require('org.apache.flex.FlexObject');
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.FlexObject}
+ */
+org.apache.flex.core.IDocument = function() {
+ org.apache.flex.FlexObject.call(this);
+};
+goog.inherits(
+ org.apache.flex.core.IDocument, org.apache.flex.FlexObject
+);
Propchange: flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/IDocument.js
------------------------------------------------------------------------------
svn:eol-style = native
Modified: flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/UIBase.js
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/UIBase.js?rev=1432268&r1=1432267&r2=1432268&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/UIBase.js (original)
+++ flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/UIBase.js Fri Jan 11 20:27:44 2013
@@ -29,6 +29,12 @@ org.apache.flex.core.UIBase = function()
* @type {Object}
*/
this.positioner;
+
+ /**
+ * @private
+ * @type {Array}
+ */
+ this.strand;
};
goog.inherits(org.apache.flex.core.UIBase, org.apache.flex.FlexObject);
@@ -82,3 +88,133 @@ org.apache.flex.core.UIBase.prototype.se
this.positioner.style.position = 'absolute';
this.positioner.style.top = pixels.toString() + 'px';
};
+
+/**
+ * @expose
+ * @type {string}
+ */
+org.apache.flex.core.UIBase.prototype.id;
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.UIBase}
+ * @return {string} The id.
+ */
+org.apache.flex.core.UIBase.prototype.get_id = function() {
+ return this.id;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.UIBase}
+ * @param {object} value The new id.
+ */
+org.apache.flex.core.UIBase.prototype.set_id = function(value) {
+ if (this.id != value)
+ {
+ this.id = value;
+ this.dispatchEvent(new Event('idChanged'));
+ }
+};
+
+/**
+ * @expose
+ * @type {object}
+ */
+org.apache.flex.core.UIBase.prototype.model;
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.UIBase}
+ * @return {object} The model.
+ */
+org.apache.flex.core.UIBase.prototype.get_model = function() {
+ return this.model;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.UIBase}
+ * @param {object} value The new model.
+ */
+org.apache.flex.core.UIBase.prototype.set_model = function(value) {
+ if (this.model != value)
+ {
+ this.addBead(value);
+ this.dispatchEvent(new Event('modelChanged'));
+ }
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.UIBase}
+ * @param {object} bead The new bead.
+ */
+org.apache.flex.core.UIBase.prototype.addBead = function(bead) {
+ if (!this.strand)
+ this.strand = [];
+ this.strand.push(bead);
+ if (typeof(bead.constructor.$implements) != 'undefined' &&
+ typeof(bead.constructor.$implements.IBeadModel != 'undefined'))
+ this.model = bead;
+ bead.set_strand(this);
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.UIBase}
+ * @param {object} classOrInterface The requested bead type.
+ * @return {object} The bead.
+ */
+org.apache.flex.core.UIBase.prototype.getBeadByType =
+ function(classOrInterface) {
+ var n;
+ n = this.strand.length;
+ for (var i = 0; i < n; i++)
+ {
+ var bead = strand[i];
+ if (bead instanceof classOrInterface)
+ return bead;
+ if (classOrInterface in bead.constructor.$implements)
+ return bead;
+ }
+ return null;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.UIBase}
+ * @param {object} bead The bead to remove.
+ * @return {object} The bead.
+ */
+org.apache.flex.core.UIBase.prototype.remove = function(bead) {
+ var n = this.strand.length;
+ for (var i = 0; i < n; i++)
+ {
+ var bead = strand[i];
+ if (bead == value)
+ {
+ this.strand.splice(i, 1);
+ return bead;
+ }
+ }
+ return null;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.UIBase}
+ * @return {Array} The array of descriptors.
+ */
+org.apache.flex.core.UIBase.prototype.get_MXMLDescriptor = function() {
+ return null;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.UIBase}
+ * @return {Array} The array of properties.
+ */
+org.apache.flex.core.UIBase.prototype.get_MXMLProperties = function() {
+ return null;
+};
Modified: flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/ViewBase.js
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/ViewBase.js?rev=1432268&r1=1432267&r2=1432268&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/ViewBase.js (original)
+++ flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/core/ViewBase.js Fri Jan 11 20:27:44 2013
@@ -16,10 +16,10 @@ goog.provide('org.apache.flex.core.ViewB
goog.require('org.apache.flex.FlexGlobal');
-goog.require('org.apache.flex.binding.SimpleBinding');
-
goog.require('org.apache.flex.core.UIBase');
+goog.require('org.apache.flex.utils.MXMLDataInterpreter');
+
/**
* @constructor
* @extends {org.apache.flex.core.UIBase}
@@ -36,99 +36,29 @@ org.apache.flex.core.ViewBase = function
goog.inherits(org.apache.flex.core.ViewBase, org.apache.flex.core.UIBase);
/**
- * @protected
- * @return {Array} The array of UI element descriptors.
+ * @expose
+ * @type {Object}
*/
-org.apache.flex.core.ViewBase.prototype.get_uiDescriptors = function() {
- return [];
-};
+org.apache.flex.core.ViewBase.prototype.applicationModel;
/**
- * @this {org.apache.flex.core.ViewBase}
- * @param {org.apache.flex.core.Application} app The main application.
+ * @expose
+ * @type {Array}
*/
-org.apache.flex.core.ViewBase.prototype.initUI = function(app) {
- var count, descriptor, descriptors, i, j, n, sb, value;
+org.apache.flex.core.ViewBase.prototype.MXMLProperties;
- descriptors = this.get_uiDescriptors();
+/**
+ * @expose
+ * @type {Array}
+ */
+org.apache.flex.core.ViewBase.prototype.MXMLDescriptor;
- if (descriptors && descriptors.length) {
- n = descriptors.length;
- i = 0;
- while (i < n)
- {
- // class (index 0)
- descriptor = descriptors[i++];
- this.currentObject_ =
- /* : org.apache.flex.core.ViewBase */ new descriptor();
- this.currentObject_.addToParent(this.element);
-
- // model (index 1)
- descriptor = descriptors[i++];
- if (descriptor) {
- value = new descriptor();
- this.currentObject_.addBead(value);
- }
- if (typeof this.currentObject_.initModel == 'function') {
- this.currentObject_.initModel();
- }
-
- // id (index 2)
- descriptor = descriptors[i++];
- if (descriptor) {
- this[descriptor] = this.currentObject_;
- }
-
- // num props
- count = descriptors[i++];
- for (j = 0; j < count; j++) {
- descriptor = descriptors[i++];
- value = descriptors[i++];
- this.currentObject_['set_' + descriptor](value);
- }
-
- // num beads
- count = descriptors[i++];
- for (j = 0; j < count; j++) {
- descriptor = descriptors[i++];
- value = new descriptor();
- this.currentObject_.addBead(value);
- }
- if (typeof this.currentObject_.initSkin == 'function') {
- this.currentObject_.initSkin();
- }
-
- // num events
- count = descriptors[i++];
- for (j = 0; j < count; j++) {
- descriptor = descriptors[i++];
- value = descriptors[i++];
- this.currentObject_.addEventListener(
- descriptor, org.apache.flex.FlexGlobal.createProxy(
- this, value
- )
- );
- }
-
- // num bindings
- count = descriptors[i++];
- for (j = 0; j < count; j++) {
- descriptor = descriptors[i++];
- value = descriptors[i++];
- switch (value) {
- case 0 : {
- sb = new org.apache.flex.binding.SimpleBinding();
- sb.destination = this.currentObject_;
- sb.destinationPropertyName = descriptor;
- sb.source = app[descriptors[i++]];
- sb.sourcePropertyName = descriptors[i++];
- sb.eventName = descriptors[i++];
- sb.initialize();
-
- break;
- }
- }
- }
- }
- }
+/**
+ * @this {org.apache.flex.core.ViewBase}
+ * @param {Object} model The model for this view.
+ */
+org.apache.flex.core.ViewBase.prototype.initUI = function(model) {
+ this.applicationModel = model;
+ org.apache.flex.utils.MXMLDataInterpreter.generateMXMLProperties(this, this.get_MXMLProperties());
+ org.apache.flex.utils.MXMLDataInterpreter.generateMXMLInstances(this, this, this.get_MXMLDescriptor());
};
Added: flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/TextButtonBead.js
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/TextButtonBead.js?rev=1432268&view=auto
==============================================================================
--- flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/TextButtonBead.js (added)
+++ flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/TextButtonBead.js Fri Jan 11 20:27:44 2013
@@ -0,0 +1,29 @@
+/**
+ * Licensed 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.
+ */
+
+goog.provide('org.apache.flex.html.staticControls.beads.TextButtonBead');
+
+goog.require('org.apache.flex.FlexObject');
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.FlexObject}
+ */
+org.apache.flex.html.staticControls.beads.TextButtonBead = function() {
+ org.apache.flex.FlexObject.call(this);
+};
+goog.inherits(
+ org.apache.flex.html.staticControls.beads.TextButtonBead,
+ org.apache.flex.FlexObject
+);
Propchange: flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/TextButtonBead.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/TextFieldBead.js
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/TextFieldBead.js?rev=1432268&view=auto
==============================================================================
--- flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/TextFieldBead.js (added)
+++ flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/TextFieldBead.js Fri Jan 11 20:27:44 2013
@@ -0,0 +1,29 @@
+/**
+ * Licensed 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.
+ */
+
+goog.provide('org.apache.flex.html.staticControls.beads.TextFieldBead');
+
+goog.require('org.apache.flex.FlexObject');
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.FlexObject}
+ */
+org.apache.flex.html.staticControls.beads.TextFieldBead = function() {
+ org.apache.flex.FlexObject.call(this);
+};
+goog.inherits(
+ org.apache.flex.html.staticControls.beads.TextFieldBead,
+ org.apache.flex.FlexObject
+);
Propchange: flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/TextFieldBead.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/models/TextModel.js
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/models/TextModel.js?rev=1432268&view=auto
==============================================================================
--- flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/models/TextModel.js (added)
+++ flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/models/TextModel.js Fri Jan 11 20:27:44 2013
@@ -0,0 +1,29 @@
+/**
+ * Licensed 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.
+ */
+
+goog.provide('org.apache.flex.html.staticControls.beads.models.TextModel');
+
+goog.require('org.apache.flex.FlexObject');
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.FlexObject}
+ */
+org.apache.flex.html.staticControls.beads.TextModel = function() {
+ org.apache.flex.FlexObject.call(this);
+};
+goog.inherits(
+ org.apache.flex.html.staticControls.beads.TextModel,
+ org.apache.flex.FlexObject
+);
Propchange: flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/html/staticControls/beads/models/TextModel.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/utils/MXMLDataInterpreter.js
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/utils/MXMLDataInterpreter.js?rev=1432268&view=auto
==============================================================================
--- flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/utils/MXMLDataInterpreter.js (added)
+++ flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/utils/MXMLDataInterpreter.js Fri Jan 11 20:27:44 2013
@@ -0,0 +1,356 @@
+/**
+ * Licensed 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.
+ */
+
+goog.provide('org.apache.flex.utils.MXMLDataInterpreter');
+
+goog.require('org.apache.flex.FlexGlobal');
+goog.require('org.apache.flex.FlexObject');
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.FlexObject}
+ */
+org.apache.flex.utils.MXMLDataInterpreter = function() {
+ org.apache.flex.FlexObject.call(this);
+
+};
+goog.inherits(org.apache.flex.utils.MXMLDataInterpreter,
+ org.apache.flex.FlexObject);
+
+/**
+ * @param {object} document The MXML object.
+ * @param {Array} data The data array.
+ * @return {object} The generated object.
+ */
+org.apache.flex.utils.MXMLDataInterpreter.generateMXMLObject =
+ function(document, data) {
+ var i = 0;
+ var cls = data[i++];
+ var comp = new cls();
+
+ var m;
+ var j;
+ var name;
+ var simple;
+ var value;
+ var id;
+
+ var generateMXMLArray = org.apache.flex.utils.MXMLDataInterpreter.generateMXMLArray;
+ var generateMXMLObject = org.apache.flex.utils.MXMLDataInterpreter.generateMXMLObject;
+
+ m = data[i++]; // num props
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(document, null, value);
+ else if (simple == false)
+ value = generateMXMLObject(document, value);
+ if (name == 'id')
+ {
+ document['set_' + value](comp);
+ id = value;
+ }
+ else if (name == '_id')
+ {
+ document[value] = comp;
+ id = value;
+ continue; // skip assignment to comp
+ }
+ if (typeof(comp['set_' + name]) == 'function')
+ comp['set_' + name](value);
+ else
+ comp[name] = value;
+ }
+ if (typeof(comp.setDocument) == 'function')
+ comp.setDocument(document, id);
+ return comp;
+};
+
+/**
+ * @expose
+ * @param {Object} document The MXML object.
+ * @param {Object} parent The parent object.
+ * @param {Array} data The data array.
+ * @param {Boolean} recursive Whether to create objects in children.
+ * @return {Array} The generated array.
+ */
+org.apache.flex.utils.MXMLDataInterpreter.generateMXMLArray =
+ function(document, parent, data, recursive) {
+ if (typeof(recursive) == 'undefined')
+ recursive = true;
+
+ var generateMXMLArray = org.apache.flex.utils.MXMLDataInterpreter.generateMXMLArray;
+ var generateMXMLObject = org.apache.flex.utils.MXMLDataInterpreter.generateMXMLObject;
+
+ var comps = [];
+
+ var n = data.length;
+ var i = 0;
+ while (i < n)
+ {
+ var cls = data[i++];
+ var comp = new cls();
+
+ if (parent)
+ {
+ comp.addToParent(parent.element);
+ }
+
+ var m;
+ var j;
+ var name;
+ var simple;
+ var value;
+ var id = null;
+
+ m = data[i++]; // num props
+ if (m > 0 && data[0] == 'model')
+ {
+ m--;
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(document, parent,
+ value, recursive);
+ else if (simple == false)
+ value = generateMXMLObject(document, value);
+ if (typeof(comp['set_' + name]) == 'function')
+ comp['set_' + name](value);
+ else
+ comp[name] = value;
+ if (typeof(value.addBead) == 'function' &&
+ typeof(comp.get_strand) == 'function')
+ comp.addBead(value);
+ }
+ if (typeof(comp.initModel) == 'function')
+ comp.initModel();
+ var beadOffset = i + (m - 1) * 3;
+ if (m > 0 && data[beadOffset] == 'beads')
+ {
+ m--;
+ }
+ else
+ beadOffset = -1;
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(document, null, value, recursive);
+ else if (simple == false)
+ value = generateMXMLObject(document, value);
+ if (name == 'id')
+ id = value;
+ if (name == 'document' && !comp.document)
+ comp.document = document;
+ else if (name == '_id')
+ id = value; // and don't assign to comp
+ else
+ {
+ if (typeof(comp['set_' + name]) == 'function')
+ comp['set_' + name](value);
+ else
+ comp[name] = value;
+ }
+ }
+ if (beadOffset > -1)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(document, null, value, recursive);
+ else if (simple == false)
+ value = generateMXMLObject(document, value);
+ else
+ {
+ if (typeof(comp['set_' + name]) == 'function')
+ comp['set_' + name](value);
+ else
+ comp[name] = value;
+ }
+ var beads = value;
+ var l = beads.length;
+ for (var k = 0; k < l; k++)
+ {
+ var bead = beads[k];
+ comp.addBead(bead);
+ }
+ }
+ m = data[i++]; // num styles
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(document, null, value, recursive);
+ else if (simple == false)
+ value = generateMXMLObject(document, value);
+ comp.setStyle(name, value);
+ }
+ if (typeof(comp.initSkin) == 'function')
+ {
+ comp.initSkin();
+ }
+
+ /*
+ m = data[i++]; // num effects
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(document, null, value, recursive);
+ else if (simple == false)
+ value = generateMXMLObject(document, value);
+ comp.setStyle(name, value);
+ }
+ */
+
+ m = data[i++]; // num events
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ value = data[i++];
+ comp.addEventListener(name,
+ org.apache.flex.FlexGlobal.createProxy(document, value));
+ }
+
+ var children = data[i++];
+ if (children)
+ {
+ if (recursive)
+ org.apache.flex.utils.MXMLDataInterpreter.generateMXMLInstances(document, comp, children, recursive);
+ else
+ comp.setMXMLDescriptor(children);
+ }
+
+ if (id)
+ {
+ if (typeof(document['set_' + id]) == 'function')
+ document['set_' + id](comp);
+ else
+ document[id] = comp;
+ }
+
+ if (typeof(comp.setDocument) == 'function')
+ comp.setDocument(document, id);
+ comps.push(comp);
+ }
+ return comps;
+};
+
+/**
+ * @expose
+ * @param {Object} document The MXML object.
+ * @param {Object} parent The parent object.
+ * @param {Array} data The data array.
+ * @param {Boolean} recursive Whether to create objects in children.
+ */
+org.apache.flex.utils.MXMLDataInterpreter.generateMXMLInstances =
+ function(document, parent, data, recursive) {
+ org.apache.flex.utils.MXMLDataInterpreter.generateMXMLArray(
+ document, parent, data, recursive);
+};
+
+/**
+ * @expose
+ * @param {Object} host The MXML object.
+ * @param {Array} data The data array.
+ */
+org.apache.flex.utils.MXMLDataInterpreter.generateMXMLProperties =
+ function(host, data) {
+ var i = 0;
+ var m;
+ var j;
+ var name;
+ var simple;
+ var value;
+ var id = null;
+
+ var generateMXMLArray = org.apache.flex.utils.MXMLDataInterpreter.generateMXMLArray;
+ var generateMXMLObject = org.apache.flex.utils.MXMLDataInterpreter.generateMXMLObject;
+
+ m = data[i++]; // num props
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(host, null, value, false);
+ else if (simple == false)
+ value = generateMXMLObject(host, value);
+ if (name == 'id')
+ id = value;
+ if (name == '_id')
+ id = value; // and don't assign
+ else
+ {
+ if (typeof(host['set_' + name]) == 'function')
+ host['set_' + name](value);
+ else
+ host[name] = value;
+ }
+ }
+ m = data[i++]; // num styles
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(host, null, value, false);
+ else if (simple == false)
+ value = generateMXMLObject(host, value);
+ if (typeof(host['set_' + name]) == 'function')
+ host['set_' + name](value);
+ else
+ host[name] = value;
+ }
+
+ /*
+ m = data[i++]; // num effects
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple == null)
+ value = generateMXMLArray(host, null, value, false);
+ else if (simple == false)
+ value = generateMXMLObject(host, value);
+ if (typeof(host['set_' + name]) == 'function')
+ host['set_' + name](value);
+ else
+ host[name] = value;
+ }
+ */
+
+ m = data[i++]; // num events
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ value = data[i++];
+ host.addEventListener(name,
+ org.apache.flex.FlexGlobal.createProxy(host, value));
+ }
+};
Propchange: flex/asjs/branches/develop/frameworks/js/src/org/apache/flex/utils/MXMLDataInterpreter.js
------------------------------------------------------------------------------
svn:eol-style = native