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/12/06 20:34:00 UTC
svn commit: r601825 - 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/java/org/apache/myfaces/tobago/taglib/sandbox/
sandbox/src/...
Author: lofwyr
Date: Thu Dec 6 11:33:59 2007
New Revision: 601825
URL: http://svn.apache.org/viewvc?rev=601825&view=rev
Log:
TOBAGO-518: JavaDoc + Renaming
Added:
myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/AbstractWizardController.java
Removed:
myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/AbstractWizard.java
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/Wizard.java
myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/WizardTag.java
myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-goto.xml
myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-navigation.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=601825&r1=601824&r2=601825&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 Thu Dec 6 11:33:59 2007
@@ -21,13 +21,13 @@
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.UIOutput;
import org.apache.myfaces.tobago.component.UIPanel;
-import org.apache.myfaces.tobago.model.AbstractWizard;
+import org.apache.myfaces.tobago.model.AbstractWizardController;
import org.apache.myfaces.tobago.model.BeanItem;
import java.util.ArrayList;
import java.util.List;
-public class SampleWizard extends AbstractWizard {
+public class SampleWizard extends AbstractWizardController {
private static final Log LOG = LogFactory.getLog(SampleWizard.class);
Added: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/AbstractWizardController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/AbstractWizardController.java?rev=601825&view=auto
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/AbstractWizardController.java (added)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/model/AbstractWizardController.java Thu Dec 6 11:33:59 2007
@@ -0,0 +1,504 @@
+package org.apache.myfaces.tobago.model;
+
+/*
+ * 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.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;
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class AbstractWizardController implements Wizard {
+
+ private static final Log LOG = LogFactory.getLog(AbstractWizardController.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;
+
+ // XXX remove (use: "private Integer size" instead)
+ private boolean sizeSet;
+
+ // XXX remove
+ // private boolean started;
+
+ private boolean preparedForFinishing;
+
+ private boolean backNavImmediate = true; // default, if not set otherwise
+
+ // private boolean dynamicContent;
+
+ // private String staticContentSource = null;
+
+ private int requestedIndex;
+
+ private WizardBackwardNavigationStrategy backNavStrategy = WizardBackwardNavigationStrategy.NOT_ALLOWED;
+
+ private String viewId;
+
+ private List<Info> course;
+
+ protected AbstractWizardController() {
+ reset();
+ }
+
+ /*
+ * public boolean isStartable() { return true; }
+ */
+ // XXX is this needed?
+ /*
+ * 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 org.apache.myfaces.tobago.model.AbstractWizardController#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 org.apache.myfaces.tobago.model.AbstractWizardController#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();
+
+ // XXX simplify
+ public void next(ActionEvent event) {
+ next();
+ }
+
+ public void gotoStep(ActionEvent event) {
+ int step = Integer.parseInt((String) (event.getComponent().getAttributes()
+ .get("step")));
+ index = step;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.myfaces.tobago.model.Wizard#isNextAvailable()
+ */
+ public final boolean isNextAvailable() {
+ // return (started && !preparedForFinishing);
+ return !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;
+ default:
+ break;
+ }
+ }
+
+ // makeContentDecision(index);
+
+ return course.get(index).getOutcome();
+ // return getDefaultOutcome();
+ }
+
+ /**
+ * <p>
+ * Hook for the implementation of business logic, after invoking the action
+ * {@link org.apache.myfaces.tobago.model.AbstractWizardController#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() > 0;
+ }
+
+ 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 org.apache.myfaces.tobago.model.AbstractWizardController#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 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;
+ default:
+ break;
+ }
+ }
+
+ // makeContentDecision(index);
+ // reset requestIndex
+ requestedIndex = 0;
+ return getDefaultOutcome();
+ }
+
+ /**
+ * <p>
+ * Hook for the implementation of business logic, after invoking the action
+ * {@link org.apache.myfaces.tobago.model.AbstractWizardController#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;
+ }
+ course = new ArrayList<Info>();
+ }
+
+ 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 Wizard}.
+ *
+ * @return The actual backward navigation strategy as a String.
+ */
+ public final String getBackwardNavigationStrategy() {
+ return this.backNavStrategy.getName();
+ }
+
+ /**
+ * <p>
+ * Set the strategy for backward navigation. This should be done only once,
+ * e.g. during initialization. For possible parameter values see
+ * {@link Wizard}.
+ * </p>
+ * <p>
+ * <b>Note: </b>If the parameter value is not known by the wizard the backward
+ * navigation strategy {@link org.apache.myfaces.tobago.model.WizardBackwardNavigationStrategy#NOT_ALLOWED}
+ * will be applied.
+ * </p>
+ *
+ * @param strategy
+ * The strategy to use for backward navigation
+ */
+ public final void setBackwardNavigationStrategy(String strategy) {
+ try {
+ this.backNavStrategy = WizardBackwardNavigationStrategy
+ .getStrategy(strategy);
+ } catch (IllegalArgumentException e) {
+ this.backNavStrategy = WizardBackwardNavigationStrategy.NOT_ALLOWED;
+ LOG
+ .error(
+ "WizardBackwardNavigationStrategy is not correctly initialized! Setting strategy to "
+ + backNavStrategy.getName(), e);
+ }
+ }
+
+ // todo
+ public String getViewId() {
+ viewId = FacesContext.getCurrentInstance().getViewRoot().getViewId();
+ return viewId; // To change body of implemented methods use File | Settings
+ // | File Templates.
+ }
+
+ public List<Info> getCourse() {
+ return course;
+ }
+
+ public void registerOutcome(String outcome, String title) {
+
+ if (index == course.size()) { // this is a new page
+ course.add(new Info(outcome, title, index));
+ } else if (index < course.size()) {
+ course.set(index, new Info(outcome, title, index));
+ } else {
+ throw new IllegalStateException("Index too large for course: index="
+ + index + " course.size()=" + course.size());
+ }
+ LOG.info("course: " + course);
+ }
+
+ // XXX
+ public static class Info {
+ private String outcome;
+ private String title;
+ private int index;
+
+ public Info(String outcome, String title, int index) {
+ this.outcome = outcome;
+ this.title = title;
+ this.index = index;
+ }
+
+ public String getOutcome() {
+ return outcome;
+ }
+
+ public void setOutcome(String outcome) {
+ this.outcome = outcome;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public void setIndex(int index) {
+ this.index = index;
+ }
+ }
+
+}
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=601825&r1=601824&r2=601825&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 Dec 6 11:33:59 2007
@@ -23,8 +23,8 @@
public interface Wizard {
/*
- * Constants
- */
+ * Constants
+ */
String BACKWARD_NAVIGATION_STRATEGY_DELETE = "delete";
@@ -33,22 +33,8 @@
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
+ * Methods
*/
-// String getStaticContentSource();
-
-// void setDynamicContent();
-
-// void setStaticContent(String staticContentSource);
/**
* Return the index of the actual wizard view.
@@ -63,66 +49,112 @@
int getSize();
/**
- * Sets the number (size) of views of the wizard.
- * The size should be set only once, e.g. during initialization.
+ * 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
+ * @param size
+ * The number of views of the wizard
*/
void setSize(int size);
-// String initialize();
-
- // DynamicBean doInitialization();
-
-// boolean isStarted();
-
+ /**
+ * Managed bean (controller) method to execute to show the next view of the
+ * wizard.
+ *
+ * @return The outcome after the method was executed
+ */
String next();
- // void doNext();
-
+ /**
+ * Indicates if the action next is available.
+ *
+ * @return True if the action next is available otherwise false
+ */
boolean isNextAvailable();
+ /**
+ * Managed bean (controller) method to execute to show the previous view of
+ * the wizard.
+ *
+ * @return The outcome after the method was executed
+ */
String previous();
- // void doPrevious(DynamicBean currentBean);
-
+ /**
+ * Indicates if the action previous is available.
+ *
+ * @return True if the action previous is available otherwise false
+ */
boolean isPreviousAvailable();
+ /**
+ * Indicates if the component which invokes the previous action is rendered
+ *
+ * @return True if the component is renderer otherwise false
+ */
boolean isPreviousRendered();
/**
- * Modificator, if backward navigation actions are immediate.
- * The modifactor should be set only once, e.g. during initialization.
+ * 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();
+ /**
+ * Sets an indicator for the wizard to state that the wizard is prepared for
+ * finishing.
+ */
void setPreparedForFinishing();
+ /**
+ * Managed bean (controller) method to execute to quit (save and exit) the
+ * wizard.
+ *
+ * @return The outcome after the method was executed
+ */
String finish();
- // void doFinish();
-
+ /**
+ * Indicates if the action finish is available.
+ *
+ * @return True if the action finish is available otherwise false
+ */
boolean isFinishAvailable();
+ /**
+ * Managed bean (controller) method to execute to quit (not save and exit) the
+ * wizard.
+ *
+ * @return The outcome after the method was executed
+ */
String cancel();
- // void doCancel();
-
+ /**
+ * Managed bean (controller) method which is called, when an action to
+ * navigate between the wizards views is exectued. The method parameter
+ * contains information about the component which was used to navigate.
+ *
+ * @param actionEvent
+ */
void gotoClicked(ActionEvent actionEvent);
+ /**
+ * Managed bean (controller) method to execute to navigate between the wizards
+ * views.
+ *
+ * @return The outcome after the method was executed
+ */
String gotoStep();
-// void makeContentDecision(int indexToShow);
-
String getDefaultOutcome();
- // void setBackwardNavigationStrategy(String strategy);
+ // void setBackwardNavigationStrategy(String strategy);
String getViewId();
- List<AbstractWizard.Info> getCourse();
+ List<AbstractWizardController.Info> getCourse();
void registerOutcome(String outcome, String title);
}
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=601825&r1=601824&r2=601825&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 Dec 6 11:33:59 2007
@@ -25,7 +25,7 @@
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
-import org.apache.myfaces.tobago.model.AbstractWizard;
+import org.apache.myfaces.tobago.model.AbstractWizardController;
import org.apache.myfaces.tobago.model.Wizard;
import org.apache.myfaces.tobago.taglib.component.AttributeTag;
import org.apache.myfaces.tobago.taglib.component.ButtonTag;
@@ -90,7 +90,7 @@
private void processTrain() throws JspException {
- List<AbstractWizard.Info> course = null;
+ List<AbstractWizardController.Info> course = null;
try {
Object bean = VariableResolverUtil.resolveVariable(FacesContext.getCurrentInstance(), "controller");
Wizard wizard = (Wizard) PropertyUtils.getProperty(bean, "wizard");
@@ -115,7 +115,7 @@
gridLayoutTag.setPageContext(pageContext);
// gridLayoutTag.setColumns("*");
StringBuilder columns = new StringBuilder();
- for (AbstractWizard.Info info : course) {
+ for (AbstractWizardController.Info info : course) {
columns.append("fixed;");
}
gridLayoutTag.setColumns(columns + "*");
@@ -125,7 +125,7 @@
facetTag.doEndTag();
- for (AbstractWizard.Info info : course) {
+ for (AbstractWizardController.Info info : course) {
ButtonTag button = new ButtonTag();
button.setPageContext(pageContext);
button.setParent(p);
Modified: 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=601825&r1=601824&r2=601825&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-goto.xml (original)
+++ myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-goto.xml Thu Dec 6 11:33:59 2007
@@ -25,51 +25,51 @@
<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:choose>
+ <!-- replace goto -->
+ <c:when test="${replaceGoto}">
+ <ui:include src="${gotoSource}" />
+ </c:when>
+ <!-- default goto -->
+ <c:otherwise>
+
+ <!-- layout information -->
+ <c:set var="colums" value="" />
<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:set var="colums" value="${colums};fixed" />
</c:if>
- <tc:button action="${controller.gotoStep}"
- actionListener="${controller.gotoClicked}"
- disabled="${isButtonDisabled}"
- immediate="${controller.backwardNavigationImmediate}"
- label="${index}"
- id="wizard-goto-${index}" />
+ <c:set var="colums" value="${colums};fixed" />
</c:forEach>
-
- <tc:cell />
-
- </tc:panel>
- </c:if>
+ <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:otherwise>
+ </c:choose>
</ui:composition>
Modified: 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=601825&r1=601824&r2=601825&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-navigation.xml (original)
+++ myfaces/tobago/trunk/sandbox/src/main/resources/META-INF/wizard-navigation.xml Thu Dec 6 11:33:59 2007
@@ -29,41 +29,42 @@
<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" />
+
+ <c:choose>
+ <!-- replace navigation -->
+ <c:when test="${replaceNavigation}" >
+ <ui:include src="${navigationSource}" />
+ </c:when>
- </tc:panel>
- </c:if>
+ <!-- default navigation -->
+ <c:otherwise>
+ <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:otherwise>
+ </c:choose>
</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=601825&r1=601824&r2=601825&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 Thu Dec 6 11:33:59 2007
@@ -24,13 +24,10 @@
<tc:panel>
<f:facet name="layout">
- <tc:gridLayout rows="fixed;fixed;fixed;fixed;fixed;fixed;*" />
+ <tc:gridLayout rows="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>
@@ -51,45 +48,38 @@
<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>
+ <c:choose>
+ <c:when test="${isGotoRendered}">
+ <tfs:wizard-goto controller="${controller}" gotoSource="${gotoSource}" />
+ </c:when>
+ <!-- placeholder for layout -->
+ <c:otherwise>
+ <tc:cell />
+ </c:otherwise>
+ </c:choose>
<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}" />
+ <ui:insert />
<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>
+ <c:choose>
+ <c:when test="${isNavigationRendered}">
+ <tfs:wizard-navigation controller="${controller}"
+ isPreviousRendered="${isPreviousRendered}"
+ navigationSource="${navigationSource}" />
+ </c:when>
+ <!-- placeholder for layout -->
+ <c:otherwise>
+ <tc:cell />
+ </c:otherwise>
+ </c:choose>
<!-- layout -->
<tc:cell />