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/12/09 18:41:46 UTC
[1/2] git commit: [flex-asjs] [refs/heads/develop] - copy resources
the way maven does
Repository: flex-asjs
Updated Branches:
refs/heads/develop 57dc53036 -> 055f90b08
copy resources the way maven does
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/f7e9ea05
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/f7e9ea05
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/f7e9ea05
Branch: refs/heads/develop
Commit: f7e9ea05f834a407dfed6b62e0cc379581dc335a
Parents: 57dc530
Author: Alex Harui <ah...@apache.org>
Authored: Fri Dec 9 10:39:14 2016 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Dec 9 10:39:14 2016 -0800
----------------------------------------------------------------------
examples/build_example.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f7e9ea05/examples/build_example.xml
----------------------------------------------------------------------
diff --git a/examples/build_example.xml b/examples/build_example.xml
index bdecb12..820209d 100644
--- a/examples/build_example.xml
+++ b/examples/build_example.xml
@@ -135,7 +135,7 @@
output="${basedir}/bin-debug"/>
<copy todir="${basedir}/bin-debug">
- <fileset dir="${basedir}/src">
+ <fileset dir="${basedir}/src/main/resources">
<include name="**/*.png" />
<include name="**/*.jpg" />
<include name="**/*.json" />
@@ -178,7 +178,7 @@
</mxmlc>
<copy todir="${basedir}/bin-debug">
- <fileset dir="${basedir}/src">
+ <fileset dir="${basedir}/src/main/resources">
<include name="**/*.png" />
<include name="**/*.jpg" />
</fileset>
[2/2] git commit: [flex-asjs] [refs/heads/develop] - bare bones of
ASDoc app. Requires json ASDoc files from Falcon
Posted by ah...@apache.org.
bare bones of ASDoc app. Requires json ASDoc files from Falcon
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/055f90b0
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/055f90b0
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/055f90b0
Branch: refs/heads/develop
Commit: 055f90b082358e544744ec3ccdfba1247c03066f
Parents: f7e9ea0
Author: Alex Harui <ah...@apache.org>
Authored: Fri Dec 9 10:41:02 2016 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Dec 9 10:41:02 2016 -0800
----------------------------------------------------------------------
examples/flexjs/ASDoc/build.xml | 53 ++++
examples/flexjs/ASDoc/pom.xml | 81 +++++
examples/flexjs/ASDoc/src/main/flex/ASDoc.mxml | 44 +++
.../ASDoc/src/main/flex/ASDocMainView.mxml | 95 ++++++
.../ASDoc/src/main/flex/DetailRenderer.mxml | 37 +++
.../ASDoc/src/main/flex/SummaryRenderer.mxml | 38 +++
.../main/flex/controllers/ASDocController.as | 72 +++++
.../ASDoc/src/main/flex/models/ASDocModel.as | 309 +++++++++++++++++++
.../src/main/flex/valueObjects/ValueObject.as | 27 ++
9 files changed, 756 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/055f90b0/examples/flexjs/ASDoc/build.xml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ASDoc/build.xml b/examples/flexjs/ASDoc/build.xml
new file mode 100644
index 0000000..3a1336d
--- /dev/null
+++ b/examples/flexjs/ASDoc/build.xml
@@ -0,0 +1,53 @@
+<?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="asdoc" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../../.."/>
+ <property name="example" value="ASDoc" />
+
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+ <property name="opt1_arg" value="-js-output-optimization=skipAsCoercions" />
+
+ <include file="${basedir}/../../build_example.xml" />
+
+ <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">
+ <copy todir="${basedir}/bin/js-debug">
+ <fileset dir="${basedir}/src/main/resources">
+ <include name="**/*.png" />
+ <include name="**/*.jpg" />
+ <include name="**/*.json" />
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="clean">
+ <delete dir="${basedir}/bin" failonerror="false" />
+ <delete dir="${basedir}/bin-debug" failonerror="false" />
+ <delete dir="${basedir}/bin-release" failonerror="false" />
+ <delete dir="${basedir}/target" failonerror="false" />
+ </target>
+
+
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/055f90b0/examples/flexjs/ASDoc/pom.xml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ASDoc/pom.xml b/examples/flexjs/ASDoc/pom.xml
new file mode 100644
index 0000000..691b10d
--- /dev/null
+++ b/examples/flexjs/ASDoc/pom.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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 xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.flex.flexjs.examples</groupId>
+ <artifactId>examples-flexjs</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>ASDoc</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <packaging>swf</packaging>
+
+ <name>Apache Flex - FlexJS: Examples: FlexJS: ASDoc</name>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.flex.flexjs.compiler</groupId>
+ <artifactId>flexjs-maven-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <mainClass>ASDoc.mxml</mainClass>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.adobe.flash.framework</groupId>
+ <artifactId>playerglobal</artifactId>
+ <version>${flash.version}</version>
+ <type>swc</type>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>Network</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <type>swc</type>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/055f90b0/examples/flexjs/ASDoc/src/main/flex/ASDoc.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ASDoc/src/main/flex/ASDoc.mxml b/examples/flexjs/ASDoc/src/main/flex/ASDoc.mxml
new file mode 100644
index 0000000..994cab4
--- /dev/null
+++ b/examples/flexjs/ASDoc/src/main/flex/ASDoc.mxml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+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.
+
+-->
+<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:local="*"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ xmlns:models="models.*"
+ xmlns:controllers="controllers.*"
+ width="900" height="500"
+ >
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+ <js:initialView>
+ <local:ASDocMainView id="mainView" />
+ </js:initialView>
+ <js:model>
+ <models:ASDocModel />
+ </js:model>
+ <js:controller>
+ <controllers:ASDocController />
+ </js:controller>
+ <js:beads>
+ <js:HTTPService id="service">
+ </js:HTTPService>
+ <js:ViewSourceContextMenuOption />
+ </js:beads>
+</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/055f90b0/examples/flexjs/ASDoc/src/main/flex/ASDocMainView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ASDoc/src/main/flex/ASDocMainView.mxml b/examples/flexjs/ASDoc/src/main/flex/ASDocMainView.mxml
new file mode 100644
index 0000000..26c6f18
--- /dev/null
+++ b/examples/flexjs/ASDoc/src/main/flex/ASDocMainView.mxml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+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.
+
+-->
+<js:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ width="100%" height="100%">
+ <fx:Script>
+ <![CDATA[
+ import models.ASDocModel;
+ import org.apache.flex.events.Event;
+
+ public var currentPackage:String;
+
+ private function packageChangedHandler():void
+ {
+ currentPackage = packageList.selectedItem as String;
+ dispatchEvent(new Event("packageChanged"));
+ }
+
+ public var currentClass:String;
+
+ private function classChangedHandler():void
+ {
+ currentClass = classList.selectedItem as String;
+ dispatchEvent(new Event("classChanged"));
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Style>
+ </fx:Style>
+ <js:beads>
+ <js:ViewDataBinding />
+ <js:OneFlexibleChildVerticalLayout flexibleChild="topContainer" />
+ </js:beads>
+ <js:Label text="FlexJS ActionScript Library Reference" width="100%" height="30" style="fontSize:20"/>
+ <js:Container className="topContainer" id="topContainer" width="100%">
+ <js:beads>
+ <js:OneFlexibleChildHorizontalLayout flexibleChild="rightSide" />
+ </js:beads>
+ <js:Container width="300" height="100%" className="leftSide">
+ <js:beads>
+ <js:VerticalLayout />
+ </js:beads>
+ <js:Container className="packages" height="50%" width="100%">
+ <js:List id="packageList" dataProvider="{ASDocModel(applicationModel).packageList}" change="packageChangedHandler()" width="100%" height="100%"/>
+ </js:Container>
+ <js:Container className="classes" height="50%" width="100%">
+ <js:List id="classList" dataProvider="{ASDocModel(applicationModel).classList}" change="classChangedHandler()" width="100%" height="100%"/>
+ </js:Container>
+ </js:Container>
+ <js:Container className="rightSide" id="rightSide" style="verticalAlign:top" height="100%">
+ <js:beads>
+ <js:VerticalLayout />
+ <js:ScrollingViewport />
+ </js:beads>
+ <js:Label id="packageName" text="{ASDocModel(applicationModel).currentPackage}" width="100%"/>
+ <js:Label id="baseName" text="{ASDocModel(applicationModel).currentClass}" width="100%" style="fontSize:20"/>
+ <js:Label id="inheritance" text="{ASDocModel(applicationModel).inheritance}" width="100%"/>
+ <js:Label id="attributes" text="{ASDocModel(applicationModel).attributes}" width="100%"/>
+ <js:MultilineLabel id="description" text="{ASDocModel(applicationModel).description}" width="100%"/>
+ <js:Label text="Public Properties" />
+ <js:List id="publicPropertyList" dataProvider="{ASDocModel(applicationModel).publicProperties}"
+ itemRenderer="SummaryRenderer" width="100%"/>
+ <js:Label text="Public Methods" />
+ <js:List id="publicMethodList" dataProvider="{ASDocModel(applicationModel).publicMethods}"
+ itemRenderer="SummaryRenderer" width="100%"/>
+ <js:Label text="Property Details" />
+ <js:DataContainer id="propertyDetails" dataProvider="{ASDocModel(applicationModel).publicProperties}"
+ itemRenderer="DetailRenderer" width="100%"/>
+ <js:Label text="Constructor Details" />
+ <js:DataContainer id="constructorDetails" dataProvider="{ASDocModel(applicationModel).constructorList}"
+ itemRenderer="DetailRenderer" width="100%"/>
+ <js:Label text="Method Details" />
+ <js:DataContainer id="MethodDetails" dataProvider="{ASDocModel(applicationModel).publicMethods}"
+ itemRenderer="DetailRenderer" width="100%"/>
+ </js:Container>
+ </js:Container>
+</js:View>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/055f90b0/examples/flexjs/ASDoc/src/main/flex/DetailRenderer.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ASDoc/src/main/flex/DetailRenderer.mxml b/examples/flexjs/ASDoc/src/main/flex/DetailRenderer.mxml
new file mode 100644
index 0000000..df8af32
--- /dev/null
+++ b/examples/flexjs/ASDoc/src/main/flex/DetailRenderer.mxml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+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.
+
+-->
+<js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ width="100%">
+ <fx:Script>
+ <![CDATA[
+ import valueObjects.ValueObject;
+ ]]>
+ </fx:Script>
+ <fx:Style>
+ </fx:Style>
+ <js:beads>
+ <js:VerticalLayout />
+ <js:ItemRendererDataBinding />
+ </js:beads>
+ <js:Label width="100%" height="30" style="fontWeight:bold" text="{ValueObject(data).qname}" >
+ </js:Label>
+ <js:MultilineLabel id="description" width="100%" text="{ValueObject(data).description}" />
+</js:MXMLItemRenderer>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/055f90b0/examples/flexjs/ASDoc/src/main/flex/SummaryRenderer.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ASDoc/src/main/flex/SummaryRenderer.mxml b/examples/flexjs/ASDoc/src/main/flex/SummaryRenderer.mxml
new file mode 100644
index 0000000..2e271be
--- /dev/null
+++ b/examples/flexjs/ASDoc/src/main/flex/SummaryRenderer.mxml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+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.
+
+-->
+<js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ width="100%">
+ <fx:Script>
+ <![CDATA[
+ import valueObjects.ValueObject;
+ ]]>
+ </fx:Script>
+ <fx:Style>
+ </fx:Style>
+ <js:beads>
+ <js:VerticalLayout />
+ <js:ItemRendererDataBinding />
+ <js:ItemRendererSimpleBinding sourcePropertyName="shortDescription" destinationID="short" destinationPropertyName="text"/>
+ </js:beads>
+ <js:Label width="100%" height="30" style="fontWeight:bold" text="{ValueObject(data).qname}" >
+ </js:Label>
+ <js:MultilineLabel id="short" width="100%" />
+</js:MXMLItemRenderer>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/055f90b0/examples/flexjs/ASDoc/src/main/flex/controllers/ASDocController.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/ASDoc/src/main/flex/controllers/ASDocController.as b/examples/flexjs/ASDoc/src/main/flex/controllers/ASDocController.as
new file mode 100644
index 0000000..1f2115b
--- /dev/null
+++ b/examples/flexjs/ASDoc/src/main/flex/controllers/ASDocController.as
@@ -0,0 +1,72 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 controllers
+{
+ import org.apache.flex.events.Event;
+
+ import org.apache.flex.core.Application;
+ import org.apache.flex.core.IDocument;
+ import org.apache.flex.net.HTTPService;
+ import org.apache.flex.collections.LazyCollection;
+
+ import models.ASDocModel;
+
+ public class ASDocController implements IDocument
+ {
+ public function ASDocController(app:Application = null)
+ {
+ if (app)
+ {
+ app.addEventListener("viewChanged", viewChangeHandler);
+ }
+ }
+
+ private var model:ASDocModel;
+ private var mainView:ASDocMainView;
+
+ private function viewChangeHandler(event:Event):void
+ {
+ var app:ASDoc = event.target as ASDoc;
+ mainView = app.mainView as ASDocMainView;
+ mainView.addEventListener("packageChanged", packageChangedHandler);
+ mainView.addEventListener("classChanged", classChangedHandler);
+
+ model = app.model as ASDocModel;
+ }
+
+ private function packageChangedHandler(event:Event):void
+ {
+ var sym:String = mainView.currentPackage;
+ model.currentPackage = sym;
+ }
+
+ private function classChangedHandler(event:Event):void
+ {
+ var sym:String = mainView.currentClass;
+ model.currentClass = sym;
+ }
+
+ public function setDocument(document:Object, id:String = null):void
+ {
+ var app:Application = document as Application;
+ app.addEventListener("viewChanged", viewChangeHandler);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/055f90b0/examples/flexjs/ASDoc/src/main/flex/models/ASDocModel.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/ASDoc/src/main/flex/models/ASDocModel.as b/examples/flexjs/ASDoc/src/main/flex/models/ASDocModel.as
new file mode 100644
index 0000000..41c8400
--- /dev/null
+++ b/examples/flexjs/ASDoc/src/main/flex/models/ASDocModel.as
@@ -0,0 +1,309 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 models
+{
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ public class ASDocModel extends EventDispatcher implements IBeadModel
+ {
+ public function ASDocModel()
+ {
+ }
+
+ private var app:ASDoc;
+
+ public function set strand(value:IStrand):void
+ {
+ app = value as ASDoc;
+ app.addEventListener("initialize", initializeHandler);
+
+ }
+
+ private function initializeHandler(event:Event):void
+ {
+ app.service.addEventListener("complete", completeHandler);
+ app.service.url = "classes.json";
+ app.service.send();
+ }
+
+ private var masterData:Object;
+
+ private function completeHandler(event:Event):void
+ {
+ app.service.removeEventListener("complete", completeHandler);
+ masterData = JSON.parse(app.service.data);
+ var packages:Object = {};
+ for each (var classData:Object in masterData.classes)
+ {
+ var packageName:String;
+ var qname:String = classData.name;
+ var c:int = qname.lastIndexOf(".")
+ if (c == -1)
+ packageName = "Top Level";
+ else
+ {
+ packageName = qname.substr(0, c);
+ qname = qname.substr(c + 1);
+ }
+ if (packages[packageName] == null)
+ {
+ packages[packageName] = {};
+ }
+ packages[packageName][qname] = classData;
+ }
+ var arr:Array = [];
+ for (var p:String in packages)
+ {
+ arr.push(p);
+ }
+ arr.sort();
+ _packageList = arr;
+ allPackages = packages;
+ dispatchEvent(new Event("packageListChanged"));
+ }
+
+ private var allPackages:Object;
+
+ private var _packageList:Array;
+
+ [Bindable("packageListChanged")]
+ public function get packageList():Array
+ {
+ return _packageList;
+ }
+
+ private var _currentPackage:String;
+
+ [Bindable("currentPackageChanged")]
+ public function get currentPackage():String
+ {
+ return _currentPackage;
+ }
+
+ public function set currentPackage(value:String):void
+ {
+ if (value != _currentPackage)
+ {
+ _currentPackage = value;
+ var packageData:Object = allPackages[value];
+ var arr:Array = [];
+ for (var p:String in packageData)
+ {
+ arr.push(p);
+ }
+ arr.sort();
+ _classList = arr;
+ dispatchEvent(new Event("currentPackageChanged"));
+ }
+ }
+
+ private var _classList:Array;
+
+ [Bindable("currentPackageChanged")]
+ public function get classList():Array
+ {
+ return _classList;
+ }
+
+ private var _currentClass:String;
+
+ [Bindable("currentClassChanged")]
+ public function get currentClass():String
+ {
+ return _currentClass;
+ }
+
+ public function set currentClass(value:String):void
+ {
+ if (value != _currentClass)
+ {
+ _currentClass = value;
+ var packageData:Object = allPackages[_currentPackage];
+ dispatchEvent(new Event("currentClassChanged"));
+ app.service.addEventListener("complete", completeClassHandler);
+ app.service.url = computeFileName(_currentPackage + "." + _currentClass);
+ app.service.send();
+ _currentClassData = null;
+ }
+ }
+
+ private var _currentClassData:Object;
+
+ private function completeClassHandler(event:Event):void
+ {
+ app.service.removeEventListener("complete", completeClassHandler);
+ var data:Object = JSON.parse(app.service.data);
+ if (_currentClassData == null)
+ {
+ _currentClassData = data;
+ _publicProperties = [];
+ _publicMethods = [];
+ _constructorList = [];
+ }
+ for each (var m:Object in data.members)
+ {
+ m.shortDescription = makeShortDescription(m.description);
+ if (m.type == "method")
+ {
+ if (m.qname == _currentPackage + "." + _currentClass)
+ {
+ _constructorList.push(m);
+ }
+ else
+ _publicMethods.push(m);
+ }
+ else
+ {
+ _publicProperties.push(m);
+ }
+
+ }
+ if (data.type == "class" && data.baseClassname && data.baseClassname.indexOf("flash.") != 0)
+ {
+ app.service.addEventListener("complete", completeClassHandler);
+ app.service.url = computeFileName(data.baseClassname);
+ app.service.send();
+ }
+ else if (data.type == "interface" && data.baseInterfaceNames && data.baseInterfaceNames[0].indexOf("flash.") != 0)
+ {
+ app.service.addEventListener("complete", completeInterfaceHandler);
+ extensions = data.baseInterfaceNames;
+ app.service.url = computeFileName(data.baseInterfaceNames[0]);
+ app.service.send();
+
+ }
+ else
+ {
+ _publicMethods.sortOn("qname");
+ _publicProperties.sortOn("qname");
+ dispatchEvent(new Event("currentDataChanged"));
+ }
+ }
+
+ private function computeFileName(input:String):String
+ {
+ return input.replace(new RegExp("\\.", "g"), "/") + ".json";
+ }
+
+ private function makeShortDescription(input:String):String
+ {
+ var c:int = input.indexOf(".");
+ if (c == -1) return input;
+
+ return input.substr(0, c + 1);
+ }
+
+ private var extensions:Array;
+
+ private function completeInterfaceHandler(event:Event):void
+ {
+ app.service.removeEventListener("complete", completeInterfaceHandler);
+ var data:Object = JSON.parse(app.service.data);
+ if (_currentClassData == null)
+ {
+ _currentClassData = data;
+ _publicProperties = [];
+ _publicMethods = [];
+ _constructorList = [];
+ }
+ for each (var m:Object in data.members)
+ {
+ m.shortDescription = makeShortDescription(m.description);
+ if (m.type == "method")
+ {
+ if (m.qname == _currentPackage + "." + _currentClass)
+ {
+ _constructorList.push(m);
+ }
+ else if (m.qname != data.qname)
+ _publicMethods.push(m);
+ }
+ else
+ {
+ _publicProperties.push(m);
+ }
+
+ }
+ if (data.baseInterfaceNames)
+ extensions = extensions.concat(data.baseInterfaceNames);
+
+ if (extensions.length)
+ {
+ app.service.addEventListener("complete", completeInterfaceHandler);
+ app.service.url = computeFileName(extensions.shift());
+ app.service.send();
+ }
+ else
+ {
+ _publicMethods.sortOn("qname");
+ _publicProperties.sortOn("qname");
+ dispatchEvent(new Event("currentDataChanged"));
+ }
+ }
+
+ private var _publicProperties:Array;
+
+ [Bindable("currentDataChanged")]
+ public function get publicProperties():Array
+ {
+ return _publicProperties;
+ }
+
+ private var _publicMethods:Array;
+
+ [Bindable("currentDataChanged")]
+ public function get publicMethods():Array
+ {
+ return _publicMethods;
+ }
+
+ private var _constructorList:Array;
+
+ [Bindable("currentDataChanged")]
+ public function get constructorList():Array
+ {
+ return _constructorList;
+ }
+
+ [Bindable("currentDataChanged")]
+ public function get description():String
+ {
+ return _currentClassData.description;
+ }
+
+ private var _inheritance:String;
+
+ [Bindable("currentDataChanged")]
+ public function get inheritance():String
+ {
+ return _inheritance;
+ }
+
+ private var _attributes:String;
+
+ [Bindable("currentDataChanged")]
+ public function get attributes():String
+ {
+ return _attributes;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/055f90b0/examples/flexjs/ASDoc/src/main/flex/valueObjects/ValueObject.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/ASDoc/src/main/flex/valueObjects/ValueObject.as b/examples/flexjs/ASDoc/src/main/flex/valueObjects/ValueObject.as
new file mode 100644
index 0000000..b41e451
--- /dev/null
+++ b/examples/flexjs/ASDoc/src/main/flex/valueObjects/ValueObject.as
@@ -0,0 +1,27 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 valueObjects
+{
+ [Bindable]
+ public class ValueObject
+ {
+ public var qname:String;
+ public var description:String;
+ }
+}
\ No newline at end of file