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 2007/11/26 15:34:22 UTC

svn commit: r598289 - in /myfaces/tobago/trunk: example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/ sandbox/src/main/java/org/apache/myfaces/tobago/model/ sandbox/src/main/resources/META-INF/

Author: lofwyr
Date: Mon Nov 26 06:34:21 2007
New Revision: 598289

URL: http://svn.apache.org/viewvc?rev=598289&view=rev
Log:
wizard modifications

Added:
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/UIWizard.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardBackwardNavigationStrategy.java
    myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/dynamic-content.xml
    myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-goto.xml
    myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-navigation.xml
Modified:
    myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/SampleWizard.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/AbstractWizard.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/Wizard.java
    myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/tobago-facelet-sandbox.taglib.xml
    myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard.xml

Modified: myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/SampleWizard.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/SampleWizard.java?rev=598289&r1=598288&r2=598289&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/SampleWizard.java (original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/SampleWizard.java Mon Nov 26 06:34:21 2007
@@ -33,10 +33,6 @@
 
   private List<BeanItem> items = new ArrayList<BeanItem>();
 
-  public String finish() {
-    return null;
-  }
-
   public UIPanel getCurrentComponent() {
 
     UIOutput out = new UIOutput();
@@ -49,7 +45,7 @@
   }
 
   @Override
-  public String next() {
+  public boolean doNext() {
 
     LOG.info("items: " + items);
     items.clear();
@@ -68,12 +64,29 @@
         break;
       default:
     }
+    return true;
+  }
+
+  public boolean doInitialization() {
+    return true;
+  }
 
-    return super.next();
+  public boolean doPrevious() {
+    return true;
   }
 
-  public List<BeanItem> getItems() {
-    return items;
+  public boolean doFinish() {
+    return true;
   }
 
+  public boolean doCancel() {
+    return true;
+  }
+
+  public boolean doGotoStep(int indexToShow) {
+    return true;
+  }
+
+  public void makeContentDecision(int indexToShow) {
+  }
 }

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/AbstractWizard.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/AbstractWizard.java?rev=598289&r1=598288&r2=598289&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/AbstractWizard.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/AbstractWizard.java Mon Nov 26 06:34:21 2007
@@ -17,54 +17,401 @@
  * limitations under the License.
  */
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.component.UICommand;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
 
 public abstract class AbstractWizard implements Wizard {
 
-  private static final Log LOG = LogFactory.getLog(AbstractWizard.class);
+    private static final Log LOG = LogFactory.getLog(AbstractWizard.class);
+
+    private static final String WIZARD_FINISH_OUTCOME = "wizard-finish";
+
+    private static final String WIZARD_CANCEL_OUTCOME = "wizard-cancel";
+
+    private String defaultOutcome;
+
+    private int index;
+
+    private int size;
+
+    private boolean sizeSet;
+
+    private boolean started;
+
+    private boolean preparedForFinishing;
+
+    private boolean backNavImmediate = true; // default, if not set otherwise
+
+    boolean dynamicContent;
+
+    private String staticContentSource = null;
+
+    private int requestedIndex;
 
-  private int index = 0;
+    private WizardBackwardNavigationStrategy backNavStrategy = WizardBackwardNavigationStrategy.NOT_ALLOWED;
+
+    public boolean isStartable() {
+        return true;
+    }
+
+    public final String initialize() {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("initialize");
+        }
+        if (!started) {
+            reset();
+
+            boolean success = doInitialization();
+            if (success) {
+                started = true;
+                dynamicContent = true;
+                index++;
+
+                if (!sizeSet) {
+                    size++;
+                }
+            }
+
+            makeContentDecision(index);
+
+        }
+        return getDefaultOutcome();
+    }
+
+    /**
+     * <p>
+     * Hook for the implementation of business logic, after invoking the action {@link AbstractWizard#initialize()}.
+     * 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
+     */
+
+    public abstract boolean doInitialization();
+
+    public final boolean isStartAvailable() {
+        return (!started);
+    }
+
+    public boolean isStarted() {
+        return started;
+    }
+
+    public final String next() {
+        LOG.debug("next");
+
+        boolean success = doNext();
+        if (success) {
+            index++;
+
+            if (!sizeSet && (size < index)) {
+                size++;
+            }
+
+        }
+
+        makeContentDecision(index);
+
+        return getDefaultOutcome();
+    }
+
+    /**
+     * <p>
+     * Hook for the implementation of business logic, after invoking the action {@link AbstractWizard#next()}.
+     * 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
+     */
+    public abstract boolean doNext();
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.myfaces.tobago.model.Wizard#isNextAvailable()
+     */
+    public final boolean isNextAvailable() {
+        return (started && !preparedForFinishing);
+    }
+
+    public final String previous() {
+        LOG.debug("previous");
+
+        boolean success = doPrevious();
+        if (success) {
+
+            if (index > 0) {
+                index--;
+            }
+            if (index == 0) {
+                started = false;
+            }
+            if (preparedForFinishing) {
+                preparedForFinishing = false;
+            }
+
+            switch (backNavStrategy) {
+                case DELETE :
+                    if (!sizeSet) {
+                        size = index;
+                    }
+                    break;
+            }
+        }
+
+        makeContentDecision(index);
+
+        return getDefaultOutcome();
+    }
+
+    /**
+     * <p>
+     * Hook for the implementation of business logic, after invoking the action {@link AbstractWizard#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
+     */
+    public abstract boolean doPrevious();
+
+    public final boolean isPreviousAvailable() {
+        return getIndex() > 1 ? true : false;
+    }
+
+    public boolean isPreviousRendered() {
+        return true;
+    }
+
+    public boolean isBackwardNavigationImmediate() {
+        return backNavImmediate;
+    }
+
+    public void setBackwardNavigationImmediate(boolean immediate) {
+        this.backNavImmediate = immediate;
+    }
+
+    public final void setPreparedForFinishing() {
+        this.preparedForFinishing = true;
+    }
+
+    public final String finish() {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("finish");
+        }
+
+        boolean success = doFinish();
+        if (!success) {
+            makeContentDecision(index);
+            return getDefaultOutcome();
+        }
+
+        reset();
+        return WIZARD_FINISH_OUTCOME;
+    }
+
+    /**
+     * <p>
+     * Hook for the implementation of business logic, after invoking the action {@link AbstractWizard#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
+     */
+    public abstract boolean doFinish();
+
+    public final boolean isFinishAvailable() {
+        return (started && preparedForFinishing);
+    }
+
+    public final String cancel() {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("cancel");
+        }
+        boolean success = doCancel();
+        if (!success) {
+            makeContentDecision(index);
+            return getDefaultOutcome();
+        }
+        reset();
+        return WIZARD_CANCEL_OUTCOME;
+    }
+
+    public abstract boolean doCancel();
+
+    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 {
+            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));
+        }
+    }
+
+    public final String gotoStep() {
+        LOG.debug("gotoStep: " + requestedIndex);
+
+        boolean success = doGotoStep(requestedIndex);
+        if (success) {
+            preparedForFinishing = false;
+            index = requestedIndex;
+
+            switch (backNavStrategy) {
+                case DELETE :
+                    if (!isSizeSet()) {
+                        size = index;
+                    }
+                    break;
+            }
+        }
+
+        makeContentDecision(index);
+        // reset requestIndex
+        requestedIndex = 0;
+        return getDefaultOutcome();
+    }
+
+    /**
+     * <p>
+     * Hook for the implementation of business logic, after invoking the action {@link AbstractWizard#gotoStep()}.
+     * 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>
+     * 
+     * @param indexToShow The view index to show next
+     * 
+     * @return true if the method completed sucessfully, false if not
+     */
+    public abstract boolean doGotoStep(int indexToShow);
+
+    public final int getIndex() {
+        return index;
+    }
+
+    public final boolean isSizeSet() {
+        return sizeSet;
+    }
+
+    public final void setSize(int size) {
+        if (!sizeSet) {
+            sizeSet = true;
+            this.size = size;
+        } else {
+            LOG.error("Size for wizard is already set and can not be changed!");
+        }
+    }
+
+    public final int getSize() {
+        return size;
+    }
+
+    public final void resetSize(int size) {
+        this.size = size;
+    }
+
+    public final boolean isDynamicContent() {
+        return dynamicContent;
+    }
+
+    public final void setDynamicContent() {
+        this.dynamicContent = true;
+        this.staticContentSource = null;
+    }
+
+    public final void setStaticContent(String staticContentSource) {
+        this.dynamicContent = false;
+        this.staticContentSource = staticContentSource;
+    }
+
+    public final String getStaticContentSource() {
+        return staticContentSource;
+    }
+
+    public abstract void makeContentDecision(int indexToShow);
+
+    /*
+     * Helper method to reset all attributes 
+     */
+    protected void reset() {
+        dynamicContent = true;
+        staticContentSource = null;
+        started = false;
+        preparedForFinishing = false;
+        requestedIndex = 0;
+        index = 0;
+        if (!sizeSet) {
+            size = 0;
+        }
+    }
+
+    public final String getDefaultOutcome() {
+        return defaultOutcome;
+    }
+
+    public final void setDefaultOutcome(String defaultOutcome) {
+        this.defaultOutcome = defaultOutcome;
+    }
+
+    /**
+     * 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 org.apache.myfaces.tobago.model.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 org.apache.myfaces.tobago.model.Wizard}.
+     * </p>
+     * <p>
+     * <b>Note: </b>If the parameter value is not known by the wizard the backward navigation strategy
+     * {@link 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);
+        }
+    }
 
-  public String start() {
-    index = 0;
-    return "wizard";
-  }
-
-  public boolean isStartAvailable() {
-    return index > 0;
-  }
-
-  public String next() {
-    index++;
-    LOG.info("next -> " + index);
-    return "wizard";
-  }
-
-  public boolean isNextAvailable() {
-    return getSize() == null || index + 1  < getSize();
-  }
-
-  public String previous() {
-    if (index > 0) {
-      index--;
-    }
-    return "wizard";
-  }
-
-  public boolean isPreviousAvailable() {
-    return index > 0;
-  }
-
-  public boolean isFinishAvailable() {
-    return getSize() == null || index + 1 >=  getSize();
-  }
-
-  public int getIndex() {
-    return index;
-  }
-
-  public Integer getSize() {
-    return 6;  //xxx not implemented yet
-  }
 }

Added: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/UIWizard.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/UIWizard.java?rev=598289&view=auto
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/UIWizard.java (added)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/UIWizard.java Mon Nov 26 06:34:21 2007
@@ -0,0 +1,13 @@
+package org.apache.myfaces.tobago.model;
+
+import org.apache.myfaces.tobago.component.UIPanel;
+
+public interface UIWizard {
+
+    /**
+     * 
+     * @return the current UIPanel with the (dynamic) UIComponents as chlidren
+     */
+    UIPanel getCurrentComponent();
+
+}

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=598289&r1=598288&r2=598289&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 Mon Nov 26 06:34:21 2007
@@ -17,37 +17,109 @@
  * limitations under the License.
  */
 
