myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r696581 - in /myfaces/tobago/trunk: example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/ example/sandbox/src/main/webapp/WEB-INF/ example/sandbox/src/main/webapp/facelets/ example/sandbox/src/main/webapp/facelets/wizard/...
Date Thu, 18 Sep 2008 07:09:39 GMT
Author: lofwyr
Date: Thu Sep 18 00:09:38 2008
New Revision: 696581

URL: http://svn.apache.org/viewvc?rev=696581&view=rev
Log:
TOBAGO-518: Split the features in some Tags

Added:
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/facelets/
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/facelets/wizard/
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/facelets/wizard/navi/
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/facelets/wizard/navi/filter.xml   (contents, props changed)
      - copied, changed from r695392, myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard.xml
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardLeaveTag.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardNextTag.java   (contents, props changed)
      - copied, changed from r695932, myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardTag.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardPreviousTag.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardTrainTag.java
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/WEB-INF/web.xml
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/fileIntoCondition.jsp
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/filter.jsp
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard/navi/finish.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/facelets/TobagoSandboxTagLibrary.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/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=696581&r1=696580&r2=696581&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 Thu Sep 18 00:09:38 2008
@@ -34,6 +34,7 @@
   private Wizard wizard;
 
   private String filterType;
+  private String filterValue;
 
   public Controller() {
     // wizard
@@ -94,4 +95,12 @@
   public void setFilterType(String filterType) {
     this.filterType = filterType;
   }
+
+  public String getFilterValue() {
+    return filterValue;
+  }
+
+  public void setFilterValue(String filterValue) {
+    this.filterValue = filterValue;
+  }
 }

Modified: myfaces/tobago/trunk/example/sandbox/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/webapp/WEB-INF/web.xml?rev=696581&r1=696580&r2=696581&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/webapp/WEB-INF/web.xml Thu Sep 18 00:09:38 2008
@@ -94,4 +94,11 @@
     <welcome-file>index.jsp</welcome-file>
   </welcome-file-list>
 
+  <jsp-config>
+    <jsp-property-group>
+      <url-pattern>*.jsp</url-pattern>
+      <page-encoding>UTF-8</page-encoding>
+    </jsp-property-group>
+  </jsp-config>
+
 </web-app>

