You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2008/08/06 13:38:23 UTC

svn commit: r683231 - in /myfaces/tobago/trunk: example/sandbox/src/main/webapp/ example/sandbox/src/main/webapp/WEB-INF/ example/sandbox/src/main/webapp/wizard/ example/sandbox/src/main/webapp/wizard/navi/ sandbox/src/main/java/org/apache/myfaces/toba...

Author: lofwyr
Date: Wed Aug  6 04:38:21 2008
New Revision: 683231

URL: http://svn.apache.org/viewvc?rev=683231&view=rev
Log:
TOBAGO-518: Work in progress...
* Refactoring: Remove some attributes

Added:
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/index.jsp
Removed:
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardBackwardNavigationStrategy.java
Modified:
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/navigation.jsp
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/fileIntoCondition.jsp
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/finish.jsp
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/Wizard.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardImpl.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardStep.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardTag.java

Modified: myfaces/tobago/trunk/example/sandbox/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/webapp/WEB-INF/faces-config.xml?rev=683231&r1=683230&r2=683231&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/webapp/WEB-INF/faces-config.xml Wed Aug  6 04:38:21 2008
@@ -39,6 +39,13 @@
   </managed-bean>
 
   <navigation-rule>
+    <navigation-case>
+      <from-outcome>index</from-outcome>
+      <to-view-id>/wizard/index.jsp</to-view-id>
+    </navigation-case>
+  </navigation-rule>
+
+  <navigation-rule>
     <from-view-id>/wizard/bean/single.jsp</from-view-id>
     <navigation-case>
       <from-outcome>wizard</from-outcome>
@@ -55,7 +62,7 @@
   </navigation-rule>
 
   <navigation-rule>
