You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gm...@apache.org on 2007/02/08 16:17:39 UTC
svn commit: r504927 - in /myfaces/tomahawk/trunk/sandbox/core/src/main:
java/org/apache/myfaces/custom/ppr/
resources/org/apache/myfaces/custom/ppr/resource/ tld/
Author: gmuellan
Date: Thu Feb 8 07:17:38 2007
New Revision: 504927
URL: http://svn.apache.org/viewvc?view=rev&rev=504927
Log:
added new attribute "stateUpdate" to ppr
Modified:
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupTag.java
myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js
myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java?view=diff&rev=504927&r1=504926&r2=504927
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java Thu Feb 8 07:17:38 2007
@@ -41,6 +41,7 @@
private String _inlineLoadingMessage;
private Boolean _showDebugMessages = new Boolean(false);
+ private Boolean _stateUpdate = new Boolean(true);
public PPRPanelGroup()
{
@@ -115,6 +116,22 @@
_showDebugMessages = showDebugMessages;
}
+
+ public Boolean getStateUpdate()
+ {
+ if (_stateUpdate != null)
+ {
+ return _stateUpdate;
+ }
+ ValueBinding vb = getValueBinding("stateUpdate");
+ return vb != null ? (Boolean) vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setStateUpdate(Boolean stateUpdate)
+ {
+ _stateUpdate = stateUpdate;
+ }
+
public void restoreState(FacesContext context, Object state)
{
@@ -124,17 +141,19 @@
_partialTriggerPattern = (String) values[2];
_periodicalUpdate = (Integer) values[3];
_showDebugMessages = (Boolean) values[4];
+ _stateUpdate = (Boolean) values[5];
}
public Object saveState(FacesContext context)
{
- Object[] values = new Object[5];
+ Object[] values = new Object[6];
values[0] = super.saveState(context);
values[1] = _partialTriggers;
values[2] = _partialTriggerPattern;
values[3] = _periodicalUpdate;
values[4] = _showDebugMessages;
+ values[5] = _stateUpdate;
return values;
}
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java?view=diff&rev=504927&r1=504926&r2=504927
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java Thu Feb 8 07:17:38 2007
@@ -99,7 +99,8 @@
Boolean.TRUE);
script.append(pprCtrlReference + "=" +
- MY_FACES_PPR_INIT_CODE + "('" + fi.getFormName() + "',"+ pprGroup.getShowDebugMessages().booleanValue()+");\n");
+ MY_FACES_PPR_INIT_CODE + "('" + fi.getFormName() + "',"+ pprGroup.getShowDebugMessages().booleanValue()
+ + ","+ pprGroup.getStateUpdate().booleanValue()+");\n");
if (pprGroup.getPeriodicalUpdate() != null)
{
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupTag.java?view=diff&rev=504927&r1=504926&r2=504927
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupTag.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupTag.java Thu Feb 8 07:17:38 2007
@@ -37,6 +37,8 @@
private String _showDebugMessages;
+ private String _stateUpdate;
+
public String getComponentType()
{
return PPRPanelGroup.COMPONENT_TYPE;
@@ -53,6 +55,7 @@
_partialTriggers = null;
_periodicalUpdate = null;
_showDebugMessages = null;
+ _stateUpdate = null;
}
protected void setProperties(UIComponent component)
@@ -64,6 +67,7 @@
setStringProperty(component, "inlineLoadingMessage", _inlineLoadingMessage);
setIntegerProperty(component,"periodicalUpdate", _periodicalUpdate);
setBooleanProperty(component, "showDebugMessages", _showDebugMessages);
+ setBooleanProperty(component, "stateUpdate", _stateUpdate);
}
public String getPartialTriggers()
@@ -97,9 +101,13 @@
_periodicalUpdate = periodicalUpdate;
}
-
public void setShowDebugMessages(String showDebugMessages)
{
_showDebugMessages = showDebugMessages;
+ }
+
+ public void setStateUpdate(String stateUpdate)
+ {
+ _stateUpdate = stateUpdate;
}
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js?view=diff&rev=504927&r1=504926&r2=504927
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js Thu Feb 8 07:17:38 2007
@@ -25,10 +25,11 @@
//Define the Partial Page Rendering Controller Class
-org.apache.myfaces.PPRCtrl = function(formId, showDebugMessages)
+org.apache.myfaces.PPRCtrl = function(formId, showDebugMessages, stateUpdate)
{
org.apache.myfaces.PPRCtrl.blockPeriodicalUpdateDuringPost = false;
org.apache.myfaces.PPRCtrl.showDebugMessages = showDebugMessages;
+ org.apache.myfaces.PPRCtrl.stateUpdate = stateUpdate;
if(typeof window.myFacesPartialTriggers == "undefined")
{
@@ -129,34 +130,33 @@
//ensure that new buttons in the ParitalUpdate also have onclick-handlers
this.formNode.myFacesPPRCtrl.addButtonOnClickHandlers();
- var stateElem = data.getElementsByTagName("state")[0];
-
- if(stateElem)
- {
- var stateUpdate = dojo.dom.firstElement(stateElem,'INPUT');
-
- if(stateUpdate)
- {
- var stateUpdateId = stateUpdate.getAttribute('id');
-
- if(stateUpdateId =='javax.faces.ViewState')
- {
- var formArray = document.forms;
-
- for(var i=0; i<formArray.length; i++)
- {
- var form = formArray[i];
- var domElement = form.elements['javax.faces.ViewState'];
- if(domElement)
- domElement.value = stateUpdate.getAttribute('value');
- }
- }
- else if (stateUpdateId !='jsf_tree' && org.apache.myfaces.PPRCtrl.showDebugMessages)
- alert("server didn't return appropriate element for state-update. returned element-id: "+
- stateUpdate.getAttribute('id')+", value : "+stateUpdate.getAttribute('value'));
- }
- }
- }
+ if (org.apache.myfaces.PPRCtrl.stateUpdate)
+ {
+ var stateElem = data.getElementsByTagName("state")[0];
+ var stateUpdate = dojo.dom.firstElement(stateElem, 'INPUT');
+
+ if (stateUpdate)
+ {
+ var stateUpdateId = stateUpdate.getAttribute('id');
+
+ if (stateUpdateId == 'javax.faces.ViewState')
+ {
+ var formArray = document.forms;
+
+ for (var i = 0; i < formArray.length; i++)
+ {
+ var form = formArray[i];
+ var domElement = form.elements['javax.faces.ViewState'];
+ if (domElement)
+ domElement.value = stateUpdate.getAttribute('value');
+ }
+ }
+ else if (stateUpdateId != 'jsf_tree' && org.apache.myfaces.PPRCtrl.showDebugMessages)
+ alert("server didn't return appropriate element for state-update. returned element-id: " +
+ stateUpdate.getAttribute('id') + ", value : " + stateUpdate.getAttribute('value'));
+ }
+ }
+ }
else if(org.apache.myfaces.PPRCtrl.showDebugMessages)
{
alert("an Error occured during the ajax-request " + data.message);
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld?view=diff&rev=504927&r1=504926&r2=504927
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld Thu Feb 8 07:17:38 2007
@@ -159,7 +159,7 @@
Enhanced standard JSP actions and custom MyFaces actions.
</description>
-
+
<tag>
<name>loadBundle</name>
<tag-class>org.apache.myfaces.custom.loadbundle.LoadBundleTag</tag-class>
@@ -1285,6 +1285,15 @@
<description>If false, alert messages which can be fired after a ppr response are not displayed in the browser.
May switched to true in test environments. Default: false
+ </description>
+ </attribute>
+ <attribute>
+ <name>stateUpdate</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <type>java.lang.Boolean</type>
+ <description>If set to false, there will be no stateUpdate on server side due to the partialPage refresh.
+ Default: true
</description>
</attribute>
</tag>