Copied: myfaces/tobago/trunk/example/sandbox/src/main/webapp/facelets/wizard/navi/filter.xml (from r695392, myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard.xml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/webapp/facelets/wizard/navi/filter.xml?p2=myfaces/tobago/trunk/example/sandbox/src/main/webapp/facelets/wizard/navi/filter.xml&p1=myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard.xml&r1=695392&r2=696581&rev=696581&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/webapp/wizard.xml (original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/webapp/facelets/wizard/navi/filter.xml Thu Sep 18 00:09:38 2008
@@ -29,7 +29,39 @@
       <tc:gridLayout margin="10px"/>
     </f:facet>
 
-    <tfs:wizard controller="#{controller.wizard}"/>
+    <tfs:wizardController var="w" controller="#{controller.wizard}" title="New Filter" outcome="filter"
+                          allowJumpForward="true">
+
+      <tc:panel>
+        <f:facet name="layout">
+          <tc:gridLayout rows="fixed;*;fixed"/>
+        </f:facet>
+
+        <!--<tfs:wizardTrain wizard="w" controller="#{controller.wizard}"/>-->
+
+        <tc:selectOneRadio value="#{controller.filterType}" required="true">
+          <tc:selectItem itemLabel="File Into" itemValue="fileInto"/>
+          <tc:selectItem itemLabel="Forward" itemValue="forward"/>
+        </tc:selectOneRadio>
+
+        <tc:panel>
+          <f:facet name="layout">
+            <tc:gridLayout columns="*;fixed;fixed;fixed;fixed"/>
+          </f:facet>
+
+          <tc:cell/>
+          <!--<tfs:wizardPrevious wizard="w" label="Vorherige"/>-->
+          <!--<tfs:wizardNext wizard="w" label="Nächste" action="#{controller.createFilter}"/>-->
+          <!--<tfs:wizardLeave wizard="w" label="Fertig"/>-->
+          <!--<tfs:wizardLeave wizard="w" label="Cancel"/>-->
+
+        </tc:panel>
+
+      </tc:panel>
+
+    </tfs:wizardController>
+
+
 
   </tc:page>
 </f:view>

Propchange: myfaces/tobago/trunk/example/sandbox/src/main/webapp/facelets/wizard/navi/filter.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tobago/trunk/example/sandbox/src/main/webapp/facelets/wizard/navi/filter.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tobago/trunk/example/sandbox/src/main/webapp/facelets/wizard/navi/filter.xml
------------------------------------------------------------------------------
    svn:mergeinfo = 

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=696581&r1=696580&r2=696581&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 Thu Sep 18 00:09:38 2008
@@ -24,12 +24,14 @@
 <layout:wizard>
   <jsp:body>
 
-    <tcs:wizard controller="#{controller.wizard}" title="File Into Condition" outcome="fileIntoCondition" next="finish">
+    <tcs:wizardController var="w" controller="#{controller.wizard}" title="File Into Condition" outcome="fileIntoCondition">
       <tc:panel>
         <f:facet name="layout">
-          <tc:gridLayout rows="fixed;fixed;fixed;fixed;fixed;*"/>
+          <tc:gridLayout rows="fixed;fixed;fixed;fixed;fixed;fixed;*;fixed"/>
         </f:facet>
 
+        <tcs:wizardTrain wizard="w" controller="#{controller.wizard}" />
+
         <tc:out value="File Into Condition"/>
 
         <tx:selectOneChoice label="Header Field">
@@ -43,14 +45,27 @@
           <tc:selectItem itemLabel="equals" itemValue="equals"/>
         </tx:selectOneChoice>
 
-        <tx:in label="Value"/>
+        <tx:in label="Value" value="#{controller.filterValue}"/>
 
         <tx:in label="Folder"/>
 
         <tc:cell/>
 
+        <tc:panel>
+          <f:facet name="layout">
+            <tc:gridLayout columns="*;fixed;fixed;fixed;fixed"/>
+          </f:facet>
+
+          <tc:cell/>
+          <tcs:wizardPrevious wizard="w" label="Vorherige"/>
+          <tcs:wizardNext wizard="w" label="Nächste" action="finish"/>
+          <tcs:wizardLeave wizard="w" label="Fertig"/>
+          <tcs:wizardLeave wizard="w" label="Cancel"/>
+
+        </tc:panel>
+
       </tc:panel>
-    </tcs:wizard>
+    </tcs:wizardController>
 
   </jsp:body>
 </layout:wizard>

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=696581&r1=696580&r2=696581&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 Thu Sep 18 00:09:38 2008
@@ -23,15 +23,52 @@
 <layout:wizard>
   <jsp:body>
 
-    <tcs:wizard controller="#{controller.wizard}" title="New Filter" outcome="filter" next="#{controller.createFilter}"
-        allowJumpForward="true">
+    <tcs:wizardController var="w" controller="#{controller.wizard}" title="New Filter" outcome="filter"
+                          allowJumpForward="true">
 
-      <tc:selectOneRadio value="#{controller.filterType}" required="true">
-        <tc:selectItem itemLabel="File Into" itemValue="fileInto"/>
-        <tc:selectItem itemLabel="Forward" itemValue="forward"/>
-      </tc:selectOneRadio>
+      <tc:panel>
+        <f:facet name="layout">
+          <tc:gridLayout rows="fixed;*;fixed"/>
+        </f:facet>
 
-    </tcs:wizard>
+        <tcs:wizardTrain wizard="w" controller="#{controller.wizard}"/>
+
+        <tc:selectOneRadio value="#{controller.filterType}" required="true">
+          <tc:selectItem itemLabel="File Into" itemValue="fileInto"/>
+          <tc:selectItem itemLabel="Forward" itemValue="forward"/>
+        </tc:selectOneRadio>
+
+        <tc:panel>
+          <f:facet name="layout">
+            <tc:gridLayout columns="*;fixed;fixed;fixed;fixed"/>
+          </f:facet>
+
+          <tc:cell/>
+          <tcs:wizardPrevious wizard="w" label="Vorherige"/>
+          <tcs:wizardNext wizard="w" label="Nächste" action="#{controller.createFilter}"/>
+          <tcs:wizardLeave wizard="w" label="Fertig"/>
+          <tcs:wizardLeave wizard="w" label="Cancel"/>
+
+        </tc:panel>
+
+      </tc:panel>
+
+    </tcs:wizardController>
+
+    <%--
+    <tcs:wizardStep controller="#{controller.wizard}" var="w" title="New Filter" outcome="filter" allowJumpForward="true">
+
+    <tcs:wizardTrain wizard="w" />
+
+      <tc:out value="Click finish for activation."/>
+
+    <tcs:wizardPrevious wizard="w" />
+    <tcs:wizardNext wizard="w" action="#{controller.createFilter}" />
+    <tcs:wizardFinish wizard="w" />
+    <tcs:wizardCancel wizard="w" />
+
+    </tcs:wizardStep>
+--%>
 
   </jsp:body>
 </layout:wizard>

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=696581&r1=696580&r2=696581&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 Thu Sep 18 00:09:38 2008
@@ -23,11 +23,56 @@
 <layout:wizard>
   <jsp:body>
 
-    <tcs:wizard controller="#{controller.wizard}" title="Finish" outcome="finish" finish="index">
+    <tcs:wizardController var="w" controller="#{controller.wizard}" title="Finish" outcome="finish">
+      <tc:panel>
+        <f:facet name="layout">
+          <tc:gridLayout rows="fixed;*;fixed"/>
+        </f:facet>
+
+        <tcs:wizardTrain wizard="w" controller="#{controller.wizard}" />
+
+        <tc:out value="Click finish for activation."/>
+
+        <tc:panel>
+          <f:facet name="layout">
+            <tc:gridLayout columns="*;fixed;fixed;fixed;fixed"/>
+          </f:facet>
+
+          <tc:cell/>
+          <tcs:wizardPrevious wizard="w" label="Vorherige"/>
+          <tcs:wizardNext wizard="w" label="Nächste"/>
+          <tcs:wizardLeave wizard="w" label="Fertig" action="index"/>
+          <tcs:wizardLeave wizard="w" label="Cancel"/>
+
+        </tc:panel>
+
+      </tc:panel>
+
+    </tcs:wizardController>
+
+  </jsp:body>
+</layout:wizard>
+<%--
+<layout:wizard>
+  <jsp:body>
+
+    <tcs:wizard controller="#{controller.wizard}" title="File Into Condition" outcome="fileIntoCondition" next="finish"></tcs:wizard>
+    <tcs:wizard controller="#{controller.wizard}" title="New Filter" outcome="filter" next="#{controller.createFilter}"></tcs:wizard>
+
+    <tcs:wizardStep controller="#{controller.wizard}" var="w" title="Finish" outcome="finish">
+
+
+    <tcs:wizardTrain controller="#{controller.wizard}" title="Finish" outcome="finish" finish="index" />
 
       <tc:out value="Click finish for activation."/>
 
-    </tcs:wizard>
+    <tcs:wizardPrevious controller="#{controller.wizard}" title="Finish" outcome="finish" finish="index" />
+    <tcs:wizardNext controller="#{controller.wizard}" title="Finish" outcome="finish" finish="index" />
+    <tcs:wizardFinish controller="#{controller.wizard}" title="Finish" outcome="finish" finish="index" />
+    <tcs:wizardCancel controller="#{controller.wizard}" title="Finish" outcome="finish" finish="index" />
+
+    </tcs:wizardStep>
 
   </jsp:body>
 </layout:wizard>
+--%>
\ No newline at end of file

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=696581&r1=696580&r2=696581&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 Thu Sep 18 00:09:38 2008
@@ -23,11 +23,33 @@
 <layout:wizard>
   <jsp:body>
 
-    <tcs:wizard controller="#{controller.wizard}" title="Forward Condition" outcome="forwardCondition" next="finish">
+    <tcs:wizardController var="w" controller="#{controller.wizard}" title="Forward Condition" outcome="forwardCondition">
 
-      <tc:out value="Forward Condition"/>
+      <tc:panel>
+        <f:facet name="layout">
+          <tc:gridLayout rows="fixed;*;fixed"/>
+        </f:facet>
 
-    </tcs:wizard>
+        <tcs:wizardTrain wizard="w" controller="#{controller.wizard}" />
+
+        <tc:out value="Forward Condition"/>
+
+        <tc:panel>
+          <f:facet name="layout">
+            <tc:gridLayout columns="*;fixed;fixed;fixed;fixed"/>
+          </f:facet>
+
+          <tc:cell/>
+          <tcs:wizardPrevious wizard="w" label="Vorherige"/>
+          <tcs:wizardNext wizard="w" label="Nächste" action="finish"/>
+          <tcs:wizardLeave wizard="w" label="Fertig"/>
+          <tcs:wizardLeave wizard="w" label="Cancel"/>
+
+        </tc:panel>
+
+      </tc:panel>
+
+    </tcs:wizardController>
 
   </jsp:body>
 </layout:wizard>

Modified: myfaces/tobago/trunk/sandbox/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/pom.xml?rev=696581&r1=696580&r2=696581&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/pom.xml (original)
+++ myfaces/tobago/trunk/sandbox/pom.xml Thu Sep 18 00:09:38 2008
@@ -89,8 +89,8 @@
                 <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>
+<!--                <exclude>org/apache/myfaces/tobago/taglib/sandbox/WizardTag.java</exclude>
+-->              </excludes>
               <additionalSourceRoots>
                 <additionalSourceRoot>${project.build.directory}/tobago-core-sources</additionalSourceRoot>
               </additionalSourceRoots>

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=696581&r1=696580&r2=696581&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 Thu Sep 18 00:09:38 2008
@@ -17,16 +17,18 @@
  * limitations under the License.
  */
 
+import org.apache.myfaces.tobago.OnComponentCreated;
 import org.apache.myfaces.tobago.event.FacesEventWrapper;
 import org.apache.myfaces.tobago.model.Wizard;
 
+import javax.faces.component.UIComponent;
 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 class UIWizard extends UIPanel implements OnComponentCreated {
 
   public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Wizard";
 
@@ -39,31 +41,24 @@
   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);
-    }
-  }
-
+  @Override
   public void processDecodes(FacesContext facesContext) {
     facesContext.getExternalContext().getRequestMap().put(var, getController());
     super.processDecodes(facesContext);
   }
 
