You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2024/06/10 12:28:02 UTC

(myfaces-tobago) branch tobago-5.x updated: fix: tc:popup throws PropertyNotWriteableException support readonly attribute for collapsed attribute issue: TOBAGO-2320

This is an automated email from the ASF dual-hosted git repository.

bommel pushed a commit to branch tobago-5.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/tobago-5.x by this push:
     new a0215d1fb6 fix: tc:popup throws PropertyNotWriteableException support readonly attribute for collapsed attribute issue: TOBAGO-2320
a0215d1fb6 is described below

commit a0215d1fb6c366de0344b1cf545c2a29a23c0af0
Author: Bernd Bohmann <bo...@apache.org>
AuthorDate: Thu Jun 6 16:57:38 2024 +0200

    fix: tc:popup throws PropertyNotWriteableException
    support readonly attribute for collapsed attribute
    issue: TOBAGO-2320
    
    (cherry picked from commit 64f629ceef2a4976efd222b62b28d84afe65658c)
---
 .../internal/component/AbstractUICollapsiblePanel.java    | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICollapsiblePanel.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICollapsiblePanel.java
index 7ef3a52d19..13ef8f5641 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICollapsiblePanel.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICollapsiblePanel.java
@@ -22,7 +22,12 @@ package org.apache.myfaces.tobago.internal.component;
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.model.CollapseMode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
+import java.lang.invoke.MethodHandles;
+
+import javax.el.ELContext;
 import javax.el.ValueExpression;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -34,6 +39,8 @@ public abstract class AbstractUICollapsiblePanel extends AbstractUIPanelBase {
 
   private transient Boolean submittedCollapsed;
 
+  private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
   @Override
   public void processDecodes(final FacesContext facesContext) {
     if (isNormalLifecycle()) {
@@ -105,7 +112,13 @@ public abstract class AbstractUICollapsiblePanel extends AbstractUIPanelBase {
     if (submittedCollapsed != null) {
       final ValueExpression valueExpression = getValueExpression(Attributes.collapsed.name());
       if (valueExpression != null) {
-        valueExpression.setValue(FacesContext.getCurrentInstance().getELContext(), submittedCollapsed);
+        ELContext elContext = FacesContext.getCurrentInstance().getELContext();
+        if (!valueExpression.isReadOnly(elContext)) {
+          valueExpression.setValue(elContext, submittedCollapsed);
+        } else {
+          LOG.warn("Component clientId={} ValueExpression of collapsed attribute is readonly. Can not process state.",
+              getClientId(FacesContext.getCurrentInstance()));
+        }
       } else {
         setCollapsed(submittedCollapsed);
       }