This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 7c9d517  more tweaks
7c9d517 is described below

commit 7c9d51794c2f995125683c39edb118ed838c52a7
Author: Alex Harui <aha...@apache.org>
AuthorDate: Sun Feb 4 23:45:26 2018 -0800

    more tweaks
---
 .../ASDoc/src/main/royale/ASDocMainView.mxml       |  19 +++-
 ...tailRenderer.mxml => MethodDetailRenderer.mxml} |  11 +-
 .../src/main/royale/MethodSummaryRenderer.mxml     | 112 +++++++++++++++++++++
 .../ASDoc/src/main/royale/ParameterRenderer.as     |  73 ++++++++++++++
 ...ilRenderer.mxml => PropertyDetailRenderer.mxml} |   0
 .../ASDoc/src/main/royale/models/ASDocModel.as     |  38 ++++++-
 .../src/main/royale/valueObjects/ValueObject.as    |   1 +
 7 files changed, 245 insertions(+), 9 deletions(-)

diff --git a/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml 
b/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml
index 3f40e07..7441546 100644
--- a/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml
+++ b/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml
@@ -225,6 +225,17 @@ limitations under the License.
                font-family: monospace;
         }
         
+        .paramName {
+               font-family: monospace;
+        }
+        .paramType {
+               font-family: monospace;
+        }
+        .paramLink {
+            text-decoration: none;
+               font-family: monospace;
+        }
+        
        </fx:Style>
        <fx:Declarations>
                <fx:Component className="AltBGRenderer">
@@ -318,16 +329,16 @@ limitations under the License.
                             itemRenderer="SummaryRenderer" width="100%"/>
                    <js:Label text="Public Methods" className="sectionLabel"/>
                    <js:List className="summaryList" id="publicMethodList" 
dataProvider="{ASDocModel(applicationModel).publicMethods}" 
-                            itemRenderer="SummaryRenderer" width="100%"/>
+                            itemRenderer="MethodSummaryRenderer" width="100%"/>
                    <js:Label text="Property Details" className="sectionLabel"/>
                    <js:DataContainer className="detailList" 
id="propertyDetails" 
dataProvider="{ASDocModel(applicationModel).publicProperties}" 
-                                     itemRenderer="DetailRenderer" 
width="100%"/>
+                                     itemRenderer="PropertyDetailRenderer" 
width="100%"/>
                    <js:Label text="Constructor Details" 
className="sectionLabel"/>
                    <js:DataContainer className="detailList" 
id="constructorDetails" 
dataProvider="{ASDocModel(applicationModel).constructorList}" 
-                                     itemRenderer="DetailRenderer" 
width="100%"/>
+                                     itemRenderer="MethodDetailRenderer" 
width="100%"/>
                    <js:Label text="Method Details" className="sectionLabel"/>
                    <js:DataContainer className="detailList" id="MethodDetails" 
dataProvider="{ASDocModel(applicationModel).publicMethods}" 
-                                     itemRenderer="DetailRenderer" 
width="100%"/>
+                                     itemRenderer="MethodDetailRenderer" 
width="100%"/>
                </js:Group>
         </js:Container>
     </js:Group>        
diff --git a/examples/royale/ASDoc/src/main/royale/DetailRenderer.mxml 
b/examples/royale/ASDoc/src/main/royale/MethodDetailRenderer.mxml
similarity index 88%
copy from examples/royale/ASDoc/src/main/royale/DetailRenderer.mxml
copy to examples/royale/ASDoc/src/main/royale/MethodDetailRenderer.mxml
index 5cfe8bd..e269966 100644
--- a/examples/royale/ASDoc/src/main/royale/DetailRenderer.mxml
+++ b/examples/royale/ASDoc/src/main/royale/MethodDetailRenderer.mxml
@@ -53,14 +53,21 @@ limitations under the License.
         <js:HorizontalLayout />
       </js:beads>
       <js:Label className="propertyQNameTitle" text="{obj.qname}"/>
-      <js:Label text="property"/>
+      <js:Label text="method"/>
     </js:Group>
     <js:Group id="propertyTypeGroup" className="propertyTypeGroup">
       <js:beads>
         <js:HorizontalLayout />
       </js:beads>
       <js:Label className="propertyQName" text="{ValueObject(data).qname}" />