-import org.apache.myfaces.tobago.component.UIPanel;
-
-import java.util.List;
+import javax.faces.event.ActionEvent;
 
 public interface Wizard {
 
-  String start();
+    /*
+     * Constants
+     */
+
+    static final String BACKWARD_NAVIGATION_STRATEGY_DELETE = "delete";
+
+    static final String BACKWARD_NAVIGATION_STRATEGY_REPLACE = "replace";
+
+    static final String BACKWARD_NAVIGATION_STRATEGY_NOTALLOWED = "notallowed";
+
+    /*
+     * Methods
+     */
+
+    /**
+     * 
+     * @return A boolean value stating if the content of the wizard is dynamic or a "static" content should be use
+     */
+    boolean isDynamicContent();
+
+    /**
+     * 
+     * @return The source-path or Url to the static content to be included
+     */
+    String getStaticContentSource();
+
+    void setDynamicContent();
+
+    void setStaticContent(String staticContentSource);
+
+    /**
+     * Return the index of the actual wizard view.
+     * 
+     * @return The index of the actual wizard view 
+     */
+    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);
+
+    String initialize();
+
+    //    DynamicBean doInitialization();
+
+    boolean isStarted();
+
+    String next();
+
+    //    void doNext();
+
+    boolean isNextAvailable();
+
+    String previous();
+
+    //    void doPrevious(DynamicBean currentBean);
+
+    boolean isPreviousAvailable();
+
+    boolean isPreviousRendered();
+
+    /**
+     * Modificator, if backward navigation actions are immediate.
+     * The modifactor should be set only once, e.g. during initialization.
+     * 
+     * @return If backward navigation actions are immediate
+     */
+    boolean isBackwardNavigationImmediate();
+
+    void setPreparedForFinishing();
 
