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 eeb9e4a more tweaks to ASDoc eeb9e4a is described below commit eeb9e4ae2ec4facca7b5e66041baa360ec3fea8d Author: Alex Harui <aha...@apache.org> AuthorDate: Fri Feb 2 16:46:03 2018 -0800 more tweaks to ASDoc --- .../ASDoc/src/main/royale/ASDocMainView.mxml | 32 +++++++++- .../royale/OptionalHashAnchorStringItemRenderer.as | 74 ++++++++++++++++++++++ .../ASDoc/src/main/royale/models/ASDocModel.as | 21 ++++-- 3 files changed, 119 insertions(+), 8 deletions(-) diff --git a/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml b/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml index 9c82fc3..1f82076 100644 --- a/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml +++ b/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml @@ -131,6 +131,10 @@ limitations under the License. text-decoration: none; } + .detailCaption { + font-weight: bold; + } + </fx:Style> <fx:Declarations> <fx:Component className="AltBGRenderer"> @@ -190,8 +194,32 @@ limitations under the License. <js:VerticalLayout /> </js:beads> <js:Label className="paneTitle" id="baseName" text="{ASDocModel(applicationModel).currentClass}" width="100%" style="fontSize:20"/> - <js:Label id="packageName" text="{ASDocModel(applicationModel).currentPackage}" width="100%"/> - <js:Label id="inheritance" text="{ASDocModel(applicationModel).inheritance}" width="100%"/> + <js:Group> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + <js:Label className="detailCaption" text="Package" /> + <js:Label className="detailInfo" id="packageName" text="{ASDocModel(applicationModel).currentPackage}" /> + </js:Group> + <js:Group> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + <js:Label className="detailCaption" text="Class" /> + <js:Label className="detailInfo" text="{ASDocModel(applicationModel).currentClass}" /> + </js:Group> + <js:Group> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + <js:Label className="detailCaption" text="Inheritance" /> + <js:List className="detailInfo" id="inheritance" dataProvider="{ASDocModel(applicationModel).inheritance}" + itemRenderer="OptionalHashAnchorStringItemRenderer" labelField="label"> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + </js:List> + </js:Group> <js:MultilineLabel id="attributes" text="{ASDocModel(applicationModel).attributes}" width="100%"/> <js:MultilineLabel id="description" text="{ASDocModel(applicationModel).description}" width="100%"/> <js:Label text="Public Properties" className="sectionLabel"/> diff --git a/examples/royale/ASDoc/src/main/royale/OptionalHashAnchorStringItemRenderer.as b/examples/royale/ASDoc/src/main/royale/OptionalHashAnchorStringItemRenderer.as new file mode 100644 index 0000000..22f1df4 --- /dev/null +++ b/examples/royale/ASDoc/src/main/royale/OptionalHashAnchorStringItemRenderer.as @@ -0,0 +1,74 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.List; + + /** + * The OptionalHashAnchorStringItemRenderer class displays data in string form using the data's toString() + * function. It assumes the data is a class and + * sets up the renderer so the controller logic will open the right document. On JS, by + * using anchor tags, it should allow the browser to dictate permalinks and allow + * search engines to crawl the app. If no href is available, then no anchor is used. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + public class OptionalHashAnchorStringItemRenderer extends StringItemRenderer + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + public function OptionalHashAnchorStringItemRenderer() + { + typeNames += " HashAnchorStringItemRenderer" + } + + override public function set text(value:String):void + { + var last:Boolean = false; + if (itemRendererParent) + { + var n:int = (itemRendererParent as List).dataProvider.length; + last = n == index + 1; + } + COMPILE::SWF + { + textField.text = value; + } + COMPILE::JS + { + var href:String = data.href; + if (!href) + this.element.innerHTML = value + (last ? "" : " -> "); + else + this.element.innerHTML = "<a href='#!" + href + "' class='HashAnchorAnchor'>" + value + "</a>" + (last ? "" : " -> "); + } + } + + } +} diff --git a/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as b/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as index cf13d92..76de577 100644 --- a/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as +++ b/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as @@ -367,22 +367,31 @@ package models return _currentClassData.description; } - private var _inheritance:String; + private var _inheritance:Array; [Bindable("currentDataChanged")] - public function get inheritance():String + public function get inheritance():Array { if (!_inheritance) { - var s:String = "extends "; + var s:Array; if (_baseClassList.length == 0) - s += "Object"; + s = [{label: currentClass}, { label: "Object"}]; else { - s += _baseClassList.shift(); + s = [{label: currentClass}]; for each (var p:String in _baseClassList) { - s += "-> " + p; + var end:String = p; + var c:int = end.lastIndexOf("."); + if (c != -1) + end = end.substr(c + 1); + var data:Object = {label: end }; + if (masterData.classnames.indexOf(p) != -1) + { + data.href = p; + } + s.push(data); } } _inheritance = s; -- To stop receiving notification emails like this one, please contact aha...@apache.org.