-      <js:Label text=":" />
+      <js:Label text="(" />
+         <js:DataContainer id="params" 
dataProvider="{ValueObject(data).params}" style="border-style:none"
+            itemRenderer="ParameterRenderer">
+           <js:beads>
+             <js:HorizontalLayout />
+           </js:beads>
+         </js:DataContainer>
+      <js:Label text="):" />
       <js:Label id="label" className="propertyType" 
text="{ValueObject(data).return}" />
       <html:A id="link" className="propertyTypeLink" 
text="{ValueObject(data).return}" href="{ValueObject(data).returnhref}" />
     </js:Group>
diff --git a/examples/royale/ASDoc/src/main/royale/MethodSummaryRenderer.mxml 
b/examples/royale/ASDoc/src/main/royale/MethodSummaryRenderer.mxml
new file mode 100644
index 0000000..00c3688
--- /dev/null
+++ b/examples/royale/ASDoc/src/main/royale/MethodSummaryRenderer.mxml
@@ -0,0 +1,112 @@
+<?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/royale/basic"
+                               xmlns:html="library://ns.apache.org/royale/html"
+                               className="summary"
+                           width="100%">
+    <fx:Script>
+        <![CDATA[
+            import valueObjects.ValueObject;
+            
+                       private var _color0:String = "#fff";
+                       
+                       public function get backgroundColor0():String
+                       {
+                               return _color0;
+                       }
+                       public function set backgroundColor0(value:String):void
+                       {
+                               _color0 = value;
+                       }
+                       
+                       private var _color1:String = "#ffeeee";
+                       
+                       public function get backgroundColor1():String
+                       {
+                               return _color1;
+                       }
+                       public function set backgroundColor1(value:String):void
+                       {
+                               _color1 = value;
+                       }
+                       
+                       private var oddIndex:Boolean;
+
+                       override public function set data(value:Object):void
+                       {
+                               super.data = value;
+                               if (value.returnhref)
+                                       typeGroup.removeElement(label);
+                               else
+                                       typeGroup.removeElement(link);
+                       }
+               
+                       override public function addedToParent():void
+                       {
+                               super.addedToParent();
+       
+                               var index:int = parent.getElementIndex(this);
+                               oddIndex = ((index % 2) == 1)
+                               COMPILE::JS
+                               {
+                                       element.style.backgroundColor = 
oddIndex ? _color1 : _color0;
+                               }
+                       }
+                       
+                       /**
+                        * @private
+                        */
+                       override public function updateRenderer():void
+                       {
+                               super.updateRenderer();
+                               COMPILE::JS
+                               {
+                                       if (element.style.backgroundColor == 
null || element.style.backgroundColor == "")
+                                               element.style.backgroundColor = 
oddIndex ? _color1 : _color0;
+                               }
+                       }
+                       
+               ]]>
+    </fx:Script>
+       <fx:Style>
+       </fx:Style>
+    <js:beads>
+        <js:VerticalLayout />
+        <js:ItemRendererDataBinding />
+    </js:beads>
+    <js:Group id="typeGroup">
+      <js:beads>
+        <js:HorizontalLayout />
+      </js:beads>
+      <js:Label className="summaryQName" text="{ValueObject(data).qname}" />
+      <js:Label text="(" />
+         <js:DataContainer id="params" 
dataProvider="{ValueObject(data).params}" style="border-style:none"
+            itemRenderer="ParameterRenderer">
+           <js:beads>
+             <js:HorizontalLayout />
+           </js:beads>
+         </js:DataContainer>
+      <js:Label text="):" />
+      <js:Label id="label" className="summaryType" 
text="{ValueObject(data).return}" />
+      <html:A id="link" className="summaryTypeLink" 
text="{ValueObject(data).return}" href="{ValueObject(data).returnhref}" />
+    </js:Group>
+    <js:MultilineLabel className="summaryDescription" id="short" width="100%" 
text="{ValueObject(data).shortDescription}"/>
+</js:MXMLItemRenderer>
diff --git a/examples/royale/ASDoc/src/main/royale/ParameterRenderer.as 
b/examples/royale/ASDoc/src/main/royale/ParameterRenderer.as
new file mode 100644
index 0000000..3712d0a
--- /dev/null
+++ b/examples/royale/ASDoc/src/main/royale/ParameterRenderer.as
@@ -0,0 +1,73 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+import  org.apache.royale.html.supportClasses.StringItemRenderer;
+import  org.apache.royale.html.DataContainer;
+
+       /**
+        *  The AttributeRenderer class displays an ASDoc attribute.  
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.0
+        */
+       public class ParameterRenderer extends StringItemRenderer
+       {
+               /**
+                *  constructor.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.0
+                */
+               public function ParameterRenderer()
+               {
+                       typeNames = "AttributeRenderer"
+               }
+
+               override public function set text(value:String):void
+               {
+                       var last:Boolean = false;
+                       if (itemRendererParent)
+                       {
+                               var n:int = (itemRendererParent as 
DataContainer).dataProvider.length;
+                               last = n == index + 1; 
+                       }                       
+                       var html:String = "<span class='paramName'>" + 
data.name + ":</span>";
+                       if (data.typehref)
+                               html += "<a href='#!" + data.typehref + "' 
class='paramLink'>" + data.type + "</a>";
+                       else
+                               html += "<span class='paramType'>" + data.type 
+ "</span>";
+                       if (!last)
+                           html += ", ";
+            COMPILE::SWF
+            {
+                textField.htmlText = value;
+            }
+            COMPILE::JS
+            {
+                this.element.innerHTML = html;
+            }
+               }
+
+       }
+}
diff --git a/examples/royale/ASDoc/src/main/royale/DetailRenderer.mxml 
b/examples/royale/ASDoc/src/main/royale/PropertyDetailRenderer.mxml
similarity index 100%
rename from examples/royale/ASDoc/src/main/royale/DetailRenderer.mxml
rename to examples/royale/ASDoc/src/main/royale/PropertyDetailRenderer.mxml
diff --git a/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as 
b/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as
index 3feeb6a..6168d10 100644
--- a/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as
+++ b/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as
@@ -232,7 +232,10 @@ package models
                     var href:String = m.return;
                     var c:int = href.lastIndexOf(".");
                     if (c != -1)
