You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2016/03/19 04:13:09 UTC
svn commit: r1735720 - in /myfaces/shared/trunk/core/src:
main/java/org/apache/myfaces/shared/context/flash/
main/java/org/apache/myfaces/shared/renderkit/html/ main/resources/META-INF/
test/java/org/apache/myfaces/shared/renderkit/html/
Author: lu4242
Date: Sat Mar 19 03:13:08 2016
New Revision: 1735720
URL: http://svn.apache.org/viewvc?rev=1735720&view=rev
Log:
update for 2.2.10 release
Modified:
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventUtils.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml
myfaces/shared/trunk/core/src/test/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtilsTest.java
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java?rev=1735720&r1=1735719&r2=1735720&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java Sat Mar 19 03:13:08 2016
@@ -34,6 +34,7 @@ import java.security.NoSuchAlgorithmExce
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -392,9 +393,13 @@ public class FlashImpl extends Flash imp
public boolean isKeepMessages()
{
FacesContext facesContext = FacesContext.getCurrentInstance();
- ExternalContext externalContext = facesContext.getExternalContext();
- Map<String, Object> requestMap = externalContext.getRequestMap();
- Boolean keepMessages = (Boolean) requestMap.get(FLASH_KEEP_MESSAGES);
+ Boolean keepMessages = null;
+ if (facesContext != null)
+ {
+ ExternalContext externalContext = facesContext.getExternalContext();
+ Map<String, Object> requestMap = externalContext.getRequestMap();
+ keepMessages = (Boolean) requestMap.get(FLASH_KEEP_MESSAGES);
+ }
return (keepMessages == null ? Boolean.FALSE : keepMessages);
}
@@ -747,7 +752,7 @@ public class FlashImpl extends Flash imp
* Take the render map key and store it as a key for the next request.
*
* On the next request we can get it with _getRenderFlashMapTokenFromPreviousRequest().
- * @param externalContext
+ * @param facesContext
*/
private void _saveRenderFlashMapTokenForNextRequest(FacesContext facesContext)
{
@@ -790,7 +795,7 @@ public class FlashImpl extends Flash imp
*
* Returns the value of _saveRenderFlashMapTokenForNextRequest() from
* the previous request.
- * @param externalContext
+ * @param facesContext
* @return
*/
private String _getRenderFlashMapTokenFromPreviousRequest(FacesContext facesContext)
@@ -963,14 +968,22 @@ public class FlashImpl extends Flash imp
// if we create more SubKeyMaps with the same subkey, because they are
// totally equal and point to the same entries in the SessionMap.
- Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
- Map<String, Object> map = (Map<String, Object>) requestMap.get(FLASH_EXECUTE_MAP);
+ Map<String, Object> requestMap = context != null && context.getExternalContext() != null ?
+ context.getExternalContext().getRequestMap() : null;
+ Map<String, Object> map = requestMap != null ? (Map<String, Object>) requestMap.get(FLASH_EXECUTE_MAP) : null;
if (map == null)
{
- String token = (String) requestMap.get(FLASH_EXECUTE_MAP_TOKEN);
- String fullToken = FLASH_SESSION_MAP_SUBKEY_PREFIX + SEPARATOR_CHAR + token + SEPARATOR_CHAR;
- map = _createSubKeyMap(context, fullToken);
- requestMap.put(FLASH_EXECUTE_MAP, map);
+ if (requestMap != null)
+ {
+ String token = (String) requestMap.get(FLASH_EXECUTE_MAP_TOKEN);
+ String fullToken = FLASH_SESSION_MAP_SUBKEY_PREFIX + SEPARATOR_CHAR + token + SEPARATOR_CHAR;
+ map = _createSubKeyMap(context, fullToken);
+ requestMap.put(FLASH_EXECUTE_MAP, map);
+ }
+ else
+ {
+ map = Collections.emptyMap();
+ }
}
return map;
}
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventUtils.java?rev=1735720&r1=1735719&r2=1735720&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventUtils.java Sat Mar 19 03:13:08 2016
@@ -72,12 +72,12 @@ public class CommonEventUtils
public static boolean renderBehaviorizedAttribute(
FacesContext facesContext, ResponseWriter writer,
String componentProperty, UIComponent component,
- String targetClientId, String eventName,
+ String sourceId, String eventName,
Map<String, List<ClientBehavior>> clientBehaviors)
throws IOException
{
return renderBehaviorizedAttribute(facesContext, writer,
- componentProperty, component, targetClientId, eventName,
+ componentProperty, component, sourceId, eventName,
clientBehaviors, componentProperty);
}*/
@@ -113,12 +113,12 @@ public class CommonEventUtils
public static boolean renderBehaviorizedAttribute(
FacesContext facesContext, ResponseWriter writer,
String componentProperty, UIComponent component,
- String targetClientId, String eventName,
+ String sourceId, String eventName,
Map<String, List<ClientBehavior>> clientBehaviors,
String htmlAttrName) throws IOException
{
return renderBehaviorizedAttribute(facesContext, writer,
- componentProperty, component, targetClientId, eventName, null,
+ componentProperty, component, sourceId, eventName, null,
clientBehaviors, htmlAttrName, (String) component
.getAttributes().get(componentProperty));
}
@@ -148,14 +148,14 @@ public class CommonEventUtils
{
return renderBehaviorizedAttribute(facesContext, writer,
componentProperty, component,
- component.getClientId(facesContext), eventName,
+ null, eventName,
eventParameters, clientBehaviors, htmlAttrName, attributeValue);
}
public static boolean renderBehaviorizedAttribute(
FacesContext facesContext, ResponseWriter writer,
String componentProperty, UIComponent component,
- String targetClientId, String eventName,
+ String sourceId, String eventName,
Collection<ClientBehaviorContext.Parameter> eventParameters,
Map<String, List<ClientBehavior>> clientBehaviors,
String htmlAttrName, String attributeValue) throws IOException
@@ -174,7 +174,7 @@ public class CommonEventUtils
{
return HtmlRendererUtils.renderHTMLStringAttribute(writer, componentProperty, htmlAttrName,
HtmlRendererUtils.buildBehaviorChain(facesContext,
- component, targetClientId, eventName,
+ component, sourceId, eventName,
eventParameters, clientBehaviors, attributeValue,
HtmlRendererUtils.STR_EMPTY));
}
@@ -188,7 +188,7 @@ public class CommonEventUtils
cbl.get(0).getScript(
ClientBehaviorContext.createClientBehaviorContext(
facesContext, component, eventName,
- targetClientId, eventParameters)));
+ sourceId, eventParameters)));
}
}
@@ -201,13 +201,13 @@ public class CommonEventUtils
{
renderBehaviorizedEventHandlers(facesContext, writer,
commonPropertiesMarked, commonEventsMarked, uiComponent,
- uiComponent.getClientId(facesContext), clientBehaviors);
+ null, clientBehaviors);
}
public static void renderBehaviorizedEventHandlers(
FacesContext facesContext, ResponseWriter writer,
long commonPropertiesMarked, long commonEventsMarked,
- UIComponent uiComponent, String targetClientId,
+ UIComponent uiComponent, String sourceId,
Map<String, List<ClientBehavior>> clientBehaviors)
throws IOException
{
@@ -215,21 +215,21 @@ public class CommonEventUtils
(commonEventsMarked & CommonEventConstants.CLICK_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONCLICK_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.CLICK,
+ uiComponent, sourceId, ClientBehaviorEvents.CLICK,
clientBehaviors, HTML.ONCLICK_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONDBLCLICK_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.DBLCLICK_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONDBLCLICK_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.DBLCLICK,
+ uiComponent, sourceId, ClientBehaviorEvents.DBLCLICK,
clientBehaviors, HTML.ONDBLCLICK_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEDOWN_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.MOUSEDOWN_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer,
- HTML.ONMOUSEDOWN_ATTR, uiComponent, targetClientId,
+ HTML.ONMOUSEDOWN_ATTR, uiComponent, sourceId,
ClientBehaviorEvents.MOUSEDOWN, clientBehaviors,
HTML.ONMOUSEDOWN_ATTR);
}
@@ -237,14 +237,14 @@ public class CommonEventUtils
(commonEventsMarked & CommonEventConstants.MOUSEUP_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONMOUSEUP_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.MOUSEUP,
+ uiComponent, sourceId, ClientBehaviorEvents.MOUSEUP,
clientBehaviors, HTML.ONMOUSEUP_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEOVER_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.MOUSEOVER_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer,
- HTML.ONMOUSEOVER_ATTR, uiComponent, targetClientId,
+ HTML.ONMOUSEOVER_ATTR, uiComponent, sourceId,
ClientBehaviorEvents.MOUSEOVER, clientBehaviors,
HTML.ONMOUSEOVER_ATTR);
}
@@ -252,7 +252,7 @@ public class CommonEventUtils
(commonEventsMarked & CommonEventConstants.MOUSEMOVE_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer,
- HTML.ONMOUSEMOVE_ATTR, uiComponent, targetClientId,
+ HTML.ONMOUSEMOVE_ATTR, uiComponent, sourceId,
ClientBehaviorEvents.MOUSEMOVE, clientBehaviors,
HTML.ONMOUSEMOVE_ATTR);
}
@@ -260,28 +260,28 @@ public class CommonEventUtils
(commonEventsMarked & CommonEventConstants.MOUSEOUT_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONMOUSEOUT_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.MOUSEOUT,
+ uiComponent, sourceId, ClientBehaviorEvents.MOUSEOUT,
clientBehaviors, HTML.ONMOUSEOUT_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYPRESS_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.KEYPRESS_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYPRESS_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.KEYPRESS,
+ uiComponent, sourceId, ClientBehaviorEvents.KEYPRESS,
clientBehaviors, HTML.ONKEYPRESS_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYDOWN_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.KEYDOWN_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYDOWN_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.KEYDOWN,
+ uiComponent, sourceId, ClientBehaviorEvents.KEYDOWN,
clientBehaviors, HTML.ONKEYDOWN_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYUP_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.KEYUP_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYUP_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.KEYUP,
+ uiComponent, sourceId, ClientBehaviorEvents.KEYUP,
clientBehaviors, HTML.ONKEYUP_ATTR);
}
}
@@ -295,7 +295,7 @@ public class CommonEventUtils
{
renderBehaviorizedEventHandlersWithoutOnclick(facesContext, writer,
commonPropertiesMarked, commonEventsMarked, uiComponent,
- uiComponent.getClientId(facesContext), clientBehaviors);
+ null, clientBehaviors);
}
/**
@@ -309,7 +309,7 @@ public class CommonEventUtils
public static void renderBehaviorizedEventHandlersWithoutOnclick(
FacesContext facesContext, ResponseWriter writer,
long commonPropertiesMarked, long commonEventsMarked,
- UIComponent uiComponent, String targetClientId,
+ UIComponent uiComponent, String sourceId,
Map<String, List<ClientBehavior>> clientBehaviors)
throws IOException
{
@@ -317,14 +317,14 @@ public class CommonEventUtils
(commonEventsMarked & CommonEventConstants.DBLCLICK_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONDBLCLICK_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.DBLCLICK,
+ uiComponent, sourceId, ClientBehaviorEvents.DBLCLICK,
clientBehaviors, HTML.ONDBLCLICK_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEDOWN_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.MOUSEDOWN_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer,
- HTML.ONMOUSEDOWN_ATTR, uiComponent, targetClientId,
+ HTML.ONMOUSEDOWN_ATTR, uiComponent, sourceId,
ClientBehaviorEvents.MOUSEDOWN, clientBehaviors,
HTML.ONMOUSEDOWN_ATTR);
}
@@ -332,14 +332,14 @@ public class CommonEventUtils
(commonEventsMarked & CommonEventConstants.MOUSEUP_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONMOUSEUP_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.MOUSEUP,
+ uiComponent, sourceId, ClientBehaviorEvents.MOUSEUP,
clientBehaviors, HTML.ONMOUSEUP_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEOVER_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.MOUSEOVER_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer,
- HTML.ONMOUSEOVER_ATTR, uiComponent, targetClientId,
+ HTML.ONMOUSEOVER_ATTR, uiComponent, sourceId,
ClientBehaviorEvents.MOUSEOVER, clientBehaviors,
HTML.ONMOUSEOVER_ATTR);
}
@@ -347,7 +347,7 @@ public class CommonEventUtils
(commonEventsMarked & CommonEventConstants.MOUSEMOVE_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer,
- HTML.ONMOUSEMOVE_ATTR, uiComponent, targetClientId,
+ HTML.ONMOUSEMOVE_ATTR, uiComponent, sourceId,
ClientBehaviorEvents.MOUSEMOVE, clientBehaviors,
HTML.ONMOUSEMOVE_ATTR);
}
@@ -355,28 +355,28 @@ public class CommonEventUtils
(commonEventsMarked & CommonEventConstants.MOUSEOUT_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONMOUSEOUT_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.MOUSEOUT,
+ uiComponent, sourceId, ClientBehaviorEvents.MOUSEOUT,
clientBehaviors, HTML.ONMOUSEOUT_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYPRESS_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.KEYPRESS_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYPRESS_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.KEYPRESS,
+ uiComponent, sourceId, ClientBehaviorEvents.KEYPRESS,
clientBehaviors, HTML.ONKEYPRESS_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYDOWN_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.KEYDOWN_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYDOWN_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.KEYDOWN,
+ uiComponent, sourceId, ClientBehaviorEvents.KEYDOWN,
clientBehaviors, HTML.ONKEYDOWN_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYUP_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.KEYUP_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYUP_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.KEYUP,
+ uiComponent, sourceId, ClientBehaviorEvents.KEYUP,
clientBehaviors, HTML.ONKEYUP_ATTR);
}
}
@@ -392,7 +392,7 @@ public class CommonEventUtils
public static void renderBehaviorizedFieldEventHandlers(
FacesContext facesContext, ResponseWriter writer,
long commonPropertiesMarked, long commonEventsMarked,
- UIComponent uiComponent, String targetClientId,
+ UIComponent uiComponent, String sourceId,
Map<String, List<ClientBehavior>> clientBehaviors)
throws IOException
{
@@ -400,28 +400,28 @@ public class CommonEventUtils
(commonEventsMarked & CommonEventConstants.FOCUS_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONFOCUS_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.FOCUS, clientBehaviors,
+ uiComponent, sourceId, ClientBehaviorEvents.FOCUS, clientBehaviors,
HTML.ONFOCUS_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONBLUR_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.BLUR_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONBLUR_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.BLUR, clientBehaviors,
+ uiComponent, sourceId, ClientBehaviorEvents.BLUR, clientBehaviors,
HTML.ONBLUR_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONCHANGE_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.CHANGE_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONCHANGE_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.CHANGE, clientBehaviors,
+ uiComponent, sourceId, ClientBehaviorEvents.CHANGE, clientBehaviors,
HTML.ONCHANGE_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONSELECT_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.SELECT_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONSELECT_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.SELECT, clientBehaviors,
+ uiComponent, sourceId, ClientBehaviorEvents.SELECT, clientBehaviors,
HTML.ONSELECT_ATTR);
}
}
@@ -429,7 +429,7 @@ public class CommonEventUtils
public static void renderBehaviorizedFieldEventHandlersWithoutOnfocus(
FacesContext facesContext, ResponseWriter writer,
long commonPropertiesMarked, long commonEventsMarked,
- UIComponent uiComponent, String targetClientId,
+ UIComponent uiComponent, String sourceId,
Map<String, List<ClientBehavior>> clientBehaviors)
throws IOException
{
@@ -437,21 +437,21 @@ public class CommonEventUtils
(commonEventsMarked & CommonEventConstants.BLUR_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONBLUR_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.BLUR, clientBehaviors,
+ uiComponent, sourceId, ClientBehaviorEvents.BLUR, clientBehaviors,
HTML.ONBLUR_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONCHANGE_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.CHANGE_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONCHANGE_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.CHANGE, clientBehaviors,
+ uiComponent, sourceId, ClientBehaviorEvents.CHANGE, clientBehaviors,
HTML.ONCHANGE_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONSELECT_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.SELECT_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONSELECT_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.SELECT, clientBehaviors,
+ uiComponent, sourceId, ClientBehaviorEvents.SELECT, clientBehaviors,
HTML.ONSELECT_ATTR);
}
}
@@ -465,13 +465,13 @@ public class CommonEventUtils
{
renderBehaviorizedFieldEventHandlersWithoutOnchange(
facesContext, writer, commonPropertiesMarked, commonEventsMarked,
- uiComponent, uiComponent.getClientId(facesContext), clientBehaviors);
+ uiComponent, null, clientBehaviors);
}
public static void renderBehaviorizedFieldEventHandlersWithoutOnchange(
FacesContext facesContext, ResponseWriter writer,
long commonPropertiesMarked, long commonEventsMarked,
- UIComponent uiComponent, String targetClientId,
+ UIComponent uiComponent, String sourceId,
Map<String, List<ClientBehavior>> clientBehaviors)
throws IOException
{
@@ -479,21 +479,21 @@ public class CommonEventUtils
(commonEventsMarked & CommonEventConstants.FOCUS_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONFOCUS_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.FOCUS, clientBehaviors,
+ uiComponent, sourceId, ClientBehaviorEvents.FOCUS, clientBehaviors,
HTML.ONFOCUS_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONBLUR_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.BLUR_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONBLUR_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.BLUR, clientBehaviors,
+ uiComponent, sourceId, ClientBehaviorEvents.BLUR, clientBehaviors,
HTML.ONBLUR_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONSELECT_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.SELECT_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONSELECT_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.SELECT, clientBehaviors,
+ uiComponent, sourceId, ClientBehaviorEvents.SELECT, clientBehaviors,
HTML.ONSELECT_ATTR);
}
}
@@ -508,14 +508,14 @@ public class CommonEventUtils
renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
facesContext, writer,
commonPropertiesMarked, commonEventsMarked,
- uiComponent, uiComponent.getClientId(facesContext),
+ uiComponent, null,
clientBehaviors);
}
public static void renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
FacesContext facesContext, ResponseWriter writer,
long commonPropertiesMarked, long commonEventsMarked,
- UIComponent uiComponent, String targetClientId,
+ UIComponent uiComponent, String sourceId,
Map<String, List<ClientBehavior>> clientBehaviors)
throws IOException
{
@@ -523,14 +523,14 @@ public class CommonEventUtils
(commonEventsMarked & CommonEventConstants.FOCUS_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONFOCUS_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.FOCUS, clientBehaviors,
+ uiComponent, sourceId, ClientBehaviorEvents.FOCUS, clientBehaviors,
HTML.ONFOCUS_ATTR);
}
if ((commonPropertiesMarked & CommonPropertyConstants.ONBLUR_PROP) != 0 ||
(commonEventsMarked & CommonEventConstants.BLUR_EVENT) != 0)
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONBLUR_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.BLUR, clientBehaviors,
+ uiComponent, sourceId, ClientBehaviorEvents.BLUR, clientBehaviors,
HTML.ONBLUR_ATTR);
}
}
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java?rev=1735720&r1=1735719&r2=1735720&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java Sat Mar 19 03:13:08 2016
@@ -441,6 +441,15 @@ public final class CommonPropertyUtils
renderFocusBlurEventProperties(writer, commonPropertiesMarked, component);
}
+ public static void renderAnchorPassthroughPropertiesDisabled(ResponseWriter writer,
+ long commonPropertiesMarked, UIComponent component)
+ throws IOException
+ {
+ renderAccesskeyTabindexProperties(writer, commonPropertiesMarked, component);
+ renderCommonPassthroughProperties(writer, commonPropertiesMarked, component);
+ renderFocusBlurEventProperties(writer, commonPropertiesMarked, component);
+ }
+
public static void renderAnchorPassthroughPropertiesWithoutEvents(ResponseWriter writer,
long commonPropertiesMarked, UIComponent component)
throws IOException
@@ -450,6 +459,15 @@ public final class CommonPropertyUtils
renderUniversalProperties(writer, commonPropertiesMarked, component);
}
+ public static void renderAnchorPassthroughPropertiesDisabledWithoutEvents(ResponseWriter writer,
+ long commonPropertiesMarked, UIComponent component)
+ throws IOException
+ {
+ renderAccesskeyTabindexProperties(writer, commonPropertiesMarked, component);
+ renderStyleProperties(writer, commonPropertiesMarked, component);
+ renderUniversalProperties(writer, commonPropertiesMarked, component);
+ }
+
public static void renderAnchorPassthroughPropertiesWithoutStyleAndEvents(ResponseWriter writer,
long commonPropertiesMarked, UIComponent component)
throws IOException
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java?rev=1735720&r1=1735719&r2=1735720&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java Sat Mar 19 03:13:08 2016
@@ -251,7 +251,22 @@ public interface HTML
(String[]) org.apache.myfaces.shared.util.ArrayUtils.concat(
ANCHOR_ATTRIBUTES,
UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE);
-
+
+ String[] ANCHOR_ATTRIBUTES_DISABLED =
+ {
+ ACCESSKEY_ATTR,
+ TABINDEX_ATTR,
+ };
+ String[] ANCHOR_PASSTHROUGH_ATTRIBUTES_DISABLED =
+ (String[]) ArrayUtils.concat(
+ ANCHOR_ATTRIBUTES_DISABLED,
+ COMMON_PASSTROUGH_ATTRIBUTES,
+ COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONSELECT_AND_ONCHANGE);
+ String[] ANCHOR_PASSTHROUGH_ATTRIBUTES_DISABLED_WITHOUT_EVENTS =
+ (String[]) ArrayUtils.concat(
+ ANCHOR_ATTRIBUTES_DISABLED,
+ UNIVERSAL_ATTRIBUTES);
+
// <form>
String ACCEPT_CHARSET_ATTR = "accept-charset";
String ENCTYPE_ATTR = "enctype";
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java?rev=1735720&r1=1735719&r2=1735720&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java Sat Mar 19 03:13:08 2016
@@ -383,21 +383,24 @@ public class HtmlCheckboxRendererBase ex
{
long commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(uiComponent);
HtmlRendererUtils.renderBehaviorizedOnchangeEventHandler(
- facesContext, writer, uiComponent, behaviors);
+ facesContext, writer, uiComponent, itemId != null ? itemId : clientId, behaviors);
if (isCommonEventsOptimizationEnabled(facesContext))
{
Long commonEventsMarked = CommonEventUtils.getCommonEventsMarked(uiComponent);
CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer,
- commonPropertiesMarked, commonEventsMarked, uiComponent, behaviors);
+ commonPropertiesMarked, commonEventsMarked, uiComponent,
+ itemId != null ? itemId : clientId, behaviors);
CommonEventUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
- facesContext, writer, commonPropertiesMarked, commonEventsMarked, uiComponent, behaviors);
+ facesContext, writer, commonPropertiesMarked, commonEventsMarked, uiComponent,
+ itemId != null ? itemId : clientId, behaviors);
}
else
{
HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext,
writer, uiComponent, behaviors);
HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
- facesContext, writer, uiComponent, behaviors);
+ facesContext, writer, uiComponent,
+ itemId != null ? itemId : clientId, behaviors);
}
}
HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent,
@@ -429,22 +432,23 @@ public class HtmlCheckboxRendererBase ex
{
long commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(uiComponent);
HtmlRendererUtils.renderBehaviorizedOnchangeEventHandler(
- facesContext, writer, uiComponent, behaviors);
+ facesContext, writer, uiComponent, itemId != null ? itemId : clientId, behaviors);
if (isCommonEventsOptimizationEnabled(facesContext))
{
Long commonEventsMarked = CommonEventUtils.getCommonEventsMarked(uiComponent);
CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer,
- commonPropertiesMarked, commonEventsMarked, uiComponent, behaviors);
+ commonPropertiesMarked, commonEventsMarked, uiComponent,
+ itemId != null ? itemId : clientId, behaviors);
CommonEventUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
facesContext, writer, commonPropertiesMarked, commonEventsMarked,
- uiComponent, behaviors);
+ uiComponent, itemId != null ? itemId : clientId, behaviors);
}
else
{
HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer,
- uiComponent, behaviors);
+ uiComponent, itemId != null ? itemId : clientId, behaviors);
HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
- facesContext, writer, uiComponent, behaviors);
+ facesContext, writer, uiComponent, itemId != null ? itemId : clientId, behaviors);
}
}
HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent,
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java?rev=1735720&r1=1735719&r2=1735720&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java Sat Mar 19 03:13:08 2016
@@ -312,13 +312,13 @@ public abstract class HtmlLinkRendererBa
}
if (isCommonPropertiesOptimizationEnabled(facesContext))
{
- CommonPropertyUtils.renderAnchorPassthroughPropertiesWithoutEvents(writer,
+ CommonPropertyUtils.renderAnchorPassthroughPropertiesDisabledWithoutEvents(writer,
commonPropertiesMarked, component);
}
else
{
HtmlRendererUtils.renderHTMLAttributes(writer, component,
- HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS);
+ HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES_DISABLED_WITHOUT_EVENTS);
}
}
else
@@ -326,12 +326,13 @@ public abstract class HtmlLinkRendererBa
HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);
if (isCommonPropertiesOptimizationEnabled(facesContext))
{
- CommonPropertyUtils.renderAnchorPassthroughProperties(writer,
+ CommonPropertyUtils.renderAnchorPassthroughPropertiesDisabled(writer,
CommonPropertyUtils.getCommonPropertiesMarked(component), component);
}
else
{
- HtmlRendererUtils.renderHTMLAttributes(writer, component, HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES);
+ HtmlRendererUtils.renderHTMLAttributes(writer, component,
+ HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES_DISABLED);
}
}
}
@@ -858,13 +859,13 @@ public abstract class HtmlLinkRendererBa
}
if (isCommonPropertiesOptimizationEnabled(facesContext))
{
- CommonPropertyUtils.renderAnchorPassthroughPropertiesWithoutEvents(writer,
+ CommonPropertyUtils.renderAnchorPassthroughPropertiesDisabledWithoutEvents(writer,
commonPropertiesMarked, output);
}
else
{
HtmlRendererUtils.renderHTMLAttributes(writer, output,
- HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS);
+ HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES_DISABLED_WITHOUT_EVENTS);
}
}
else
@@ -872,12 +873,12 @@ public abstract class HtmlLinkRendererBa
HtmlRendererUtils.writeIdIfNecessary(writer, output, facesContext);
if (isCommonPropertiesOptimizationEnabled(facesContext))
{
- CommonPropertyUtils.renderAnchorPassthroughProperties(writer,
+ CommonPropertyUtils.renderAnchorPassthroughPropertiesDisabled(writer,
CommonPropertyUtils.getCommonPropertiesMarked(output), output);
}
else
{
- HtmlRendererUtils.renderHTMLAttributes(writer, output, HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES);
+ HtmlRendererUtils.renderHTMLAttributes(writer, output, HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES_DISABLED);
}
}
}
@@ -1053,13 +1054,13 @@ public abstract class HtmlLinkRendererBa
}
if (isCommonPropertiesOptimizationEnabled(facesContext))
{
- CommonPropertyUtils.renderAnchorPassthroughPropertiesWithoutEvents(writer,
+ CommonPropertyUtils.renderAnchorPassthroughPropertiesDisabledWithoutEvents(writer,
commonPropertiesMarked, output);
}
else
{
HtmlRendererUtils.renderHTMLAttributes(writer, output,
- HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS);
+ HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES_DISABLED_WITHOUT_EVENTS);
}
}
else
@@ -1067,12 +1068,12 @@ public abstract class HtmlLinkRendererBa
HtmlRendererUtils.writeIdIfNecessary(writer, output, facesContext);
if (isCommonPropertiesOptimizationEnabled(facesContext))
{
- CommonPropertyUtils.renderAnchorPassthroughProperties(writer,
+ CommonPropertyUtils.renderAnchorPassthroughPropertiesDisabled(writer,
CommonPropertyUtils.getCommonPropertiesMarked(output), output);
}
else
{
- HtmlRendererUtils.renderHTMLAttributes(writer, output, HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES);
+ HtmlRendererUtils.renderHTMLAttributes(writer, output, HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES_DISABLED);
}
}
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java?rev=1735720&r1=1735719&r2=1735720&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java Sat Mar 19 03:13:08 2016
@@ -370,20 +370,25 @@ public class HtmlRadioRendererBase
}
else
{
- HtmlRendererUtils.renderBehaviorizedOnchangeEventHandler(facesContext, writer, uiComponent, behaviors);
+ HtmlRendererUtils.renderBehaviorizedOnchangeEventHandler(facesContext, writer, uiComponent,
+ itemId != null ? itemId : clientId, behaviors);
if (isCommonEventsOptimizationEnabled(facesContext))
{
Long commonEventsMarked = CommonEventUtils.getCommonEventsMarked(uiComponent);
CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer,
- commonPropertiesMarked, commonEventsMarked, uiComponent, behaviors);
+ commonPropertiesMarked, commonEventsMarked, uiComponent,
+ itemId != null ? itemId : clientId, behaviors);
CommonEventUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
- facesContext, writer, commonPropertiesMarked, commonEventsMarked, uiComponent, behaviors);
+ facesContext, writer, commonPropertiesMarked, commonEventsMarked, uiComponent,
+ itemId != null ? itemId : clientId, behaviors);
}
else
{
- HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent, behaviors);
+ HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent,
+ itemId != null ? itemId : clientId, behaviors);
HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
- facesContext, writer, uiComponent, behaviors);
+ facesContext, writer, uiComponent,
+ itemId != null ? itemId : clientId, behaviors);
}
}
HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent,
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java?rev=1735720&r1=1735719&r2=1735720&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java Sat Mar 19 03:13:08 2016
@@ -1803,7 +1803,7 @@ public final class HtmlRendererUtils
* @since 4.0.0
*/
private static boolean getClientBehaviorScript(FacesContext facesContext,
- UIComponent uiComponent, String targetClientId, String eventName,
+ UIComponent uiComponent, String sourceId, String eventName,
Map<String, List<ClientBehavior>> clientBehaviors,
ScriptContext target,
Collection<ClientBehaviorContext.Parameter> params)
@@ -1829,7 +1829,7 @@ public final class HtmlRendererUtils
}
ClientBehaviorContext context = ClientBehaviorContext
.createClientBehaviorContext(facesContext, uiComponent,
- eventName, targetClientId, params);
+ eventName, sourceId, params);
boolean submitting = false;
// List<ClientBehavior> attachedEventBehaviors is 99% _DeltaList created in
@@ -1893,12 +1893,12 @@ public final class HtmlRendererUtils
String userEventCode, String serverEventCode)
{
return buildBehaviorChain(facesContext, uiComponent,
- uiComponent.getClientId(facesContext), eventName, params,
+ null, eventName, params,
clientBehaviors, userEventCode, serverEventCode);
}
public static String buildBehaviorChain(FacesContext facesContext,
- UIComponent uiComponent, String targetClientId, String eventName,
+ UIComponent uiComponent, String sourceId, String eventName,
Collection<ClientBehaviorContext.Parameter> params,
Map<String, List<ClientBehavior>> clientBehaviors,
String userEventCode, String serverEventCode)
@@ -1912,7 +1912,7 @@ public final class HtmlRendererUtils
}
ScriptContext behaviorCode = new ScriptContext();
ScriptContext retVal = new ScriptContext();
- getClientBehaviorScript(facesContext, uiComponent, targetClientId,
+ getClientBehaviorScript(facesContext, uiComponent, sourceId,
eventName, clientBehaviors, behaviorCode, params);
if (behaviorCode != null
&& !behaviorCode.toString().trim().equals(STR_EMPTY))
@@ -1932,8 +1932,15 @@ public final class HtmlRendererUtils
{
//according to the spec jsf.util.chain has to be used to build up the
//behavior and scripts
- retVal.append("jsf.util.chain(document.getElementById('"
- + targetClientId + "'), event,");
+ if (sourceId == null)
+ {
+ retVal.append("jsf.util.chain(this, event,");
+ }
+ else
+ {
+ retVal.append("jsf.util.chain(document.getElementById('"
+ + sourceId + "'), event,");
+ }
while (it.hasNext())
{
retVal.append(it.next());
@@ -1969,13 +1976,13 @@ public final class HtmlRendererUtils
String userEventCode, String serverEventCode)
{
return buildBehaviorChain(facesContext, uiComponent,
- uiComponent.getClientId(facesContext), eventName1, params,
+ null, eventName1, params,
eventName2, params2, clientBehaviors, userEventCode,
serverEventCode);
}
public static String buildBehaviorChain(FacesContext facesContext,
- UIComponent uiComponent, String targetClientId, String eventName1,
+ UIComponent uiComponent, String sourceId, String eventName1,
Collection<ClientBehaviorContext.Parameter> params,
String eventName2,
Collection<ClientBehaviorContext.Parameter> params2,
@@ -1992,11 +1999,11 @@ public final class HtmlRendererUtils
ScriptContext behaviorCode = new ScriptContext();
ScriptContext retVal = new ScriptContext();
boolean submitting1 = getClientBehaviorScript(facesContext,
- uiComponent, targetClientId, eventName1, clientBehaviors,
+ uiComponent, sourceId, eventName1, clientBehaviors,
behaviorCode, params);
ScriptContext behaviorCode2 = new ScriptContext();
boolean submitting2 = getClientBehaviorScript(facesContext,
- uiComponent, targetClientId, eventName2, clientBehaviors,
+ uiComponent, sourceId, eventName2, clientBehaviors,
behaviorCode2, params2);
// ClientBehaviors for both events have to be checked for the Submitting hint
@@ -2029,8 +2036,15 @@ public final class HtmlRendererUtils
}
//according to the spec jsf.util.chain has to be used to build up the
//behavior and scripts
- retVal.append("jsf.util.chain(document.getElementById('"
- + targetClientId + "'), event,");
+ if (sourceId == null)
+ {
+ retVal.append("jsf.util.chain(this, event,");
+ }
+ else
+ {
+ retVal.append("jsf.util.chain(document.getElementById('"
+ + sourceId + "'), event,");
+ }
int cursor = 0;
while (cursor != size)
{
@@ -2169,12 +2183,12 @@ public final class HtmlRendererUtils
public static boolean renderBehaviorizedAttribute(
FacesContext facesContext, ResponseWriter writer,
String componentProperty, UIComponent component,
- String targetClientId, String eventName,
+ String sourceId, String eventName,
Map<String, List<ClientBehavior>> clientBehaviors)
throws IOException
{
return renderBehaviorizedAttribute(facesContext, writer,
- componentProperty, component, targetClientId, eventName, clientBehaviors, componentProperty);
+ componentProperty, component, sourceId, eventName, clientBehaviors, componentProperty);
}
/**
@@ -2206,11 +2220,11 @@ public final class HtmlRendererUtils
public static boolean renderBehaviorizedAttribute(
FacesContext facesContext, ResponseWriter writer, String componentProperty, UIComponent component,
- String targetClientId, String eventName, Map<String, List<ClientBehavior>> clientBehaviors,
+ String sourceId, String eventName, Map<String, List<ClientBehavior>> clientBehaviors,
String htmlAttrName) throws IOException
{
return renderBehaviorizedAttribute(facesContext, writer,
- componentProperty, component, targetClientId, eventName, null,
+ componentProperty, component, sourceId, eventName, null,
clientBehaviors, htmlAttrName, (String) component.getAttributes().get(componentProperty));
}
@@ -2239,14 +2253,14 @@ public final class HtmlRendererUtils
{
return renderBehaviorizedAttribute(facesContext, writer,
componentProperty, component,
- component.getClientId(facesContext), eventName,
+ null, eventName,
eventParameters, clientBehaviors, htmlAttrName, attributeValue);
}
public static boolean renderBehaviorizedAttribute(
FacesContext facesContext, ResponseWriter writer,
String componentProperty, UIComponent component,
- String targetClientId, String eventName,
+ String sourceId, String eventName,
Collection<ClientBehaviorContext.Parameter> eventParameters,
Map<String, List<ClientBehavior>> clientBehaviors,
String htmlAttrName, String attributeValue) throws IOException
@@ -2263,7 +2277,7 @@ public final class HtmlRendererUtils
{
return renderHTMLAttribute(writer, componentProperty, htmlAttrName,
HtmlRendererUtils.buildBehaviorChain(facesContext,
- component, targetClientId, eventName,
+ component, sourceId, eventName,
eventParameters, clientBehaviors, attributeValue,
STR_EMPTY));
}
@@ -2275,7 +2289,7 @@ public final class HtmlRendererUtils
cbl.get(0).getScript(
ClientBehaviorContext.createClientBehaviorContext(
facesContext, component, eventName,
- targetClientId, eventParameters)));
+ sourceId, eventParameters)));
}
}
@@ -2307,7 +2321,7 @@ public final class HtmlRendererUtils
{
return renderBehaviorizedAttribute(facesContext, writer,
componentProperty, component,
- component.getClientId(facesContext), eventName,
+ null, eventName,
eventParameters, clientBehaviors, htmlAttrName, attributeValue,
serverSideScript);
}
@@ -2316,7 +2330,7 @@ public final class HtmlRendererUtils
public static boolean renderBehaviorizedAttribute(
FacesContext facesContext, ResponseWriter writer,
String componentProperty, UIComponent component,
- String targetClientId, String eventName,
+ String sourceId, String eventName,
Collection<ClientBehaviorContext.Parameter> eventParameters,
Map<String, List<ClientBehavior>> clientBehaviors,
String htmlAttrName, String attributeValue, String serverSideScript)
@@ -2349,7 +2363,7 @@ public final class HtmlRendererUtils
ClientBehaviorContext
.createClientBehaviorContext(
facesContext, component,
- eventName, targetClientId,
+ eventName, sourceId,
eventParameters)));
}
}
@@ -2357,7 +2371,7 @@ public final class HtmlRendererUtils
{
return renderHTMLStringAttribute(writer, componentProperty, htmlAttrName,
HtmlRendererUtils.buildBehaviorChain(facesContext,
- component, targetClientId, eventName,
+ component, sourceId, eventName,
eventParameters, clientBehaviors, attributeValue,
serverSideScript));
}
@@ -2375,7 +2389,7 @@ public final class HtmlRendererUtils
{
return renderBehaviorizedAttribute(facesContext, writer,
componentProperty, component,
- component.getClientId(facesContext), eventName,
+ null, eventName,
eventParameters, eventName2, eventParameters2, clientBehaviors,
htmlAttrName, attributeValue, serverSideScript);
}
@@ -2383,7 +2397,7 @@ public final class HtmlRendererUtils
public static boolean renderBehaviorizedAttribute(
FacesContext facesContext, ResponseWriter writer,
String componentProperty, UIComponent component,
- String targetClientId, String eventName,
+ String sourceId, String eventName,
Collection<ClientBehaviorContext.Parameter> eventParameters,
String eventName2,
Collection<ClientBehaviorContext.Parameter> eventParameters2,
@@ -2415,7 +2429,7 @@ public final class HtmlRendererUtils
cb1.get(0).getScript(ClientBehaviorContext
.createClientBehaviorContext(
facesContext, component,
- eventName, targetClientId,
+ eventName, sourceId,
eventParameters)));
}
else
@@ -2425,7 +2439,7 @@ public final class HtmlRendererUtils
cb2.get(0).getScript(ClientBehaviorContext
.createClientBehaviorContext(
facesContext, component,
- eventName2, targetClientId,
+ eventName2, sourceId,
eventParameters2)));
}
}
@@ -2433,7 +2447,7 @@ public final class HtmlRendererUtils
{
return renderHTMLStringAttribute(writer, componentProperty, htmlAttrName,
HtmlRendererUtils.buildBehaviorChain(facesContext,
- component, targetClientId, eventName,
+ component, sourceId, eventName,
eventParameters, eventName2, eventParameters2,
clientBehaviors, attributeValue, serverSideScript));
}
@@ -2450,47 +2464,47 @@ public final class HtmlRendererUtils
throws IOException
{
renderBehaviorizedEventHandlers(facesContext, writer, uiComponent,
- uiComponent.getClientId(facesContext), clientBehaviors);
+ null, clientBehaviors);
}
public static void renderBehaviorizedEventHandlers(
FacesContext facesContext, ResponseWriter writer,
- UIComponent uiComponent, String targetClientId,
+ UIComponent uiComponent, String sourceId,
Map<String, List<ClientBehavior>> clientBehaviors)
throws IOException
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONCLICK_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.CLICK,
+ uiComponent, sourceId, ClientBehaviorEvents.CLICK,
clientBehaviors, HTML.ONCLICK_ATTR);
renderBehaviorizedAttribute(facesContext, writer, HTML.ONDBLCLICK_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.DBLCLICK,
+ uiComponent, sourceId, ClientBehaviorEvents.DBLCLICK,
clientBehaviors, HTML.ONDBLCLICK_ATTR);
renderBehaviorizedAttribute(facesContext, writer,
- HTML.ONMOUSEDOWN_ATTR, uiComponent, targetClientId,
+ HTML.ONMOUSEDOWN_ATTR, uiComponent, sourceId,
ClientBehaviorEvents.MOUSEDOWN, clientBehaviors,
HTML.ONMOUSEDOWN_ATTR);
renderBehaviorizedAttribute(facesContext, writer, HTML.ONMOUSEUP_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.MOUSEUP,
+ uiComponent, sourceId, ClientBehaviorEvents.MOUSEUP,
clientBehaviors, HTML.ONMOUSEUP_ATTR);
renderBehaviorizedAttribute(facesContext, writer,
- HTML.ONMOUSEOVER_ATTR, uiComponent, targetClientId,
+ HTML.ONMOUSEOVER_ATTR, uiComponent, sourceId,
ClientBehaviorEvents.MOUSEOVER, clientBehaviors,
HTML.ONMOUSEOVER_ATTR);
renderBehaviorizedAttribute(facesContext, writer,
- HTML.ONMOUSEMOVE_ATTR, uiComponent, targetClientId,
+ HTML.ONMOUSEMOVE_ATTR, uiComponent, sourceId,
ClientBehaviorEvents.MOUSEMOVE, clientBehaviors,
HTML.ONMOUSEMOVE_ATTR);
renderBehaviorizedAttribute(facesContext, writer, HTML.ONMOUSEOUT_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.MOUSEOUT,
+ uiComponent, sourceId, ClientBehaviorEvents.MOUSEOUT,
clientBehaviors, HTML.ONMOUSEOUT_ATTR);
renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYPRESS_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.KEYPRESS,
+ uiComponent, sourceId, ClientBehaviorEvents.KEYPRESS,
clientBehaviors, HTML.ONKEYPRESS_ATTR);
renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYDOWN_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.KEYDOWN,
+ uiComponent, sourceId, ClientBehaviorEvents.KEYDOWN,
clientBehaviors, HTML.ONKEYDOWN_ATTR);
renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYUP_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.KEYUP,
+ uiComponent, sourceId, ClientBehaviorEvents.KEYUP,
clientBehaviors, HTML.ONKEYUP_ATTR);
}
@@ -2621,16 +2635,16 @@ public final class HtmlRendererUtils
public static void renderBehaviorizedFieldEventHandlersWithoutOnchange(
FacesContext facesContext, ResponseWriter writer,
- UIComponent uiComponent, String targetClientId,
+ UIComponent uiComponent, String sourceId,
Map<String, List<ClientBehavior>> clientBehaviors)
throws IOException
{
renderBehaviorizedAttribute(facesContext, writer, HTML.ONFOCUS_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.FOCUS, clientBehaviors, HTML.ONFOCUS_ATTR);
+ uiComponent, sourceId, ClientBehaviorEvents.FOCUS, clientBehaviors, HTML.ONFOCUS_ATTR);
renderBehaviorizedAttribute(facesContext, writer, HTML.ONBLUR_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.BLUR, clientBehaviors, HTML.ONBLUR_ATTR);
+ uiComponent, sourceId, ClientBehaviorEvents.BLUR, clientBehaviors, HTML.ONBLUR_ATTR);
renderBehaviorizedAttribute(facesContext, writer, HTML.ONSELECT_ATTR,
- uiComponent, targetClientId, ClientBehaviorEvents.SELECT, clientBehaviors, HTML.ONSELECT_ATTR);
+ uiComponent, sourceId, ClientBehaviorEvents.SELECT, clientBehaviors, HTML.ONSELECT_ATTR);
}
public static void renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
@@ -2691,7 +2705,7 @@ public final class HtmlRendererUtils
public static boolean renderBehaviorizedOnchangeEventHandler(
FacesContext facesContext, ResponseWriter writer,
- UIComponent uiComponent, String targetClientId,
+ UIComponent uiComponent, String sourceId,
Map<String, List<ClientBehavior>> clientBehaviors)
throws IOException
{
@@ -2704,7 +2718,7 @@ public final class HtmlRendererUtils
if (hasChange && hasValueChange)
{
String chain = HtmlRendererUtils.buildBehaviorChain(facesContext,
- uiComponent, targetClientId, ClientBehaviorEvents.CHANGE,
+ uiComponent, sourceId, ClientBehaviorEvents.CHANGE,
null, ClientBehaviorEvents.VALUECHANGE, null,
clientBehaviors,
(String) uiComponent.getAttributes().get(HTML.ONCHANGE_ATTR), null);
@@ -2715,13 +2729,13 @@ public final class HtmlRendererUtils
else if (hasChange)
{
return HtmlRendererUtils.renderBehaviorizedAttribute(facesContext,
- writer, HTML.ONCHANGE_ATTR, uiComponent, targetClientId,
+ writer, HTML.ONCHANGE_ATTR, uiComponent, sourceId,
ClientBehaviorEvents.CHANGE, clientBehaviors, HTML.ONCHANGE_ATTR);
}
else if (hasValueChange)
{
return HtmlRendererUtils.renderBehaviorizedAttribute(facesContext,
- writer, HTML.ONCHANGE_ATTR, uiComponent, targetClientId,
+ writer, HTML.ONCHANGE_ATTR, uiComponent, sourceId,
ClientBehaviorEvents.VALUECHANGE, clientBehaviors, HTML.ONCHANGE_ATTR);
}
else
Modified: myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml?rev=1735720&r1=1735719&r2=1735720&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml (original)
+++ myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml Sat Mar 19 03:13:08 2016
@@ -2157,6 +2157,11 @@ resource.</longDesc>
<generatedTagClass>true</generatedTagClass>
<template>true</template>
<clientBehaviorHolder>true</clientBehaviorHolder>
+ <facet>
+ <name>caption</name>
+ <desc>The facet associated to the Caption</desc>
+ <longDesc>The facet associated to the Caption.</longDesc>
+ </facet>
<implementedInterfaces>
<interface name="javax.faces.component.behavior.ClientBehaviorHolder"/>
</implementedInterfaces>
Modified: myfaces/shared/trunk/core/src/test/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtilsTest.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/test/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtilsTest.java?rev=1735720&r1=1735719&r2=1735720&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/test/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtilsTest.java (original)
+++ myfaces/shared/trunk/core/src/test/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtilsTest.java Sat Mar 19 03:13:08 2016
@@ -48,7 +48,7 @@ public class HtmlRendererUtilsTest exten
ClientBehaviorEvents.CLICK, params, ClientBehaviorEvents.ACTION, params, behaviors, null,
null));
- Assert.assertEquals("return jsf.util.chain(document.getElementById('j_id__v_0'), event,'huhn', 'suppe');",
+ Assert.assertEquals("return jsf.util.chain(this, event,'huhn', 'suppe');",
HtmlRendererUtils.buildBehaviorChain(facesContext,
component, ClientBehaviorEvents.CLICK, params, ClientBehaviorEvents.ACTION, params, behaviors, "huhn",
"suppe"));
@@ -70,7 +70,7 @@ public class HtmlRendererUtilsTest exten
behaviors.put(ClientBehaviorEvents.CLICK, Arrays.asList(submittingBehavior));
- Assert.assertEquals("jsf.util.chain(document.getElementById('j_id__v_0'), event,'huhn', 'script()', 'suppe'); return false;",
+ Assert.assertEquals("jsf.util.chain(this, event,'huhn', 'script()', 'suppe'); return false;",
HtmlRendererUtils.buildBehaviorChain(facesContext,
component,
ClientBehaviorEvents.CLICK, params, ClientBehaviorEvents.ACTION, params, behaviors, "huhn",