-    <from-view-id>/wizard/navi/*</from-view-id>
+    <from-view-id>/wizard/*</from-view-id>
     <navigation-case>
       <from-outcome>fileIntoCondition</from-outcome>
       <to-view-id>/wizard/navi/fileIntoCondition.jsp</to-view-id>
@@ -74,6 +81,7 @@
     </navigation-case>
   </navigation-rule>
 
+<!--
   <navigation-rule>
     <from-view-id>/wizard/navi/filter.jsp</from-view-id>
     <navigation-case>
@@ -92,30 +100,31 @@
       <from-outcome>next</from-outcome>
       <to-view-id>/wizard/navi/finish.jsp</to-view-id>
     </navigation-case>
+-->
 <!--
     <navigation-case>
       <from-outcome>previous</from-outcome>
       <to-view-id>/wizard/navi/filter.jsp</to-view-id>
     </navigation-case>
 -->
-  </navigation-rule>
+<!--  </navigation-rule>
 
   <navigation-rule>
     <from-view-id>/wizard/navi/forwardCondition.jsp</from-view-id>
     <navigation-case>
       <from-outcome>next</from-outcome>
       <to-view-id>/wizard/navi/finish.jsp</to-view-id>
-    </navigation-case>
+    </navigation-case>-->
 <!--
     <navigation-case>
       <from-outcome>previous</from-outcome>
       <to-view-id>/wizard/navi/filter.jsp</to-view-id>
     </navigation-case>
 -->
-  </navigation-rule>
+<!--  </navigation-rule>
 
   <navigation-rule>
-    <from-view-id>/wizard/navi/finish.jsp</from-view-id>
+    <from-view-id>/wizard/navi/finish.jsp</from-view-id>-->
 <!--
     <navigation-case>
       <from-outcome>forwardCondition</from-outcome>
@@ -126,6 +135,6 @@
       <to-view-id>/wizard/navi/forwardCondition.jsp</to-view-id>
     </navigation-case>
 -->
-  </navigation-rule>
+<!--  </navigation-rule> -->
 
 </faces-config>

Modified: myfaces/tobago/trunk/example/sandbox/src/main/webapp/navigation.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/webapp/navigation.jsp?rev=683231&r1=683230&r2=683231&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/webapp/navigation.jsp (original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/webapp/navigation.jsp Wed Aug  6 04:38:21 2008
@@ -30,11 +30,7 @@
 
     <tc:link link="inputSlider.jsp" label="inputSlider.jsp" target="View"/>
 
-    <tc:link link="wizard/bean/single.jsp" label="Wizard with navigation from model" target="View"/>
-
-    <tc:link link="wizard/navi/filter.jsp" label="Wizard with navigation tree" target="View"/>
-
-    <tc:link link="wizard.xml" label="wizard.xml" target="View"/>
+    <tc:link link="wizard/index.jsp" label="Wizard" target="View"/>
 
     <tc:cell/>
   </tc:page>

Added: myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/index.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/index.jsp?rev=683231&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/index.jsp (added)
+++ myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/index.jsp Wed Aug  6 04:38:21 2008
@@ -0,0 +1,39 @@
+<%--
+ * 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.
+--%>
+
+<%@ taglib uri="http://myfaces.apache.org/tobago/sandbox" prefix="tcs" %>
+<%@ taglib uri="http://myfaces.apache.org/tobago/component" prefix="tc" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
+
+<layout:wizard>
+  <jsp:body>
+
+    <tc:panel >
+      <f:facet name="layout">
+        <tc:gridLayout />
+      </f:facet>
+
+    <tc:link action="filter" label="Mail Filter Example (separate pages with navigation rules)" />
+
+    <tc:link link="wizard/bean/single.jsp" label="Wizard with navigation from model"/>
+
+    <tc:link link="wizard.xml" label="wizard.xml"/>
+
+    </tc:panel>
+  </jsp:body>
+</layout:wizard>

Modified: myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/fileIntoCondition.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/fileIntoCondition.jsp?rev=683231&r1=683230&r2=683231&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/fileIntoCondition.jsp (original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/fileIntoCondition.jsp Wed Aug  6 04:38:21 2008
@@ -17,29 +17,35 @@
 
 <%@ taglib uri="http://myfaces.apache.org/tobago/sandbox" prefix="tcs" %>
 <%@ taglib uri="http://myfaces.apache.org/tobago/component" prefix="tc" %>
+<%@ taglib uri="http://myfaces.apache.org/tobago/extension" prefix="tx" %>
 <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
 <%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
 
 <layout:wizard>
   <jsp:body>
 
-    <tcs:wizard controller="#{controller.wizard}" title="File Into Condition" outcome="fileIntoCondition" next="next">
+    <tcs:wizard controller="#{controller.wizard}" title="File Into Condition" outcome="fileIntoCondition" next="finish">
       <tc:panel>
         <f:facet name="layout">
-          <tc:gridLayout rows="fixed;fixed;fixed;fixed;*"/>
+          <tc:gridLayout rows="fixed;fixed;fixed;fixed;fixed;*"/>
         </f:facet>
 
-        <tc:out value="file into condition"/>
+        <tc:out value="File Into Condition"/>
 
-        <tc:selectOneChoice>
-          <f:selectItems/>
-        </tc:selectOneChoice>
+        <tx:selectOneChoice label="Header Field">
+          <tc:selectItem itemLabel="To:" itemValue="to" />
+          <tc:selectItem itemLabel="From:" itemValue="from"/>
+          <tc:selectItem itemLabel="Subject:" itemValue="subject"/>
+        </tx:selectOneChoice>
+
+        <tx:selectOneChoice label="Condition">
+          <tc:selectItem itemLabel="contains" itemValue="contains"/>
+          <tc:selectItem itemLabel="equals" itemValue="equals"/>
+        </tx:selectOneChoice>
 
-        <tc:selectOneChoice>
-          <f:selectItems/>
-        </tc:selectOneChoice>
+        <tx:in label="Value"/>
 
-        <tc:in/>
+        <tx:in label="Folder"/>
 
         <tc:cell/>
 

Modified: myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/finish.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/finish.jsp?rev=683231&r1=683230&r2=683231&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/finish.jsp (original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/finish.jsp Wed Aug  6 04:38:21 2008
@@ -23,7 +23,7 @@
 <layout:wizard>
   <jsp:body>
 
-    <tcs:wizard controller="#{controller.wizard}" title="Finish" outcome="finish">
+    <tcs:wizard controller="#{controller.wizard}" title="Finish" outcome="finish" finish="index">
 
       <tc:out value="Click finish for activation."/>
 

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/Wizard.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/Wizard.java?rev=683231&r1=683230&r2=683231&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/Wizard.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/Wizard.java Wed Aug  6 04:38:21 2008
@@ -22,20 +22,6 @@
 
 public interface Wizard {
 
-  /*
-   * Constants
-   */
-
-  String BACKWARD_NAVIGATION_STRATEGY_DELETE = "delete";
-
-  String BACKWARD_NAVIGATION_STRATEGY_REPLACE = "replace";
-
-  String BACKWARD_NAVIGATION_STRATEGY_NOTALLOWED = "notallowed";
-
-  /*
-   * Methods
-   */
-
   /**
    * Return the index of the actual wizard view.
    * 
@@ -44,41 +30,12 @@
   int getIndex();
 
   /**
-   * @return The size (number) of views in the wizard
-   */
-  int getSize();
-
-  /**
-   * Sets the number (size) of views of the wizard. The size should be set only
-   * once, e.g. during initialization.
-   * 
-   * @param size
-   *          The number of views of the wizard
-   */
-  void setSize(int size);
-
-  /**
    * Managed bean (controller) method to execute to show the next view of the
    * wizard.
    */
   void next(ActionEvent event);
 
   /**
-   * Indicates if the action next is available.
-   * 
-   * @return True if the action next is available otherwise false
-   */
-  boolean isNextAvailable();
-
-  /**
-   * Managed bean (controller) method to execute to show the previous view of
-   * the wizard.
-   * 
-   * @return The outcome after the method was executed
-   */
-  String previous();
-
-  /**
    * Indicates if the action previous is available.
    * 
    * @return True if the action previous is available otherwise false
@@ -86,75 +43,22 @@
   boolean isPreviousAvailable();
 
   /**
-   * Indicates if the component which invokes the previous action is rendered
-   * 
-   * @return True if the component is renderer otherwise false
-   */
-  boolean isPreviousRendered();
-
-  /**
-   * Indicator, if backward navigation actions are immediate. The indicator
-   * should be set only once, e.g. during initialization.
-   * 
-   * @return If backward navigation actions are immediate
-   */
-  boolean isBackwardNavigationImmediate();
-
-  /**
-   * Sets an indicator for the wizard to state that the wizard is prepared for
-   * finishing.
-   */
-  void setPreparedForFinishing();
-
-  /**
    * Managed bean (controller) method to execute to quit (save and exit) the
    * wizard.
    * 
    * @return The outcome after the method was executed
    */
