You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2018/03/20 21:00:22 UTC

[royale-asjs] branch develop updated (83c355e -> 4628588)

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

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


    from 83c355e  example of how to debug ant task
     new 235c514  Removed warning
     new 4628588  Added InfiniteVScroller

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../ListExample/src/main/royale/MyInitialView.mxml |   4 +
 .../Basic/src/main/resources/basic-manifest.xml    |   1 +
 .../apache/royale/html/beads/InfiniteVScroller.as  | 157 +++++++++++++++++++++
 .../flexUnitTests/KeyboardEventConverterTest.as    |   2 +-
 4 files changed, 163 insertions(+), 1 deletion(-)
 create mode 100644 frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/InfiniteVScroller.as

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

[royale-asjs] 01/02: Removed warning

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 235c5146a8fe04bc581f604d940a2c138ffd5fe2
Author: Harbs <ha...@in-tools.com>
AuthorDate: Tue Mar 20 22:59:36 2018 +0200

    Removed warning
---
 .../Core/src/test/royale/flexUnitTests/KeyboardEventConverterTest.as    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/frameworks/projects/Core/src/test/royale/flexUnitTests/KeyboardEventConverterTest.as b/frameworks/projects/Core/src/test/royale/flexUnitTests/KeyboardEventConverterTest.as
index e7af1a1..39dbe9d 100644
--- a/frameworks/projects/Core/src/test/royale/flexUnitTests/KeyboardEventConverterTest.as
+++ b/frameworks/projects/Core/src/test/royale/flexUnitTests/KeyboardEventConverterTest.as
@@ -70,7 +70,7 @@ package flexUnitTests
                 var nEv:org.apache.royale.events.KeyboardEvent = KeyboardEventConverter.convert(oEv);
                 assertEquals("keyUp", nEv.type);
                 oEv = {"type":"keyDown","keyCode":66,"charCode":66};
-                var nEv:org.apache.royale.events.KeyboardEvent = KeyboardEventConverter.convert(oEv);
+                nEv = KeyboardEventConverter.convert(oEv);
                 assertEquals("keyDown", nEv.type);
             }
         }

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

[royale-asjs] 02/02: Added InfiniteVScroller

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 46285885bda44629db86f66d0a930b31f7595653
Author: Harbs <ha...@in-tools.com>
AuthorDate: Tue Mar 20 23:00:10 2018 +0200

    Added InfiniteVScroller
---
 .../ListExample/src/main/royale/MyInitialView.mxml |   4 +
 .../Basic/src/main/resources/basic-manifest.xml    |   1 +
 .../apache/royale/html/beads/InfiniteVScroller.as  | 157 +++++++++++++++++++++
 3 files changed, 162 insertions(+)

diff --git a/examples/royale/ListExample/src/main/royale/MyInitialView.mxml b/examples/royale/ListExample/src/main/royale/MyInitialView.mxml
index 2019a00..0d3507f 100644
--- a/examples/royale/ListExample/src/main/royale/MyInitialView.mxml
+++ b/examples/royale/ListExample/src/main/royale/MyInitialView.mxml
@@ -62,6 +62,9 @@ limitations under the License.
 			{
 				(applicationModel as ProductsModel).productNames.addItemAt("Wing Bats", 2);
 			}
+			private function onScrollEnd():void{
+				trace("scroll end");
+			}
 		]]>
 	</fx:Script>
 	
@@ -91,6 +94,7 @@ limitations under the License.
 				sourceID="applicationModel"
 				sourcePropertyName="states"
 				destinationPropertyName="dataProvider" />
+			<js:InfiniteVScroller scrollEnd="onScrollEnd()"/>
 		</js:beads>
 	</js:List>
 	
diff --git a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
index 3836d1d..6d00cc9 100644
--- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
@@ -150,6 +150,7 @@
     <component id="ClippingViewport" class="org.apache.royale.html.supportClasses.Viewport" lookupOnly="true" />
     <component id="Viewport" class="org.apache.royale.html.supportClasses.Viewport" />
     <component id="OverflowViewport" class="org.apache.royale.html.supportClasses.OverflowViewport" />
+    <component id="InfiniteVScroller" class="org.apache.royale.html.beads.InfiniteVScroller" />
 
     <component id="ArraySelectionModel" class="org.apache.royale.html.beads.models.ArraySelectionModel" />
     <component id="ArrayListSelectionModel" class="org.apache.royale.html.beads.models.ArrayListSelectionModel" />
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/InfiniteVScroller.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/InfiniteVScroller.as
new file mode 100644
index 0000000..58992c7
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/InfiniteVScroller.as
@@ -0,0 +1,157 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.beads
+{
+	import org.apache.royale.core.IBead;
+	import org.apache.royale.core.IStrand;
+	import org.apache.royale.core.IUIBase;
+	import org.apache.royale.events.EventDispatcher;
+
+	/**
+	 * The scrollEnd event is dispatched scrolled to the bottom.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9.3
+	 */
+    [Event(name="scrollEnd", type="org.apache.royale.events.Event")]
+	
+	/**
+	 * InfiniteVScroller dispatches an event when the component scrolls
+	 * to the bottom to allow loading more content dynamically.
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9.3
+	 */
+	public class InfiniteVScroller extends EventDispatcher implements IBead
+	{
+		/**
+		 * Constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.3
+		 */
+		public function InfiniteVScroller()
+		{
+			super();
+		}
+		
+		protected var _strand:IStrand;
+		
+		/**
+		 * @royaleignorecoercion org.apache.royale.core.IUIBase
+		 */
+		private function get host():IUIBase
+		{
+			return _strand as IUIBase;
+		}
+		
+		private var _offset:Number = 0;
+
+		/**
+		 *  offset specifies how many pixels before the end to dispatch scrollEnd.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.3
+		 */
+		public function get offset():Number
+		{
+			return _offset;
+		}
+
+		public function set offset(value:Number):void
+		{
+			_offset = value;
+		}
+
+		private var _interval:int = 1000;
+
+		/**
+		 *  Minimum number of milliseconds between scrollEnd events.
+		 *  default 1000
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.3
+		 */
+		public function get interval():int
+		{
+			return _interval;
+		}
+
+		public function set interval(value:int):void
+		{
+			_interval = value;
+		}
+
+		/**
+		 *  @copy org.apache.royale.core.IBead#strand
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.3
+		 */
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			COMPILE::JS
+			{
+				host.positioner.addEventListener("scroll", handleScroll);
+			}
+		}
+		COMPILE::JS
+		private var lastTime:int = 0;
+		
+		COMPILE::JS
+		private var lastTop:Number = 0;
+
+		COMPILE::JS
+		private function handleScroll(ev:Object):void
+		{
+			var elem:HTMLElement = host.positioner;
+			// only handle down scrolling
+			var top:Number = elem.scrollTop;
+			if(top < lastTop) //scrolling up
+			{
+				lastTop = top;
+				return;
+			}
+			lastTop = top;
+
+			if(elem.offsetHeight + top >= elem.scrollHeight - _offset)
+			{
+				var time:int = new Date().getTime();
+				if(time - lastTime < _interval)
+					return;
+				lastTime = time;
+				dispatchEvent(new Event("scrollEnd"));
+			}
+		}
+
+	}
+}

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