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
commit 8eeccd3a0f4ff8695367004a212b3904588075f2 Author: Alex Harui <aha...@apache.org> AuthorDate: Sun Feb 4 20:46:46 2018 -0800 more tweaks to ASDoc. Next up details for methods --- .../ASDoc/src/main/royale/ASDocMainView.mxml | 68 +++++++++++++++-- .../ASDoc/src/main/royale/DetailRenderer.mxml | 35 +++++++-- .../ASDoc/src/main/royale/SummaryRenderer.mxml | 75 ++++++++++++++++++- .../ASDoc/src/main/royale/models/ASDocModel.as | 85 +++++++++++++++++++++- .../src/main/royale/valueObjects/ValueObject.as | 4 + 5 files changed, 249 insertions(+), 18 deletions(-) diff --git a/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml b/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml index 5e13dd1..3f40e07 100644 --- a/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml +++ b/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml @@ -104,10 +104,11 @@ limitations under the License. @namespace rs "library://ns.apache.org/royale/site"; .sectionLabel{ + padding-top: 3px; + padding-bottom: 3px; font-size: 16px; font-weight: bold; - background-color: black; - color: white; + background-color: rgb( 253, 171, 125); text-align: center; } @@ -122,6 +123,7 @@ limitations under the License. } .paneTitle { + padding-left: 20px; font-size: 24px; font-weight: bold; background-color: rgb( 253, 171, 125); @@ -146,6 +148,11 @@ limitations under the License. padding-right: 3px; } + .summary { + padding-top:3px; + padding-bottom:3px; + } + .detailCaption { font-weight: bold; width: 80px; @@ -171,6 +178,53 @@ limitations under the License. font-weight: bold; } + .summaryQName { + font-weight: bold; + margin-left: 10px; + margin-top: 3px; + } + .summaryType { + } + .summaryTypeLink { + text-decoration: none; + } + .summaryDescription { + margin-left: 10px; + margin-bottom: 3px; + } + + .summaryList { + margin-bottom: 20px; + border-style: solid; + } + + .detailList { + margin-bottom: 20px; + } + + .property { + padding-left: 20px; + padding-right: 10px; + padding-bottom: 20px; + border-bottom-style: solid; + } + .propertyQName { + font-family: monospace; + } + .propertyType { + font-family: monospace; + } + .propertyQNameTitle { + font-weight: bold; + font-size: 18px; + margin-top: 3px; + margin-right: 3px; + } + .propertyTypeLink { + text-decoration: none; + font-family: monospace; + } + </fx:Style> <fx:Declarations> <fx:Component className="AltBGRenderer"> @@ -260,19 +314,19 @@ limitations under the License. itemRenderer="AttributeRenderer" width="100%"/> <js:MultilineLabel id="description" className="description" text="{ASDocModel(applicationModel).description}" width="100%"/> <js:Label text="Public Properties" className="sectionLabel"/> - <js:List id="publicPropertyList" dataProvider="{ASDocModel(applicationModel).publicProperties}" + <js:List className="summaryList" id="publicPropertyList" dataProvider="{ASDocModel(applicationModel).publicProperties}" itemRenderer="SummaryRenderer" width="100%"/> <js:Label text="Public Methods" className="sectionLabel"/> - <js:List id="publicMethodList" dataProvider="{ASDocModel(applicationModel).publicMethods}" + <js:List className="summaryList" id="publicMethodList" dataProvider="{ASDocModel(applicationModel).publicMethods}" itemRenderer="SummaryRenderer" width="100%"/> <js:Label text="Property Details" className="sectionLabel"/> - <js:DataContainer id="propertyDetails" dataProvider="{ASDocModel(applicationModel).publicProperties}" + <js:DataContainer className="detailList" id="propertyDetails" dataProvider="{ASDocModel(applicationModel).publicProperties}" itemRenderer="DetailRenderer" width="100%"/> <js:Label text="Constructor Details" className="sectionLabel"/> - <js:DataContainer id="constructorDetails" dataProvider="{ASDocModel(applicationModel).constructorList}" + <js:DataContainer className="detailList" id="constructorDetails" dataProvider="{ASDocModel(applicationModel).constructorList}" itemRenderer="DetailRenderer" width="100%"/> <js:Label text="Method Details" className="sectionLabel"/> - <js:DataContainer id="MethodDetails" dataProvider="{ASDocModel(applicationModel).publicMethods}" + <js:DataContainer className="detailList" id="MethodDetails" dataProvider="{ASDocModel(applicationModel).publicMethods}" itemRenderer="DetailRenderer" width="100%"/> </js:Group> </js:Container> diff --git a/examples/royale/ASDoc/src/main/royale/DetailRenderer.mxml b/examples/royale/ASDoc/src/main/royale/DetailRenderer.mxml index cd7fcf3..5cfe8bd 100644 --- a/examples/royale/ASDoc/src/main/royale/DetailRenderer.mxml +++ b/examples/royale/ASDoc/src/main/royale/DetailRenderer.mxml @@ -19,11 +19,22 @@ 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="property" width="100%"> <fx:Script> <![CDATA[ import valueObjects.ValueObject; + override public function set data(value:Object):void + { + super.data = value; + if (value.returnhref) + propertyTypeGroup.removeElement(label); + else + propertyTypeGroup.removeElement(link); + } + [Bindable("dataChange")] public function get obj():ValueObject { @@ -37,9 +48,23 @@ limitations under the License. <js:VerticalFlexLayout /> <js:ItemRendererDataBinding /> </js:beads> - <js:Spacer height="2"/> - <js:Label width="100%" style="fontWeight:bold;text-indent:10px" text="{obj.qname}"/> - <js:Spacer height="2"/> - <js:MultilineLabel id="description" width="100%" text="{obj.description}" style="text-indent:5px"/> - <js:Spacer height="7"/> + <js:Group> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + <js:Label className="propertyQNameTitle" text="{obj.qname}"/> + <js:Label text="property"/> + </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 id="label" className="propertyType" text="{ValueObject(data).return}" /> + <html:A id="link" className="propertyTypeLink" text="{ValueObject(data).return}" href="{ValueObject(data).returnhref}" /> + </js:Group> + <js:DataContainer id="attributes" className="attributeList" dataProvider="{ValueObject(data).attributes}" + itemRenderer="AttributeRenderer" width="100%"/> + <js:MultilineLabel id="description" width="100%" text="{obj.description}"/> </js:MXMLItemRenderer> diff --git a/examples/royale/ASDoc/src/main/royale/SummaryRenderer.mxml b/examples/royale/ASDoc/src/main/royale/SummaryRenderer.mxml index 4778b0e..849e154 100644 --- a/examples/royale/ASDoc/src/main/royale/SummaryRenderer.mxml +++ b/examples/royale/ASDoc/src/main/royale/SummaryRenderer.mxml @@ -19,10 +19,71 @@ 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> @@ -30,9 +91,15 @@ limitations under the License. <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:Group id="typeGroup"> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + <js:Label className="summaryQName" text="{ValueObject(data).qname}" /> + <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/models/ASDocModel.as b/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as index 10e9d8d..3feeb6a 100644 --- a/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as +++ b/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as @@ -221,11 +221,19 @@ package models _constructorList.push(m); } else if (m.qname != data.qname) - _publicMethods.push(m); + addIfNeededAndMakeAttributes(_publicMethods, m); } else { - _publicProperties.push(m); + addIfNeededAndMakeAttributes(_publicProperties, m); + } + if (masterData.classnames.indexOf(m.return) != -1) + { + var href:String = m.return; + var c:int = href.lastIndexOf("."); + if (c != -1) + href = href.substr(0, c) + "/" + href.substr(c + 1); + m.returnhref = "#!" +href; } } @@ -259,6 +267,79 @@ package models } } + private function addIfNeededAndMakeAttributes(arr:Array, data:Object):void + { + var n:int = arr.length; + for (var i:int = 0; i < n; i++) + { + var obj:Object = arr[i]; + if (obj.qname == data.qname) + { + // if no description and the base definition has one + // then use base description + if (obj.description == "" && data.description != "") + { + addAttributes(data, data); + arr.splice(i, 1, data); + } + else + { + addAttributes(obj, data); + } + return; + } + } + addAttributes(data, data); + arr.push(data); + } + + private function addAttributes(dest:Object, src:Object):void + { + if (!src.tags) return; + + var arr:Array; + if (!dest.attributes) + { + dest.attributes = []; + } + arr = dest.attributes; + var map:Object = {}; + for (var tag:Object in arr) + { + map[tag.name] = tag.value; + } + var n:int = src.tags.length; + for (var i:int = 0; i < n; i++) + { + tag = src.tags[i]; + var obj:Object = {}; + var k:String = tagNameMap[tag.tagName]; + if (k != null) + obj.name = k; + else + obj.name = tag.tagName; + var s:String = ""; + var firstOne:Boolean = true; + var o:Array = tag.values; + for each (var q:String in o) + { + if (!firstOne) + s += ", "; + firstOne = false; + s += q; + } + if (map[obj.name]) + { + map[obj.name].value += "," + s; + } + else + { + obj.value = s; + arr.push(obj); + } + } + } + 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 d933326..3d76999 100644 --- a/examples/royale/ASDoc/src/main/royale/valueObjects/ValueObject.as +++ b/examples/royale/ASDoc/src/main/royale/valueObjects/ValueObject.as @@ -22,6 +22,10 @@ package valueObjects public class ValueObject { public var qname:String; + public var shortDescription:String; public var description:String; + public var return:String; + public var returnhref:String; + public var attributes:Array; } } -- To stop receiving notification emails like this one, please contact aha...@apache.org.