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 2016/02/24 21:28:16 UTC
svn commit: r1732218 - in /myfaces/tobago/branches/tobago-3.0.x:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/
tobago-core/src/main/java/org/apache/myfaces/tob...
Author: lofwyr
Date: Wed Feb 24 20:28:16 2016
New Revision: 1732218
URL: http://svn.apache.org/viewvc?rev=1732218&view=rev
Log:
TOBAGO-1524: Use standard ajax mechanism
* using "javax.faces.source" as actionId for normal (non AJAX) POST requests.
Modified:
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java
myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SplitLayoutRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/CommandRendererBase.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FormRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetPageCommandRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java?rev=1732218&r1=1732217&r2=1732218&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java Wed Feb 24 20:28:16 2016
@@ -61,8 +61,6 @@ public abstract class AbstractUIPage ext
private String formId;
- private String actionId;
-
@Override
public boolean getRendersChildren() {
return true;
@@ -228,24 +226,24 @@ public abstract class AbstractUIPage ext
// reset old submitted state
setSubmitted(false);
- String currentActionId = getActionId();
+ String sourceId = facesContext.getExternalContext().getRequestParameterMap().get("javax.faces.source");
if (LOG.isDebugEnabled()) {
- LOG.debug("actionId = '" + currentActionId + "'");
+ LOG.debug("sourceId = '" + sourceId + "'");
}
final UIViewRoot viewRoot = facesContext.getViewRoot();
- UIComponent command = viewRoot.findComponent(currentActionId);
+ UIComponent command = viewRoot.findComponent(sourceId);
// TODO: remove this if block if proven this never happens anymore
if (command == null
- && currentActionId != null && currentActionId.matches(".*:\\d+:.*")) {
+ && sourceId != null && sourceId.matches(".*:\\d+:.*")) {
// If currentActionId component was inside a sheet the id contains the
// rowIndex and is therefore not found here.
// We do not need the row here because we want just to find the
// related form, so removing the rowIndex will help here.
- currentActionId = currentActionId.replaceAll(":\\d+:", ":");
+ sourceId = sourceId.replaceAll(":\\d+:", ":");
try {
- command = viewRoot.findComponent(currentActionId);
+ command = viewRoot.findComponent(sourceId);
//LOG.info("command = \"" + command + "\"", new Exception());
} catch (final Exception e) {
// ignore
@@ -253,7 +251,7 @@ public abstract class AbstractUIPage ext
}
if (LOG.isTraceEnabled()) {
- LOG.trace(currentActionId);
+ LOG.trace(sourceId);
LOG.trace("command:{}", command);
LOG.trace(DebugUtils.toString(viewRoot, 0));
}
@@ -298,11 +296,10 @@ public abstract class AbstractUIPage ext
}
}
- public String getActionId() {
- return actionId;
- }
-
- public void setActionId(final String actionId) {
- this.actionId = actionId;
+ /** @deprecated XXX delete me */
+ @Deprecated
+ private String getActionId() {
+ LOG.warn("XXX should not be called, because of AJAX cleanup...");
+ return null;
}
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java?rev=1732218&r1=1732217&r2=1732218&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java Wed Feb 24 20:28:16 2016
@@ -21,7 +21,7 @@ package org.apache.myfaces.tobago.intern
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.Visual;
-import org.apache.myfaces.tobago.internal.util.FacesContextUtils;
+import org.apache.myfaces.tobago.internal.util.StringUtils;
import org.apache.myfaces.tobago.util.ComponentUtils;
import javax.el.ValueExpression;
@@ -74,17 +74,17 @@ public abstract class AbstractUIPopup ex
private boolean isSubmitted() {
final FacesContext facesContext = getFacesContext();
- final String action = FacesContextUtils.getActionId(facesContext);
- return action != null && action.startsWith(
- getClientId(facesContext) + UINamingContainer.getSeparatorChar(facesContext));
+ final String sourceId = facesContext.getExternalContext().getRequestParameterMap().get("javax.faces.source");
+ return StringUtils.startsWith(
+ sourceId, getClientId(facesContext) + UINamingContainer.getSeparatorChar(facesContext));
}
private boolean isRedisplay() {
if (isSubmitted()) {
- final String action = FacesContextUtils.getActionId(getFacesContext());
- if (action != null) {
- final UIComponent command = getFacesContext().getViewRoot().findComponent(
- UINamingContainer.getSeparatorChar(getFacesContext()) + action);
+ final String sourceId = getFacesContext().getExternalContext().getRequestParameterMap().get("javax.faces.source");
+ if (sourceId != null) {
+ final UIComponent command = getFacesContext().getViewRoot()
+ .findComponent(UINamingContainer.getSeparatorChar(getFacesContext()) + sourceId);
if (command != null && command instanceof UICommand) {
return ComponentUtils.getAttribute(command, Attributes.popupClose) == null;
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java?rev=1732218&r1=1732217&r2=1732218&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java Wed Feb 24 20:28:16 2016
@@ -38,7 +38,6 @@ public final class FacesContextUtils {
private static final String TOBAGO_STYLE_FILES = "org.apache.myfaces.tobago.styleFiles";
private static final String TOBAGO_POPUPS = "org.apache.myfaces.tobago.popups";
private static final String TOBAGO_FOCUS_ID = "org.apache.myfaces.tobago.focusId";
- private static final String TOBAGO_ACTION_ID = "org.apache.myfaces.tobago.actionId";
private FacesContextUtils() {
}
@@ -59,15 +58,6 @@ public final class FacesContextUtils {
return (String) context.getAttributes().get(TOBAGO_FOCUS_ID);
}
- public static void setActionId(final FacesContext context, final String actionId) {
- context.getAttributes().put(TOBAGO_ACTION_ID, actionId);
- }
-
- public static String getActionId(final FacesContext context) {
- return (String) context.getAttributes().get(TOBAGO_ACTION_ID);
- }
-
-
public static String getAjaxComponentId(final FacesContext context) {
return (String) context.getAttributes().get(TOBAGO_AJAX_COMPONENT_ID);
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java?rev=1732218&r1=1732217&r2=1732218&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java Wed Feb 24 20:28:16 2016
@@ -490,4 +490,15 @@ public final class StringUtils {
}
return true;
}
+
+ public static boolean startsWith(String string, String prefix) {
+ if (string == null || prefix == null) {
+ return (string == null && prefix == null);
+ }
+ if (prefix.length() > string.length()) {
+ return false;
+ }
+ return string.regionMatches(0, prefix, 0, prefix.length());
+ }
+
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java?rev=1732218&r1=1732217&r2=1732218&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java Wed Feb 24 20:28:16 2016
@@ -37,29 +37,30 @@ public class ApplyRequestValuesCallback
@SuppressWarnings("UnusedDeclaration")
private static final Logger LOG = LoggerFactory.getLogger(ApplyRequestValuesCallback.class);
- public void invokeContextCallback(final FacesContext context, final UIComponent component) {
- if (FacesContextUtils.isAjax(context)) {
- final String ajaxId = FacesContextUtils.getAjaxComponentId(context);
+ public void invokeContextCallback(final FacesContext facesContext, final UIComponent component) {
+ if (FacesContextUtils.isAjax(facesContext)) {
+ final String ajaxId = FacesContextUtils.getAjaxComponentId(facesContext);
+ final String sourceId = facesContext.getExternalContext().getRequestParameterMap().get("javax.faces.source");
final UIComponent reload = ComponentUtils.getFacet(component, Facets.reload);
- if (ajaxId != null && ajaxId.equals(component.getClientId(context)) && reload != null && reload.isRendered()
- && ajaxId.equals(FacesContextUtils.getActionId(context))) {
+ if (ajaxId != null && ajaxId.equals(component.getClientId(facesContext)) && reload != null && reload.isRendered()
+ && ajaxId.equals(sourceId)) {
final boolean immediate = ComponentUtils.getBooleanAttribute(reload, Attributes.immediate);
if (immediate) {
final boolean update = ComponentUtils.getBooleanAttribute(reload, Attributes.update);
if (!update) {
- final Object response = context.getExternalContext().getResponse();
+ final Object response = facesContext.getExternalContext().getResponse();
if (response instanceof HttpServletResponse) {
((HttpServletResponse) response).setStatus(HttpServletResponse.SC_NOT_MODIFIED);
} else if (response instanceof PortletResponse) {
// TBD: Portlet: what is to do here?
}
- context.responseComplete();
+ facesContext.responseComplete();
return;
}
}
}
}
- component.processDecodes(context);
+ component.processDecodes(facesContext);
}
public PhaseId getPhaseId() {
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SplitLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SplitLayoutRenderer.java?rev=1732218&r1=1732217&r2=1732218&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SplitLayoutRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SplitLayoutRenderer.java Wed Feb 24 20:28:16 2016
@@ -30,7 +30,6 @@ import org.apache.myfaces.tobago.renderk
import org.apache.myfaces.tobago.renderkit.html.standard.standard.tag.GridLayoutRenderer;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
-import org.apache.myfaces.tobago.util.ComponentUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,8 +54,9 @@ public class SplitLayoutRenderer extends
@Override
public void decode(final FacesContext facesContext, final UIComponent component) {
+ final String sourceId = facesContext.getExternalContext().getRequestParameterMap().get("javax.faces.source");
final String clientId = component.getClientId();
- if (clientId.equals(ComponentUtils.findPage(facesContext).getActionId())) {
+ if (clientId.equals(sourceId)) {
// only decode and update layout at resize request
final Map<String, String> parameterMap = facesContext.getExternalContext().getRequestParameterMap();
final String position = parameterMap.get(clientId + POSITION_ID_POSTFIX);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/CommandRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/CommandRendererBase.java?rev=1732218&r1=1732217&r2=1732218&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/CommandRendererBase.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/CommandRendererBase.java Wed Feb 24 20:28:16 2016
@@ -19,7 +19,6 @@
package org.apache.myfaces.tobago.renderkit;
-import org.apache.myfaces.tobago.internal.util.FacesContextUtils;
import org.apache.myfaces.tobago.util.ComponentUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,18 +36,15 @@ public abstract class CommandRendererBas
if (ComponentUtils.isOutputOnly(component)) {
return;
}
- final String actionId = FacesContextUtils.getActionId(facesContext);
final String sourceId = facesContext.getExternalContext().getRequestParameterMap().get("javax.faces.source");
final String clientId = component.getClientId(facesContext);
if (LOG.isDebugEnabled()) {
- LOG.debug("actionId = '" + actionId + "'");
LOG.debug("sourceId = '" + sourceId + "'");
LOG.debug("clientId = '" + clientId + "'");
}
- // XXX todo: remove actionId
- if (actionId != null && actionId.equals(clientId) || sourceId != null && sourceId.equals(clientId)) {
+ if (clientId.equals(sourceId)) {
if (LOG.isDebugEnabled()) {
- LOG.debug("queueEvent = '" + actionId + "'");
+ LOG.debug("queueEvent = '" + clientId + "'");
}
commandActivated(component);
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FormRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FormRenderer.java?rev=1732218&r1=1732217&r2=1732218&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FormRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FormRenderer.java Wed Feb 24 20:28:16 2016
@@ -19,7 +19,6 @@
package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
-import org.apache.myfaces.tobago.internal.util.FacesContextUtils;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import javax.faces.component.UIComponent;
@@ -30,9 +29,9 @@ public class FormRenderer extends Render
public void decode(final FacesContext facesContext, final UIComponent component) {
final UIForm form = (UIForm) component;
- final String actionId = FacesContextUtils.getActionId(facesContext);
+ final String sourceId = facesContext.getExternalContext().getRequestParameterMap().get("javax.faces.source");
final String clientId = form.getClientId(facesContext);
- if (actionId != null && actionId.startsWith(clientId)) {
+ if (sourceId != null && sourceId.startsWith(clientId)) {
form.setSubmitted(true);
}
super.decode(facesContext, form);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java?rev=1732218&r1=1732217&r2=1732218&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java Wed Feb 24 20:28:16 2016
@@ -21,10 +21,9 @@ package org.apache.myfaces.tobago.render
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.internal.component.AbstractUIInput;
-import org.apache.myfaces.tobago.internal.util.FacesContextUtils;
import org.apache.myfaces.tobago.internal.util.StringUtils;
-import org.apache.myfaces.tobago.renderkit.css.Classes;
import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
+import org.apache.myfaces.tobago.renderkit.css.Classes;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
@@ -47,8 +46,9 @@ public class InRenderer extends InputRen
@Override
public void decode(final FacesContext facesContext, final UIComponent component) {
super.decode(facesContext, component);
+ final String sourceId = facesContext.getExternalContext().getRequestParameterMap().get("javax.faces.source");
final String clientId = component.getClientId(facesContext);
- if (clientId.equals(FacesContextUtils.getActionId(facesContext))) {
+ if (clientId.equals(sourceId)) {
// this is a inputSuggest request -> render response
facesContext.renderResponse();
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java?rev=1732218&r1=1732217&r2=1732218&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java Wed Feb 24 20:28:16 2016
@@ -80,14 +80,6 @@ public class PageRenderer extends Render
final AbstractUIPage page = (AbstractUIPage) component;
final String clientId = page.getClientId(facesContext);
- final String actionIdName = clientId + ComponentUtils.SUB_SEPARATOR + "form-action";
- final String newActionId = facesContext.getExternalContext().getRequestParameterMap().get(actionIdName);
- if (LOG.isDebugEnabled()) {
- LOG.debug("action = " + newActionId);
- }
- page.setActionId(newActionId);
- FacesContextUtils.setActionId(facesContext, newActionId);
-
final ExternalContext externalContext = facesContext.getExternalContext();
// last focus
final String lastFocusId =
@@ -260,10 +252,12 @@ public class PageRenderer extends Render
// TODO evaluate 'accept' attribute usage
//writer.writeAttribute(HtmlAttributes.ACCEPT, );
writer.writeAttribute(DataAttributes.CONTEXT_PATH, externalContext.getRequestContextPath(), true);
+
writer.startElement(HtmlElements.INPUT);
writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN);
- writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "form-action");
- writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "form-action");
+ writer.writeNameAttribute("javax.faces.source");
+ writer.writeIdAttribute("javax.faces.source");
+ writer.writeAttribute(HtmlAttributes.DISABLED, true);
writer.endElement(HtmlElements.INPUT);
writer.startElement(HtmlElements.INPUT);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetPageCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetPageCommandRenderer.java?rev=1732218&r1=1732217&r2=1732218&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetPageCommandRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetPageCommandRenderer.java Wed Feb 24 20:28:16 2016
@@ -22,7 +22,6 @@ package org.apache.myfaces.tobago.render
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.event.PageAction;
import org.apache.myfaces.tobago.event.PageActionEvent;
-import org.apache.myfaces.tobago.internal.util.FacesContextUtils;
import org.apache.myfaces.tobago.util.ComponentUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,19 +36,14 @@ public class SheetPageCommandRenderer ex
@Override
public void decode(final FacesContext facesContext, final UIComponent component) {
- final String actionId = FacesContextUtils.getActionId(facesContext);
final String sourceId = facesContext.getExternalContext().getRequestParameterMap().get("javax.faces.source");
final String clientId = component.getClientId(facesContext);
if (LOG.isDebugEnabled()) {
- LOG.debug("actionId = '" + actionId + "'");
LOG.debug("sourceId = '" + sourceId + "'");
LOG.debug("clientId = '" + clientId + "'");
}
- // XXX todo: remove actionId
- if (actionId != null && actionId.equals(clientId) || sourceId != null && sourceId.equals(clientId)) {
-
- final String id = sourceId != null ? sourceId : actionId;
+ if (clientId.equals(sourceId)) {
final PageAction action = (PageAction) ComponentUtils.getAttribute(component, Attributes.pageAction);
final PageActionEvent event = new PageActionEvent(component.getParent(), action);
@@ -60,7 +54,7 @@ public class SheetPageCommandRenderer ex
Integer target = (Integer) ComponentUtils.getAttribute(component, Attributes.pagingTarget);
if (target == null) {
final Map map = facesContext.getExternalContext().getRequestParameterMap();
- final Object value = map.get(id);
+ final Object value = map.get(clientId);
try {
target = Integer.parseInt((String) value);
} catch (final NumberFormatException e) {
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1732218&r1=1732217&r2=1732218&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Wed Feb 24 20:28:16 2016
@@ -57,12 +57,6 @@ var Tobago = {
form: null,
/**
- * The hidden html input object for submitted actionId.
- * set via init function
- */
- action: null,
-
- /**
* The id of the element which should became the focus after loading.
* Set via renderer if requested.
*/
@@ -196,7 +190,6 @@ var Tobago = {
this.page = page.get(0);
this.form = page.find("form").get(0); // find() seems to be faster than children()
this.addBindEventListener(this.form, 'submit', this, 'onSubmit');
- this.action = this.element(this.page.id + this.SUB_COMPONENT_SEP + 'form-action');
this.addBindEventListener(window, 'unload', this, 'onUnload');
@@ -326,7 +319,6 @@ var Tobago = {
delete this.page;
delete this.form;
- delete this.action;
delete this.lastFocusId;
},
@@ -399,7 +391,9 @@ var Tobago = {
if (!this.isSubmit) {
this.isSubmit = true;
var oldTarget = Tobago.form.target;
- Tobago.action.value = actionId;
+ var $sourceHidden = jQuery(Tobago.Utils.escapeClientId("javax.faces.source"));
+ $sourceHidden.prop("disabled", false);
+ $sourceHidden.val(actionId);
if (options.target) {
Tobago.form.target = options.target;
}
@@ -1900,7 +1894,7 @@ Tobago.Transport.JqueryTransport = {
return Tobago.Transport.request(function() {
requestObject.url = requestOptions.url;
- Tobago.action.value = requestOptions.actionId;
+ jQuery(Tobago.Utils.escapeClientId("javax.faces.source")).val(requestOptions.actionId);
Tobago.partialRequestIds.value = requestOptions.ajaxComponentIds;
requestObject.data = jQuery(Tobago.form).serialize();
requestOptions.xhr = jQuery.ajax(requestObject);