myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r695932 - in /myfaces/tobago/trunk: example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/ example/sandbox/src/main/webapp/wizard/navi/ sandbox/ sandbox/src/main/java/org/apache/myfaces/tobago/component/ sandbox/src/main/j...
Date Tue, 16 Sep 2008 15:03:39 GMT
Author: lofwyr
Date: Tue Sep 16 08:03:38 2008
New Revision: 695932

URL: http://svn.apache.org/viewvc?rev=695932&view=rev
Log:
TOBAGO-518: Implement the main stuff over the UIWizard

Modified:
    myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/filter.jsp
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/forwardCondition.jsp
    myfaces/tobago/trunk/sandbox/pom.xml
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UIWizard.java
    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/renderkit/html/scarborough/standard/tag/WizardRenderer.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardControllerTagDeclaration.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardTag.java

Modified: myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java?rev=695932&r1=695931&r2=695932&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java
(original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java
Tue Sep 16 08:03:38 2008
@@ -57,12 +57,13 @@
   }
 
   public String createFilter() {
+    LOG.info("Filter type: '" + filterType + "'");
     if ("fileInto".equals(filterType)) {
       return "fileIntoCondition";
     } else if ("forward".equals(filterType)) {
       return "forwardCondition";
     }
-    throw new RuntimeException("no filter");
+    throw new RuntimeException("No filter type set.");
   }
 
   public String getCurrentTime() {

Modified: myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/filter.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/filter.jsp?rev=695932&r1=695931&r2=695932&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/filter.jsp (original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/filter.jsp Tue Sep 16
08:03:38 2008
@@ -23,7 +23,8 @@
 <layout:wizard>
   <jsp:body>
 
-    <tcs:wizard controller="#{controller.wizard}" title="New Filter" outcome="filter"
next="#{controller.createFilter}">
+    <tcs:wizard controller="#{controller.wizard}" title="New Filter" outcome="filter"
next="#{controller.createFilter}"
+        allowJumpForward="true">
 
       <tc:selectOneRadio value="#{controller.filterType}" required="true">
         <tc:selectItem itemLabel="File Into" itemValue="fileInto"/>

Modified: myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/forwardCondition.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/forwardCondition.jsp?rev=695932&r1=695931&r2=695932&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/forwardCondition.jsp
(original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/forwardCondition.jsp
Tue Sep 16 08:03:38 2008
@@ -23,7 +23,7 @@
 <layout:wizard>
   <jsp:body>
 
-    <tcs:wizard controller="#{controller.wizard}" title="Forward Condition" outcome="forwardCondition"
next="next">
+    <tcs:wizard controller="#{controller.wizard}" title="Forward Condition" outcome="forwardCondition"
next="finish">
 
       <tc:out value="Forward Condition"/>
 

Modified: myfaces/tobago/trunk/sandbox/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/pom.xml?rev=695932&r1=695931&r2=695932&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/pom.xml (original)
+++ myfaces/tobago/trunk/sandbox/pom.xml Tue Sep 16 08:03:38 2008
@@ -79,7 +79,7 @@
           <execution>
             <id>tobago-tlds</id>
             <goals><goal>process</goal></goals>
-            <phase>compile</phase>
+            <phase>generate-resources</phase>
             <configuration>
               <targetFiles>
                 <targetFile>org/apache/myfaces/tobago/taglib/sandbox/tobago-sandbox.tld</targetFile>
@@ -89,6 +89,7 @@
                 <exclude>org/apache/myfaces/tobago/application/FopConverter.java</exclude>
                 <exclude>org/apache/myfaces/tobago/taglib/component/*</exclude>
                 <exclude>org/apache/myfaces/tobago/taglib/extension/*</exclude>
+                <exclude>org/apache/myfaces/tobago/taglib/sandbox/WizardTag.java</exclude>
               </excludes>
               <additionalSourceRoots>
                 <additionalSourceRoot>${project.build.directory}/tobago-core-sources</additionalSourceRoot>
@@ -114,6 +115,7 @@
                 <exclude>org/apache/myfaces/tobago/taglib/extension/*</exclude>
                 <exclude>org/apache/myfaces/tobago/taglib/component/*</exclude>
                 <exclude>org/apache/myfaces/tobago/taglib/sandbox/package-info.java</exclude>
+                <exclude>org/apache/myfaces/tobago/taglib/sandbox/WizardTag.java</exclude>
               </excludes>
               <additionalSourceRoots>
                 <additionalSourceRoot>${project.build.directory}/tobago-core-sources</additionalSourceRoot>
@@ -175,6 +177,10 @@
           <target>${maven.compile.target}</target>
           <encoding>${maven.compile.encoding}</encoding>
           <showWarnings>true</showWarnings>
+          <excludes>
+            <exclude>workaround-because-otherwise-this-will-be-excluded-in-the-next-step</exclude>
+            <exclude>org/apache/myfaces/tobago/taglib/sandbox/WizardTag.java</exclude>
+          </excludes>
         </configuration>
         <executions>
           <execution>
@@ -189,6 +195,7 @@
                 <include>org/apache/myfaces/tobago/internal/taglib/*</include>
                 <include>org/apache/myfaces/tobago/component/*</include>
                 <include>org/apache/myfaces/tobago/renderkit/*</include>
+                <include>org/apache/myfaces/tobago/taglib/sandbox/WizardTag.java</include>
               </includes>
               <excludes>
               </excludes>

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UIWizard.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UIWizard.java?rev=695932&r1=695931&r2=695932&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UIWizard.java
(original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UIWizard.java
Tue Sep 16 08:03:38 2008
@@ -17,16 +17,93 @@
  * limitations under the License.
  */
 
+import org.apache.myfaces.tobago.event.FacesEventWrapper;
 import org.apache.myfaces.tobago.model.Wizard;
 
+import javax.faces.context.FacesContext;
 import javax.faces.el.ValueBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import java.io.IOException;
 
 public class UIWizard extends UIPanel {
 
   public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Wizard";
 
+  // todo: how to use a auto-generated controller?
   private Wizard controller;
 
+  private String var;
+
+  private String outcome;
+  private String title;
+  private Boolean allowJumpForward;
+
+  public void init() {
+    Wizard wizard = getController();
+    wizard.register();
+    if (outcome != null) {
+       getController().getCurrentStep().setOutcome(outcome);
+    }
+    if (title != null) {
+       getController().getCurrentStep().setTitle(title);
+    }
+  }
+
+  public void processDecodes(FacesContext facesContext) {
+    facesContext.getExternalContext().getRequestMap().put(var, getController());
+    super.processDecodes(facesContext);
+  }
+
+  public void decode(FacesContext facesContext) {
+    super.decode(facesContext);
+    facesContext.getExternalContext().getRequestMap().remove(var);
+  }
+
+  public void queueEvent(FacesEvent event) {
+      super.queueEvent(new FacesEventWrapper(event, this));
+  }
+
+  public void broadcast(FacesEvent event) throws AbortProcessingException {
+    if (event instanceof FacesEventWrapper) {
+      FacesContext facesContext = FacesContext.getCurrentInstance();
+      facesContext.getExternalContext().getRequestMap().put(var, getController());
+      FacesEvent originalEvent = ((FacesEventWrapper) event).getWrappedFacesEvent();
+      originalEvent.getComponent().broadcast(originalEvent);
+      facesContext.getExternalContext().getRequestMap().remove(var);
+    } else {
+      super.broadcast(event);
+    }
+  }
+
+  public void encodeBegin(FacesContext facesContext) throws IOException {
+    facesContext.getExternalContext().getRequestMap().put(var, getController());
+    super.encodeBegin(facesContext);
+  }
+
+
+  public void encodeEnd(FacesContext facesContext) throws IOException {
+    super.encodeEnd(facesContext);
+    facesContext.getExternalContext().getRequestMap().remove(var);
+  }
+
+  @Override
+  public Object saveState(FacesContext facesContext) {
+    Object[] state = new Object[3];
+    state[0] = super.saveState(facesContext);
+    state[1] = var;
+    state[2] = controller;
+    return state;
+  }
+
+  @Override
+  public void restoreState(FacesContext facesContext, Object state) {
+    Object[] values = (Object[]) state;
+    super.restoreState(facesContext, values[0]);
+    var = (String) values[1];
+    controller = (Wizard) values[2];
+  }
+
   public Wizard getController() {
     if (controller != null) {
       return controller;
@@ -42,4 +119,37 @@
   public void setController(Wizard controller) {
     this.controller = controller;
   }
+
+  public String getVar() {
+    return var;
+  }
+
+  public void setVar(String var) {
+    this.var = var;
+  }
+
+  public String getOutcome() {
+    return outcome;
+  }
+
+  public void setOutcome(String outcome) {
+    this.outcome = outcome;
+  }
+
+  public String getTitle() {
+    return title;
+  }
+
+  public void setTitle(String title) {
+    this.title = title;
+  }
+
+  public Boolean isAllowJumpForward() {
+    return allowJumpForward != null ? allowJumpForward : false;
+  }
+
+  public void setAllowJumpForward(Boolean allowJumpForward) {
+    this.allowJumpForward = allowJumpForward;
+//    getController().removeForwardSteps();
+  }
 }

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=695932&r1=695931&r2=695932&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
Tue Sep 16 08:03:38 2008
@@ -35,6 +35,8 @@
    */
   void next(ActionEvent event);
 
+  void gotoStep(ActionEvent event);
+
   /**
    * Indicates if the action previous is available.
    * 
@@ -58,7 +60,11 @@
 
   List<WizardStep> getCourse();
 
-  void registerOutcome(String outcome, String title);
+  void register();
 
   WizardStep getPreviousStep();
+
+  WizardStep getCurrentStep();
+
+  void removeForwardSteps();
 }

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=695932&r1=695931&r2=695932&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
Tue Sep 16 08:03:38 2008
@@ -48,6 +48,18 @@
     LOG.debug("gotoStep: " + index);
   }
 
+  public String previous() {
+    String outcome = getPreviousStep().getOutcome();
+    if (index > 0) {
+      index--;
+    } else {
+      LOG.error("Previous not available!");
+    }
+
+    LOG.debug("gotoStep: " + index);
+    return outcome;
+  }
+
   public final boolean isPreviousAvailable() {
     return getIndex() > 0;
   }
@@ -83,12 +95,12 @@
     return course;
   }
 
-  public void registerOutcome(String outcome, String title) {
+  public void register() {
 
     if (index == course.size()) { // this is a new page
-      course.add(new WizardStep(outcome, title, index));
+      course.add(new WizardStep(index));
     } else if (index < course.size()) {
-      course.set(index, new WizardStep(outcome, title, index));
+      course.set(index, new WizardStep(index));
     } else {
       throw new IllegalStateException("Index too large for course: index="
           + index + " course.size()=" + course.size());
@@ -105,4 +117,12 @@
       return null;
     }
   }
+  public WizardStep getCurrentStep() {
+      return course.get(index);
+  }
+
+  public void removeForwardSteps() {
+    // todo
+    LOG.error("Not implemented yet");
+  }
 }

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=695932&r1=695931&r2=695932&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
Tue Sep 16 08:03:38 2008
@@ -28,9 +28,7 @@
   private String title;
   private int index;
 
-  public WizardStep(String outcome, String title, int index) {
-    this.outcome = outcome;
-    this.title = title;
+  public WizardStep(int index) {
     this.index = index;
   }
 

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/WizardRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/WizardRenderer.java?rev=695932&r1=695931&r2=695932&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/WizardRenderer.java
(original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/WizardRenderer.java
Tue Sep 16 08:03:38 2008
@@ -17,8 +17,20 @@
  * limitations under the License.
  */
 
+import org.apache.myfaces.tobago.component.UIWizard;
 import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
 
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.io.IOException;
+
 public class WizardRenderer extends LayoutableRendererBase {
 
+  public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException
{
+    UIWizard wizard = (UIWizard) component;
+    facesContext.getExternalContext().getRequestMap().put(wizard.getVar(), wizard.getController());
+    super.prepareRender(facesContext, component);
+    // xxx can't be removed here, because there is no looping over children possible here.
+//    facesContext.getExternalContext().getRequestMap().remove(wizard.getVar());
+  }
 }

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardControllerTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardControllerTagDeclaration.java?rev=695932&r1=695931&r2=695932&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardControllerTagDeclaration.java
(original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardControllerTagDeclaration.java
Tue Sep 16 08:03:38 2008
@@ -41,4 +41,32 @@
   @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.model.Wizard",
       expression = DynamicExpression.VALUE_BINDING_REQUIRED)
   void setController(String controller);
+
+  /**
+   * Name of a request-scope attribute under which the model data will be exposed.
+   */
+  @TagAttribute(required = true)
+  @UIComponentTagAttribute(expression = DynamicExpression.PROHIBITED)
+  void setVar(String var);
+
+  /**
+   * Outcome to navigate to this page.
+   */
+  @TagAttribute(required = true)
+  @UIComponentTagAttribute(expression = DynamicExpression.PROHIBITED)
+  void setOutcome(String outcome);
+
+  /**
+   * Title of this page
+   */
+  @TagAttribute
+  @UIComponentTagAttribute
+  void setTitle(String title);
+
+  /**
+   * Is a jump forward to folling pages allowed?
+   */
+  @TagAttribute
+  @UIComponentTagAttribute(type = "java.lang.Boolean")
+  void setAllowJumpForward(String allowJumpForward);
 }

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=695932&r1=695931&r2=695932&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
Tue Sep 16 08:03:38 2008
@@ -17,7 +17,6 @@
  * limitations under the License.
  */
 
-import org.apache.commons.beanutils.PropertyUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import static org.apache.myfaces.tobago.TobagoConstants.FACET_LAYOUT;
@@ -25,17 +24,16 @@
 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.component.UIWizard;
 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.model.Wizard;
+import org.apache.myfaces.tobago.internal.taglib.WizardControllerTag;
 import org.apache.myfaces.tobago.model.WizardStep;
-import org.apache.myfaces.tobago.util.VariableResolverUtil;
 
-import javax.faces.context.FacesContext;
 import javax.faces.webapp.FacetTag;
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.BodyTagSupport;
@@ -53,23 +51,31 @@
   private String finish;
   private String outcome;
   private String title;
+  private String allowJumpForward;
 
-//  private WizardControllerTag controllerTag;
+  private WizardControllerTag controllerTag;
   private PanelTag panelTag;
 
   @Override
   public int doStartTag() throws JspException {
-/*
+
     controllerTag = new WizardControllerTag();
     controllerTag.setPageContext(pageContext);
     controllerTag.setParent(getParent());
     controllerTag.setController(controller);
+
+    controllerTag.setOutcome(outcome);
+    controllerTag.setTitle(title);
+    controllerTag.setAllowJumpForward(allowJumpForward);
+
+    // todo: change "w" to ? or make it configurable or settable over this tag? Whould this
be helpful?
+    controllerTag.setVar("w");
+
     controllerTag.doStartTag();
-*/
+
     panelTag = new PanelTag();
     panelTag.setPageContext(pageContext);
-    panelTag.setParent(getParent());
-//    panelTag.setParent(controllerTag);
+    panelTag.setParent(controllerTag);
 /* todo
     if (rendered != null) {
       panelTag.setRendered(rendered);
@@ -93,23 +99,32 @@
 
     facetTag.doEndTag();
 
-    processTrain();
-
     return super.doStartTag();
   }
 
+  public void doInitBody() throws JspException {
+    super.doInitBody();
+    processTrain();
+  }
+
   private void processTrain() throws JspException {
 
-    List<WizardStep> course = null;
-    try {
+    // XXX is this possible with facelets?
+
+    UIWizard uiWizard = (UIWizard) controllerTag.getComponentInstance();
+    uiWizard.init();
+    List<WizardStep> course = uiWizard.getController().getCourse();
+
+/*    try {
+      // fixme
       Object bean = VariableResolverUtil.resolveVariable(FacesContext.getCurrentInstance(),
"controller");
       Wizard wizard = (Wizard) PropertyUtils.getProperty(bean, "wizard");
-      wizard.registerOutcome(outcome, title);
+//      wizard.registerOutcome(outcome, title, allowJumpForward);
       course = wizard.getCourse();
     } catch (Exception e) {
       LOG.error("", e);
     }
-
+*/
     PanelTag p = new PanelTag();
     p.setPageContext(pageContext);
     p.setParent(panelTag);
@@ -140,7 +155,8 @@
       button.setPageContext(pageContext);
       button.setParent(p);
       button.setAction(info.getOutcome());
-      button.setActionListener(controller.replace("}", ".gotoStep}"));
+      button.setActionListener("#{w.gotoStep}");
+//      button.setActionListener(controller.replace("}", ".gotoStep}"));
       button.setLabel(info.getTitle());
       button.doStartTag();
 
@@ -157,7 +173,8 @@
     OutTag spacer = new OutTag();
     spacer.setPageContext(pageContext);
     spacer.setParent(p);
-    spacer.setValue(controller.replace("}", ".index}"));
+    spacer.setValue("#{w.index}");
+//  spacer.setValue(controller.replace("}", ".index}"));
     spacer.doStartTag();
     spacer.doEndTag();
 
@@ -166,19 +183,23 @@
 
   @Override
   public int doEndTag() throws JspException {
-
+/*
     String previous = null;
     int previousIndex = 0;
+    boolean previousAvailable = false;
     try {
-      Object bean = VariableResolverUtil.resolveVariable(FacesContext.getCurrentInstance(),
"controller");
-      Wizard wizard = (Wizard) PropertyUtils.getProperty(bean, "wizard");
+      UIWizard uiWizard = (UIWizard) controllerTag.getComponentInstance();
+      Wizard wizard = uiWizard.getController();
+//      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();
+      previousAvailable = wizard.isPreviousAvailable();
     } catch (Exception e) {
       LOG.error("", e);
-    }
+    }*/
 
     PanelTag p = new PanelTag();
     p.setPageContext(pageContext);
@@ -205,12 +226,14 @@
     ButtonTag previousTag = new ButtonTag();
     previousTag.setPageContext(pageContext);
     previousTag.setParent(panelTag);
-    previousTag.setLabel("Previous");
-    previousTag.setAction(previous);
-    previousTag.setActionListener(controller.replace("}", ".gotoStep}"));
-    previousTag.setDisabled(controller.replace("}", ".previousAvailable}").replace("#{",
"#{!"));
+    previousTag.setLabel("x4 Previous");
+//    previousTag.setAction(previous);
+    previousTag.setAction("#{w.previous}");
+//    previousTag.setActionListener("#{w.previous}");
+//    previousTag.setDisabled(Boolean.toString(!previousAvailable));
+    previousTag.setDisabled("#{!w.previousAvailable}");
     previousTag.doStartTag();
-
+/*
     AttributeTag step = new AttributeTag();
     step.setPageContext(pageContext);
     step.setParent(previousTag);
@@ -218,7 +241,7 @@
     step.setValue("" + previousIndex);
     step.doStartTag();
     step.doEndTag();
-
+*/
     previousTag.doEndTag();
 
     ButtonTag nextTag = new ButtonTag();
@@ -226,7 +249,7 @@
     nextTag.setParent(panelTag);
     nextTag.setLabel("Next");
     nextTag.setAction(next);
-    nextTag.setActionListener(controller.replace("}", ".next}"));
+    nextTag.setActionListener("#{w.next}");
     nextTag.setDisabled(Boolean.toString(next == null));
 //    nextTag.setDisabled(controller.replace("}", ".nextAvailable}").replace("#{", "#{!"));
     nextTag.doStartTag();
@@ -237,7 +260,7 @@
     finishTag.setParent(panelTag);
     finishTag.setLabel("Finish");
     finishTag.setAction(finish);
-    finishTag.setActionListener(controller.replace("}", ".finish}"));
+    finishTag.setActionListener("#{w.finish}");
     finishTag.setDisabled(Boolean.toString(finish == null));
 //    finish.setDisabled(controller.replace("}", ".finishAvailable}").replace("#{", "#{!"));
     finishTag.doStartTag();
@@ -247,7 +270,7 @@
 
     panelTag.doEndTag();
 
-//    controllerTag.doEndTag();
+    controllerTag.doEndTag();
 
     return super.doEndTag();
   }
@@ -301,4 +324,9 @@
     this.title = title;
   }
 
+  @TagAttribute
+  @UIComponentTagAttribute(type="java.lang.Boolean")
+  public void setAllowJumpForward(String allowJumpForward) {
+    this.allowJumpForward = allowJumpForward;
+  }
 }



Mime
View raw message