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/01/25 15:01:13 UTC
svn commit: r499800 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/
core/src/main/java/org/apache/myfaces/tobago/renderkit/html/
core/src/main/java/org/apache/myfaces/tobago/taglib/component/
core/src/main/java/org/apache/myfa...
Author: lofwyr
Date: Thu Jan 25 06:01:11 2007
New Revision: 499800
URL: http://svn.apache.org/viewvc?view=rev&rev=499800
Log:
add transition flag to commands. transition=false disables the "progress/wait" image
Added:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsTransition.java
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/AbstractCommandTag.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/AbstractCommandTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java
myfaces/tobago/trunk/example/demo/src/main/webapp/best-practice/transition-after-sleep.jsp
myfaces/tobago/trunk/example/demo/src/main/webapp/best-practice/transition.jsp
myfaces/tobago/trunk/example/demo/src/main/webapp/footer.jsp
myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java?view=diff&rev=499800&r1=499799&r2=499800
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java Thu Jan 25 06:01:11 2007
@@ -156,6 +156,7 @@
public static final String ATTR_TITLE = "title";
public static final String ATTR_TIP = "tip";
public static final String ATTR_TOP = "top";
+ public static final String ATTR_TRANSITION = "transition";
public static final String ATTR_TYPE = "type";
public static final String ATTR_VALUE = "value";
public static final String ATTR_VAR = "var";
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java?view=diff&rev=499800&r1=499799&r2=499800
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java Thu Jan 25 06:01:11 2007
@@ -35,6 +35,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_CLASS;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_HEADER;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_INNER;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TRANSITION;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_OUT;
import static org.apache.myfaces.tobago.TobagoConstants.TOBAGO_CSS_CLASS_PREFIX;
import static org.apache.myfaces.tobago.TobagoConstants.TOBAGO_CSS_CLASS_SUFFIX_DEFAULT;
@@ -669,7 +670,8 @@
String clientId = component.getClientId(facesContext);
boolean defaultCommand = ComponentUtil.getBooleanAttribute(component,
TobagoConstants.ATTR_DEFAULT_COMMAND);
- String onclick = "Tobago.submitAction('" + clientId + "');";
+ boolean transition = ComponentUtil.getBooleanAttribute(component, ATTR_TRANSITION);
+ String onclick;
if (component.getAttributes().get(TobagoConstants.ATTR_ACTION_LINK) != null) {
onclick = "Tobago.navigateToUrl('"
@@ -694,6 +696,7 @@
}
} else {
LOG.error("more than one parially rendered component is currently not supported " + componentId);
+ onclick = "Tobago.submitAction('" + clientId + "', " + transition + ");";
}
} else if (defaultCommand) {
@@ -702,9 +705,9 @@
} else {
String target = ComponentUtil.getStringAttribute(component, TobagoConstants.ATTR_TARGET);
if (target == null) {
- onclick = "Tobago.submitAction('" + clientId + "');";
+ onclick = "Tobago.submitAction('" + clientId + "', " + transition + ");";
} else {
- onclick = "Tobago.submitAction('" + clientId + "', '" + target + "');";
+ onclick = "Tobago.submitAction('" + clientId + "', " + transition + ", '" + target + "');";
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/AbstractCommandTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/AbstractCommandTag.java?view=diff&rev=499800&r1=499799&r2=499800
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/AbstractCommandTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/AbstractCommandTag.java Thu Jan 25 06:01:11 2007
@@ -22,6 +22,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMMEDIATE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TYPE;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TRANSITION;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.component.UICommand;
@@ -36,6 +37,7 @@
private String immediate;
private String onclick;
private String link;
+ private String transition;
public String getComponentType() {
return UICommand.COMPONENT_TYPE;
@@ -54,6 +56,7 @@
ComponentUtil.setStringProperty(component, ATTR_ACTION_LINK, link);
ComponentUtil.setStringProperty(component, ATTR_ACTION_ONCLICK, onclick);
ComponentUtil.setActionListener(command, actionListener);
+ ComponentUtil.setBooleanProperty(component, ATTR_TRANSITION, transition);
}
public void release() {
@@ -65,6 +68,7 @@
immediate = null;
onclick = null;
link = null;
+ transition = null;
}
public String getAction() {
@@ -109,5 +113,9 @@
public void setDisabled(String disabled) {
this.disabled = disabled;
+ }
+
+ public void setTransition(String transition) {
+ this.transition = transition;
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/AbstractCommandTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/AbstractCommandTagDeclaration.java?view=diff&rev=499800&r1=499799&r2=499800
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/AbstractCommandTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/AbstractCommandTagDeclaration.java Thu Jan 25 06:01:11 2007
@@ -22,6 +22,7 @@
import org.apache.myfaces.tobago.taglib.decl.HasLink;
import org.apache.myfaces.tobago.taglib.decl.HasOnclick;
import org.apache.myfaces.tobago.taglib.decl.IsImmediateCommand;
+import org.apache.myfaces.tobago.taglib.decl.IsTransition;
/*
* Created by IntelliJ IDEA.
@@ -30,7 +31,6 @@
* Time: 22:03:07
*/
-
public interface AbstractCommandTagDeclaration extends TobagoTagDeclaration,
- HasAction, HasActionListener, IsImmediateCommand, HasOnclick, HasLink {
+ HasAction, HasActionListener, IsImmediateCommand, HasOnclick, HasLink, IsTransition {
}
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsTransition.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsTransition.java?view=auto&rev=499800
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsTransition.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsTransition.java Thu Jan 25 06:01:11 2007
@@ -0,0 +1,33 @@
+package org.apache.myfaces.tobago.taglib.decl;
+
+/*
+ * 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.myfaces.tobago.apt.annotation.TagAttribute;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+
+public interface IsTransition {
+ /**
+ * Specify, if the command calls an JSF-Action.
+ * Useful to switch off the Double-Submit-Check and Waiting-Behavior.
+ * @param transition Indicates the transition.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "java.lang.Boolean", defaultValue = "true")
+ void setTransition(String transition);
+
+}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java?view=diff&rev=499800&r1=499799&r2=499800
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java Thu Jan 25 06:01:11 2007
@@ -58,6 +58,7 @@
private String binding;
private String label;
private String immediate;
+ private String transition;
@Override
public int doStartTag() throws JspException {
@@ -92,6 +93,9 @@
if (immediate != null) {
menuCommandTag.setImmediate(immediate);
}
+ if (transition != null) {
+ menuCommandTag.setTransition(transition);
+ }
menuCommandTag.doStartTag();
facetTag = new FacetTag();
@@ -158,6 +162,10 @@
this.immediate = immediate;
}
+ public void setTransition(String transition) {
+ this.transition = transition;
+ }
+
public void release() {
super.release();
rendered = null;
@@ -170,6 +178,7 @@
binding = null;
label = null;
immediate = null;
+ transition = null;
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java?view=diff&rev=499800&r1=499799&r2=499800
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java Thu Jan 25 06:01:11 2007
@@ -61,6 +61,7 @@
private String binding;
private String label;
private String immediate;
+ private String transition;
private String converter;
@Override
@@ -97,6 +98,9 @@
if (immediate != null) {
menuCommandTag.setImmediate(immediate);
}
+ if (transition != null) {
+ menuCommandTag.setTransition(transition);
+ }
menuCommandTag.doStartTag();
facetTag = new FacetTag();
@@ -168,6 +172,10 @@
this.immediate = immediate;
}
+ public void setTransition(String transition) {
+ this.transition = transition;
+ }
+
public void setConverter(String converter) {
this.converter = converter;
}
@@ -184,6 +192,7 @@
binding = null;
label = null;
immediate = null;
+ transition = null;
converter = null;
}
Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/best-practice/transition-after-sleep.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/best-practice/transition-after-sleep.jsp?view=diff&rev=499800&r1=499799&r2=499800
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/best-practice/transition-after-sleep.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/best-practice/transition-after-sleep.jsp Thu Jan 25 06:01:11 2007
@@ -22,8 +22,10 @@
<jsp:body>
<tc:box label="Transition after sleep">
<f:facet name="layout">
- <tc:gridLayout />
+ <tc:gridLayout rows="fixed;*" />
</f:facet>
+
+ <tc:button label="Back" action="best-practice/transition" />
<tc:cell />
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=499800&r1=499799&r2=499800
==============================================================================
--- 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 06:01:11 2007
@@ -22,11 +22,12 @@
<jsp:body>
<tc:box label="Transitions between pages">
<f:facet name="layout">
- <tc:gridLayout rows="fixed;fixed;*" />
+ <tc:gridLayout rows="fixed;fixed;fixed;*" />
</f:facet>
<tc:out value="Prevent double-clicks" />
- <tc:button label="Sleep 5 s" action="#{transitionController.sleep5s}" />
+ <tc:button label="Sleep 5 s (transition=true)" action="#{transitionController.sleep5s}" transition="true"/>
+ <tc:button label="Sleep 5 s (transition=false)" action="#{transitionController.sleep5s}" transition="false"/>
<tc:cell />
Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/footer.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/footer.jsp?view=diff&rev=499800&r1=499799&r2=499800
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/footer.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/footer.jsp Thu Jan 25 06:01:11 2007
@@ -18,13 +18,13 @@
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:subview id="footer" >
- <tc:panel id="a">
+ <tc:panel>
<f:facet name="layout">
<tc:gridLayout columns="70px;70px;130px;1*"
- rows="15px;fixed" id="b"/>
+ rows="15px;fixed"/>
</f:facet>
- <tc:cell spanX="4" id="c">
+ <tc:cell spanX="4">
<f:verbatim><hr /></f:verbatim>
</tc:cell>
@@ -33,22 +33,20 @@
image="image/prev.gif"
action="#{overviewNavigation.gotoPrevious}"
disabled="#{overviewNavigation.first}"
- label="#{overviewBundle.footer_previous}" id="d"/>
+ label="#{overviewBundle.footer_previous}"/>
<%-- fixme: next and previous button are not working in them moment (rendered="false") --%>
<tc:button immediate="true" rendered="false"
image="image/next.gif"
action="#{overviewNavigation.gotoNext}"
disabled="#{overviewNavigation.last}"
- label="#{overviewBundle.footer_next}" id="e"/>
+ label="#{overviewBundle.footer_next}"/>
<tc:button action="#{overviewNavigation.viewSource}"
- immediate="true" label="#{overviewBundle.footer_viewSource}" id="f"/>
+ immediate="true" label="#{overviewBundle.footer_viewSource}"
+ target="Source Viewer" transition="false"/>
<tc:out value="#{overviewBundle.notTranslated}"/>
-
- <%--<tc:link id="atanion_link" action="http://www.atanion.com/"--%>
- <%--type="navigate" image="image/poweredBy.gif" />--%>
</tc:panel>
</f:subview>
Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?view=diff&rev=499800&r1=499799&r2=499800
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Thu Jan 25 06:01:11 2007
@@ -251,10 +251,12 @@
this.form.appendChild(clientDimension);
},
- onBeforeUnload: function() {
- Tobago.createOverlay(Tobago.page);
- setTimeout(Tobago.makeOverlaySemitransparent, 750);
- setTimeout(Tobago.makeOverlayWait, 2000);
+ onBeforeUnload: function(transition, target) {
+ if (transition && !target) {
+ Tobago.createOverlay(Tobago.page);
+ setTimeout(Tobago.makeOverlaySemitransparent, 750);
+ setTimeout(Tobago.makeOverlayWait, 2000);
+ }
},
makeOverlaySemitransparent: function() {
@@ -405,7 +407,11 @@
/**
* Submitting the page with specified actionId.
*/
- submitAction: function(actionId, target) {
+ submitAction: function(actionId, transition, target) {
+ if (transition == null) {
+ transition = true;
+ }
+ LOG.info("transition =" + transition);
Tobago.Transport.request(function() {
if (!this.isSubmit) {
this.isSubmit = true;
@@ -421,7 +427,7 @@
// LOG.debug("submit form with action: " + Tobago.action.value);
Tobago.form.submit();
Tobago.action.value = oldAction;
- if (target) {
+ if (target || !transition) {
Tobago.form.target = oldTarget;
this.isSubmit = false;
} else {