You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/02/05 09:16:59 UTC
[royale-asjs] branch develop updated: handle events
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 1fcfd72 handle events
1fcfd72 is described below
commit 1fcfd72ee75b49854ab837bb23d0ec770ae010ee
Author: Alex Harui <ah...@apache.org>
AuthorDate: Mon Feb 5 01:16:51 2018 -0800
handle events
---
.../ASDoc/src/main/royale/ASDocMainView.mxml | 21 +++++
.../ASDoc/src/main/royale/EventDetailRenderer.mxml | 69 ++++++++++++++++
.../src/main/royale/EventSummaryRenderer.mxml | 93 ++++++++++++++++++++++
.../ASDoc/src/main/royale/ParameterRenderer.as | 2 +-
.../ASDoc/src/main/royale/models/ASDocModel.as | 48 ++++++++++-
.../src/main/royale/valueObjects/ValueObject.as | 2 +
6 files changed, 232 insertions(+), 3 deletions(-)
diff --git a/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml b/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml
index 7441546..e45ec0c 100644
--- a/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml
+++ b/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml
@@ -236,6 +236,21 @@ limitations under the License.
font-family: monospace;
}
+ .eventQName {
+ font-weight: bold;
+ }
+ .eventLink {
+ text-decoration: none;
+ }
+
+ .eventSummaryQName {
+ font-weight: bold;
+ width: 120px;
+ margin-left: 10px;
+ margin-right: 10px;
+ margin-top: 3px;
+ }
+
</fx:Style>
<fx:Declarations>
<fx:Component className="AltBGRenderer">
@@ -330,6 +345,9 @@ limitations under the License.
<js:Label text="Public Methods" className="sectionLabel"/>
<js:List className="summaryList" id="publicMethodList" dataProvider="{ASDocModel(applicationModel).publicMethods}"
itemRenderer="MethodSummaryRenderer" width="100%"/>
+ <js:Label text="Events" className="sectionLabel"/>
+ <js:List className="summaryList" id="publicEventList" dataProvider="{ASDocModel(applicationModel).publicEvents}"
+ itemRenderer="EventSummaryRenderer" width="100%"/>
<js:Label text="Property Details" className="sectionLabel"/>
<js:DataContainer className="detailList" id="propertyDetails" dataProvider="{ASDocModel(applicationModel).publicProperties}"
itemRenderer="PropertyDetailRenderer" width="100%"/>
@@ -339,6 +357,9 @@ limitations under the License.
<js:Label text="Method Details" className="sectionLabel"/>
<js:DataContainer className="detailList" id="MethodDetails" dataProvider="{ASDocModel(applicationModel).publicMethods}"
itemRenderer="MethodDetailRenderer" width="100%"/>
+ <js:Label text="Event Details" className="sectionLabel"/>
+ <js:DataContainer className="detailList" id="EventDetails" dataProvider="{ASDocModel(applicationModel).publicEvents}"
+ itemRenderer="EventDetailRenderer" width="100%"/>
</js:Group>
</js:Container>
</js:Group>
diff --git a/examples/royale/ASDoc/src/main/royale/EventDetailRenderer.mxml b/examples/royale/ASDoc/src/main/royale/EventDetailRenderer.mxml
new file mode 100644
index 0000000..c5aa3a1
--- /dev/null
+++ b/examples/royale/ASDoc/src/main/royale/EventDetailRenderer.mxml
@@ -0,0 +1,69 @@
+<?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="property"
+ width="100%">
+ <fx:Script>
+ <![CDATA[
+ import valueObjects.ValueObject;
+
+ override public function set data(value:Object):void
+ {
+ super.data = value;
+ if (value.typehref)
+ eventTypeGroup.removeElement(label);
+ else
+ eventTypeGroup.removeElement(link);
+ }
+
+ [Bindable("dataChange")]
+ public function get obj():ValueObject
+ {
+ return data as ValueObject;
+ }
+ ]]>
+ </fx:Script>
+ <fx:Style>
+ </fx:Style>
+ <js:beads>
+ <js:VerticalFlexLayout />
+ <js:ItemRendererDataBinding />
+ </js:beads>
+ <js:Group>
+ <js:beads>
+ <js:HorizontalLayout />
+ </js:beads>
+ <js:Label className="propertyQNameTitle" text="{obj.qname}"/>
+ <js:Label text="event"/>
+ </js:Group>
+ <js:Group id="eventTypeGroup" className="eventTypeGroup">
+ <js:beads>
+ <js:HorizontalLayout />
+ </js:beads>
+ <js:Label className="eventQName" text="Event Object Type:" />
+ <js:Label id="label" className="eventType" text="{ValueObject(data).type}" />
+ <html:A id="link" className="eventTypeLink" text="{ValueObject(data).type}" href="{ValueObject(data).typehref}" />
+ </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/EventSummaryRenderer.mxml b/examples/royale/ASDoc/src/main/royale/EventSummaryRenderer.mxml
new file mode 100644
index 0000000..2a3b8aa
--- /dev/null
+++ b/examples/royale/ASDoc/src/main/royale/EventSummaryRenderer.mxml
@@ -0,0 +1,93 @@
+<?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 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="eventSummaryQName" text="{ValueObject(data).qname}" />
+ <js:Label id="label" className="eventDescription" text="{ValueObject(data).shortDescription}" />
+ </js:Group>
+</js:MXMLItemRenderer>
diff --git a/examples/royale/ASDoc/src/main/royale/ParameterRenderer.as b/examples/royale/ASDoc/src/main/royale/ParameterRenderer.as
index 3712d0a..6bd7203 100644
--- a/examples/royale/ASDoc/src/main/royale/ParameterRenderer.as
+++ b/examples/royale/ASDoc/src/main/royale/ParameterRenderer.as
@@ -54,7 +54,7 @@ import org.apache.royale.html.DataContainer;
}
var html:String = "<span class='paramName'>" + data.name + ":</span>";
if (data.typehref)
- html += "<a href='#!" + data.typehref + "' class='paramLink'>" + data.type + "</a>";
+ html += "<a href='" + data.typehref + "' class='paramLink'>" + data.type + "</a>";
else
html += "<span class='paramType'>" + data.type + "</span>";
if (!last)
diff --git a/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as b/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as
index 6168d10..86e1d5b 100644
--- a/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as
+++ b/examples/royale/ASDoc/src/main/royale/models/ASDocModel.as
@@ -203,6 +203,7 @@ package models
_currentClassData = data;
_publicProperties = [];
_publicMethods = [];
+ _publicEvents = [];
_constructorList = [];
_baseClassList = [];
_inheritance = null;
@@ -240,6 +241,22 @@ package models
}
}
+ for each (m in data.events)
+ {
+ m.shortDescription = makeShortDescription(m.description);
+ addIfNeededAndMakeAttributes(_publicEvents, m);
+ if (masterData.classnames.indexOf(m.type) != -1)
+ {
+ href = m.type;
+ c = href.lastIndexOf(".");
+ if (c != -1)
+ {
+ m.type = href.substr(c + 1);
+ href = href.substr(0, c) + "/" + href.substr(c + 1);
+ }
+ m.typehref = "#!" +href;
+ }
+ }
for each (m in data.tags)
{
if (!_attributesMap[m.tagName])
@@ -265,6 +282,7 @@ package models
else
{
_publicMethods.sortOn("qname");
+ _publicEvents.sortOn("qname");
_publicProperties.sortOn("qname");
dispatchEvent(new Event("currentDataChanged"));
}
@@ -397,6 +415,7 @@ package models
_currentClassData = data;
_publicProperties = [];
_publicMethods = [];
+ _publicEvents = [];
_constructorList = [];
_baseClassList = [];
_inheritance = null;
@@ -415,14 +434,30 @@ package models
_constructorList.push(m);
}
else if (m.qname != data.qname)
- _publicMethods.push(m);
+ addIfNeededAndMakeAttributes(_publicMethods, m);
}
else
{
- _publicProperties.push(m);
+ addIfNeededAndMakeAttributes(_publicProperties, m);
}
}
+ for each (m in data.events)
+ {
+ m.shortDescription = makeShortDescription(m.description);
+ addIfNeededAndMakeAttributes(_publicEvents, m);
+ if (masterData.classnames.indexOf(m.type) != -1)
+ {
+ var href:String = m.type;
+ var c:int = href.lastIndexOf(".");
+ if (c != -1)
+ {
+ m.type = href.substr(c + 1);
+ href = href.substr(0, c) + "/" + href.substr(c + 1);
+ }
+ m.typehref = "#!" +href;
+ }
+ }
for each (m in data.tags)
{
if (!_attributesMap[m.tagName])
@@ -445,6 +480,7 @@ package models
else
{
_publicMethods.sortOn("qname");
+ _publicEvents.sortOn("qname");
_publicProperties.sortOn("qname");
dispatchEvent(new Event("currentDataChanged"));
}
@@ -474,6 +510,14 @@ package models
return _constructorList;
}
+ private var _publicEvents:Array;
+
+ [Bindable("currentDataChanged")]
+ public function get publicEvents():Array
+ {
+ return _publicEvents;
+ }
+
[Bindable("currentDataChanged")]
public function get description():String
{
diff --git a/examples/royale/ASDoc/src/main/royale/valueObjects/ValueObject.as b/examples/royale/ASDoc/src/main/royale/valueObjects/ValueObject.as
index bbf20ad..81d2772 100644
--- a/examples/royale/ASDoc/src/main/royale/valueObjects/ValueObject.as
+++ b/examples/royale/ASDoc/src/main/royale/valueObjects/ValueObject.as
@@ -28,5 +28,7 @@ package valueObjects
public var returnhref:String;
public var attributes:Array;
public var params:Array;
+ public var type:String;
+ public var typehref:String;
}
}
--
To stop receiving notification emails like this one, please contact
aharui@apache.org.