+  @Override
   public void decode(FacesContext facesContext) {
     super.decode(facesContext);
     facesContext.getExternalContext().getRequestMap().remove(var);
   }
 
+  @Override
   public void queueEvent(FacesEvent event) {
       super.queueEvent(new FacesEventWrapper(event, this));
   }
 
+  @Override
   public void broadcast(FacesEvent event) throws AbortProcessingException {
     if (event instanceof FacesEventWrapper) {
       FacesContext facesContext = FacesContext.getCurrentInstance();
@@ -76,17 +71,30 @@
     }
   }
 
+  @Override
   public void encodeBegin(FacesContext facesContext) throws IOException {
     facesContext.getExternalContext().getRequestMap().put(var, getController());
     super.encodeBegin(facesContext);
   }
 
 
+  @Override
   public void encodeEnd(FacesContext facesContext) throws IOException {
     super.encodeEnd(facesContext);
     facesContext.getExternalContext().getRequestMap().remove(var);
   }
 
+  public void onComponentCreated(FacesContext context, UIComponent component) {
+    Wizard wizard = getController();
+    wizard.register();
+    if (outcome != null) {
+       getController().getCurrentStep().setOutcome(outcome);
+    }
+    if (title != null) {
+       getController().getCurrentStep().setTitle(title);
+    }
+  }
+
   @Override
   public Object saveState(FacesContext facesContext) {
     Object[] state = new Object[3];

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/facelets/TobagoSandboxTagLibrary.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/facelets/TobagoSandboxTagLibrary.java?rev=696581&r1=696580&r2=696581&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/facelets/TobagoSandboxTagLibrary.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/facelets/TobagoSandboxTagLibrary.java Thu Sep 18 00:09:38 2008
@@ -33,11 +33,7 @@
 
     super(NAMESPACE);
 
-    addComponent("tree", "org.apache.myfaces.tobago.Tree", "Tree", TobagoComponentHandler.class);
-
-    addComponent("treeNode", "org.apache.myfaces.tobago.TreeNode", "TreeNode", TobagoComponentHandler.class);
-
-    addComponent("treeData", "org.apache.myfaces.tobago.TreeData", "TreeData", TobagoComponentHandler.class);
+    addComponent("wizardController", "org.apache.myfaces.tobago.WizardController", "WizardController", TobagoComponentHandler.class);
 
   }
 }

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=696581&r1=696580&r2=696581&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 Thu Sep 18 00:09:38 2008
@@ -50,7 +50,7 @@
    * 
    * @return The outcome after the method was executed
    */