-  String finish();
-
-  /**
-   * Indicates if the action finish is available.
-   * 
-   * @return True if the action finish is available otherwise false
-   */
-  boolean isFinishAvailable();
+  void finish(ActionEvent event);
 
   /**
    * Managed bean (controller) method to execute to quit (not save and exit) the
    * wizard.
-   * 
-   * @return The outcome after the method was executed
    */
-  String cancel();
-
-  /**
-   * Managed bean (controller) method which is called, when an action to
-   * navigate between the wizards views is exectued. The method parameter
-   * contains information about the component which was used to navigate.
-   * 
-   * @param actionEvent
-   */
-//  void gotoClicked(ActionEvent actionEvent);
-
-  /**
-   * Managed bean (controller) method to execute to navigate between the wizards
-   * views.
-   * 
-   * @return The outcome after the method was executed
-   */
-//  String gotoStep();
-
-  /**
-   * Sets the strategy to use for backward navigation
-   * 
-   * @param strategy
-   *          The strategy to use for backward navigation
-   */
-  void setBackwardNavigationStrategy(String strategy);
+  void cancel(ActionEvent event);
 
   List<WizardStep> getCourse();
 
   void registerOutcome(String outcome, String title);
+
+  WizardStep getPreviousStep();
 }

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardImpl.java?rev=683231&r1=683230&r2=683231&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardImpl.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardImpl.java Wed Aug  6 04:38:21 2008
@@ -28,25 +28,8 @@
 
   private static final Log LOG = LogFactory.getLog(WizardImpl.class);
 
