JBoss Rich Faces SVN: r23190 - in branches/enterprise/3.3.1.SP3_BZ-795490: framework/impl/src/main/java/org/ajax4jsf/renderkit and 28 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ivassile
Date: 2012-02-20 16:07:13 -0500 (Mon, 20 Feb 2012)
New Revision: 23190
Modified:
branches/enterprise/3.3.1.SP3_BZ-795490/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
branches/enterprise/3.3.1.SP3_BZ-795490/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
branches/enterprise/3.3.1.SP3_BZ-795490/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
branches/enterprise/3.3.1.SP3_BZ-795490/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/test/java/org/ajax4jsf/component/AbstractQueueComponentTest.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/dataFilterSlider/src/main/java/org/richfaces/renderkit/DataFilterSliderRendererBase.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/ExtDropzoneRendererContributor.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/SimpleTableMenuRenderer.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
branches/enterprise/3.3.1.SP3_BZ-795490/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
branches/enterprise/3.3.1.SP3_BZ-795490/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js
branches/enterprise/3.3.1.SP3_BZ-795490/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableOptions.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
branches/enterprise/3.3.1.SP3_BZ-795490/ui/tabPanel/src/main/java/org/richfaces/component/UITabPanel.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabHeaderRendererBase.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java
branches/enterprise/3.3.1.SP3_BZ-795490/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
Log:
One-off patch BZ-795490
Integrate changes 14684, 14685 and 14686
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -69,8 +69,6 @@
public class AjaxViewRoot extends UIViewRoot implements AjaxContainer {
public static final String ROOT_ID = "_viewRoot";
-
- public static final String JS_NULL = "null";
private Lifecycle lifecycle;
@@ -217,9 +215,8 @@
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
String submittedRegionClientId = ajaxContext
.getSubmittedRegionClientId();
- // !submittedRegionClientId.equals(JS_NULL) - fix for myfaces 1.2.4
if (ajaxContext.isAjaxRequest() && submittedRegionClientId != null &&
- !submittedRegionClientId.equals(JS_NULL)
+ !submittedRegionClientId.equals(ROOT_ID)
&& !submittedRegionClientId.equals(getClientId(context))) {
invokeOnComponent(context, submittedRegionClientId, new InvokerCallbackWrapper(callback));
} else {
@@ -539,7 +536,7 @@
String submittedRegionClientId = ajaxContext
.getSubmittedRegionClientId();
boolean invoked = false;
- if (submittedRegionClientId != null && !submittedRegionClientId.equals(JS_NULL) && !submittedRegionClientId.equals(getClientId(context))) {
+ if (submittedRegionClientId != null && !submittedRegionClientId.equals(ROOT_ID) && !submittedRegionClientId.equals(getClientId(context))) {
invoked = invokeOnComponent(context, submittedRegionClientId, _ajaxInvoker);
}
// if container not found, use Root for encode.
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -126,6 +126,8 @@
public static final String SIMILARITY_GROUPING_ID_ATTR = "similarityGroupingId";
+ private static final RendererUtils rendererUtils = RendererUtils.getInstance();
+
/**
* Static class - protect constructor
*
@@ -144,8 +146,24 @@
*/
public static StringBuffer buildOnClick(UIComponent uiComponent,
FacesContext facesContext) {
- return buildOnEvent(uiComponent, facesContext, HTML.onclick_ATTRIBUTE);
+
+ return buildOnClick(uiComponent, facesContext, false);
}
+
+ /**
+ * Build JavaScript onclick event for given component
+ *
+ * @param uiComponent -
+ * component for build event
+ * @param facesContext
+ * @param omitDefaultActionUrl - default action URL is not encoded if parameter is true
+ *
+ * @return <code>StringBuffer</code> with Javascript code
+ */
+ public static StringBuffer buildOnClick(UIComponent uiComponent,
+ FacesContext facesContext, boolean omitDefaultActionUrl) {
+ return buildOnEvent(uiComponent, facesContext, HTML.onclick_ATTRIBUTE, omitDefaultActionUrl);
+ }
/**
* Build JavaScript event for component
@@ -159,6 +177,24 @@
*/
public static StringBuffer buildOnEvent(UIComponent uiComponent,
FacesContext facesContext, String eventName) {
+
+ return buildOnEvent(uiComponent, facesContext, eventName, false);
+ }
+
+ /**
+ * Build JavaScript event for component
+ *
+ * @param uiComponent -
+ * component for build event
+ * @param facesContext
+ * @param eventName -
+ * name of event
+ * @param omitDefaultActionUrl - default action URL is not encoded if parameter is true
+ *
+ * @return <code>StringBuffer</code> with Javascript code
+ */
+ public static StringBuffer buildOnEvent(UIComponent uiComponent,
+ FacesContext facesContext, String eventName, boolean omitDefaultActionUrl) {
StringBuffer onEvent = new StringBuffer();
if (null != eventName) {
String commandOnEvent = (String) uiComponent.getAttributes().get(
@@ -181,7 +217,7 @@
// status - id of request status component.
// parameters - map of parameters name/value for append on request.
// ..........
- ajaxFunction.addParameter(buildEventOptions(facesContext, uiComponent));
+ ajaxFunction.addParameter(buildEventOptions(facesContext, uiComponent, omitDefaultActionUrl));
// appendAjaxSubmitParameters(facesContext, uiComponent, onEvent);
ajaxFunction.appendScript(onEvent);
@@ -202,17 +238,37 @@
return buildEventOptions(facesContext, component, null);
}
+
+ public static Map<String, Object> buildEventOptions(FacesContext facesContext,
+ UIComponent uiComponent, Map<String, Object> params) {
+
+ return buildEventOptions(facesContext, uiComponent, params, false);
+ }
+ public static Map<String, Object> buildEventOptions(FacesContext facesContext,
+ UIComponent component, boolean omitDefaultActionUrl) {
+
+ return buildEventOptions(facesContext, component, null, omitDefaultActionUrl);
+ }
+
/**
* @param facesContext
* @param uiComponent
* @return
*/
public static Map<String, Object> buildEventOptions(FacesContext facesContext,
- UIComponent uiComponent, Map<String, Object> params) {
+ UIComponent uiComponent, Map<String, Object> params, boolean omitDefaultActionUrl) {
String clientId = uiComponent.getClientId(facesContext);
Map<String, Object> componentAttributes = uiComponent.getAttributes();
Map<String, Object> options = new HashMap<String, Object>();
+
+ UIComponent nestingContainer = (UIComponent) findAjaxContainer(
+ facesContext, uiComponent);
+ String containerClientId = nestingContainer.getClientId(facesContext);
+ if (containerClientId != null && !AjaxViewRoot.ROOT_ID.equals(containerClientId)) {
+ options.put("containerId", containerClientId);
+ }
+
Map<String, Object> parameters = new HashMap<String, Object>();
UIComponent targetComponent = (uiComponent instanceof AjaxSupport)?uiComponent.getParent():uiComponent;
// UIForm form = getNestingForm(uiComponent);
@@ -241,9 +297,23 @@
controlValue = clientId;
parameters.put(controlName, controlValue);
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(facesContext);
- // Setup action URL. For portlet environment, it will be different from
- // page.
- options.put("actionUrl", ajaxContext.getAjaxActionURL(facesContext));
+
+ String ajaxActionURL = ajaxContext.getAjaxActionURL(facesContext);
+ if (omitDefaultActionUrl) {
+ UIComponent form = getNestingForm(uiComponent);
+ if (form != null && !rendererUtils.isBooleanAttribute(form, "ajaxSubmit")) {
+ if (rendererUtils.getActionUrl(facesContext).equals(ajaxActionURL)) {
+ ajaxActionURL = null;
+ }
+ }
+ }
+
+ if (ajaxActionURL != null) {
+ // Setup action URL. For portlet environment, it will be different from
+ // page.
+ options.put("actionUrl", ajaxActionURL);
+ }
+
// Add application-wide Ajax parameters
parameters.putAll(ajaxContext.getCommonAjaxParameters());
// add child parameters
@@ -398,18 +468,7 @@
public static JSFunction buildAjaxFunction(UIComponent uiComponent,
FacesContext facesContext, String functionName) {
JSFunction ajaxFunction = new JSFunction(functionName);
- UIComponent nestingContainer = (UIComponent) findAjaxContainer(
- facesContext, uiComponent);
-
-
- String clientId = nestingContainer.getClientId(facesContext);
- if (clientId != null) {
- ajaxFunction.addParameter(clientId);
- } else {
- // fix for myfaces 1.2.4
- ajaxFunction.addParameter(JSReference.NULL);
- }
-
+
// build form name or ActionUrl for script
UIComponent nestingForm = getNestingForm(uiComponent);
if (null == nestingForm) {
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2012-02-20 21:07:13 UTC (rev 23190)
@@ -10,6 +10,8 @@
A4J.AJAX = {};
+A4J.AJAX.VIEW_ROOT_ID = "_viewRoot";
+
A4J.AJAX.Stub = function() {};
/**
@@ -661,7 +663,7 @@
*
*
*/
-A4J.AJAX.Poll = function( containerId, form, options ) {
+A4J.AJAX.Poll = function(form, options ) {
A4J.AJAX.StopPoll(options.pollId);
if(!options.onerror){
options.onerror = function(req,status,message){
@@ -669,13 +671,13 @@
A4J.AJAX.onError(req,status,message);
}
// For error, re-submit request.
- A4J.AJAX.Poll(containerId,form,options);
+ A4J.AJAX.Poll(form,options);
};
}
if (!options.onqueuerequestdrop) {
options.onqueuerequestdrop = function() {
- A4J.AJAX.Poll(containerId,form,options);
+ A4J.AJAX.Poll(form,options);
};
}
@@ -685,9 +687,9 @@
A4J.AJAX._pollers[options.pollId]=undefined;
if((typeof(options.onsubmit) == 'function') && (options.onsubmit()==false)){
// Onsubmit disable current poll, start next interval.
- A4J.AJAX.Poll(containerId,form,options);
+ A4J.AJAX.Poll(form,options);
} else {
- A4J.AJAX.Submit(containerId,form,null,options);
+ A4J.AJAX.Submit(form,null,options);
}
},options.pollinterval);
};
@@ -703,11 +705,11 @@
*
*
*/
-A4J.AJAX.Push = function( containerId, form, options ) {
+A4J.AJAX.Push = function(form, options ) {
A4J.AJAX.StopPush(options.pushId);
options.onerror = function(){
// For error, re-submit request.
- A4J.AJAX.Push(containerId,form,options);
+ A4J.AJAX.Push(form,options);
};
options.onqueuerequestdrop = function() {
@@ -722,7 +724,7 @@
if(request.status == 200){
if(request.getResponseHeader("Ajax-Push-Status")=="READY"){
A4J.AJAX.SetZeroRequestDelay(options);
- A4J.AJAX.Submit(containerId,form||options.dummyForm,null,options);
+ A4J.AJAX.Submit(form||options.dummyForm,null,options);
}
}
} catch(e){
@@ -732,7 +734,7 @@
request=null;
A4J.AJAX._pollers[options.pushId] = null;
// Re-send request.
- A4J.AJAX.Push( containerId, form, options );
+ A4J.AJAX.Push(form, options );
}
}
A4J.AJAX.SendPush( request,options );
@@ -770,7 +772,7 @@
}
-A4J.AJAX.SubmitForm = function( containerId, form, options ) {
+A4J.AJAX.SubmitForm = function(form, options ) {
var opt = A4J.AJAX.CloneObject(options);
// Setup active control if form submitted by button.
if(A4J._formInput){
@@ -779,7 +781,7 @@
A4J._formInput = null;
opt.submitByForm=true;
}
- A4J.AJAX.Submit(containerId,form,null,opt);
+ A4J.AJAX.Submit(form,null,opt);
}
/**
@@ -805,7 +807,7 @@
return domEvt;
};
-A4J.AJAX.PrepareQuery = function(containerId, formId, domEvt, options) {
+A4J.AJAX.PrepareQuery = function(formId, domEvt, options) {
// Process listeners.
for(var li = 0; li < A4J.AJAX._listeners.length; li++){
var listener = A4J.AJAX._listeners[li];
@@ -830,7 +832,7 @@
return false;
};
};
- var tosend = new A4J.Query(containerId, form);
+ var tosend = new A4J.Query(options.containerId, form);
tosend.appendFormControls(options.single, options.control);
//appending options.control moved to appendFormControls
//if(options.control){
@@ -896,9 +898,9 @@
//Submit or put in queue request. It not full queues - framework perform waiting only one request to same queue, new events simple replace last.
//If request for same queue already performed, replace with current parameters.
-A4J.AJAX.Submit = function( containerId, formId, event , options ) {
+A4J.AJAX.Submit = function(formId, event , options ) {
var domEvt = A4J.AJAX.CloneEvent(event);
- var query = A4J.AJAX.PrepareQuery(containerId, formId, domEvt, options);
+ var query = A4J.AJAX.PrepareQuery(formId, domEvt, options);
if (query) {
var queue = A4J.AJAX.EventQueue.getOrCreateQueue(options, formId);
@@ -921,9 +923,9 @@
// list of updated areas in response.
// statusID - DOM id request status tags.
// oncomplete - function for call after complete request.
-A4J.AJAX.SubmitRequest = function( containerId, formId, event, options ) {
+A4J.AJAX.SubmitRequest = function(formId, event, options ) {
var domEvt = A4J.AJAX.CloneEvent(event);
- var query = A4J.AJAX.PrepareQuery(containerId, formId, domEvt, options);
+ var query = A4J.AJAX.PrepareQuery(formId, domEvt, options);
if (query) {
A4J.AJAX.SubmitQuery(query, options, domEvt);
}
@@ -1394,11 +1396,12 @@
// Class for build query string.
A4J.Query = function(containerId, form){
- // For detect AJAX Request.
- this._query = {AJAXREQUEST : containerId};
+ var containerIdOrDefault = containerId || A4J.AJAX.VIEW_ROOT_ID;
+ // For detect AJAX Request.
+ this._query = {AJAXREQUEST : containerIdOrDefault};
this._oldSubmit = null ;
this._form = form;
- this._containerId = containerId;
+ this._containerId = containerIdOrDefault;
this._actionUrl = ( this._form.action)?this._form.action:this._form;
};
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -460,7 +460,7 @@
HashMap<String, Object> params = new HashMap<String, Object>();
params.put(calendar.getClientId(context) + CURRENT_DATE_PRELOAD, Boolean.TRUE);
- Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, calendar, params);
+ Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, calendar, params, true);
options.put("calendar", JSReference.THIS);
String oncomplete = AjaxRendererUtils.getAjaxOncomplete(calendar);
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -95,7 +95,7 @@
buildOnEvent.append(onsubmit).append(";");
}
buildOnEvent.append(AjaxRendererUtils.buildOnEvent(this,
- getFacesContext(), getEvent()));
+ getFacesContext(), getEvent(), true));
String script = buildOnEvent.toString();
return script;
}
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -80,7 +80,7 @@
public String getOnClick(FacesContext context, UIComponent component) {
StringBuffer onClick;
if (!getUtils().isBooleanAttribute(component, "disabled")) {
- onClick = AjaxRendererUtils.buildOnClick(component, context);
+ onClick = AjaxRendererUtils.buildOnClick(component, context, true);
if (!"reset".equals(component.getAttributes().get("type"))) {
onClick.append(";return false;");
}
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -63,7 +63,7 @@
// Create AJAX Submit function.
JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(
component, context,AjaxRendererUtils.AJAX_FUNCTION_NAME);
- Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, component);
+ Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, component, true);
Map<String, Object> parameters = (Map<String, Object>) options.get("parameters");
if (null == parameters) {
parameters = new HashMap<String, Object>();
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -132,7 +132,7 @@
component, context,
AJAX_FORM_FUNCTION_NAME);
ajaxFunction.addParameter(AjaxRendererUtils.buildEventOptions(
- context, component));
+ context, component, false));
ajaxFunction.appendScript(onSubmit);
writer.writeURIAttribute("action", onSubmit, "action");
} else {
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -59,7 +59,7 @@
StringBuffer script = new StringBuffer("\n");
if(poll.isEnabled()){
JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context, AJAX_POLL_FUNCTION);
- Map options = AjaxRendererUtils.buildEventOptions(context, component);
+ Map options = AjaxRendererUtils.buildEventOptions(context, component, true);
Integer interval = new Integer(poll.getInterval());
options.put("pollinterval", interval);
options.put("pollId", component.getClientId(context));
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -69,7 +69,7 @@
if(push.isEnabled()){
JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context, AJAX_PUSH_FUNCTION);
// Set dummy form id, if nessesary.
- Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, component);
+ Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, component, false);
options.put("dummyForm", component.getClientId(context)+RendererUtils.DUMMY_FORM_ID);
int interval = push.getInterval();
if(interval == Integer.MIN_VALUE){
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/test/java/org/ajax4jsf/component/AbstractQueueComponentTest.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/test/java/org/ajax4jsf/component/AbstractQueueComponentTest.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/core/src/test/java/org/ajax4jsf/component/AbstractQueueComponentTest.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -103,7 +103,7 @@
public void encodeToHead(FacesContext facesContext, UIComponent component)
throws IOException {
JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(component, facesContext);
- Map<String, Object> options = AjaxRendererUtils.buildEventOptions(facesContext, component);
+ Map<String, Object> options = AjaxRendererUtils.buildEventOptions(facesContext, component, true);
options.put("requestDelay", new JSReference("options.requestDelay"));
options.put("similarityGroupingId", new JSReference("options.similarityGroupingId || '" +
component.getClientId(facesContext) + "'"));
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/dataFilterSlider/src/main/java/org/richfaces/renderkit/DataFilterSliderRendererBase.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/dataFilterSlider/src/main/java/org/richfaces/renderkit/DataFilterSliderRendererBase.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/dataFilterSlider/src/main/java/org/richfaces/renderkit/DataFilterSliderRendererBase.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -128,7 +128,7 @@
JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(slider,context);
ajaxFunction.addParameter(AjaxRendererUtils.buildEventOptions(
- context, slider));
+ context, slider, true));
StringBuffer script= new StringBuffer();
ajaxFunction.appendScript(script);
script.append("; return false");
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -652,7 +652,7 @@
setRequiresScripts(context);
JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(table, context);
- Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(context, table);
+ Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(context, table, true);
@SuppressWarnings("unchecked")
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -287,7 +287,7 @@
JSFunction function = AjaxRendererUtils.buildAjaxFunction(component,
context);
Map eventOptions = AjaxRendererUtils.buildEventOptions(context,
- component);
+ component, true);
Map parameters = (Map) eventOptions.get("parameters");
Map params = getParameters(context,component);
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -109,7 +109,7 @@
DraggableOptions options = new DraggableOptions(draggable);
Map eventOptions = AjaxRendererUtils.buildEventOptions(context, component,
- Collections.singletonMap(DRAG_SOURCE_ID, (Object) component.getClientId(context)));
+ Collections.singletonMap(DRAG_SOURCE_ID, (Object) component.getClientId(context)), true);
Map parameters = (Map) eventOptions.get("parameters");
if (parameters == null) {
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -278,7 +278,7 @@
definition.addParameter("event");
definition.addParameter("drag");
- Map requestOpts = AjaxRendererUtils.buildEventOptions(context, component);
+ Map requestOpts = AjaxRendererUtils.buildEventOptions(context, component, true);
definition.addToBody("var options = ").addToBody(ScriptUtils.toScript(requestOpts)).addToBody(";");
definition.addToBody("options.parameters['" + DROP_TARGET_ID + "'] = '" + component.getClientId(context) + "';");
//TODO nick - remove as legacy
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -920,7 +920,7 @@
definition.addParameter("ascending");
String id = table.getClientId(context);
Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(
- context, table);
+ context, table, true);
@SuppressWarnings("unchecked")
Map<String, Object> parameters = (Map<String, Object>) eventOptions
.get("parameters");
@@ -955,7 +955,7 @@
protected JSFunction getSortFunction(FacesContext context, UIDataTable table) {
String id = table.getClientId(context);
Map<String, Object> requestOpts = AjaxRendererUtils.buildEventOptions(
- context, table);
+ context, table, true);
@SuppressWarnings("unchecked")
Map<String, Object> parameters = (Map<String, Object>) requestOpts
.get("parameters");
@@ -978,7 +978,7 @@
UIDataTable table) {
String id = table.getClientId(context);
Map<String, Object> requestOpts = AjaxRendererUtils.buildEventOptions(
- context, table);
+ context, table, true);
@SuppressWarnings("unchecked")
Map<String, Object> parameters = (Map<String, Object>) requestOpts
.get("parameters");
@@ -1003,7 +1003,7 @@
definition.addParameter("columnId");
String id = table.getClientId(context);
Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(
- context, table);
+ context, table, true);
@SuppressWarnings("unchecked")
Map<String, Object> parameters = (Map<String, Object>) eventOptions
.get("parameters");
@@ -1032,7 +1032,7 @@
definition.addParameter("event");
definition.addParameter("groupIndex");
Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(
- context, table);
+ context, table, true);
@SuppressWarnings("unchecked")
Map<String, Object> parameters = (Map<String, Object>) eventOptions
.get("parameters");
@@ -1055,7 +1055,7 @@
definition.addParameter("columnWidths");
Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(
- context, table);
+ context, table, true);
@SuppressWarnings("unchecked")
Map<String, Object> parameters = (Map<String, Object>) eventOptions
.get("parameters");
@@ -1076,7 +1076,7 @@
FacesContext context, UIDataTable table) {
boolean ajaxSingle = true;
Map<String, Object> requestOpts = AjaxRendererUtils.buildEventOptions(
- context, table);
+ context, table, true);
JSFunctionDefinition onAjaxCompleteFunction = getOnAjaxCompleteFunction(
context, table);
@@ -1426,7 +1426,7 @@
JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(table,
context);
Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(
- context, table);
+ context, table, true);
@SuppressWarnings("unchecked")
Map<String, Object> parameters = (Map<String, Object>) eventOptions
.get("parameters");
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/ExtDropzoneRendererContributor.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/ExtDropzoneRendererContributor.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/ExtDropzoneRendererContributor.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -95,7 +95,7 @@
definition.addParameter("event");
definition.addParameter("drag");
- Map<String, Object> requestOpts = AjaxRendererUtils.buildEventOptions(context, column);
+ Map<String, Object> requestOpts = AjaxRendererUtils.buildEventOptions(context, column, true);
//replace parameters
String clientId = column.getClientId(context);
@SuppressWarnings("unchecked")
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/SimpleTableMenuRenderer.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/SimpleTableMenuRenderer.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/SimpleTableMenuRenderer.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -90,7 +90,7 @@
if ((!columnVisible) || (visibleColumnsCount > 1)) {
boolean ajaxSingle = true;
Map<String, Object> requestOpts = AjaxRendererUtils
- .buildEventOptions(context, dataColumn);
+ .buildEventOptions(context, dataColumn, true);
if (onAjaxCompleteFunction != null)
requestOpts.put(AjaxRendererUtils.ONCOMPLETE_ATTR_NAME,
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -54,8 +54,6 @@
import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.renderkit.ComponentVariables;
-import org.ajax4jsf.renderkit.ComponentsVariableResolver;
import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.request.MultipartRequest;
import org.ajax4jsf.resource.CountingOutputWriter;
@@ -209,24 +207,6 @@
}
/**
- * Gets container id
- *
- * @param context -
- * faces context
- * @param component -
- * component
- * @return String container id
- */
- public String getContainerId(FacesContext context, UIComponent component) {
- UIComponent container = (UIComponent) AjaxRendererUtils
- .findAjaxContainer(context, component);
- if (container != null) {
- return container.getClientId(context);
- }
- return null;
- }
-
- /**
* Generates map with internalized labels to be put into JS
*
* @param o
@@ -435,33 +415,21 @@
* @throws IOException
*/
@SuppressWarnings("unchecked")
- private String getActionScript(FacesContext context, UIComponent component,
- String action, Object oncomplete) throws IOException {
- ComponentVariables variables = ComponentsVariableResolver.getVariables(
- this, component);
+ public String getActionScript(FacesContext context, UIComponent component) throws IOException {
String clientId = component.getClientId(context);
- String containerId = (String) variables.getVariable("containerId");
- JSFunction ajaxFunction = new JSFunction(
- AjaxRendererUtils.AJAX_FUNCTION_NAME);
- ajaxFunction.addParameter(containerId);
- ajaxFunction.addParameter(new JSReference("formId"));
- ajaxFunction.addParameter(new JSReference("event"));
- // AjaxRendererUtils.buildAjaxFunction(
- // component, context);
+ JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(component, context);
- Map options = AjaxRendererUtils.buildEventOptions(context, component);
- Map parameters = (Map) options.get("parameters");
- parameters.put(FileUploadConstants.FILE_UPLOAD_ACTION, action);
+ Map<String, Object> parameters = new HashMap<String, Object>();
+ parameters.put(FileUploadConstants.FILE_UPLOAD_ACTION, new JSReference("action"));
parameters.put(FileUploadConstants.UPLOAD_FILES_ID, new JSReference("uid"));
- parameters.put(clientId, clientId);
parameters.put(AjaxRendererUtils.AJAX_SINGLE_ATTR, clientId);
- if (oncomplete != null) {
- options.put("onbeforedomupdate", oncomplete);
- }
+
+ Map options = AjaxRendererUtils.buildEventOptions(context, component, parameters, true);
+ options.put("onbeforedomupdate", new JSReference("callback"));
+
ajaxFunction.addParameter(options);
- JSFunctionDefinition function = new JSFunctionDefinition("uid");
- function.addParameter("formId");
+ JSFunctionDefinition function = new JSFunctionDefinition("uid", "action", "callback");
function.addParameter("event");
function.addToBody(ajaxFunction.toScript());
@@ -506,49 +474,6 @@
}
/**
- * Generates JS script for stopping uploading process
- *
- * @param context
- * @param component
- * @return
- * @throws IOException
- */
- public String getStopScript(FacesContext context, UIComponent component)
- throws IOException {
- JSFunctionDefinition oncomplete = new JSFunctionDefinition();
- oncomplete.addParameter("request");
- oncomplete.addParameter("event");
- oncomplete.addParameter("data");
- StringBuffer body = new StringBuffer("$('");
- body.append(component.getClientId(context));
- body.append("').component.cancelUpload(data);");
- oncomplete.addToBody(body);
- return getActionScript(context, component, FileUploadConstants.FILE_UPLOAD_ACTION_STOP, oncomplete);
- }
-
- /**
- * Generates JS script for getting file size from server
- *
- * @param context
- * @param component
- * @return
- * @throws IOException
- */
- public String getFileSizeScript(FacesContext context, UIComponent component)
- throws IOException {
- JSFunctionDefinition oncomplete = new JSFunctionDefinition();
- oncomplete.addParameter("request");
- oncomplete.addParameter("event");
- oncomplete.addParameter("data");
- StringBuffer body = new StringBuffer("$('");
- body.append(component.getClientId(context));
- body.append("').component.getFileSize(data);");
- oncomplete.addToBody(body);
- return getActionScript(context, component, FileUploadConstants.FILE_UPLOAD_ACTION_PROGRESS, oncomplete);
-
- }
-
- /**
* Generates progress label markup
*
* @param context
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2012-02-20 21:07:13 UTC (rev 23190)
@@ -184,7 +184,7 @@
},
stop: function() {
- this.uploadObject.stopScript(this.uid, this.uploadObject.formId);
+ this.uploadObject.executeStopScript(this.uid);
},
_clearInput: function() {
@@ -427,7 +427,7 @@
uploadedCount: 0,
- initialize: function(id, formId, actionUrl, stopScript, getFileSizeScript, progressBarId, classes, label, maxFiles, events, disabled, acceptedTypes, options, labels, parameters, sessionId) {
+ initialize: function(id, formId, actionUrl, actionScript, progressBarId, classes, label, maxFiles, events, disabled, acceptedTypes, options, labels, parameters, sessionId) {
this.id = id;
this.element = $(this.id);
if (formId != '') {
@@ -448,8 +448,7 @@
this.element.component = this;
this.acceptedTypes = acceptedTypes;
- this.stopScript = stopScript;
- this.getFileSizeScript = getFileSizeScript;
+ this.actionScript = actionScript;
this.items = $(this.id + ":fileItems");
this.classes = classes;
@@ -472,7 +471,13 @@
this.initFileInput();
},
- cancelUpload: function(uid) {
+ executeStopScript: function (uid) {
+ this.actionScript(uid, "richfaces_file_upload_action_stop", this.cancelUpload.bind(this));
+ },
+
+ cancelUpload: function(request, event, data) {
+ var uid = data;
+
if (this.activeEntry && this.activeEntry.uid == uid) {
if (this.watcher) {
this.watcher.oncancel();
@@ -592,7 +597,11 @@
}
},
- getFileSize: function (data) {
+ executeFileSizeScript: function(uid) {
+ this.actionScript(uid, "progress", this.getFileSize.bind(this));
+ },
+
+ getFileSize: function(request, event, data) {
if (data) {
if (!this.isFlash) {
@@ -610,7 +619,7 @@
if (this.activeEntry) {
this._fileSizeScriptTimeoutId = setTimeout(function() {
this._fileSizeScriptTimeoutId = undefined;
- this.getFileSizeScript(this.activeEntry.uid, this.formId);
+ this.executeFileSizeScript(this.activeEntry.uid);
}.bind(this), this.progressBar.options['pollinterval'] || 500);
}
}
@@ -1074,7 +1083,7 @@
Richfaces.writeAttribute(parentForm, "enctype", "multipart/form-data");
Richfaces.writeAttribute(parentForm, "action",
- this.actionUrl + (/\?/.test(this.actionUrl) ? '&_richfaces_upload_uid' : '?_richfaces_upload_uid') + '=' + encodeURI(entry.uid) + "&" + this.id + "=" + this.id + "&_richfaces_upload_file_indicator=true"+"&AJAXREQUEST="+this.progressBar.containerId);
+ this.actionUrl + (/\?/.test(this.actionUrl) ? '&_richfaces_upload_uid' : '?_richfaces_upload_uid') + '=' + encodeURI(entry.uid) + "&" + this.id + "=" + this.id + "&_richfaces_upload_file_indicator=true"+"&AJAXREQUEST=" + (this.progressBar.options.containerId || A4J.AJAX.VIEW_ROOT_ID));
Richfaces.writeAttribute(parentForm, "target", this.id + "_iframe");
@@ -1135,7 +1144,7 @@
this.currentInput.disabled = true;
}else {
Richfaces.writeAttribute(parentForm, "target", oldTarget);
- this.getFileSizeScript(entry.uid, this.formId)
+ this.executeFileSizeScript(entry.uid)
}
}
},
@@ -1287,7 +1296,7 @@
},
_flashGetPostParams: function () {
- var query = new A4J.Query(this.progressBar.containerId, this.form);
+ var query = new A4J.Query(this.progressBar.options.containerId, this.form);
if (query) {
query.appendFormControls();
var qStr = query.getQueryString();
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2012-02-20 21:07:13 UTC (rev 23190)
@@ -49,9 +49,8 @@
variables.setVariable("uploadLabel",labels.get("upload"));
variables.setVariable("clearAllLabel",labels.get("clear_all"));
- variables.setVariable("formId",getFormId(context, component));
- variables.setVariable("containerId",getContainerId(context, component));
+
variables.setVariable("listWidth", getFileListWidth(component));
variables.setVariable("listHeight", getFileListHeight(component));
@@ -195,7 +194,7 @@
onfileuploadcomplete : #{this:getAsEventHandler(context, component, "onfileuploadcomplete")}
};
- new FileUpload('#{clientId}','#{formId}','#{this:getActionUrl(context)}',#{this:getStopScript(context, component)}, #{this:getFileSizeScript(context, component)} ,'#{this:getProgressBarId(context, component)}', FileUpload.CLASSES, #{this:getLabelMarkup(context, component)}, #{maxCount}, events, #{component.attributes["disabled"]}, #{this:getAcceptedTypes(context, component)}, {'autoclear':#{component.attributes["autoclear"]},'autoUpload':#{component.attributes["immediateUpload"]},'noDuplicate':#{component.attributes["noDuplicate"]}, 'allowFlash':'#{allowFlash}', 'flashComponentUrl':'#{flashComponent}'},#{this:_getLabels(labels)},#{this:getChildrenParams(context, component)},'#{this:getSessionId(context, component)}');
+ new FileUpload('#{clientId}','#{formId}','#{this:getActionUrl(context)}',#{this:getActionScript(context, component)},'#{this:getProgressBarId(context, component)}', FileUpload.CLASSES, #{this:getLabelMarkup(context, component)}, #{maxCount}, events, #{component.attributes["disabled"]}, #{this:getAcceptedTypes(context, component)}, {'autoclear':#{component.attributes["autoclear"]},'autoUpload':#{component.attributes["immediateUpload"]},'noDuplicate':#{component.attributes["noDuplicate"]}, 'allowFlash':'#{allowFlash}', 'flashComponentUrl':'#{flashComponent}'},#{this:_getLabels(labels)},#{this:getChildrenParams(context, component)},'#{this:getSessionId(context, component)}');
</script>
</span>
<f:call name="utils.encodeEndFormIfNessesary" />
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -233,7 +233,7 @@
event = HTML.onselect_ATTRIBUTE;
}
}
- scriptValue.append(AjaxRendererUtils.buildOnEvent(menuItem, context, event).toString());
+ scriptValue.append(AjaxRendererUtils.buildOnEvent(menuItem, context, event, true).toString());
menuItem.getAttributes().put(HTML.onselect_ATTRIBUTE, null);
} else if (MenuComponent.MODE_SERVER.equalsIgnoreCase(mode)) {
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -501,7 +501,7 @@
JSFunction function = AjaxRendererUtils.buildAjaxFunction(child,
context);
Map eventOptions = AjaxRendererUtils.buildEventOptions(context,
- child);
+ child, true);
function.addParameter(eventOptions);
buffer.append(",\"");
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -260,8 +260,6 @@
this, component);
StringBuffer script = new StringBuffer();
String clientId = component.getClientId(context);
- String containerId = ((UIComponent) AjaxRendererUtils
- .findAjaxContainer(context, component)).getClientId(context);
String mode = (String) component.getAttributes().get("mode");
UIComponent form = AjaxRendererUtils.getNestingForm(component);
String formId = "";
@@ -279,7 +277,6 @@
StringBuffer markup = getMarkup(context, component);
script.append("new ProgressBar('").append(clientId).append("','") // id
- .append(containerId).append("','") // containerId
.append(formId).append("','") // formId
.append(mode).append("',") // mode
.append(minValue).append(",") // min value
@@ -317,7 +314,7 @@
*/
private Map buildAjaxOptions(String clientId, UIProgressBar progressBar,
FacesContext context) {
- Map options = AjaxRendererUtils.buildEventOptions(context, progressBar);
+ Map options = AjaxRendererUtils.buildEventOptions(context, progressBar, true);
Integer interval = new Integer(progressBar.getInterval());
options.put("pollId", clientId);
options.put("pollinterval", interval);
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js 2012-02-20 21:07:13 UTC (rev 23190)
@@ -1,10 +1,9 @@
ProgressBar = {};
ProgressBar = Class.create();
Object.extend(ProgressBar.prototype, {
- initialize: function(id, containerId, formId, mode, minValue, maxValue, context, markup, options, progressVar, state, value) {
+ initialize: function(id, formId, mode, minValue, maxValue, context, markup, options, progressVar, state, value) {
this.id = id;
- this.containerId = containerId;
if (formId != '') {
this.formId = formId;
}else {
@@ -76,7 +75,7 @@
},
poll: function () {
- A4J.AJAX.Poll(this.containerId, this.formId, this.options);
+ A4J.AJAX.Poll(this.formId, this.options);
},
interpolate: function (placeholders) {
for(var k in this.context) {
@@ -255,6 +254,6 @@
if (oncomplete) {
options['oncomplete'] = oncomplete;
}
- A4J.AJAX.SubmitRequest(this.containerId, this.formId, null, options);
+ A4J.AJAX.SubmitRequest(this.formId, null, options);
}
});
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -628,7 +628,7 @@
public String getRowsAjaxUpdate(FacesContext context, UIScrollableDataTable grid){
JSFunction function = AjaxRendererUtils.buildAjaxFunction(grid, context);
- Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, grid);
+ Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, grid, true);
options.put("oncomplete", AjaxFunctionBuilder.getOnComplete(context, grid, AjaxFunctionBuilder.SCROLL));
@SuppressWarnings("unchecked")
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableOptions.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableOptions.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableOptions.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -75,7 +75,7 @@
JSReference sortStartRow = new JSReference("event.startRow");
JSReference sortIndex = new JSReference("event.index");
- Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, grid);
+ Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, grid, true);
@SuppressWarnings("unchecked")
Map<String, Object> parametersMap = (Map)options.get("parameters");
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -152,7 +152,7 @@
onClick.append(";");
JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(tgComp, context);
- ajaxFunction.addParameter(AjaxRendererUtils.buildEventOptions(context, tgComp));
+ ajaxFunction.addParameter(AjaxRendererUtils.buildEventOptions(context, tgComp, true));
ajaxFunction.appendScript(onClick);
if (tgComp instanceof AjaxSupport) {
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -396,7 +396,7 @@
submitSuggest.addParameter(targetId);
submitSuggest.addParameter(component.getClientId(context));
submitSuggest.addParameter(component.getAttributes().get("onsubmit"));
- Map options = AjaxRendererUtils.buildEventOptions(context, component);
+ Map options = AjaxRendererUtils.buildEventOptions(context, component, true);
options.put("popup", component.getClientId(context));
for (int i = 0; i < OPTIONS.length; i++) {
String option = OPTIONS[i];
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2012-02-20 21:07:13 UTC (rev 23190)
@@ -994,7 +994,7 @@
return;
}
- A4J.AJAX.Submit(this.containerId, this.actionUrl, event, this.options);
+ A4J.AJAX.Submit(this.actionUrl, event, this.options);
},
onComplete: function(request, event, data) {
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/tabPanel/src/main/java/org/richfaces/component/UITabPanel.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/tabPanel/src/main/java/org/richfaces/component/UITabPanel.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/tabPanel/src/main/java/org/richfaces/component/UITabPanel.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -52,7 +52,7 @@
protected Iterator getSwitchedFacetsAndChildren() {
- final Object renderedValue = this.restoredRenderedValue;
+ final Object renderedValue = null != this.restoredRenderedValue?this.restoredRenderedValue:getRenderedValue();
return new IteratorChain(new FilterIterator(getRenderedTabs(), new Predicate() {
@@ -167,8 +167,8 @@
Object[] states = (Object[]) state;
super.restoreState(context, states[0]);
this.renderedValue = states[1];
- //TODO remove that
- this.restoredRenderedValue = getRenderedValue();
+ // https://jira.jboss.org/jira/browse/RF-7353 - getRenderedValue() can call wrong bean instance.
+ this.restoredRenderedValue = this.renderedValue;//getRenderedValue();
}
private static final Predicate RENDERED_TAB_PREDICATE = new Predicate() {
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabHeaderRendererBase.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabHeaderRendererBase.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabHeaderRendererBase.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -133,7 +133,7 @@
JSFunction function = AjaxRendererUtils.buildAjaxFunction(tab,
context);
Map eventOptions = AjaxRendererUtils.buildEventOptions(context,
- tab);
+ tab, true);
function.addParameter(eventOptions);
StringBuffer buffer = new StringBuffer();
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -113,7 +113,7 @@
} else if(UITogglePanel.AJAX_METHOD.equals(switchType)) {
// Ajax
if ( !getUtils().isBooleanAttribute(component,"disabled")) {
- return AjaxRendererUtils.buildOnClick(component, context).toString();
+ return AjaxRendererUtils.buildOnClick(component, context, true).toString();
} else {
return "return false;";
}
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -155,7 +155,7 @@
public Map<String, Object> buildEventOptions(FacesContext context,
UIComponent component, String targetId) {
Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(
- context, component);
+ context, component, true);
String jsVarName = "_toolTip";
// after element is subsituted in DOM tree, we have to re-create
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -96,7 +96,7 @@
JSFunction function = AjaxRendererUtils.buildAjaxFunction(nodeFacet,
context);
Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(context,
- nodeFacet);
+ nodeFacet, true);
Map<Object, Object> parameters = (Map<Object, Object>) eventOptions.get("parameters");
parameters.remove(id);
Modified: branches/enterprise/3.3.1.SP3_BZ-795490/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
--- branches/enterprise/3.3.1.SP3_BZ-795490/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2012-02-20 17:20:05 UTC (rev 23189)
+++ branches/enterprise/3.3.1.SP3_BZ-795490/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2012-02-20 21:07:13 UTC (rev 23190)
@@ -560,7 +560,7 @@
String id = tree.getBaseClientId(context);
JSFunction function = AjaxRendererUtils
.buildAjaxFunction(tree, context);
- Map eventOptions = AjaxRendererUtils.buildEventOptions(context, tree);
+ Map eventOptions = AjaxRendererUtils.buildEventOptions(context, tree, true);
Map parameters = (Map) eventOptions.get("parameters");
parameters.remove(id);
parameters.put(id + UITree.SELECTED_NODE_PARAMETER_NAME,
12 years, 8 months