-  boolean isStartAvailable();
+    String finish();
 
-  String next();
+    //    void doFinish();
 
-  boolean isNextAvailable();
+    boolean isFinishAvailable();
 
-  String previous();
+    String cancel();
 
-  boolean isPreviousAvailable();
+    //    void doCancel();
 
-  String finish();
+    void gotoClicked(ActionEvent actionEvent);
 
-  boolean isFinishAvailable();
+    String gotoStep();
 
-  UIPanel getCurrentComponent();
+    void makeContentDecision(int indexToShow);
 
-  List<BeanItem> getItems();
+    String getDefaultOutcome();
 
-  int getIndex();
+    //        void setBackwardNavigationStrategy(String strategy);
 
-  /**
-   *
-   * @return The number of pages in the wizard or null if this information is unavailable.
-   */
-  Integer getSize();
 }

Added: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardBackwardNavigationStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardBackwardNavigationStrategy.java?rev=598289&view=auto
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardBackwardNavigationStrategy.java (added)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/WizardBackwardNavigationStrategy.java Mon Nov 26 06:34:21 2007
@@ -0,0 +1,27 @@
+package org.apache.myfaces.tobago.model;
+
+public enum WizardBackwardNavigationStrategy {
+
+    DELETE(Wizard.BACKWARD_NAVIGATION_STRATEGY_DELETE), REPLACE(Wizard.BACKWARD_NAVIGATION_STRATEGY_REPLACE), NOT_ALLOWED(
+            Wizard.BACKWARD_NAVIGATION_STRATEGY_NOTALLOWED);
+
+    private String name;
+
+    private WizardBackwardNavigationStrategy(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public static WizardBackwardNavigationStrategy getStrategy(String strategy) throws IllegalArgumentException {
+        for (WizardBackwardNavigationStrategy ws : WizardBackwardNavigationStrategy.values()) {
+            if (ws.name.equalsIgnoreCase(strategy)) {
+                return ws;
+            }
+        }
+        throw new IllegalArgumentException("WizardBackwardNavigationStrategy '" + strategy + "' unknown!");
+    }
+
+}

Added: myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/dynamic-content.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/dynamic-content.xml?rev=598289&view=auto
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/dynamic-content.xml (added)
+++ myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/dynamic-content.xml Mon Nov 26 06:34:21 2007
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	* 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.
+-->
+
+<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:c="http://java.sun.com/jstl/core"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:tc="http://myfaces.apache.org/tobago/component">
+
+	<tc:panel>
+		<f:facet name="layout">
+			<tc:gridLayout />
+		</f:facet>
+
+		<!-- content -->
+		<c:set var="isDynamicContent"
+			value="${controller.dynamicContent}" />
+		<c:if test="${isDynamicContent}">
+			<ui:include src="${defaultDynamicContentSource}" />
+		</c:if>
+		<c:if test="${!isDynamicContent}">
+			<ui:include src="${controller.staticContentSource}" />
+		</c:if>
+
+	</tc:panel>
+
+</ui:composition>

Modified: myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/tobago-facelet-sandbox.taglib.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/tobago-facelet-sandbox.taglib.xml?rev=598289&r1=598288&r2=598289&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/tobago-facelet-sandbox.taglib.xml (original)
+++ myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/tobago-facelet-sandbox.taglib.xml Mon Nov 26 06:34:21 2007
@@ -10,4 +10,16 @@
     <tag-name>bean</tag-name>
     <source>bean.xml</source>
   </tag>
+  <tag>
+    <tag-name>wizard-goto</tag-name>
+    <source>wizard-goto.xml</source>
+  </tag>
+  <tag>
+    <tag-name>wizard-navigation</tag-name>
+    <source>wizard-navigation.xml</source>
+  </tag>
+  <tag>
+    <tag-name>dynamic-content</tag-name>
+    <source>dynamic-content.xml</source>
+  </tag>
 </facelet-taglib>

Added: myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-goto.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-goto.xml?rev=598289&view=auto
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-goto.xml (added)
+++ myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-goto.xml Mon Nov 26 06:34:21 2007
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	* 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.
+-->
+
+<ui:composition xmlns:c="http://java.sun.com/jstl/core"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:tc="http://myfaces.apache.org/tobago/component">
+	
+	<c:set var="replaceGoto" value="true" />
+	<c:if test="${empty gotoSource}" >
+		<c:set var="replaceGoto" value="false" />
+	</c:if>	
+	
+	<!-- replace goto -->
+	
+	<c:if test="${replaceGoto}">
+		<ui:include src="${gotoSource}" />
+	</c:if>
+	
+	<!-- default goto -->
+
+	<c:if test="${!replaceGoto}">
+		<!-- layout information -->
+		<c:set var="colums" value="" />
+		<c:forEach var="index" begin="1" end="${controller.size}" step="1">
+			<c:if test="${index ne 1}">
+				<c:set var="colums" value="${colums};fixed" />
+			</c:if>
+			<c:set var="colums" value="${colums};fixed" />
+		</c:forEach>
+		<c:set var="colums" value="${colums};*" />
+		
+		<!-- navigation -->
+		<tc:panel>
+			<f:facet name="layout">
+				<tc:gridLayout rows="fixed" columns="${colums}" />
+			</f:facet>
+		
+			<c:forEach var="index" begin="1" end="${controller.size}" step="1">
+				<c:if test="${index ne 1}">
+					<tc:out value=">>" />
+				</c:if>
+				<c:set var="isButtonDisabled" value="false" />
+				<c:if test="${(i gt controller.index) or (controller.backwardNavigationStrategy eq 'notallowed')}">
+					<c:set var="isButtonDisabled" value="true" />
+				</c:if>
+				<tc:button action="${controller.gotoStep}"
+					actionListener="${controller.gotoClicked}"
+					disabled="${isButtonDisabled}"
+					immediate="${controller.backwardNavigationImmediate}"
+					label="${index}"
+					id="wizard-goto-${index}" />
+			</c:forEach>
+		
+			<tc:cell />
+		
+		</tc:panel>
+	</c:if>
+
+</ui:composition>

Added: myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-navigation.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-navigation.xml?rev=598289&view=auto
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-navigation.xml (added)
+++ myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-navigation.xml Mon Nov 26 06:34:21 2007
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	* 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.
+-->
+
+<ui:composition xmlns:c="http://java.sun.com/jstl/core"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:tc="http://myfaces.apache.org/tobago/component">
+
+	<c:set var="replaceNavigation" value="true" />
+	<c:if test="${empty navigationSource}" >
+		<c:set var="replaceNavigation" value="false" />
+	</c:if>
+
+	<c:if test="${empty isPreviousRendered}">
+		<c:set var="isPreviousRendered" value="true" />
+	</c:if>
+	
+	<!-- replace navigation -->
+	<c:if test="${replaceNavigation}" >
+		<ui:include src="${navigationSource}" />
+	</c:if>
+	
+	<!-- default navigation -->
+
+	<c:if test="${!replaceNavigation}" >
+		<tc:panel>
+			<f:facet name="layout">
+				<tc:gridLayout columns="*;fixed;fixed;fixed;fixed" />
+			</f:facet>
+			
+			<c:if test="${!controller.previousAvailable or (controller.backwardNavigationStrategy eq 'notallowed')}" >
+				<c:set var="previousDisabled" value="true" />
+			</c:if>
+		
+			<tc:cell />
+			<tc:button action="${controller.previous}"
+				rendered="${isPreviousRendered}"
+				disabled="${previousDisabled}" 
+				immediate="${controller.backwardNavigationImmediate}"
+				label="Previous" />
+			<tc:button action="${controller.next}"
+				disabled="${!controller.nextAvailable}"
+				label="Next" />
+			<tc:button action="${controller.finish}"
+				disabled="${!controller.finishAvailable}"
+				label="Finish" />
+			<tc:button action="${controller.cancel}"
+				label="Cancel"
+				immediate="true" />
+		
+		</tc:panel>
+	</c:if>
+
+</ui:composition>

Modified: myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard.xml?rev=598289&r1=598288&r2=598289&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard.xml (original)
+++ myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard.xml Mon Nov 26 06:34:21 2007
@@ -1,49 +1,99 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- * 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.
+	* 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.
 -->
 
 <ui:composition xmlns:c="http://java.sun.com/jstl/core"
-                xmlns:ui="http://java.sun.com/jsf/facelets"
-                xmlns:f="http://java.sun.com/jsf/core"
-                xmlns:tc="http://myfaces.apache.org/tobago/component"
-                xmlns:tfs="http://myfaces.apache.org/tobago/facelet-sandbox">
-
-  <tc:panel>
-    <f:facet name="layout">
-      <tc:gridLayout columns="*;fixed;fixed;fixed;fixed" rows="*;fixed"/>
-    </f:facet>
-
-    <tc:cell spanX="5">
-
-      <c:if test="${controller.index lt 2}">
-        <ui:include src="/snip-${controller.index}.xml"/>
-      </c:if>
-      <c:if test="${! (controller.index lt 2)}">
-        <tfs:bean controller="${controller}"/>
-      </c:if>
-
-    </tc:cell>
-
-    <tc:cell/>
-    <tc:button action="${controller.start}" disabled="${! controller.startAvailable}" label="Start"/>
-    <tc:button action="${controller.previous}" disabled="${! controller.previousAvailable}" label="Previous"/>
-    <tc:button action="${controller.next}" disabled="${! controller.nextAvailable}" label="Next"/>
-    <tc:button action="${controller.finish}" disabled="${! controller.finishAvailable}" label="Finish"/>
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:tc="http://myfaces.apache.org/tobago/component"
+	xmlns:tfs="http://myfaces.apache.org/tobago/facelet-sandbox">
+
+	<tc:panel>
+		<f:facet name="layout">
+			<tc:gridLayout rows="fixed;fixed;fixed;fixed;fixed;fixed;*" />
+		</f:facet>
+
+		<!-- default settings -->
+		<c:if test="${empty canDoPrevious}">
+			<c:set var="canDoPrevious" value="true" />
+		</c:if>
+		<c:if test="${empty isGotoRendered}">
+			<c:set var="isGotoRendered" value="true" />
+		</c:if>
+		<c:if test="${!canDoPrevious}">
+			<c:set var="isGotoRendered" value="false" />
+			<c:set var="isPreviousRendered" value="false" />
+		</c:if>
+		<c:if test="${empty isGotoSeparatorRendered}">
+			<c:set var="isGotoSeparatorRendered" value="true" />
+		</c:if>
+		<c:if test="${empty isNavigationSeparatorRendered}">
+			<c:set var="isNavigationSeparatorRendered" value="true" />
+		</c:if>
+		<c:if test="${empty isNavigationRendered}">
+			<c:set var="isNavigationRendered" value="true" />
+		</c:if>
+		<c:set var="replaceNavigation" value="true" />
+		<c:if test="${empty navigationSource}">
+			<c:set var="replaceNavigation" value="false" />
+		</c:if>
+		<c:if test="${empty showMessages}">
+			<c:set var="showMessages" value="false" />
+		</c:if>
+
+
+		<!-- goto -->
+		<c:if test="${isGotoRendered}">
+			<tfs:wizard-goto controller="${controller}" gotoSource="${gotoSource}" />
+		</c:if>
+		<!-- placeholder for layout -->
+		<c:if test="${!isGotoRendered}">
+			<tc:cell />
+		</c:if>
+
+		<tc:separator rendered="${isGotoSeparatorRendered}" />
+		
+		<!-- messages -->
+		<c:if test="${showMessages}">
+			<tc:messages />
+		</c:if>
+		<c:if test="${!showMessages}">
+			<tc:cell />
+		</c:if>
+
+		<!-- content -->
+		<tfs:dynamic-content controller="${controller}" defaultDynamicContentSource="${defaultDynamicContentSource}" />
+
+		<tc:separator rendered="${isNavigationSeparatorRendered}" />
+
+		<!-- navigation -->
+		<c:if test="${isNavigationRendered}">
+			<tfs:wizard-navigation controller="${controller}"
+				isPreviousRendered="${isPreviousRendered}"
+				navigationSource="${navigationSource}" />
+		</c:if>
+		<!-- placeholder for layout -->
+		<c:if test="${!isNavigationRendered}">
+			<tc:cell />
+		</c:if>
 
-  </tc:panel>
+		<!-- layout -->
+		<tc:cell />
+
+	</tc:panel>
 
 </ui:composition>