-  private static final String WIZARD_FINISH_OUTCOME = "wizard-finish";
-
-  private static final String WIZARD_CANCEL_OUTCOME = "wizard-cancel";
-
   private int index;
 
-  private int size;
-
-  // XXX remove (use: "private Integer size" instead)
-  private boolean sizeSet;
-
-  private boolean preparedForFinishing;
-
-  private boolean backNavImmediate = true; // default, if not set otherwise
-
-  private int requestedIndex;
-
-  private WizardBackwardNavigationStrategy backNavStrategy = WizardBackwardNavigationStrategy.NOT_ALLOWED;
-
   private List<WizardStep> course;
 
   public WizardImpl() {
@@ -57,349 +40,49 @@
     LOG.debug("next: " + event);
 
     index++;
-
-    if (!sizeSet && (size < index)) {
-      size++;
-    }
   }
 
   public void gotoStep(ActionEvent event) {
     index = Integer.parseInt((String) (event.getComponent().getAttributes().get("step")));
 
     LOG.debug("gotoStep: " + index);
-
-    preparedForFinishing = false;
-    index = requestedIndex;
-
-    switch (backNavStrategy) {
-      case DELETE:
-        if (!isSizeSet()) {
-          size = index;
-        }
-        break;
-      default:
-        break;
-    }
-  }
-
-  /**
-   * @see Wizard#isNextAvailable()
-   */
-  public final boolean isNextAvailable() {
-    // return (started && !preparedForFinishing);
-    return !preparedForFinishing;
-  }
-
-  /**
-   * @see Wizard#previous()
-   */
-  public final String previous() {
-    LOG.debug("previous");
-
-    boolean success = doPrevious();
-    if (success) {
-
-      if (index > 1) {
-        index--;
-      }
-
-      // if (index == 0) {
-      // started = false;
-      // }
-
-      if (preparedForFinishing) {
-        preparedForFinishing = false;
-      }
-
-      switch (backNavStrategy) {
-        case DELETE:
-          if (!sizeSet) {
-            size = index;
-          }
-          break;
-        default:
-          break;
-      }
-    }
-
-    // makeContentDecision(index);
-
-    return getOutcome(index);
-    // return getDefaultOutcome();
-  }
-
-  /**
-   * <p>
-   * Hook for the implementation of business logic, after invoking the action
-   * {@link WizardImpl#previous()}.
-   * If the execution of the business logic completed successfully, the method
-   * has to return <i>true</i>. Otherwise the method has to return <i>false</i>.
-   * </p>
-   * <p>
-   * <b>Note: </b>Even if the action which triggerd the execution of the
-   * business logic is <i>immediate</i>, the same view will be showed again if
-   * the business logic returned <i>false</i>.
-   * </p>
-   *
-   * @return true if the method completed sucessfully, false if not
-   */
-  protected boolean doPrevious() {
-    return true; // fixme
   }
 
-  /**
-   * @see Wizard#isPreviousAvailable()
-   */
   public final boolean isPreviousAvailable() {
     return getIndex() > 0;
   }
 