-  void finish(ActionEvent event);
+  void leave(ActionEvent event);
 
   /**
    * Managed bean (controller) method to execute to quit (not save and exit) the

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=696581&r1=696580&r2=696581&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 Thu Sep 18 00:09:38 2008
@@ -64,9 +64,9 @@
     return getIndex() > 0;
   }
 
-  public final void finish(ActionEvent event) {
+  public final void leave(ActionEvent event) {
     if (LOG.isDebugEnabled()) {
-      LOG.debug("finish");
+      LOG.debug("leave");
     }
 
     reset();

Added: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardLeaveTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardLeaveTag.java?rev=696581&view=auto
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardLeaveTag.java (added)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardLeaveTag.java Thu Sep 18 00:09:38 2008
@@ -0,0 +1,82 @@
+package org.apache.myfaces.tobago.taglib.sandbox;
+
+/*
+ * 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.
+ */
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.myfaces.tobago.apt.annotation.ExtensionTag;
+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.ButtonTag;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.BodyTagSupport;
+
+@Tag(name = "wizardLeave")
+@ExtensionTag(baseClassName = "org.apache.myfaces.tobago.taglib.sandbox.WizardLeaveTag")
+public class WizardLeaveTag extends BodyTagSupport {
+
+  private String wizard;
+  private String action;
+  private String label;
+
+  @Override
+  public int doStartTag() throws JspException {
+
+    int result = super.doStartTag();
+
+    ButtonTag button = new ButtonTag();
+    button.setPageContext(pageContext);
+    button.setParent(getParent());
+    button.setLabel(StringUtils.isEmpty(label) ? "OK" : label); // todo: i18n
+    button.setAction(action);
+    button.setActionListener("#{" + wizard + ".leave}");
+    button.setDisabled(Boolean.toString(action == null));
+//    button.setDisabled(controller.replace("}", ".finishAvailable}").replace("#{", "#{!"));
+    button.doStartTag();
+    button.doEndTag();
+
+    return result;
+  }
+
+  @Override
+  public void release() {
+    super.release();
+    wizard = null;
+    action = null;
+    label = null;
+  }
+
+  @TagAttribute(required = true)
+  @UIComponentTagAttribute
+  public void setWizard(String wizard) {
+    this.wizard = wizard;
+  }
+
+  @TagAttribute
+  @UIComponentTagAttribute
+  public void setAction(String action) {
+    this.action = action;
+  }
+
+  @TagAttribute
+  @UIComponentTagAttribute
+  public void setLabel(String label) {
+    this.label = label;
+  }
+}
\ No newline at end of file

