[seam-commits] Seam SVN: r9514 - trunk/src/main/org/jboss/seam/navigation.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Nov 6 01:01:48 EST 2008


Author: shane.bryzak at jboss.com
Date: 2008-11-06 01:01:47 -0500 (Thu, 06 Nov 2008)
New Revision: 9514

Modified:
   trunk/src/main/org/jboss/seam/navigation/Page.java
   trunk/src/main/org/jboss/seam/navigation/Pages.java
   trunk/src/main/org/jboss/seam/navigation/Rule.java
Log:
JBSEAM-2154

Modified: trunk/src/main/org/jboss/seam/navigation/Page.java
===================================================================
--- trunk/src/main/org/jboss/seam/navigation/Page.java	2008-11-06 03:09:55 UTC (rev 9513)
+++ trunk/src/main/org/jboss/seam/navigation/Page.java	2008-11-06 06:01:47 UTC (rev 9514)
@@ -16,7 +16,7 @@
 import org.jboss.seam.core.ResourceLoader;
 import org.jboss.seam.core.Expressions.ValueExpression;
 import org.jboss.seam.security.Identity;
-import org.jboss.seam.util.Faces;
+import org.jboss.seam.util.Strings;
 import org.jboss.seam.web.Pattern;
 
 /**
@@ -45,7 +45,7 @@
    private TaskControl taskControl = new TaskControl();
    private ProcessControl processControl = new ProcessControl();
    private ConversationIdParameter conversationIdParameter;
-   private String eventType;
+   private List<String> eventTypes = new ArrayList<String>();
    private List<Pattern> rewritePatterns = new ArrayList<Pattern>();
    private List<Header> httpHeaders = new ArrayList<Header>();
    
@@ -270,7 +270,7 @@
       
       for ( Input in: getInputs() ) in.in();
       
-      if (eventType!=null)
+      for (String eventType : eventTypes)
       {
          Events.instance().raiseEvent(eventType);
       }
@@ -386,20 +386,23 @@
       this.conversationIdParameter = param;
    }
 
-   public String getEventType()
+   public List<String> getEventTypes()
    {
-      return eventType;
+      return eventTypes;
    }
 
-   public void setEventType(String eventType)
+   public void addEventType(String eventType)
    {
-      this.eventType = eventType;
+      if (!Strings.isEmpty(eventType))
+      {
+         eventTypes.add(eventType);
+      }
    }
-
    
-    public List<Pattern> getRewritePatterns() {
-        return rewritePatterns;
-    }
+   public List<Pattern> getRewritePatterns() 
+   {
+      return rewritePatterns;
+   }
 
     //public void setRewritePatterns(List<String> rewritePatterns) {
     //    this.rewritePatterns = rewritePatterns;

Modified: trunk/src/main/org/jboss/seam/navigation/Pages.java
===================================================================
--- trunk/src/main/org/jboss/seam/navigation/Pages.java	2008-11-06 03:09:55 UTC (rev 9513)
+++ trunk/src/main/org/jboss/seam/navigation/Pages.java	2008-11-06 06:01:47 UTC (rev 9514)
@@ -1217,10 +1217,10 @@
            page.addRewritePattern(pattern.attributeValue("pattern"));
       }
       
-      Element eventElement = element.element("raise-event");
-      if (eventElement!=null)
+      List<Element> events = element.elements("raise-event");
+      for (Element eventElement : events)
       {
-         page.setEventType( eventElement.attributeValue("type") );
+         page.addEventType( eventElement.attributeValue("type") );
       }
       
       Action action = parseAction(element, "action", false);
@@ -1413,10 +1413,10 @@
    
    private static void parseEvent(Element element, Rule rule)
    {
-      Element eventElement = element.element("raise-event");
-      if ( eventElement!=null )
+      List<Element> events = element.elements("raise-event");
+      for (Element eventElement : events)
       {
-         rule.setEventType( eventElement.attributeValue("type") );
+         rule.addEventType( eventElement.attributeValue("type") );
       }
    }
    

Modified: trunk/src/main/org/jboss/seam/navigation/Rule.java
===================================================================
--- trunk/src/main/org/jboss/seam/navigation/Rule.java	2008-11-06 03:09:55 UTC (rev 9513)
+++ trunk/src/main/org/jboss/seam/navigation/Rule.java	2008-11-06 06:01:47 UTC (rev 9514)
@@ -7,6 +7,7 @@
 
 import org.jboss.seam.core.Events;
 import org.jboss.seam.core.Expressions.ValueExpression;
+import org.jboss.seam.util.Strings;
 
 /**
  * Metadata for an &lt;rule/&gt; in pages.xml
@@ -23,7 +24,7 @@
    private TaskControl taskControl = new TaskControl();
    private ProcessControl processControl = new ProcessControl();
    private List<NavigationHandler> navigationHandlers = new ArrayList<NavigationHandler>();
-   private String eventType;
+   private List<String> eventTypes = new ArrayList<String>();
 
    public boolean matches(String actualValue)
    {
@@ -91,7 +92,7 @@
       {
          output.out();
       }
-      if (eventType!=null)
+      for (String eventType : eventTypes)
       {
          Events.instance().raiseEvent(eventType);
       }
@@ -102,13 +103,16 @@
       return false;
    }
 
-   public String getEventType()
+   public List<String> getEventTypes()
    {
-      return eventType;
+      return eventTypes;
    }
 
-   public void setEventType(String event)
+   public void addEventType(String eventType)
    {
-      this.eventType = event;
+      if (!Strings.isEmpty(eventType))
+      {
+         eventTypes.add(eventType);
+      }
    }
 }
\ No newline at end of file




More information about the seam-commits mailing list