-  /**
-   * @see Wizard#isPreviousRendered()
-   */
-  public boolean isPreviousRendered() {
-    return true;
-  }
-
-  /**
-   * @see Wizard#isBackwardNavigationImmediate()
-   */
-  public boolean isBackwardNavigationImmediate() {
-    return backNavImmediate;
-  }
-
-  /**
-   * Sets the indicator for immediate backward navigation.
-   *
-   * @param immediate True if backward navigation is immediate, otherwise false
-   */
-  public void setBackwardNavigationImmediate(boolean immediate) {
-    this.backNavImmediate = immediate;
-  }
-
-  /**
-   * @see Wizard#setPreparedForFinishing()
-   */
-  public final void setPreparedForFinishing() {
-    this.preparedForFinishing = true;
-  }
-
-  /**
-   * @see Wizard#finish()
-   */
-  public final String finish() {
+  public final void finish(ActionEvent event) {
     if (LOG.isDebugEnabled()) {
       LOG.debug("finish");
     }
 
-    boolean success = doFinish();
-    if (!success) {
-      // makeContentDecision(index);
-      return "fixme"; // fixme
-    }
-
     reset();
-    return WIZARD_FINISH_OUTCOME;
   }
 
-  /**
-   * <p>
-   * Hook for the implementation of business logic, after invoking the action
-   * {@link WizardImpl#finish()}.
-   * If the execution of the business logic completed successfully, the method
-   * has to return <i>true</i>. Otherwise the method has to return <i>false</i>.
-   * </p>
-   *
-   * @return true if the method completed sucessfully, false if not
-   */
-  protected boolean doFinish() {
-    return true;
-  }
-
-  /**
-   * @see Wizard#isFinishAvailable()
-   */
-  public final boolean isFinishAvailable() {
-    return preparedForFinishing;
-  }
-
-  /**
-   * @see Wizard#cancel()
-   */
-  public final String cancel() {
+  public final void cancel(ActionEvent event) {
     if (LOG.isDebugEnabled()) {
       LOG.debug("cancel");
     }
-    boolean success = doCancel();
-    if (!success) {
-      // makeContentDecision(index);
-      return "fixme"; // fixme
-    }
     reset();
-    return WIZARD_CANCEL_OUTCOME;
-  }
-
-  /**
-   * <p>
-   * Hook for the implementation of business logic, after invoking the action
-   * {@link WizardImpl#cancel()}.
-   * If the execution of the business logic completed successfully, the method
-   * has to return <i>true</i>. Otherwise the method has to return <i>false</i>.
-   * </p>
-   *
-   * @return true if the method completed sucessfully, false if not
-   */
-  protected boolean doCancel() {
-    return true; // fixme
-  }
-
-  /**
-   * @see Wizard#gotoClicked(ActionEvent)
-   */
-/*  public final void gotoClicked(ActionEvent actionEvent) {
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("gotoClicked");
-    }
-    UICommand command = (UICommand) actionEvent.getComponent();
-    String id = command.getId();
-    String stepIndex = StringUtils.difference("wizard-goto-", id);
-    try {
-      if (LOG.isInfoEnabled()) {
-        LOG.info("Goto step " + stepIndex);
-      }
-      requestedIndex = Integer.valueOf(stepIndex);
-    } catch (NumberFormatException lvException) {
-      FacesContext.getCurrentInstance().addMessage(
-          "",
-          new FacesMessage(FacesMessage.SEVERITY_ERROR, null,
-              "Step index unknown: " + stepIndex));
-    }
   }
-*/
 
-  /**
-   * @see Wizard#getIndex()
-   */
   public final int getIndex() {
     return index;
   }
 
   /**
-   * Returns an indicator to distinguish if the number (size) of the wizard
-   * views is known or is configured.
-   *
-   * @return True if the size of the wizards views is set otherwise false
-   */
-  public final boolean isSizeSet() {
-    return sizeSet;
-  }
-
-  /**
-   * @see Wizard#getSize()
-   */
-  public final int getSize() {
-    return size;
-  }
-
-  /**
-   * @see Wizard#setSize(int)
-   */
-  public final void setSize(int size) {
-    setSize(size, true);
-  }
-
-  /**
-   * Sets the size (number) of the wizards views and a flag indicating that the
-   * set/configured size has to be reset.
-   *
-   * @param size  The number of the wizards views
-   * @param reset Flag indication if the already size set, has to be reset
-   */
-  public final void setSize(int size, boolean reset) {
-    if (reset) {
-      sizeSet = true;
-    }
-    this.size = size;
-    // } else {
-    // LOG.error("Size for wizard is already set and can not be changed!");
-    // }
-    // this.size = size;
-  }
-
-  // public final void resetSize(int size) {
-  // this.size = size;
-  // }
-
-  /**
    * Helper method to reset attributes
    */
   protected void reset() {
-    preparedForFinishing = false;
-    requestedIndex = 0;
     index = 0;
-    if (!sizeSet) {
-      size = 0;
-    }
     course = new ArrayList<WizardStep>();
   }
 
-  /**
-   * Return the set backward navigation strategy.
-   *
-   * @return The actual backward navigation strategy.
-   */
-  public final WizardBackwardNavigationStrategy getWizardBackwardNavigationStrategy() {
-    return this.backNavStrategy;
-  }
-
-  /**
-   * Return the set backward navigation strategy as a String. For possible
-   * parameter values see {@link Wizard}.
-   *
-   * @return The actual backward navigation strategy as a String.
-   */
-  public final String getBackwardNavigationStrategy() {
-    return this.backNavStrategy.getName();
-  }
-
-  /**
-   * <p>
-   * Set the strategy for backward navigation. This should be done only once,
-   * e.g. during initialization. For possible parameter values see
-   * {@link Wizard}.
-   * </p>
-   * <p>
-   * <b>Note: </b>If the parameter value is not known by the wizard the backward
-   * navigation strategy
-   * {@link org.apache.myfaces.tobago.model.WizardBackwardNavigationStrategy#NOT_ALLOWED}
-   * will be applied.
-   * </p>
-   *
-   * @param strategy The strategy to use for backward navigation
-   */
-  public final void setBackwardNavigationStrategy(String strategy) {
-    try {
-      this.backNavStrategy = WizardBackwardNavigationStrategy
-          .getStrategy(strategy);
-    } catch (IllegalArgumentException e) {
-      this.backNavStrategy = WizardBackwardNavigationStrategy.NOT_ALLOWED;
-      LOG
-          .error(
-              "WizardBackwardNavigationStrategy is not correctly initialized! Setting strategy to "
-                  + backNavStrategy.getName(), e);
-    }
-  }
-
-  /**
-   * @see Wizard#getCourse()
-   */
   public List<WizardStep> getCourse() {
     return course;
   }
 
-  /**
-   * @see Wizard#registerOutcome(String, String)
-   */
   public void registerOutcome(String outcome, String title) {
 
     if (index == course.size()) { // this is a new page
@@ -415,24 +98,11 @@
     }
   }
 
-  /*
-    public void registerOutcome(String outcome, String title, int index) {
-
-      if (index == course.size()) { // this is a new page
-        course.add(new Info(outcome, title, index));
-      } else {
-        registerOutcome(outcome, title);
-      }
+  public WizardStep getPreviousStep() {
+    if (index > 0) {
+      return course.get(index - 1);
+    } else {
+      return null;
     }
-  */
-  /**
-   * Returns the outcome for the requested wizard view
-   *
-   * @param forIndex The index of the requested wizard view
-   * @return The outcome for the view index
-   */
-  public final String getOutcome(int forIndex) {
-    return course.get(forIndex).getOutcome();
   }
-
 }

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardStep.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardStep.java?rev=683231&r1=683230&r2=683231&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardStep.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardStep.java Wed Aug  6 04:38:21 2008
@@ -57,4 +57,16 @@
   public void setIndex(int index) {
     this.index = index;
   }
+
+  public String toString() {
+    StringBuilder builder = new StringBuilder();
+    builder.append("#");
+    builder.append(index);
+    builder.append(" outcome='");
+    builder.append(outcome);
+    builder.append("' title='");
+    builder.append(title);
+    builder.append("'");
+    return builder.toString();
+  }
 }

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardTag.java?rev=683231&r1=683230&r2=683231&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardTag.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardTag.java Wed Aug  6 04:38:21 2008
@@ -25,12 +25,7 @@
 import org.apache.myfaces.tobago.apt.annotation.Tag;
 import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
