myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1751669 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/component/ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/ tobago-example/tobago-example-demo/src/main/webapp/content/30-concep...
Date Wed, 06 Jul 2016 12:20:51 GMT
Author: lofwyr
Date: Wed Jul  6 12:20:51 2016
New Revision: 1751669

URL: http://svn.apache.org/viewvc?rev=1751669&view=rev
Log:
TOBAGO 1565: Specification for "collapsible" for Popup, Box, Section, ...
- if case of a ValueExpression for the collapsible attribute: write the state with a setter.

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICollapsiblePanel.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/collapsible-popup.xhtml
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRendererBase.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java?rev=1751669&r1=1751668&r2=1751669&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
Wed Jul  6 12:20:51 2016
@@ -55,6 +55,8 @@ public enum Attributes {
   borderTop,
   charset,
   clientProperties,
+  collapsed,
+  collapsedMode,
   columnSpan,
   columnSpacing,
   columns,

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICollapsiblePanel.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICollapsiblePanel.java?rev=1751669&r1=1751668&r2=1751669&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICollapsiblePanel.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICollapsiblePanel.java
Wed Jul  6 12:20:51 2016
@@ -19,11 +19,13 @@
 
 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 javax.el.ValueExpression;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 
@@ -31,7 +33,7 @@ public abstract class AbstractUICollapsi
 
   private static final Logger LOG = LoggerFactory.getLogger(AbstractUICollapsiblePanel.class);
 
-  private transient Boolean nextState;
+  private transient Boolean submittedCollapsed;
 
   @Override
   public void processDecodes(final FacesContext facesContext) {
@@ -80,14 +82,19 @@ public abstract class AbstractUICollapsi
 
   public abstract CollapseMode getCollapsedMode();
 
-  public void setNextState(Boolean nextState) {
-    this.nextState = nextState;
+  public void setSubmittedCollapsed(Boolean submittedCollapsed) {
+    this.submittedCollapsed = submittedCollapsed;
   }
 
   public void processState() {
-    if (nextState != null) {
-      setCollapsed(nextState);
-      nextState = null;
+    if (submittedCollapsed != null) {
+      final ValueExpression valueExpression = getValueExpression(Attributes.collapsed.name());
+      if (valueExpression != null) {
+        valueExpression.setValue(FacesContext.getCurrentInstance().getELContext(), submittedCollapsed);
+      } else {
+        setCollapsed(submittedCollapsed);
+      }
+      submittedCollapsed = null;
     }
   }
 }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/collapsible-popup.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/collapsible-popup.xhtml?rev=1751669&r1=1751668&r2=1751669&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/collapsible-popup.xhtml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/collapsible-popup.xhtml
Wed Jul  6 12:20:51 2016
@@ -34,7 +34,6 @@
       </tc:button>
     </tc:buttons>
 
-    <!--<tc:popup id="popup" collapsed="hidden">-->
     <tc:popup id="popup" collapsed="#{collapsibleController.collapsed}">
       <tc:box label="Test for Popup">
         Hallo, collapsible popup.
@@ -50,6 +49,7 @@
           <tc:button label="Submit and Close" action="#{collapsibleController.action}">
             <tc:operation name="hide" for="popup"/>
           </tc:button>
+          <tc:button label="Submit and Keep Open" action="#{collapsibleController.action}"/>
         </tc:buttons>
       </tc:box>
     </tc:popup>

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRendererBase.java?rev=1751669&r1=1751668&r2=1751669&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRendererBase.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRendererBase.java
Wed Jul  6 12:20:51 2016
@@ -35,26 +35,28 @@ import java.util.Map;
 
 public class PanelRendererBase extends RendererBase {
 
+  private static final String SUFFIX_COLLAPSE = "collapse";
+
   @Override
   public void decode(final FacesContext facesContext, final UIComponent component) {
     super.decode(facesContext, component);
 
     final AbstractUICollapsiblePanel collapsible = (AbstractUICollapsiblePanel) component;
     final String clientId = collapsible.getClientId(facesContext);
-    final String hiddenId = clientId + ComponentUtils.SUB_SEPARATOR + "collapse";
+    final String hiddenId = clientId + ComponentUtils.SUB_SEPARATOR + SUFFIX_COLLAPSE;
 
     final Map<String, String> requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
     if (requestParameterMap.containsKey(hiddenId)) {
       final String newValue = requestParameterMap.get(hiddenId);
       if (StringUtils.isNotBlank(newValue)) {
-        collapsible.setNextState(Boolean.valueOf(newValue));
+        collapsible.setSubmittedCollapsed(Boolean.valueOf(newValue));
       }
     }
   }
 
   protected void encodeHidden(final TobagoResponseWriter writer, final String clientId, final
boolean collapsed)
       throws IOException {
-    final String hiddenId = clientId + ComponentUtils.SUB_SEPARATOR + "collapse";
+    final String hiddenId = clientId + ComponentUtils.SUB_SEPARATOR + SUFFIX_COLLAPSE;
     writer.startElement(HtmlElements.INPUT);
     writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN);
     writer.writeNameAttribute(hiddenId);



Mime
View raw message