+                    {
+                       m.return = href.substr(c + 1);
                        href = href.substr(0, c) + "/" + href.substr(c + 1);
+                    }
                     m.returnhref = "#!" +href;
                 }
                     
@@ -290,6 +293,10 @@ package models
                        }
                }
                addAttributes(data, data);
+               if (data.type == "method")
+               {
+                       processParams(data);
+               }
                arr.push(data);
         }
 
@@ -304,14 +311,19 @@ package models
                }
                arr = dest.attributes;
                var map:Object = {};
-               for (var tag:Object in arr)
+               var tag:Object;
+               var n:int = arr.length;
+               for (var i:int = 0; i < n; i++)
                {
+                       tag = arr[i];
                        map[tag.name] = tag.value;
                }
-               var n:int = src.tags.length;
-            for (var i:int = 0; i < n; i++)
+               n = src.tags.length;
+            for (i = 0; i < n; i++)
             {
                tag = src.tags[i];
+               if (map[tag.tagName]) 
+                       continue;
                var obj:Object = {};
                 var k:String = tagNameMap[tag.tagName];
                 if (k != null)
@@ -340,6 +352,26 @@ package models
             }
                }
                
+               private function processParams(data:Object):void
+               {
+                       var n:int = data.params.length;
+                       for (var i:int = 0; i < n; i++)
+                       {
+                               var param:Object = data.params[i];
+                               if (masterData.classnames.indexOf(param.type) 
!= -1)
+                               {
+                    var href:String = param.type;
+                    var c:int = href.lastIndexOf(".");
+                    if (c != -1)
+                    {
+                       param.type = href.substr(c + 1);
+                       href = href.substr(0, c) + "/" + href.substr(c + 1);
+                    }
+                    param.typehref = "#!" +href;
+                               }
+                       }
+               }
+               
         private function computeFileName(input:String):String
         {
             return input.replace(new RegExp("\\.", "g"), "/") + ".json";     
diff --git a/examples/royale/ASDoc/src/main/royale/valueObjects/ValueObject.as 
b/examples/royale/ASDoc/src/main/royale/valueObjects/ValueObject.as
index 3d76999..bbf20ad 100644
--- a/examples/royale/ASDoc/src/main/royale/valueObjects/ValueObject.as
+++ b/examples/royale/ASDoc/src/main/royale/valueObjects/ValueObject.as
@@ -27,5 +27,6 @@ package valueObjects
                public var return:String;
                public var returnhref:String;
                public var attributes:Array;
+               public var params:Array;
        }
 }

-- 
To stop receiving notification emails like this one, please contact
aha...@apache.org.

Reply via email to