incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gcrawf...@apache.org
Subject svn commit: r485957 - in /incubator/adffaces/trunk/trinidad: trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/ trinidad-demo/src/main/webapp/components/...
Date Mon, 11 Dec 2006 23:59:23 GMT
Author: gcrawford
Date: Mon Dec 11 15:59:22 2006
New Revision: 485957

URL: http://svn.apache.org/viewvc?view=rev&rev=485957
Log:
fix for Issue 248: Propose adding a 'visited' attribute to the commandNavigationItem component...

http://issues.apache.org/jira/browse/ADFFACES-248

patch from Pavitra - thanks Pavitra.

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessMenuModel.java
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessUtils.java
    incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CoreCommandNavigationItem.xml
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/page_process_include.jspx
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train.jspx
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train2.jspx
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train3.jspx
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4.jspx
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4a.jspx
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4b.jspx
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4c.jspx
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train5.jspx
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train6.jspx
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train7.jspx
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train8.jspx
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TrainRenderer.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/testScripts/train.xml

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessMenuModel.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessMenuModel.java?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessMenuModel.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessMenuModel.java
Mon Dec 11 15:59:22 2006
@@ -195,6 +195,32 @@
       return ProcessUtils.isReadOnly(this, maxPath, true);
     }
   }
+  
+  /**
+   * For the Max Visited case, a stop is considered visited if
+   *   - a stop is before the max visited stop
+   *   - or is the max visited stop
+   *   
+   * For the Plus One case, a stop is considered visited if, 
+   *   - it's before the current or,
+   *   - is the current stop itself
+   *   
+   * @return
+   */
+  public boolean isVisited()
+  {
+    // Max Visited
+    Object maxPathKey = getMaxPathKey();
+    if ( maxPathKey == null)
+    {
+      return ProcessUtils.isVisited(this, false);
+    }
+    else
+    {
+      Object  maxPath = ProcessUtils.getMaxVisitedRowKey(this, maxPathKey);
+      return ProcessUtils.isVisited(this, maxPath, false);
+    }
+  }  
 
   /**
    * to clear the max visited path out of the session

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessUtils.java?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessUtils.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ProcessUtils.java
Mon Dec 11 15:59:22 2006
@@ -304,7 +304,107 @@
 
     return false;
   }
+  
+  
+  // Plus One case
 
+  /**
+   * For the Plus One case, a stop is considered visited if, 
+   * - it's before the current or,
+   * - is the current stop itself
+   * 
+   * @param model the menuModel instance to use. When the model is passed in, 
+   *  a call to model.getRowKey should return the rowKey for the "current" node.
+   * @param defaultReturnValue if the current and focus nodes aren't
+   *  siblings in the tree, this value will be returned.
+   * @return whether or not the current node has been visited.
+   */
+  public static boolean isVisited(
+    MenuModel model,
+    boolean   defaultReturnValue
+)
+  {
+    Object focusPath = model.getFocusRowKey();
+    Object currPath = model.getRowKey();
+  
+    boolean returnDefault = _hasDifferentAncestors (model, 
+                                                    focusPath,
+                                                    currPath);
+                                                    
+    if (returnDefault)
+    {
+      model.setRowKey(currPath);
+      return defaultReturnValue;
+    }
+                           
+    // current node is active
+    if (focusPath.equals(currPath))
+    {
+      model.setRowKey(currPath);
+      return true;
+    }
+    
+    // nodes before the current node are visited
+    model.setRowKey(focusPath);
+    int focusIndex = model.getRowIndex();
+    model.setRowKey(currPath);
+    int currIndex = model.getRowIndex();
+
+    if (currIndex <= focusIndex)
+      return true;
+
+    return false;
+  }
+
+  /**
+   * For the Max Visited case, a stop is considered visited if
+   *   - a stop is before the active stop
+   *   - or is the active stop
+   *   
+   * @param model the menuModel instance to use. When the model is passed in, a 
+   *  call to model.getRowKey should return the rowKey for the "current" node.
+   * @param maxVisitedRowKey the rowKey to use to determine the max visited node
+   * @param defaultReturnValue if the current, maxVisited and focus nodes aren't
+   *  siblings in the tree, this value will be returned.
+   * @return whether or not the current node has been visited.
+   */
+  public static boolean isVisited (
+    MenuModel model,
+    Object maxVisitedRowKey,
+    boolean defaultReturnValue)
+  {
+    Object focusPath = model.getFocusRowKey();
+    Object currPath = model.getRowKey();
+
+    boolean returnDefault = _hasDifferentAncestors(model,
+                                                   focusPath,
+                                                   currPath,
+                                                   maxVisitedRowKey);
+
+    if (returnDefault)
+    {
+      model.setRowKey(currPath);
+      return defaultReturnValue;
+    }
+
+    // on active node
+    if (focusPath.equals(currPath))
+    {
+      model.setRowKey(currPath);
+      return true;
+    }
+
+    model.setRowKey(maxVisitedRowKey);
+    int maxIndex = model.getRowIndex();
+
+    model.setRowKey(currPath);
+    int currIndex = model.getRowIndex();
+
+    if (currIndex <= maxIndex)
+      return true;
+
+    return false;
+  }
 
   /**
    * Get the rowKey of the max visited node in the respective process.

Modified: incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CoreCommandNavigationItem.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CoreCommandNavigationItem.xml?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CoreCommandNavigationItem.xml
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CoreCommandNavigationItem.xml
Mon Dec 11 15:59:22 2006
@@ -115,6 +115,18 @@
       </property-extension>
     </property>
     <property>
+      <description><![CDATA[whether the item is in visited state. Depending on 
+      the renderer the item may appear in a visited style, if true. This 
+      property is currently used only within the a train component.]]>
+      </description>
+      <property-name>visited</property-name>
+      <property-class>boolean</property-class>
+      <default-value>false</default-value>
+      <property-extension>
+        <mfp:required>false</mfp:required>
+      </property-extension>
+    </property>
+    <property>
       <description><![CDATA[the target frame for the go component.]]></description>
       <property-name>targetFrame</property-name>
       <property-class>java.lang.String</property-class>

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/page_process_include.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/page_process_include.jspx?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/page_process_include.jspx
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/page_process_include.jspx
Mon Dec 11 15:59:22 2006
@@ -38,7 +38,8 @@
                      text="#{foo.label}"
                      action="#{foo.getOutcome}"
                      immediate="#{processPageMenuModel.immediate}"
-                     disabled="#{processPageMenuModel.readOnly}"/>
+                     disabled="#{processPageMenuModel.readOnly}"
+                     visited="#{processTrainMenuModel.visited}"/>
                  </f:facet>
               </tr:train>    
             </f:facet>   

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train.jspx?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train.jspx
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train.jspx
Mon Dec 11 15:59:22 2006
@@ -38,7 +38,8 @@
                 <tr:commandNavigationItem text="#{foo.label}"
                                     action="#{foo.getOutcome}"
                                     immediate="#{processTrainMenuModel.immediate}"
-                                    disabled="#{processTrainMenuModel.readOnly}"/>
+                                    disabled="#{processTrainMenuModel.readOnly}"
+                                    visited="#{processTrainMenuModel.visited}"/>
               </f:facet>
             </tr:train>             
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train2.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train2.jspx?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train2.jspx
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train2.jspx
Mon Dec 11 15:59:22 2006
@@ -35,7 +35,8 @@
                 <tr:commandNavigationItem text="#{foo.label}"
                                     action="#{foo.getOutcome}"
                                     immediate="#{processTrainMenuModel.immediate}"
-                                    disabled="#{processTrainMenuModel.readOnly}"/>
+                                    disabled="#{processTrainMenuModel.readOnly}"
+                                    visited="#{processTrainMenuModel.visited}"/>
               </f:facet>
             </tr:train>                       
           </tr:panelGroupLayout>

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train3.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train3.jspx?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train3.jspx
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train3.jspx
Mon Dec 11 15:59:22 2006
@@ -35,7 +35,8 @@
                 <tr:commandNavigationItem text="#{foo.label}"
                                     action="#{foo.getOutcome}"
                                     immediate="#{processTrainMenuModel.immediate}"
-                                    disabled="#{processTrainMenuModel.readOnly}"/>
+                                    disabled="#{processTrainMenuModel.readOnly}"
+                                    visited="#{processTrainMenuModel.visited}"/>
               </f:facet>
             </tr:train>   
             </tr:panelGroupLayout>

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4.jspx?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4.jspx
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4.jspx
Mon Dec 11 15:59:22 2006
@@ -37,7 +37,8 @@
                 <tr:commandNavigationItem text="#{foo.label}"
                                     action="#{foo.getOutcome}"
                                     immediate="#{processTrainMenuModel.immediate}"
-                                    disabled="#{processTrainMenuModel.readOnly}"/>
+                                    disabled="#{processTrainMenuModel.readOnly}"
+                                    visited="#{processTrainMenuModel.visited}"/>
               </f:facet>
             </tr:train>   
             <tr:commandLink action="guide.train4a" text="Go to subprocess"/>

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4a.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4a.jspx?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4a.jspx
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4a.jspx
Mon Dec 11 15:59:22 2006
@@ -37,7 +37,8 @@
                 <tr:commandNavigationItem text="#{foo.label}"
                                     action="#{foo.getOutcome}"
                                     immediate="#{processTrainMenuModel.immediate}"
-                                    disabled="#{processTrainMenuModel.readOnly}"/>
+                                    disabled="#{processTrainMenuModel.readOnly}"
+                                    visited="#{processTrainMenuModel.visited}"/>
               </f:facet>
             </tr:train>             
           </tr:panelGroupLayout>

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4b.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4b.jspx?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4b.jspx
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4b.jspx
Mon Dec 11 15:59:22 2006
@@ -37,7 +37,8 @@
                 <tr:commandNavigationItem text="#{foo.label}"
                                     action="#{foo.getOutcome}"
                                     immediate="#{processTrainMenuModel.immediate}"
-                                    disabled="#{processTrainMenuModel.readOnly}"/>
+                                    disabled="#{processTrainMenuModel.readOnly}"
+                                    visited="#{processTrainMenuModel.visited}"/>
               </f:facet>
             </tr:train>             
           </tr:panelGroupLayout>

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4c.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4c.jspx?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4c.jspx
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train4c.jspx
Mon Dec 11 15:59:22 2006
@@ -37,7 +37,8 @@
                 <tr:commandNavigationItem text="#{foo.label}"
                                     action="#{foo.getOutcome}"
                                     immediate="#{processTrainMenuModel.immediate}"
-                                    disabled="#{processTrainMenuModel.readOnly}"/>
+                                    disabled="#{processTrainMenuModel.readOnly}"
+                                    visited="#{processTrainMenuModel.visited}"/>
               </f:facet>
             </tr:train> 
             <tr:commandLink action="guide.train4" text="back to main process"/>   
        

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train5.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train5.jspx?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train5.jspx
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train5.jspx
Mon Dec 11 15:59:22 2006
@@ -35,7 +35,8 @@
                 <tr:commandNavigationItem text="#{foo.label}"
                                     action="#{foo.getOutcome}"
                                     immediate="#{processTrainMenuModel.immediate}"
-                                    disabled="#{processTrainMenuModel.readOnly}"/>
+                                    disabled="#{processTrainMenuModel.readOnly}"
+                                    visited="#{processTrainMenuModel.visited}"/>
                                     
               </f:facet>
             </tr:train>             

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train6.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train6.jspx?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train6.jspx
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train6.jspx
Mon Dec 11 15:59:22 2006
@@ -35,7 +35,8 @@
                 <tr:commandNavigationItem text="#{foo.label}"
                                     action="#{foo.getOutcome}"
                                     immediate="#{processTrainMenuModel.immediate}"
-                                    disabled="#{processTrainMenuModel.readOnly}"/>
+                                    disabled="#{processTrainMenuModel.readOnly}"
+                                    visited="#{processTrainMenuModel.visited}"/>
               </f:facet>
             </tr:train>             
            

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train7.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train7.jspx?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train7.jspx
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train7.jspx
Mon Dec 11 15:59:22 2006
@@ -35,7 +35,8 @@
                 <tr:commandNavigationItem text="#{foo.label}"
                                     action="#{foo.getOutcome}"
                                     immediate="#{processTrainMenuModel.immediate}"
-                                    disabled="#{processTrainMenuModel.readOnly}"/>
+                                    disabled="#{processTrainMenuModel.readOnly}"
+                                    visited="#{processTrainMenuModel.visited}"/>
               </f:facet>
             </tr:train>             
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train8.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train8.jspx?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train8.jspx
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/train8.jspx
Mon Dec 11 15:59:22 2006
@@ -37,7 +37,8 @@
                 <tr:commandNavigationItem text="#{foo.label}"
                                     action="#{foo.getOutcome}"
                                     immediate="#{processTrainMenuModel.immediate}"
-                                    disabled="#{processTrainMenuModel.readOnly}"/>
+                                    disabled="#{processTrainMenuModel.readOnly}"
+                                    visited="#{processTrainMenuModel.visited}"/>
               </f:facet>
             </tr:train>             
           </tr:panelGroupLayout>

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TrainRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TrainRenderer.java?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TrainRenderer.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TrainRenderer.java
Mon Dec 11 15:59:22 2006
@@ -908,8 +908,7 @@
         UIComponent      stamp)
     {
       // Save the model state
-      int maxVisitedIndex  = _getMaxVisitedIndex(arc, process);
-      int activeIndex      = _loadStations(process, stamp, maxVisitedIndex);
+      int activeIndex      = _loadStations(process, stamp);
       int visibleStopCount = _getVisibleStopCount(arc);
       
       _formName     = arc.getFormData().getName();
@@ -968,8 +967,7 @@
         UIXProcess  process,
         UIComponent stamp,
         int         index,
-        boolean     active,
-        boolean     visited)
+        boolean     active)
     {
       process.setRowIndex(index);
       if(stamp.isRendered())
@@ -979,39 +977,10 @@
                                   stamp, 
                                   index, 
                                   process.getRowKey(), 
-                                  active, 
-                                  visited));
+                                  active));
       }
     }
 
-    /**
-     * Get the maxVisited attribute from the node and return it.
-     */
-    private int _getMaxVisitedIndex(
-      RenderingContext arc, 
-      UIComponent component)
-    {
-      int maxVisitedIndex = NO_CHILD_INDEX;
-      Integer maxVisited = (Integer) _getMaxVisited(arc, component);
-      if (maxVisited != null)
-      {
-        maxVisitedIndex = maxVisited.intValue();
-      }
-      return maxVisitedIndex;
-    }
-
-    /**
-     * Returns the MAX_VISITED_ATTR
-     * @todo =-=jmw Hopefully we'll be told this someday.
-     */
-    private static Object _getMaxVisited(
-      RenderingContext arc, 
-      UIComponent component)
-    {
-      // return component.getAttributes().get("maxVisited");
-      return null;
-    }
-    
     private int _getVisibleStopCount(RenderingContext arc)
     {
       Object propValue = 
@@ -1090,8 +1059,7 @@
     
     private int _loadStations(
         UIXProcess  process,
-        UIComponent stamp,
-        int         maxVisitedIndex)
+        UIComponent stamp)
     {
       _initialRowKey = process.getRowKey();
       try
@@ -1107,37 +1075,23 @@
         assert activeIndex < count;
         
         _stations = new ArrayList<Station>(count);
-        
+        boolean bActiveStop = false;
+
         // Process visited stations
-        for(; index < activeIndex; index++)
-        {
-          _createStation(process, stamp, index, false, true);
-        }
-        
-        assert index == activeIndex;
-        
-        _createStation(process, stamp, index, true, true);
-        index++;
-        // Might have an invisible active station. Thsi is weird, but still.
-        // You never know what users want to do, but let support 
-        // it nevertheless for now. 
-        // selectedIndex is either the active station index or the index 
-        // of the station just before the selected one if active is not visible.
-        activeIndex = _stations.size() - 1;
-        
-        if(maxVisitedIndex != NO_CHILD_INDEX)
+        for(; index < count; index++)
         {
-          for(; index < maxVisitedIndex; index++)
+          bActiveStop = (index == activeIndex);
+          _createStation(process, stamp, index, bActiveStop);
+          if (bActiveStop)
           {
-            _createStation(process, stamp, index, false, true);
+            // Might have an invisible active station. Thsi is weird, but still.
+            // You never know what users want to do, but let support 
+            // it nevertheless for now. 
+            // selectedIndex is either the active station index or the index 
+            // of the station just before the selected one if active is not visible.
+            activeIndex = _stations.size() - 1;
           }
         }
-        
-        for(; index < count; index++)
-        {
-          _createStation(process, stamp, index, false, false);
-        }
-        
         return activeIndex;
       }
       finally
