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 2020/01/26 10:01:26 UTC

[royale-asjs] branch feature/router updated: More stubs

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

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


The following commit(s) were added to refs/heads/feature/router by this push:
     new 0be84a6  More stubs
0be84a6 is described below

commit 0be84a65c1b34eb64c12babd68570e29db0dff91
Author: Harbs <ha...@in-tools.com>
AuthorDate: Sun Jan 26 11:58:17 2020 +0200

    More stubs
---
 .../{ParameterRouting.as => ComponentRoute.as}     | 39 +++++++++++-----------
 .../routing/{LinkRouting.as => LinkInterceptor.as} |  4 +--
 .../{ParameterRouting.as => ParameterRoute.as}     | 34 ++++++++-----------
 ...outeNeedsParameters.as => RouteToParameters.as} | 29 ++++++++++++++--
 4 files changed, 62 insertions(+), 44 deletions(-)

diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/ParameterRouting.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/ComponentRoute.as
similarity index 63%
copy from frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/ParameterRouting.as
copy to frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/ComponentRoute.as
index 19e1056..ee317ef 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/ParameterRouting.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/ComponentRoute.as
@@ -18,29 +18,28 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.routing
 {
-  import org.apache.royale.core.Bead;
-  import org.apache.royale.core.IStrand;
-  import org.apache.royale.events.ValueEvent;
-
-  public class ParameterRouting extends Bead
+  import org.apache.royale.core.IUIBase;
+  /**
+   * ComponentRoutes are declared in RouteToComponent beads.
+   * This maps a base name of a route path to a component class.
+   */
+  public class ComponentRoute
   {
-    public function ParameterRouting()
+    public function ComponentRoute()
     {
       
     }
-    override public function set strand(value:IStrand):void
-    {
-      _strand = value;
-      listenOnStrand("hashReceived",parseHash)
-      listenOnStrand("hashNeeded",buildHash)
-    }
-    private function buildHash(ev:ValueEvent):void
-    {
-
-    }
-    private function parseHash(ev:ValueEvent):void
-    {
-
-    }
+    /**
+     * The component class to attach to the parent. I new one is instantiated each time we have a new route.
+     */
+    public var component:Class;
+    /**
+     * This is the base name (leaf) of the route path.
+     */
+    public var baseName:String;
+    /**
+     * The parent to add the component to. (Defaults to the strand of the router.)
+     */
+    public var parent:IUIBase;
   }
 }
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/LinkRouting.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/LinkInterceptor.as
similarity index 95%
rename from frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/LinkRouting.as
rename to frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/LinkInterceptor.as
index 77e5147..585c78c 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/LinkRouting.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/LinkInterceptor.as
@@ -22,9 +22,9 @@ package org.apache.royale.routing
   import org.apache.royale.core.IStrand;
   import org.apache.royale.events.Event;
 
-  public class LinkRouting extends Bead
+  public class LinkInterceptor extends Bead
   {
-    public function LinkRouting()
+    public function LinkInterceptor()
     {
       
     }
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/ParameterRouting.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/ParameterRoute.as
similarity index 67%
rename from frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/ParameterRouting.as
rename to frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/ParameterRoute.as
index 19e1056..0184a28 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/ParameterRouting.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/ParameterRoute.as
@@ -18,29 +18,23 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.routing
 {
-  import org.apache.royale.core.Bead;
-  import org.apache.royale.core.IStrand;
-  import org.apache.royale.events.ValueEvent;
-
-  public class ParameterRouting extends Bead
+  /**
+   * ParameterRoutes are declared in (or added to) RouteToParamter beads.
+   * If the key exists in thge parameters, the callback will be called with the value as the argument to the function.
+   */
+  public class ParameterRoute
   {
-    public function ParameterRouting()
+    public function ParameterRoute()
     {
       
     }
-    override public function set strand(value:IStrand):void
-    {
-      _strand = value;
-      listenOnStrand("hashReceived",parseHash)
-      listenOnStrand("hashNeeded",buildHash)
-    }
-    private function buildHash(ev:ValueEvent):void
-    {
-
-    }
-    private function parseHash(ev:ValueEvent):void
-    {
-
-    }
+    /**
+     * Parameter key to use
+     */
+    public var key:String;
+    /**
+     * Function to call if the parameter exists. (The value is supplied as an argument.)
+     */
+    public var callback:Function;
   }
 }
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/RouteNeedsParameters.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/RouteToParameters.as
similarity index 75%
rename from frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/RouteNeedsParameters.as
rename to frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/RouteToParameters.as
index 878d243..f9a9072 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/RouteNeedsParameters.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/RouteToParameters.as
@@ -19,13 +19,38 @@
 package org.apache.royale.routing
 {
   import org.apache.royale.core.Bead;
+  import org.apache.royale.events.ValueEvent;
+  import org.apache.royale.core.IStrand;
 
-  public class RouteNeedsParameters extends Bead
+  [DefaultProperty("routes")]
+  public class RouteToParameters extends Bead
   {
-    public function RouteNeedsParameters()
+    public function RouteToParameters()
     {
       
     }
+    override public function set strand(value:IStrand):void
+    {
+      _strand = value;
+      listenOnStrand("hashNeeded",hashNeeded);
+      listenOnStrand("hashReceived",hashReceived);
+      listenOnStrand("stateChange",stateChanged)
+    }
+    private function hashNeeded(ev:ValueEvent):void
+    {
+
+    }
+
+    private function hashReceived(ev:ValueEvent):void
+    {
+      
+    }
+    private function stateChanged():void
+    {
+
+    }
+    public var routes:Array;
+
     // private function buildParameterString():String{
     //   var retVal:String = "";
     //   if(_routeState.parameters){