-import org.apache.myfaces.tobago.internal.taglib.AttributeTag;
-import org.apache.myfaces.tobago.internal.taglib.ButtonTag;
-import org.apache.myfaces.tobago.internal.taglib.CellTag;
-import org.apache.myfaces.tobago.internal.taglib.GridLayoutTag;
-import org.apache.myfaces.tobago.internal.taglib.OutTag;
-import org.apache.myfaces.tobago.internal.taglib.PanelTag;
+import org.apache.myfaces.tobago.internal.taglib.*;
 import org.apache.myfaces.tobago.model.Wizard;
 import org.apache.myfaces.tobago.model.WizardStep;
 import org.apache.myfaces.tobago.util.VariableResolverUtil;
@@ -50,6 +45,7 @@
   private String controller;
 
   private String next;
+  private String finish;
   private String outcome;
   private String title;
 
@@ -81,6 +77,7 @@
     gridLayoutTag.doStartTag();
     gridLayoutTag.doEndTag();
 
+
     facetTag.doEndTag();
 
     processTrain();
@@ -157,6 +154,19 @@
   @Override
   public int doEndTag() throws JspException {
 
+    String previous = null;
+    int previousIndex = 0;
+    try {
+      Object bean = VariableResolverUtil.resolveVariable(FacesContext.getCurrentInstance(), "controller");
+      Wizard wizard = (Wizard) PropertyUtils.getProperty(bean, "wizard");
+      wizard.registerOutcome(outcome, title);
+      WizardStep step = wizard.getPreviousStep();
+      previous = step.getOutcome();
+      previousIndex = step.getIndex();
+    } catch (Exception e) {
+      LOG.error("", e);
+    }
+
     PanelTag p = new PanelTag();
     p.setPageContext(pageContext);
     p.setParent(panelTag);
@@ -192,9 +202,19 @@
     previousTag.setPageContext(pageContext);
     previousTag.setParent(panelTag);
     previousTag.setLabel("Previous");
-    previousTag.setAction(controller.replace("}", ".previous}"));
+    previousTag.setAction(previous);
+    previousTag.setActionListener(controller.replace("}", ".gotoStep}"));
     previousTag.setDisabled(controller.replace("}", ".previousAvailable}").replace("#{", "#{!"));
     previousTag.doStartTag();
+    {
+      AttributeTag step = new AttributeTag();
+      step.setPageContext(pageContext);
+      step.setParent(previousTag);
+      step.setName("step");
+      step.setValue("" + previousIndex);
+      step.doStartTag();
+      step.doEndTag();
+    }
     previousTag.doEndTag();
 
     ButtonTag nextTag = new ButtonTag();
@@ -203,18 +223,21 @@
     nextTag.setLabel("Next");
     nextTag.setAction(next);
     nextTag.setActionListener(controller.replace("}", ".next}"));
-    nextTag.setDisabled(controller.replace("}", ".nextAvailable}").replace("#{", "#{!"));
+    nextTag.setDisabled(Boolean.toString(next == null));
+//    nextTag.setDisabled(controller.replace("}", ".nextAvailable}").replace("#{", "#{!"));
     nextTag.doStartTag();
     nextTag.doEndTag();
 
-    ButtonTag finish = new ButtonTag();
-    finish.setPageContext(pageContext);
-    finish.setParent(panelTag);
-    finish.setLabel("Finish");
-    finish.setAction(controller.replace("}", ".finish}"));
-    finish.setDisabled(controller.replace("}", ".finishAvailable}").replace("#{", "#{!"));
-    finish.doStartTag();
-    finish.doEndTag();
+    ButtonTag finishTag = new ButtonTag();
+    finishTag.setPageContext(pageContext);
+    finishTag.setParent(panelTag);
+    finishTag.setLabel("Finish");
+    finishTag.setAction(finish);
+    finishTag.setActionListener(controller.replace("}", ".finish}"));
+    finishTag.setDisabled(Boolean.toString(finish == null));
+//    finish.setDisabled(controller.replace("}", ".finishAvailable}").replace("#{", "#{!"));
+    finishTag.doStartTag();
+    finishTag.doEndTag();
 
     p.doEndTag();
 
@@ -236,6 +259,7 @@
     super.release();
     controller = null;
     next = null;
+    finish = null;
     outcome = null;
     title = null;
     panelTag = null;
@@ -255,6 +279,12 @@
 
   @TagAttribute
   @UIComponentTagAttribute
+  public void setFinish(String finish) {
+    this.finish = finish;
+  }
+
+  @TagAttribute
+  @UIComponentTagAttribute
   public void setOutcome(String outcome) {
     this.outcome = outcome;
   }