Copied: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardNextTag.java (from r695932, 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/WizardNextTag.java?p2=myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardNextTag.java&p1=myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardTag.java&r1=695932&r2=696581&rev=696581&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/WizardNextTag.java Thu Sep 18 00:09:38 2008
@@ -17,316 +17,66 @@
  * limitations under the License.
  */
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.FACET_LAYOUT;
+import org.apache.commons.lang.StringUtils;
 import org.apache.myfaces.tobago.apt.annotation.ExtensionTag;
 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.internal.taglib.WizardControllerTag;
-import org.apache.myfaces.tobago.model.WizardStep;
 
-import javax.faces.webapp.FacetTag;
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.BodyTagSupport;
-import java.util.List;
 
-@Tag(name = "wizard")
-@ExtensionTag(baseClassName = "org.apache.myfaces.tobago.taglib.sandbox.WizardTag")
-public class WizardTag extends BodyTagSupport {
-
-  private static final Log LOG = LogFactory.getLog(WizardTag.class);
-
-  private String controller;
-
-  private String next;
-  private String finish;
-  private String outcome;
-  private String title;
-  private String allowJumpForward;
-
-  private WizardControllerTag controllerTag;
-  private PanelTag panelTag;
+@Tag(name = "wizardNext")
+@ExtensionTag(baseClassName = "org.apache.myfaces.tobago.taglib.sandbox.WizardNextTag")
+public class WizardNextTag extends BodyTagSupport {
+
+  private String wizard;
+  private String action;
+  private String label;
 
   @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(controllerTag);
-/* todo
-    if (rendered != null) {
-      panelTag.setRendered(rendered);
-    }
-*/
-    panelTag.doStartTag();
-
-    FacetTag facetTag = new FacetTag();
-    facetTag.setPageContext(pageContext);
-    facetTag.setName(FACET_LAYOUT);
-    facetTag.setParent(panelTag);
-    facetTag.doStartTag();
-
-    GridLayoutTag gridLayoutTag = new GridLayoutTag();
-    gridLayoutTag.setPageContext(pageContext);
-    gridLayoutTag.setRows("fixed;*;fixed");
-    gridLayoutTag.setParent(facetTag);
-    gridLayoutTag.doStartTag();
-    gridLayoutTag.doEndTag();
-
-
-    facetTag.doEndTag();
-
-    return super.doStartTag();
-  }
-
-  public void doInitBody() throws JspException {
-    super.doInitBody();
-    processTrain();
-  }
-
-  private void processTrain() throws JspException {
-
-    // XXX is this possible with facelets?
+    int result = super.doStartTag();
 
-    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, allowJumpForward);
-      course = wizard.getCourse();
-    } catch (Exception e) {
-      LOG.error("", e);
-    }
-*/
-    PanelTag p = new PanelTag();
-    p.setPageContext(pageContext);
-    p.setParent(panelTag);
-    p.doStartTag();
-
-    FacetTag facetTag = new FacetTag();
-    facetTag.setPageContext(pageContext);
-    facetTag.setName(FACET_LAYOUT);
-    facetTag.setParent(panelTag);
-    facetTag.doStartTag();
-
-    GridLayoutTag gridLayoutTag = new GridLayoutTag();
-    gridLayoutTag.setPageContext(pageContext);
-//    gridLayoutTag.setColumns("*");
-    StringBuilder columns = new StringBuilder();
-    for (WizardStep info : course) {
-      columns.append("fixed;");
-    }
-    gridLayoutTag.setColumns(columns + "*");
-    gridLayoutTag.setParent(facetTag);
-    gridLayoutTag.doStartTag();
-    gridLayoutTag.doEndTag();
-
-    facetTag.doEndTag();
-
-    for (WizardStep info : course) {
-      ButtonTag button = new ButtonTag();
-      button.setPageContext(pageContext);
-      button.setParent(p);
-      button.setAction(info.getOutcome());
-      button.setActionListener("#{w.gotoStep}");
-//      button.setActionListener(controller.replace("}", ".gotoStep}"));
-      button.setLabel(info.getTitle());
-      button.doStartTag();
-
-      AttributeTag step = new AttributeTag();
-      step.setPageContext(pageContext);
-      step.setParent(button);
-      step.setName("step");
-      step.setValue("" + info.getIndex());
-      step.doStartTag();
-      step.doEndTag();
-
-      button.doEndTag();
-    }
-    OutTag spacer = new OutTag();
-    spacer.setPageContext(pageContext);
-    spacer.setParent(p);
-    spacer.setValue("#{w.index}");
-//  spacer.setValue(controller.replace("}", ".index}"));
-    spacer.doStartTag();
-    spacer.doEndTag();
+    ButtonTag button = new ButtonTag();
+    button.setPageContext(pageContext);
+    button.setParent(getParent());
+    button.setLabel(StringUtils.isEmpty(label) ? "Next" : label); // todo: i18n
+    button.setAction(action);
+    button.setActionListener("#{" + wizard + ".next}");
+    button.setDisabled(Boolean.toString(action == null));
+//    button.setDisabled(controller.replace("}", ".nextAvailable}").replace("#{", "#{!"));
+    button.doStartTag();
+    button.doEndTag();
 
-    p.doEndTag();
-  }
-
-  @Override
-  public int doEndTag() throws JspException {
-/*
-    String previous = null;
-    int previousIndex = 0;
-    boolean previousAvailable = false;
-    try {
-      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);
-    p.setParent(panelTag);
-    p.doStartTag();
-
-    FacetTag facetTag = new FacetTag();
-    facetTag.setPageContext(pageContext);
-    facetTag.setName(FACET_LAYOUT);
-    facetTag.setParent(panelTag);
-    facetTag.doStartTag();
-
-    GridLayoutTag gridLayoutTag = new GridLayoutTag();
-    gridLayoutTag.setPageContext(pageContext);
-    gridLayoutTag.setColumns("*;fixed;fixed;fixed");
-    gridLayoutTag.setParent(facetTag);
-    gridLayoutTag.doStartTag();
-    gridLayoutTag.doEndTag();
-
-    facetTag.doEndTag();
-
-    cell(panelTag);
-
-    ButtonTag previousTag = new ButtonTag();
-    previousTag.setPageContext(pageContext);
-    previousTag.setParent(panelTag);
-    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);
-    step.setName("step");
-    step.setValue("" + previousIndex);
-    step.doStartTag();
-    step.doEndTag();
-*/
-    previousTag.doEndTag();
-
-    ButtonTag nextTag = new ButtonTag();
-    nextTag.setPageContext(pageContext);
-    nextTag.setParent(panelTag);
-    nextTag.setLabel("Next");
-    nextTag.setAction(next);
-    nextTag.setActionListener("#{w.next}");
-    nextTag.setDisabled(Boolean.toString(next == null));
-//    nextTag.setDisabled(controller.replace("}", ".nextAvailable}").replace("#{", "#{!"));
-    nextTag.doStartTag();
-    nextTag.doEndTag();
-
-    ButtonTag finishTag = new ButtonTag();
-    finishTag.setPageContext(pageContext);
-    finishTag.setParent(panelTag);
-    finishTag.setLabel("Finish");
-    finishTag.setAction(finish);
-    finishTag.setActionListener("#{w.finish}");
-    finishTag.setDisabled(Boolean.toString(finish == null));
-//    finish.setDisabled(controller.replace("}", ".finishAvailable}").replace("#{", "#{!"));
-    finishTag.doStartTag();
-    finishTag.doEndTag();
-
-    p.doEndTag();
-
-    panelTag.doEndTag();
-
-    controllerTag.doEndTag();
-
-    return super.doEndTag();
-  }
-
-  private void cell(javax.servlet.jsp.tagext.Tag tag) throws JspException {
-    CellTag spacer = new CellTag();
-    spacer.setPageContext(pageContext);
-    spacer.setParent(tag);
-    spacer.doStartTag();
-    spacer.doEndTag();
+    return result;
   }
 
   @Override
   public void release() {
     super.release();
-    controller = null;
-    next = null;
-    finish = null;
-    outcome = null;
-    title = null;
-    panelTag = null;
+    wizard = null;
+    action = null;
+    label = null;
   }
 
   @TagAttribute(required = true)
