royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [royale-asjs] 05/10: need to handle XML separately
Date Thu, 09 Aug 2018 19:30:29 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 1a0c33ff49be3cb504d60be23fe3e1874880d977
Author: Alex Harui <aharui@apache.org>
AuthorDate: Thu Aug 9 11:59:38 2018 -0700

    need to handle XML separately
---
 .../Basic/src/main/resources/basic-manifest.xml    |  1 +
 .../html/supportClasses/TreeXMLItemRenderer.as     | 60 ++++++++++++++++++++++
 2 files changed, 61 insertions(+)

diff --git a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
index f7da4ce..97cc5f7 100644
--- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
@@ -110,6 +110,7 @@
     <component id="DispatchInputFinishedBead" class="org.apache.royale.html.beads.DispatchInputFinishedBead"/>
     <component id="DispatchKeyboardEventBead" class="org.apache.royale.html.beads.DispatchKeyboardEventBead"/>
     <component id="TreeItemRenderer" class="org.apache.royale.html.supportClasses.TreeItemRenderer"/>
+    <component id="TreeXMLItemRenderer" class="org.apache.royale.html.supportClasses.TreeXMLItemRenderer"/>
     <component id="DataItemRenderer" class="org.apache.royale.html.supportClasses.DataItemRenderer"/>
     <component id="MXMLItemRenderer" class="org.apache.royale.html.supportClasses.MXMLItemRenderer"/>
     <component id="DateItemRenderer" class="org.apache.royale.html.supportClasses.DateItemRenderer"/>
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeXMLItemRenderer.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeXMLItemRenderer.as
new file mode 100644
index 0000000..2a7a206
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeXMLItemRenderer.as
@@ -0,0 +1,60 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.royale.html.supportClasses
+{	
+    /**
+     *  JS needs special handling for XML.  It can't do [] lookups.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion Royale 0.0
+     */
+	public class TreeXMLItemRenderer extends TreeItemRenderer
+	{
+		/**
+		 * Constructor.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.0
+		 */
+		public function TreeXMLItemRenderer()
+		{
+			super();
+		}
+		
+        override public function set text(value:String):void
+        {
+            COMPILE::JS
+            {
+                if (value == "undefined")
+                {
+                    if (labelField.charAt(0) == '@')
+                        value = data["attribute"](labelField);
+                    else
+                        value = data["child"](labelField).toString();
+                }
+            }
+            super.text = value;
+        }
+
+	}
+}


Mime
View raw message