You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2007/01/26 08:29:37 UTC
svn commit: r500165 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java
example/demo/src/main/webapp/best-practice/transition.jsp
Author: bommel
Date: Thu Jan 25 23:29:36 2007
New Revision: 500165
URL: http://svn.apache.org/viewvc?view=rev&rev=500165
Log:
(TOBAGO-102) Prevent double request
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java
myfaces/tobago/trunk/example/demo/src/main/webapp/best-practice/transition.jsp
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java?view=diff&rev=500165&r1=500164&r2=500165
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java Thu Jan 25 23:29:36 2007
@@ -21,6 +21,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_RENDERED_PARTIALLY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TARGET;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TRANSITION;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -41,6 +42,7 @@
private Boolean disabled;
private String[] renderedPartially;
private String target;
+ private Boolean transition;
public boolean isDefaultCommand() {
if (defaultCommand != null) {
@@ -97,6 +99,22 @@
this.disabled = disabled;
}
+ public boolean isTransition() {
+ if (transition != null) {
+ return transition;
+ }
+ ValueBinding vb = getValueBinding(ATTR_TRANSITION);
+ if (vb != null) {
+ return Boolean.TRUE.equals(vb.getValue(getFacesContext()));
+ } else {
+ return true;
+ }
+ }
+
+ public void setTransition(boolean transition) {
+ this.transition = transition;
+ }
+
public String getTarget() {
if (target != null) {
return target;
@@ -115,12 +133,13 @@
public Object saveState(FacesContext context) {
- Object[] saveState = new Object[5];
+ Object[] saveState = new Object[6];
saveState[0] = super.saveState(context);
saveState[1] = defaultCommand;
saveState[2] = disabled;
saveState[3] = renderedPartially;
saveState[4] = target;
+ saveState[5] = transition;
return saveState;
}
@@ -131,6 +150,7 @@
disabled = (Boolean) values[2];
renderedPartially = (String[]) values[3];
target = (String) values[4];
+ transition = (Boolean) values[5];
}
Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/best-practice/transition.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/best-practice/transition.jsp?view=diff&rev=500165&r1=500164&r2=500165
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/best-practice/transition.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/best-practice/transition.jsp Thu Jan 25 23:29:36 2007
@@ -26,7 +26,7 @@
</f:facet>
<tc:out value="Prevent double-clicks" />
- <tc:button label="Sleep 5 s (transition=true)" action="#{transitionController.sleep5s}" transition="true"/>
+ <tc:button label="Sleep 5 s (transition=true)" action="#{transitionController.sleep5s}"/>
<tc:button label="Sleep 5 s (transition=false)" action="#{transitionController.sleep5s}" transition="false"/>
<tc:cell />