-  @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.model.Wizard")
-  public void setController(String controller) {
-    this.controller = controller;
-  }
-
-  @TagAttribute
   @UIComponentTagAttribute
-  public void setNext(String next) {
-    this.next = next;
+  public void setWizard(String wizard) {
+    this.wizard = wizard;
   }
 
   @TagAttribute
   @UIComponentTagAttribute
-  public void setFinish(String finish) {
-    this.finish = finish;
+  public void setAction(String action) {
+    this.action = action;
   }
 
   @TagAttribute
   @UIComponentTagAttribute
-  public void setOutcome(String outcome) {
-    this.outcome = outcome;
-  }
-
-  @TagAttribute
-  @UIComponentTagAttribute
-  public void setTitle(String title) {
-    this.title = title;
-  }
-
-  @TagAttribute
-  @UIComponentTagAttribute(type="java.lang.Boolean")
-  public void setAllowJumpForward(String allowJumpForward) {
-    this.allowJumpForward = allowJumpForward;
+  public void setLabel(String label) {
+    this.label = label;
   }
 }

Propchange: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardNextTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardNextTag.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardNextTag.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardPreviousTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardPreviousTag.java?rev=696581&view=auto
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardPreviousTag.java (added)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardPreviousTag.java Thu Sep 18 00:09:38 2008
@@ -0,0 +1,72 @@
+package org.apache.myfaces.tobago.taglib.sandbox;
+
+/*
+ * 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.
+ */
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.myfaces.tobago.apt.annotation.ExtensionTag;
+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.ButtonTag;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.BodyTagSupport;
+
+@Tag(name = "wizardPrevious")
+@ExtensionTag(baseClassName = "org.apache.myfaces.tobago.taglib.sandbox.WizardPreviousTag")
+public class WizardPreviousTag extends BodyTagSupport {
+
+  private String wizard;
+  private String label;
+
+  @Override
+  public int doStartTag() throws JspException {
+
+    int result = super.doStartTag();
+
+    ButtonTag button = new ButtonTag();
+    button.setPageContext(pageContext);
+    button.setParent(getParent());
+    button.setLabel(StringUtils.isEmpty(label) ? "Previous" : label); // todo: i18n
+    button.setAction("#{" + wizard + ".previous}");
+    button.setDisabled("#{!" + wizard + ".previousAvailable}");
+    button.doStartTag();
+    button.doEndTag();
+
+    return result;
+  }
+
+  @Override
+  public void release() {
+    super.release();
+    wizard = null;
+    label = null;
+  }
+
+  @TagAttribute(required = true)
+  @UIComponentTagAttribute
+  public void setWizard(String wizard) {
+    this.wizard = wizard;
+  }
+
+  @TagAttribute
+  @UIComponentTagAttribute
+  public void setLabel(String label) {
+    this.label = label;
+  }
+}

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=696581&r1=696580&r2=696581&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 Thu Sep 18 00:09:38 2008
@@ -24,20 +24,13 @@
 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.internal.taglib.WizardControllerTag;
-import org.apache.myfaces.tobago.model.WizardStep;
 
 import javax.faces.webapp.FacetTag;
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.BodyTagSupport;
-import java.util.List;
 
 @Tag(name = "wizard")
 @ExtensionTag(baseClassName = "org.apache.myfaces.tobago.taglib.sandbox.WizardTag")
@@ -47,8 +40,6 @@
 
   private String controller;
 
-  private String next;
-  private String finish;
   private String outcome;
   private String title;
   private String allowJumpForward;
@@ -96,177 +87,13 @@
     gridLayoutTag.doStartTag();
     gridLayoutTag.doEndTag();
 
-
     facetTag.doEndTag();
 
     return super.doStartTag();
   }
 
-  public void doInitBody() throws JspException {
-    super.doInitBody();
-    processTrain();
-  }
-
-  private void processTrain() throws JspException {
-
-    // 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, allowJumpForward);
-      course = wizard.getCourse();
-    } catch (Exception e) {
-      LOG.error("", e);
-    }
-*/
-    PanelTag p = new PanelTag();
-    p.setPageContext(pageContext);
-    p.setParent(panelTag);
-    p.doStartTag();
-
-    FacetTag facetTag = new FacetTag();
-    facetTag.setPageContext(pageContext);
-    facetTag.setName(FACET_LAYOUT);
-    facetTag.setParent(panelTag);
-    facetTag.doStartTag();
-
-    GridLayoutTag gridLayoutTag = new GridLayoutTag();
-    gridLayoutTag.setPageContext(pageContext);
-//    gridLayoutTag.setColumns("*");
-    StringBuilder columns = new StringBuilder();
-    for (WizardStep info : course) {
-      columns.append("fixed;");
-    }
-    gridLayoutTag.setColumns(columns + "*");
-    gridLayoutTag.setParent(facetTag);
-    gridLayoutTag.doStartTag();
-    gridLayoutTag.doEndTag();
-
-    facetTag.doEndTag();
-
-    for (WizardStep info : course) {
-      ButtonTag button = new ButtonTag();
-      button.setPageContext(pageContext);
-      button.setParent(p);
-      button.setAction(info.getOutcome());
-      button.setActionListener("#{w.gotoStep}");
-//      button.setActionListener(controller.replace("}", ".gotoStep}"));
-      button.setLabel(info.getTitle());
-      button.doStartTag();
-
-      AttributeTag step = new AttributeTag();
-      step.setPageContext(pageContext);
-      step.setParent(button);
-      step.setName("step");
-      step.setValue("" + info.getIndex());
-      step.doStartTag();
-      step.doEndTag();
-
-      button.doEndTag();
-    }
-    OutTag spacer = new OutTag();
-    spacer.setPageContext(pageContext);
-    spacer.setParent(p);
-    spacer.setValue("#{w.index}");
-//  spacer.setValue(controller.replace("}", ".index}"));
-    spacer.doStartTag();
-    spacer.doEndTag();
-
-    p.doEndTag();
-  }
-
   @Override
   public int doEndTag() throws JspException {
-/*
-    String previous = null;
-    int previousIndex = 0;
-    boolean previousAvailable = false;
-    try {
-      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);
-    p.setParent(panelTag);
-    p.doStartTag();
-
-    FacetTag facetTag = new FacetTag();
-    facetTag.setPageContext(pageContext);
-    facetTag.setName(FACET_LAYOUT);
-    facetTag.setParent(panelTag);
-    facetTag.doStartTag();
-
-    GridLayoutTag gridLayoutTag = new GridLayoutTag();
-    gridLayoutTag.setPageContext(pageContext);
-    gridLayoutTag.setColumns("*;fixed;fixed;fixed");
-    gridLayoutTag.setParent(facetTag);
-    gridLayoutTag.doStartTag();
-    gridLayoutTag.doEndTag();
-
-    facetTag.doEndTag();
-
-    cell(panelTag);
-
-    ButtonTag previousTag = new ButtonTag();
-    previousTag.setPageContext(pageContext);
-    previousTag.setParent(panelTag);
-    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);
-    step.setName("step");
-    step.setValue("" + previousIndex);
-    step.doStartTag();
-    step.doEndTag();
-*/
-    previousTag.doEndTag();
-
-    ButtonTag nextTag = new ButtonTag();
-    nextTag.setPageContext(pageContext);
-    nextTag.setParent(panelTag);
-    nextTag.setLabel("Next");
-    nextTag.setAction(next);
-    nextTag.setActionListener("#{w.next}");
-    nextTag.setDisabled(Boolean.toString(next == null));
-//    nextTag.setDisabled(controller.replace("}", ".nextAvailable}").replace("#{", "#{!"));
-    nextTag.doStartTag();
-    nextTag.doEndTag();
-
-    ButtonTag finishTag = new ButtonTag();
-    finishTag.setPageContext(pageContext);
-    finishTag.setParent(panelTag);
-    finishTag.setLabel("Finish");
-    finishTag.setAction(finish);
-    finishTag.setActionListener("#{w.finish}");
-    finishTag.setDisabled(Boolean.toString(finish == null));
-//    finish.setDisabled(controller.replace("}", ".finishAvailable}").replace("#{", "#{!"));
-    finishTag.doStartTag();
-    finishTag.doEndTag();
-
-    p.doEndTag();
 
     panelTag.doEndTag();
 
@@ -275,20 +102,10 @@
     return super.doEndTag();
   }
 