@@ -1307,15 +1261,14 @@
         UIComponent stamp,
         int         index,
         Object      rowKey,
-        boolean     active,
-        boolean     visited)
+        boolean     active)
     {
       Map<String, Object> attributes = stamp.getAttributes();
       
       _rowIndex    = index;
       _rowKey      = rowKey;
       _active      = active;
-      _visited     = visited;
+      _visited     = _getBooleanAttribute(attributes, "visited", false);
       _disabled    = _getBooleanAttribute(attributes, "disabled", false);
       _parentEnd   = false;
       _parentStart = false;
@@ -1718,7 +1671,7 @@
     private boolean _overflowStart; // Is this station the prev step set link?
     private boolean _parentEnd;    // Is this station a parent end?
     private boolean _parentStart;  // Is this station a parent start?
-    private boolean _visited;      // Is this station visited?
+    private boolean _visited;      // visited attribute
     
     private int _rowIndex; // Row index
     

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/testScripts/train.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/testScripts/train.xml?view=diff&rev=485957&r1=485956&r2=485957
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/testScripts/train.xml
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/testScripts/train.xml
Mon Dec 11 15:59:22 2006
@@ -5,7 +5,9 @@
     <component tr:type="org.apache.myfaces.trinidad.CoreCommandNavigationItem" 
                tr:facet="nodeStamp" 
                text="#{foo.label}"
-               disabled="#{pageList.readOnly}"/>
+               disabled="#{pageList.readOnly}"
+               visited="#{pageList.visited}"
+               immediate="#{pageList.immediate}"/>
   </base-component>
   
 



Mime
View raw message