-  private void cell(javax.servlet.jsp.tagext.Tag tag) throws JspException {
-    CellTag spacer = new CellTag();
-    spacer.setPageContext(pageContext);
-    spacer.setParent(tag);
-    spacer.doStartTag();
-    spacer.doEndTag();
-  }
-
   @Override
   public void release() {
     super.release();
     controller = null;
-    next = null;
-    finish = null;
     outcome = null;
     title = null;
     panelTag = null;
@@ -302,18 +119,6 @@
 
   @TagAttribute
   @UIComponentTagAttribute
-  public void setNext(String next) {
-    this.next = next;
-  }
-
-  @TagAttribute
-  @UIComponentTagAttribute
-  public void setFinish(String finish) {
-    this.finish = finish;
-  }
-
-  @TagAttribute
-  @UIComponentTagAttribute
   public void setOutcome(String outcome) {
     this.outcome = outcome;
   }

Added: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardTrainTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardTrainTag.java?rev=696581&view=auto
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardTrainTag.java (added)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardTrainTag.java Thu Sep 18 00:09:38 2008
@@ -0,0 +1,135 @@
+package org.apache.myfaces.tobago.taglib.sandbox;
+
+/*
+ * 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.
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import static org.apache.myfaces.tobago.TobagoConstants.FACET_LAYOUT;
+import org.apache.myfaces.tobago.apt.annotation.ExtensionTag;
+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.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.model.WizardStep;
+
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+import javax.faces.webapp.FacetTag;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.BodyTagSupport;
+import java.util.List;
+
+@Tag(name = "wizardTrain")
+@ExtensionTag(baseClassName = "org.apache.myfaces.tobago.taglib.sandbox.WizardTrainTag")
+public class WizardTrainTag extends BodyTagSupport {
+
+  private static final Log LOG = LogFactory.getLog(WizardTrainTag.class);
+
+  private String controller;
+  private String wizard;
+
+  @Override
+  public int doStartTag() throws JspException {
+
+    int result = super.doStartTag();
+
+    // XXX is this possible with facelets?
+    FacesContext facesContext = FacesContext.getCurrentInstance();
+    Application application = facesContext.getApplication();
+    Wizard wizardObject = (Wizard) application.createValueBinding(controller).getValue(facesContext);
+    List<WizardStep> course = wizardObject.getCourse();
+
+    PanelTag panel = new PanelTag();
+    panel.setPageContext(pageContext);
+    panel.setParent(getParent());
+    panel.doStartTag();
+
+    FacetTag facetTag = new FacetTag();
+    facetTag.setPageContext(pageContext);
+    facetTag.setName(FACET_LAYOUT);
+    facetTag.setParent(panel);
+    facetTag.doStartTag();
+
+    GridLayoutTag gridLayoutTag = new GridLayoutTag();
+    gridLayoutTag.setPageContext(pageContext);
+    StringBuilder columns = new StringBuilder();
+    for (WizardStep info : course) {
+      columns.append("fixed;");
+    }
+    gridLayoutTag.setColumns(columns + "*");
+    gridLayoutTag.setParent(facetTag);
+    gridLayoutTag.doStartTag();
+    gridLayoutTag.doEndTag();
+
+    facetTag.doEndTag();
+
+    for (WizardStep info : course) {
+      ButtonTag button = new ButtonTag();
+      button.setPageContext(pageContext);
+      button.setParent(panel);
+      button.setAction(info.getOutcome());
+      button.setActionListener("#{"+ wizard +".gotoStep}");
+      button.setLabel(info.getTitle());
+      button.doStartTag();
+
+      AttributeTag step = new AttributeTag();
+      step.setPageContext(pageContext);
+      step.setParent(button);
+      step.setName("step");
+      step.setValue("" + info.getIndex());
+      step.doStartTag();
+      step.doEndTag();
+
+      button.doEndTag();
+    }
+    OutTag spacer = new OutTag();
+    spacer.setPageContext(pageContext);
+    spacer.setParent(panel);
+    spacer.setValue("#{"+ wizard +".index}");
+    spacer.doStartTag();
+    spacer.doEndTag();
+
+    panel.doEndTag();
+
+    return result;
+  }
+
+  @Override
+  public void release() {
+    super.release();
+    controller = null;
+    wizard = null;
+  }
+
+  @TagAttribute(required = true)
+  @UIComponentTagAttribute
+  public void setWizard(String wizard) {
+    this.wizard = wizard;
+  }
+
+  @TagAttribute(required = true)
+  @UIComponentTagAttribute
+  public void setController(String controller) {
+    this.controller = controller;
+  }
+}



Mime
View raw message