myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1750640 [1/2] - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/component/ tobago-core/src/main/java/org/apache/myfaces/tobago/event/ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/ tob...
Date Wed, 29 Jun 2016 13:58:19 GMT
Author: lofwyr
Date: Wed Jun 29 13:58:18 2016
New Revision: 1750640

URL: http://svn.apache.org/viewvc?rev=1750640&view=rev
Log:
TOBAGO-1565: Specification for "collapsible" for Popup, Box, Section, ...
* implemented for Box, Section and Panel

Added:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/CollapsibleActionEvent.java
      - copied, changed from r1748577, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageActionEvent.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/CollapsibleActionListener.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICollapsiblePanel.java
      - copied, changed from r1746463, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBox.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIOperation.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanel.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java
      - copied, changed from r1750609, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanel.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/OperationTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/CollapseState.java
    myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/CollapseStateUnitTest.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CollapsibleController.java
      - copied, changed from r1747992, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Collapsible.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/00-collapsible-box/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.xhtml
      - copied, changed from r1747992, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/collapsible.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/
    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-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/20-collapsible-panel/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/20-collapsible-panel/collapsible-panel.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/30-collapsible-section/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/30-collapsible-section/collapsible-section.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/collapsible.xhtml
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Collapse.java
      - copied, changed from r1746463, myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Popup.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/OperationRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRendererBase.java
Removed:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Collapsible.java
Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBar.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBox.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIButtons.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommands.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIMediator.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISection.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITab.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PanelTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SectionTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsCollapsible.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/AjaxClientBehaviorRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/JsonUtils.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BoxRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SectionRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/html/JsonUtilsUnitTest.java
    myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component.stg

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java Wed Jun 29 13:58:18 2016
@@ -58,6 +58,7 @@ public enum RendererTypes {
   MenuCommand,
   MenuSeparator,
   Object,
+  Operation,
   Out,
   Page,
   Panel,
@@ -128,6 +129,7 @@ public enum RendererTypes {
   public static final String MENU_COMMAND = "MenuCommand";
   public static final String MENU_SEPARATOR = "MenuSeparator";
   public static final String OBJECT = "Object";
+  public static final String OPERATION = "Operation";
   public static final String OUT = "Out";
   public static final String PAGE = "Page";
   public static final String PANEL = "Panel";

Copied: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/CollapsibleActionEvent.java (from r1748577, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageActionEvent.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/CollapsibleActionEvent.java?p2=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/CollapsibleActionEvent.java&p1=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageActionEvent.java&r1=1748577&r2=1750640&rev=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageActionEvent.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/CollapsibleActionEvent.java Wed Jun 29 13:58:18 2016
@@ -20,39 +20,30 @@
 package org.apache.myfaces.tobago.event;
 
 
-import javax.faces.event.ActionEvent;
+import org.apache.myfaces.tobago.model.CollapseState;
+
 import javax.faces.component.UIComponent;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.PhaseId;
 
 
-public class PageActionEvent extends ActionEvent {
+public class CollapsibleActionEvent extends ActionEvent {
 
-  private static final long serialVersionUID = 3364193750247386220L;
+  private static final long serialVersionUID = 1L;
 
-  private PageAction action;
-  private int value;
+  private CollapseState newState;
 
-  public PageActionEvent(final UIComponent component, final PageAction action) {
+  public CollapsibleActionEvent(final UIComponent component, final CollapseState newState) {
     super(component);
-    this.action = action;
+    this.newState = newState;
+    setPhaseId(PhaseId.INVOKE_APPLICATION);
   }
 
-  /**
-   * Returns the action type ({@link PageAction}).
-   */
-  public PageAction getAction() {
-    return action;
+  public CollapseState getNewState() {
+    return newState;
   }
 
-  public void setValue(final int value) {
-    this.value = value;
+  public void setNewState(CollapseState newState) {
+    this.newState = newState;
   }
-
-  /**
-   * Returns the value for action types {@link PageAction#TO_ROW}
-   * and {@link PageAction#TO_PAGE}.
-   */
-  public int getValue() {
-    return value;
-  }
-
 }

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/CollapsibleActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/CollapsibleActionListener.java?rev=1750640&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/CollapsibleActionListener.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/CollapsibleActionListener.java Wed Jun 29 13:58:18 2016
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.event;
+
+import org.apache.myfaces.tobago.internal.component.AbstractUICollapsiblePanel;
+import org.apache.myfaces.tobago.util.ComponentUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+
+public class CollapsibleActionListener implements ActionListener {
+
+  private static final Logger LOG = LoggerFactory.getLogger(CollapsibleActionListener.class);
+
+  private UIComponent component;
+  private String forId;
+
+  public CollapsibleActionListener(final UIComponent component, final String forId) {
+    this.component = component;
+    this.forId = forId;
+  }
+
+  @Override
+  public void processAction(final ActionEvent actionEvent) throws AbortProcessingException {
+    final FacesContext facesContext = FacesContext.getCurrentInstance();
+    final UIViewRoot viewRoot = facesContext.getViewRoot();
+    if (viewRoot != null) {
+      final String forClientId = ComponentUtils.evaluateClientId(facesContext, component, forId);
+
+      final UIComponent component = viewRoot.findComponent(forClientId);
+      if (component instanceof AbstractUICollapsiblePanel) {
+        ((AbstractUICollapsiblePanel) component).processState();
+      } else {
+        LOG.error("Wrong component class for id: '{}'. Type is {} but expected type is {}",
+            forClientId, component.getClass().getName(), AbstractUICollapsiblePanel.class.getName());
+      }
+    }
+  }
+}

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBar.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBar.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBar.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBar.java Wed Jun 29 13:58:18 2016
@@ -19,7 +19,7 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
-public abstract class AbstractUIBar extends AbstractUIPanel {
+public abstract class AbstractUIBar extends AbstractUIPanelBase {
 
 
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBox.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBox.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBox.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBox.java Wed Jun 29 13:58:18 2016
@@ -19,33 +19,7 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
-import javax.faces.context.FacesContext;
-
-public abstract class AbstractUIBox extends AbstractUIPanel {
-
-  @Override
-  public void processDecodes(final FacesContext context) {
-    if (isCollapsed()) {
-      decode(context);
-    } else {
-      super.processDecodes(context);
-    }
-  }
-
-  @Override
-  public void processValidators(final FacesContext context) {
-    if (!isCollapsed()) {
-      super.processValidators(context);
-    }
-  }
-
-  @Override
-  public void processUpdates(final FacesContext context) {
-    if (!isCollapsed()) {
-      super.processUpdates(context);
-    }
-  }
-
-  public abstract boolean isCollapsed();
+public abstract class AbstractUIBox extends AbstractUICollapsiblePanel {
 
+  public abstract String getLabel();
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIButtons.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIButtons.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIButtons.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIButtons.java Wed Jun 29 13:58:18 2016
@@ -19,5 +19,5 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
-public abstract class AbstractUIButtons extends AbstractUIPanel {
+public abstract class AbstractUIButtons extends AbstractUIPanelBase {
 }

Copied: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICollapsiblePanel.java (from r1746463, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBox.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICollapsiblePanel.java?p2=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICollapsiblePanel.java&p1=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBox.java&r1=1746463&r2=1750640&rev=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIBox.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICollapsiblePanel.java Wed Jun 29 13:58:18 2016
@@ -19,33 +19,77 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
+import org.apache.myfaces.tobago.component.Facets;
+import org.apache.myfaces.tobago.model.CollapseState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 
-public abstract class AbstractUIBox extends AbstractUIPanel {
+public abstract class AbstractUICollapsiblePanel extends AbstractUIPanelBase {
+
+  private static final Logger LOG = LoggerFactory.getLogger(AbstractUICollapsiblePanel.class);
+
+  private volatile CollapseState nextState;
 
   @Override
-  public void processDecodes(final FacesContext context) {
-    if (isCollapsed()) {
-      decode(context);
+  public void processDecodes(final FacesContext facesContext) {
+    if (isNormalLifecycle()) {
+      super.processDecodes(facesContext);
     } else {
-      super.processDecodes(context);
+      decode(facesContext);
+      final UIComponent bar = getFacet(Facets.BAR); // XXX is from Box or Section
+      if (bar != null) {
+        bar.processDecodes(facesContext);
+      }
     }
   }
 
   @Override
-  public void processValidators(final FacesContext context) {
-    if (!isCollapsed()) {
-      super.processValidators(context);
+  public void processValidators(final FacesContext facesContext) {
+    if (isNormalLifecycle()) {
+      super.processValidators(facesContext);
+    } else {
+      final UIComponent bar = getFacet(Facets.BAR); // XXX is from Box or Section
+      if (bar != null) {
+        bar.processValidators(facesContext);
+      }
     }
   }
 
   @Override
-  public void processUpdates(final FacesContext context) {
-    if (!isCollapsed()) {
-      super.processUpdates(context);
+  public void processUpdates(final FacesContext facesContext) {
+    if (isNormalLifecycle()) {
+      super.processUpdates(facesContext);
+    } else {
+      final UIComponent bar = getFacet(Facets.BAR); // XXX is from Box or Section
+      if (bar != null) {
+        bar.processUpdates(facesContext);
+      }
     }
   }
 
-  public abstract boolean isCollapsed();
+  private boolean isNormalLifecycle() {
+    return !getCollapsed().isSkipLifecycle();
+  }
+
+  public abstract CollapseState getCollapsed();
 
+  public abstract void setCollapsed(final CollapseState collapsed);
+
+  public CollapseState getNextState() {
+    return nextState;
+  }
+
+  public void setNextState(CollapseState nextState) {
+    this.nextState = nextState;
+  }
+
+  public void processState() {
+    if (nextState != null) {
+      setCollapsed(nextState);
+      nextState = null;
+    }
+  }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java Wed Jun 29 13:58:18 2016
@@ -24,6 +24,7 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.SupportsAccessKey;
 import org.apache.myfaces.tobago.component.SupportsRenderedPartially;
 import org.apache.myfaces.tobago.component.Visual;
+import org.apache.myfaces.tobago.event.CollapsibleActionListener;
 import org.apache.myfaces.tobago.event.PopupFacetActionListener;
 import org.apache.myfaces.tobago.internal.util.AuthorizationHelper;
 import org.apache.myfaces.tobago.util.ComponentUtils;
@@ -41,6 +42,7 @@ import javax.faces.event.PhaseId;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
 
 public abstract class AbstractUICommand
     extends UICommand
@@ -66,6 +68,10 @@ public abstract class AbstractUICommand
         addActionListener(new PopupFacetActionListener());
       }
     }
+    final List<AbstractUIOperation> list = ComponentUtils.findDescendantList(this, AbstractUIOperation.class);
+    for (AbstractUIOperation operation : list) {
+      addActionListener(new CollapsibleActionListener(this, operation.getFor()));
+    }
   }
 
   @Override

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommands.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommands.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommands.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommands.java Wed Jun 29 13:58:18 2016
@@ -19,5 +19,5 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
-public abstract class AbstractUICommands extends AbstractUIPanel {
+public abstract class AbstractUICommands extends AbstractUIPanelBase {
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIMediator.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIMediator.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIMediator.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIMediator.java Wed Jun 29 13:58:18 2016
@@ -28,7 +28,7 @@ import javax.faces.event.FacesEvent;
 import java.io.IOException;
 import java.util.Map;
 
-public abstract class AbstractUIMediator extends AbstractUIPanel {
+public abstract class AbstractUIMediator extends AbstractUIPanelBase {
 
   private static final Logger LOG = LoggerFactory.getLogger(AbstractUIMediator.class);
 

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIOperation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIOperation.java?rev=1750640&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIOperation.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIOperation.java Wed Jun 29 13:58:18 2016
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.internal.component;
+
+import javax.faces.component.UIComponentBase;
+
+public abstract class AbstractUIOperation extends UIComponentBase {
+
+  public abstract String getName();
+
+  public abstract String getFor();
+}

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanel.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanel.java?rev=1750640&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanel.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanel.java Wed Jun 29 13:58:18 2016
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.internal.component;
+
+public abstract class AbstractUIPanel extends AbstractUICollapsiblePanel {
+}

Copied: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java (from r1750609, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanel.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java?p2=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java&p1=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanel.java&r1=1750609&r2=1750640&rev=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanel.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java Wed Jun 29 13:58:18 2016
@@ -27,7 +27,7 @@ import javax.faces.component.UIComponent
 import javax.faces.context.FacesContext;
 import java.io.IOException;
 
-public abstract class AbstractUIPanel extends javax.faces.component.UIPanel
+public abstract class AbstractUIPanelBase extends javax.faces.component.UIPanel
     implements OnComponentPopulated, Visual {
 
   @Override

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java Wed Jun 29 13:58:18 2016
@@ -33,7 +33,7 @@ import javax.faces.context.FacesContext;
 import java.io.IOException;
 import java.util.Iterator;
 
-public abstract class AbstractUIPopup extends AbstractUIPanel
+public abstract class AbstractUIPopup extends AbstractUIPanelBase
     implements NamingContainer, Visual {
 
   private boolean activated;

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISection.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISection.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISection.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISection.java Wed Jun 29 13:58:18 2016
@@ -20,18 +20,16 @@
 package org.apache.myfaces.tobago.internal.component;
 
 import org.apache.myfaces.tobago.component.Facets;
-import org.apache.myfaces.tobago.component.Visual;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
 import javax.faces.component.UIOutput;
 import javax.faces.context.FacesContext;
 import java.io.IOException;
 
-public abstract class AbstractUISection extends UIComponentBase implements Visual {
+public abstract class AbstractUISection extends AbstractUICollapsiblePanel {
 
   private static final Logger LOG = LoggerFactory.getLogger(AbstractUISection.class);
 
@@ -51,6 +49,8 @@ public abstract class AbstractUISection
 
   public abstract String getLabel();
 
+  public abstract String getImage();
+
   @Override
   public void encodeBegin(FacesContext context) throws IOException {
 

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITab.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITab.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITab.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITab.java Wed Jun 29 13:58:18 2016
@@ -19,7 +19,7 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
-public abstract class AbstractUITab extends AbstractUIPanel {
+public abstract class AbstractUITab extends AbstractUIPanelBase {
 
   public abstract String getLabel();
 

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java Wed Jun 29 13:58:18 2016
@@ -47,7 +47,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-public abstract class AbstractUITabGroup extends AbstractUIPanel
+public abstract class AbstractUITabGroup extends AbstractUIPanelBase
     implements TabChangeSource2, ActionSource2, OnComponentPopulated, SupportsRenderedPartially, Visual {
 
   private static final Logger LOG = LoggerFactory.getLogger(AbstractUITabGroup.class);

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/OperationTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/OperationTagDeclaration.java?rev=1750640&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/OperationTagDeclaration.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/OperationTagDeclaration.java Wed Jun 29 13:58:18 2016
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.internal.taglib.component;
+
+import org.apache.myfaces.tobago.apt.annotation.Tag;
+import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+import org.apache.myfaces.tobago.component.RendererTypes;
+
+/**
+ * An operation describes an Tobago command, which will usually executed on client side.
+ */
+@Tag(name = "operation")
+@UIComponentTag(
+    uiComponent = "org.apache.myfaces.tobago.component.UIOperation",
+    uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUIOperation",
+    componentFamily = "org.apache.myfaces.tobago.Operation",
+    rendererType = RendererTypes.OPERATION,
+    allowedChildComponenents = "NONE")
+public interface OperationTagDeclaration {
+
+  /**
+   * Name of the operation to be executed.
+   */
+  @TagAttribute()
+  @UIComponentTagAttribute()
+  void setName(String name);
+
+  /**
+   * The id of the component the operation is related to.
+   */
+  @TagAttribute()
+  @UIComponentTagAttribute()
+  void setFor(String forAttribute);
+
+}

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PanelTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PanelTagDeclaration.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PanelTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PanelTagDeclaration.java Wed Jun 29 13:58:18 2016
@@ -26,6 +26,7 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasTip;
+import org.apache.myfaces.tobago.internal.taglib.declaration.IsCollapsible;
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsVisual;
 
 import javax.faces.component.UIPanel;
@@ -48,5 +49,5 @@ import javax.faces.component.UIPanel;
         @Facet(name = Facets.LAYOUT, description = "Deprecated. Contains an layout manager. "
             + "The layout manager tag should surround the content instead.")})
 public interface PanelTagDeclaration
-    extends HasIdBindingAndRendered, IsVisual, HasTip {
+    extends HasIdBindingAndRendered, IsVisual, IsCollapsible, HasTip {
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SectionTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SectionTagDeclaration.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SectionTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SectionTagDeclaration.java Wed Jun 29 13:58:18 2016
@@ -27,6 +27,8 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasImage;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasLabel;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasTip;
+import org.apache.myfaces.tobago.internal.taglib.declaration.IsCollapsible;
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsVisual;
 
 /**
@@ -36,7 +38,7 @@ import org.apache.myfaces.tobago.interna
 @UIComponentTag(
     uiComponent = "org.apache.myfaces.tobago.component.UISection",
     uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUISection",
-    uiComponentFacesClass = "javax.faces.component.UIComponentBase",
+    uiComponentFacesClass = "javax.faces.component.UIPanel",
     componentFamily = "org.apache.myfaces.tobago.Section",
     rendererType = RendererTypes.SECTION,
     facets = {
@@ -44,5 +46,6 @@ import org.apache.myfaces.tobago.interna
             description = "This facet contains a UILabel",
             allowedChildComponenents = "org.apache.myfaces.tobago.Label")})
 
-public interface SectionTagDeclaration extends HasIdBindingAndRendered, HasLabel, IsVisual, HasImage {
+public interface SectionTagDeclaration
+    extends HasIdBindingAndRendered, HasLabel, IsVisual, HasImage, IsCollapsible, HasTip {
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsCollapsible.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsCollapsible.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsCollapsible.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsCollapsible.java Wed Jun 29 13:58:18 2016
@@ -21,12 +21,17 @@ package org.apache.myfaces.tobago.intern
 
 import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+import org.apache.myfaces.tobago.model.CollapseState;
 
 public interface IsCollapsible {
+
   /**
-   * Flag indicating whether or not this component is collapsed.
+   * Enum indicating the collapsed state of this component.
    */
   @TagAttribute
-  @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
-  void setCollapsed(String rendered);
+  @UIComponentTagAttribute(
+      type = "org.apache.myfaces.tobago.model.CollapseState",
+      defaultValue = CollapseState.VISIBLE,
+      defaultCode = "org.apache.myfaces.tobago.model.CollapseState.visible")
+  void setCollapsed(String collapsed);
 }

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/CollapseState.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/CollapseState.java?rev=1750640&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/CollapseState.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/CollapseState.java Wed Jun 29 13:58:18 2016
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.model;
+
+public enum CollapseState {
+
+  visible,
+  hidden,
+  absent;
+
+  public static final String VISIBLE = "visible";
+  public static final String HIDDEN = "hidden";
+  public static final String ABSENT = "absent";
+
+  public boolean isSkipLifecycle() {
+    return this == absent;
+  }
+
+}

Added: myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/CollapseStateUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/CollapseStateUnitTest.java?rev=1750640&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/CollapseStateUnitTest.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/model/CollapseStateUnitTest.java Wed Jun 29 13:58:18 2016
@@ -0,0 +1,13 @@
+package org.apache.myfaces.tobago.model;
+
+import org.apache.myfaces.tobago.util.EnumUnitTest;
+import org.junit.Test;
+
+public class CollapseStateUnitTest extends EnumUnitTest {
+
+  @Test
+  public void testNames() throws IllegalAccessException, NoSuchFieldException {
+    testNames(CollapseState.class);
+  }
+
+}

Copied: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CollapsibleController.java (from r1747992, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Collapsible.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CollapsibleController.java?p2=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CollapsibleController.java&p1=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Collapsible.java&r1=1747992&r2=1750640&rev=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Collapsible.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CollapsibleController.java Wed Jun 29 13:58:18 2016
@@ -28,45 +28,57 @@ import java.io.Serializable;
 
 @SessionScoped
 @Named
-public class Collapsible implements Serializable {
+public class CollapsibleController implements Serializable {
 
-  private static final Logger LOG = LoggerFactory.getLogger(Collapsible.class);
+  private static final Logger LOG = LoggerFactory.getLogger(CollapsibleController.class);
 
-  private boolean collapsed1;
-  private boolean collapsed2;
+/* TODO
+  private CollapseState collapsed1;
+  private CollapseState collapsed2;
 
-  public Collapsible() {
+  public CollapsibleController() {
   }
 
   public String toggle1() {
-    collapsed1 = !collapsed1;
+    collapsed1 = collapsed1 == CollapseState.visible ? CollapseState.hidden : CollapseState.visible; // todo: define toggle in the "enum".
 
-    LOG.info("collapsed1={}", collapsed1);
+    LOG.info("new value of collapsed1={}", collapsed1);
 
     return null;
   }
 
   public String toggle2() {
-    collapsed2 = !collapsed2;
+    collapsed2 = collapsed2 == CollapseState.visible ? CollapseState.hidden : CollapseState.visible; // todo: define toggle in the "enum".
 
-    LOG.info("collapsed2={}", collapsed2);
+    LOG.info("new value of collapsed2={}", collapsed2);
 
     return null;
   }
 
-  public boolean isCollapsed1() {
+  public String action() {
+    LOG.info("action(): collapsed2={}", collapsed2);
+    return null;
+  }
+
+  public String cancel() {
+    LOG.info("cancel(): collapsed2={}", collapsed2);
+    return null;
+  }
+
+  public CollapseState getCollapsed1() {
     return collapsed1;
   }
 
-  public void setCollapsed1(boolean collapsed1) {
+  public void setCollapsed1(CollapseState collapsed1) {
     this.collapsed1 = collapsed1;
   }
 
-  public boolean isCollapsed2() {
+  public CollapseState getCollapsed2() {
     return collapsed2;
   }
 
-  public void setCollapsed2(boolean collapsed2) {
+  public void setCollapsed2(CollapseState collapsed2) {
     this.collapsed2 = collapsed2;
   }
+*/
 }

Copied: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.xhtml (from r1747992, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/collapsible.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.xhtml?p2=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.xhtml&p1=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/collapsible.xhtml&r1=1747992&r2=1750640&rev=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/collapsible.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/00-collapsible-box/collapsible-box.xhtml Wed Jun 29 13:58:18 2016
@@ -23,41 +23,85 @@
                 xmlns:f="http://java.sun.com/jsf/core">
   <ui:param name="title" value="Container"/>
 
-    <tc:section label="Collapsible with the box collapsed attribute">
+  <tc:section label="Collapsible box without server request" id="section1">
 
-      <tc:segmentLayout medium="12" id="collapsible">
-        <tc:button action="#{collapsible.toggle1}" label="Toggle" immediate="true" renderedPartially="collapsible"/>
-        <tc:box label="Collapsible" collapsed="#{collapsible.collapsed1}">
-          Hallo, collapsible box.
-          <tc:in required="true" label="Required"/>
-        </tc:box>
-        <tc:out value="Requests: #{activityList.values[0].jsfRequest} / AJAX: #{activityList.values[0].ajaxRequest}"/>
-      </tc:segmentLayout>
-
-    </tc:section>
-
-    <tc:section label="Collapsible with the rendered attribute">
-
-      <tc:segmentLayout medium="12" id="collapsible2">
-        <tc:box label="Collapsible">
-          <f:facet name="toolBar">
-            <tc:toolBar>
-              <tc:toolBarCommand action="#{collapsible.toggle2}" label="Toggle" immediate="true" renderedPartially="collapsible2"/>
-            </tc:toolBar>
-          </f:facet>
-          <tc:panel rendered="#{!collapsible.collapsed2}">
-            Hallo, collapsible box.
-            <tc:in required="true" label="Required"/>
-          </tc:panel>
-        </tc:box>
-        <tc:out value="Requests: #{activityList.values[0].jsfRequest} / AJAX: #{activityList.values[0].ajaxRequest}"/>
-      </tc:segmentLayout>
-
-    </tc:section>
-
-    <tc:flowLayout>
-      <tc:style textAlign="right"/>
-      <tc:button label="Submit"/>
-    </tc:flowLayout>
+    Here we have the transitions <code>show</code> and <code>hide</code> and there is no server request needed.
+    The buttons have set <code>omit="true"</code>.
+
+    <tc:box label="Collapsible box (Client only)" id="box1">
+      <f:facet name="bar">
+        <tc:buttons>
+          <tc:button label="show" omit="true" id="show1">
+            <tc:operation name="show" for="box1"/>
+          </tc:button>
+          <tc:button label="hide" omit="true" id="hide1">
+            <tc:operation name="hide" for="box1"/>
+          </tc:button>
+        </tc:buttons>
+      </f:facet>
+      <tc:panel>
+        Hallo, collapsible box.
+        <tc:in required="true" label="Required"/>
+      </tc:panel>
+    </tc:box>
+
+  </tc:section>
+
+  <tc:section label="Collapsible section with AJAX server request" id="section2">
+
+    Here we have the transitions <code>show</code> and <code>drop</code> and there is no server request needed.
+    The buttons have set <code>omit="false"</code> which is the default.
+
+    <tc:box label="Collapsible box (AJAX)" id="box2">
+      <f:facet name="bar">
+        <tc:buttons>
+          <tc:button label="show" id="show2">
+            <f:ajax execute="box2" render="box2"/>
+            <tc:operation name="show" for="box2"/>
+          </tc:button>
+          <tc:button label="drop" id="drop2">
+            <f:ajax execute="box2" render="box2"/>
+            <tc:operation name="drop" for="box2"/>
+          </tc:button>
+        </tc:buttons>
+      </f:facet>
+      <tc:panel>
+        Hallo, collapsible box.
+        <tc:in required="true" label="Required"/>
+      </tc:panel>
+    </tc:box>
+
+  </tc:section>
+
+  <tc:section label="Collapsible section with full server request" id="section3">
+
+    Here we have the transitions <code>show</code> and <code>drop</code> and there is no server request needed.
+    The buttons have set <code>omit="false"</code> which is the default.
+
+    <tc:box label="Collapsible box (full request)" id="box3">
+      <f:facet name="bar">
+        <tc:buttons>
+          <tc:button label="show" id="show3">
+            <tc:operation name="show" for="box3"/>
+          </tc:button>
+          <tc:button label="drop" id="drop3">
+            <tc:operation name="drop" for="box3"/>
+          </tc:button>
+        </tc:buttons>
+      </f:facet>
+      <tc:panel>
+        Hallo, collapsible box.
+        <tc:in required="true" label="Required"/>
+      </tc:panel>
+    </tc:box>
+
+  </tc:section>
+
+  <tc:out value="Requests: #{activityList.values[0].jsfRequest} / AJAX: #{activityList.values[0].ajaxRequest}"/>
+
+  <tc:flowLayout>
+    <tc:style textAlign="right"/>
+    <tc:button label="Submit"/>
+  </tc:flowLayout>
 
 </ui:composition>

Added: 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=1750640&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/collapsible-popup.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/10-collapsible-popup/collapsible-popup.xhtml Wed Jun 29 13:58:18 2016
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<ui:composition template="/plain.xhtml"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="http://java.sun.com/jsf/facelets"
+                xmlns:f="http://java.sun.com/jsf/core">
+  <ui:param name="title" value="Container"/>
+
+  <tc:form>
+    <h1>Currently this is not a popup, but should work the same manner!</h1>
+
+    <tc:button label="Open">
+      <tc:operation name="show" for="popup"/>
+    </tc:button>
+
+    <tc:box label="Test for Popup" id="popup" collapsed="#{collapsibleController.collapsed2}">
+      Hallo, collapsible popup.
+      <tc:in required="true" label="Required"/>
+      <tc:button label="Cancel and Close (immediate)" immediate="true" action="#{collapsibleController.cancel}">
+        <tc:operation name="drop" for="popup"/>
+      </tc:button>
+      <tc:button label="Submit and Close" action="#{collapsibleController.action}">
+        <tc:operation name="drop" for="popup"/>
+      </tc:button>
+    </tc:box>
+
+    <tc:out value="Requests: #{activityList.values[0].jsfRequest} / AJAX: #{activityList.values[0].ajaxRequest}"/>
+    <tc:selectBooleanCheckbox readonly="true" value="true" label="A" itemLabel="B"/>
+    <tc:out value="#{collapsibleController.collapsed2}" label="collapsed2"/>
+
+    <tc:flowLayout>
+      <tc:style textAlign="right"/>
+      <tc:button label="Submit"/>
+    </tc:flowLayout>
+  </tc:form>
+
+</ui:composition>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/20-collapsible-panel/collapsible-panel.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/20-collapsible-panel/collapsible-panel.xhtml?rev=1750640&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/20-collapsible-panel/collapsible-panel.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/20-collapsible-panel/collapsible-panel.xhtml Wed Jun 29 13:58:18 2016
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<ui:composition template="/main.xhtml"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="http://java.sun.com/jsf/facelets"
+                xmlns:f="http://java.sun.com/jsf/core">
+  <ui:param name="title" value="Container"/>
+
+  <tc:separator label="Collapsible panel without server request"/>
+  <tc:buttons>
+    <tc:button label="show" omit="true" id="show1">
+      <tc:operation name="show" for="panel1"/>
+    </tc:button>
+    <tc:button label="hide" omit="true" id="hide1">
+      <tc:operation name="hide" for="panel1"/>
+    </tc:button>
+  </tc:buttons>
+  <tc:panel id="panel1">
+
+    Here we have the transitions <code>show</code> and <code>hide</code> and there is no server request needed.
+    The buttons have set <code>omit="true"</code>.
+
+    <tc:panel>
+      Hallo, collapsible panel.
+      <tc:in required="true" label="Required"/>
+    </tc:panel>
+
+  </tc:panel>
+
+  <tc:separator label="Collapsible panel with AJAX server request"/>
+  <tc:buttons>
+    <tc:button label="show" id="show2">
+      <f:ajax execute="panel2" render="panel2"/>
+      <tc:operation name="show" for="panel2"/>
+    </tc:button>
+    <tc:button label="drop" id="drop2">
+      <f:ajax execute="panel2" render="panel2"/>
+      <tc:operation name="drop" for="panel2"/>
+    </tc:button>
+  </tc:buttons>
+  <tc:panel id="panel2">
+
+    Here we have the transitions <code>show</code> and <code>drop</code> and there is no server request needed.
+    The buttons have set <code>omit="false"</code> which is the default.
+
+    <tc:panel>
+      Hallo, collapsible panel.
+      <tc:in required="true" label="Required"/>
+    </tc:panel>
+
+  </tc:panel>
+
+  <tc:separator label="Collapsible panel with full server request"/>
+  <tc:buttons>
+    <tc:button label="show" id="show3">
+      <tc:operation name="show" for="panel3"/>
+    </tc:button>
+    <tc:button label="drop" id="drop3">
+      <tc:operation name="drop" for="panel3"/>
+    </tc:button>
+  </tc:buttons>
+  <tc:panel id="panel3">
+
+    Here we have the transitions <code>show</code> and <code>drop</code> and there is no server request needed.
+    The buttons have set <code>omit="false"</code> which is the default.
+
+    <tc:panel>
+      Hallo, collapsible panel.
+      <tc:in required="true" label="Required"/>
+    </tc:panel>
+
+  </tc:panel>
+
+  <tc:out value="Requests: #{activityList.values[0].jsfRequest} / AJAX: #{activityList.values[0].ajaxRequest}"/>
+
+  <tc:flowLayout>
+    <tc:style textAlign="right"/>
+    <tc:button label="Submit"/>
+  </tc:flowLayout>
+
+</ui:composition>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/30-collapsible-section/collapsible-section.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/30-collapsible-section/collapsible-section.xhtml?rev=1750640&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/30-collapsible-section/collapsible-section.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/30-collapsible-section/collapsible-section.xhtml Wed Jun 29 13:58:18 2016
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<ui:composition template="/main.xhtml"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="http://java.sun.com/jsf/facelets"
+                xmlns:f="http://java.sun.com/jsf/core">
+  <ui:param name="title" value="Container"/>
+
+  <tc:section label="Collapsible section without server request" id="section1">
+
+    <f:facet name="bar">
+      <tc:buttons>
+        <tc:button label="show" omit="true" id="show1">
+          <tc:operation name="show" for="section1"/>
+        </tc:button>
+        <tc:button label="hide" omit="true" id="hide1">
+          <tc:operation name="hide" for="section1"/>
+        </tc:button>
+      </tc:buttons>
+    </f:facet>
+
+    Here we have the transitions <code>show</code> and <code>hide</code> and there is no server request needed.
+    The buttons have set <code>omit="true"</code>.
+
+    <tc:panel>
+      Hallo, collapsible section.
+      <tc:in required="true" label="Required"/>
+    </tc:panel>
+
+  </tc:section>
+
+  <tc:section label="Collapsible section with AJAX server request" id="section2">
+
+    <f:facet name="bar">
+      <tc:buttons>
+        <tc:button label="show" id="show2">
+          <f:ajax execute="section2" render="section2"/>
+          <tc:operation name="show" for="section2"/>
+        </tc:button>
+        <tc:button label="drop" id="drop2">
+          <f:ajax execute="section2" render="section2"/>
+          <tc:operation name="drop" for="section2"/>
+        </tc:button>
+      </tc:buttons>
+    </f:facet>
+
+    Here we have the transitions <code>show</code> and <code>drop</code> and there is no server request needed.
+    The buttons have set <code>omit="false"</code> which is the default.
+
+    <tc:panel>
+      Hallo, collapsible section.
+      <tc:in required="true" label="Required"/>
+    </tc:panel>
+
+  </tc:section>
+
+  <tc:section label="Collapsible section with full server request" id="section3">
+
+    <f:facet name="bar">
+      <tc:buttons>
+        <tc:button label="show" id="show3">
+          <tc:operation name="show" for="section3"/>
+        </tc:button>
+        <tc:button label="drop" id="drop3">
+          <tc:operation name="drop" for="section3"/>
+        </tc:button>
+      </tc:buttons>
+    </f:facet>
+
+    Here we have the transitions <code>show</code> and <code>drop</code> and there is no server request needed.
+    The buttons have set <code>omit="false"</code> which is the default.
+
+    <tc:panel>
+      Hallo, collapsible section.
+      <tc:in required="true" label="Required"/>
+    </tc:panel>
+
+  </tc:section>
+
+  <tc:out value="Requests: #{activityList.values[0].jsfRequest} / AJAX: #{activityList.values[0].ajaxRequest}"/>
+
+  <tc:flowLayout>
+    <tc:style textAlign="right"/>
+    <tc:button label="Submit"/>
+  </tc:flowLayout>
+
+</ui:composition>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/collapsible.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/collapsible.xhtml?rev=1750640&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/collapsible.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/collapsible.xhtml Wed Jun 29 13:58:18 2016
@@ -0,0 +1,30 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<ui:composition template="/main.xhtml"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="http://java.sun.com/jsf/facelets"
+                xmlns:f="http://java.sun.com/jsf/core">
+  <ui:param name="title" value="Collapsible"/>
+
+  <tc:section label="TODO: description of the concept">
+
+    <tc:link link="https://issues.apache.org/jira/browse/TOBAGO-1565" label="See in Jira"/>
+
+  </tc:section>
+
+</ui:composition>

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java Wed Jun 29 13:58:18 2016
@@ -42,6 +42,7 @@ public enum TobagoClass implements CssIt
   REQUIRED("required"),
 
   BOX__HEADER("tobago-box-header"),
+  COLLAPSED("tobago-collapsed"),
   FLEX_LAYOUT("tobago-flexLayout"),
   LABEL("tobago-label"),
   MENU_BAR("tobago-menuBar"),
@@ -51,6 +52,7 @@ public enum TobagoClass implements CssIt
   PANEL("tobago-panel"),
   POPUP("tobago-popup"),
   SECTION__HEADER("tobago-section-header"),
+  SECTION__CONTENT("tobago-section-content"),
   SHEET__PAGING_INPUT("tobago-sheet-pagingInput"),
   SHEET__PAGING_OUTPUT("tobago-sheet-pagingOutput"),
   SHEET__CELL__MARKUP__RIGHT("tobago-sheet-cell-markup-right"),

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/AjaxClientBehaviorRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/AjaxClientBehaviorRenderer.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/AjaxClientBehaviorRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/AjaxClientBehaviorRenderer.java Wed Jun 29 13:58:18 2016
@@ -20,6 +20,7 @@
 package org.apache.myfaces.tobago.renderkit.html;
 
 import org.apache.myfaces.tobago.internal.component.AbstractUICommand;
+import org.apache.myfaces.tobago.internal.component.AbstractUIOperation;
 import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 
@@ -34,6 +35,7 @@ import javax.faces.event.AjaxBehaviorEve
 import javax.faces.event.PhaseId;
 import javax.faces.render.ClientBehaviorRenderer;
 import java.util.Collection;
+import java.util.List;
 
 public class AjaxClientBehaviorRenderer extends ClientBehaviorRenderer {
 
@@ -46,6 +48,9 @@ public class AjaxClientBehaviorRenderer
     final Collection<String> render = ajaxBehavior.getRender();
     final UIComponent uiComponent = behaviorContext.getComponent();
 
+    //// TBD: is this nice? May be implemented with a JSF behaviour?
+    final Collapse collapse = createCollapsible(facesContext, uiComponent);
+
     if (uiComponent instanceof AbstractUICommand) {
       final AbstractUICommand component = (AbstractUICommand) uiComponent;
 
@@ -60,6 +65,7 @@ public class AjaxClientBehaviorRenderer
           null, // getConfirmation(command), // todo
           null,
           Popup.createPopup(component),
+          collapse,
           component.isOmit());
 
       final CommandMap map = new CommandMap();
@@ -78,6 +84,7 @@ public class AjaxClientBehaviorRenderer
           null,
           null,
           null,
+          collapse,
           null);
 
       final CommandMap map = new CommandMap();
@@ -116,4 +123,24 @@ public class AjaxClientBehaviorRenderer
     }
     return false;
   }
+
+  public static Collapse createCollapsible(FacesContext facesContext, UIComponent component) {
+    //// TBD: is this nice? May be implemented with a JSF behaviour?
+    //// BEGIN
+
+    // XXX too complicated
+    final List<AbstractUIOperation> operations =
+        ComponentUtils.findDescendantList(component, AbstractUIOperation.class);
+    Collapse collapse = null;
+    if (operations.size() > 0) {
+      final AbstractUIOperation operation = operations.get(0);
+      final String forId = ComponentUtils.evaluateClientId(facesContext, component, operation.getFor());
+      collapse = new Collapse(Collapse.Action.valueOf(operation.getName()), forId);
+    }
+
+    //// TBD: is this nice?
+    //// END
+    return collapse;
+  }
+
 }

Copied: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Collapse.java (from r1746463, myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Popup.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Collapse.java?p2=myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Collapse.java&p1=myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Popup.java&r1=1746463&r2=1750640&rev=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Popup.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Collapse.java Wed Jun 29 13:58:18 2016
@@ -19,53 +19,25 @@
 
 package org.apache.myfaces.tobago.renderkit.html;
 
-import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.internal.component.AbstractUICommand;
-import org.apache.myfaces.tobago.util.ComponentUtils;
-
-public class Popup {
-
-  /**
-   * Can be "open" or "close"
-   */
-  private String command;
-
-  /**
-   * true for close immediately, false for close after submit
-   */
-  private Boolean immediate;
-
-  private Popup(final String command, final Boolean immediate) {
-    this.command = command;
-    this.immediate = immediate;
+public class Collapse {
+
+  private Action action;
+  private String forId;
+
+  public Collapse(Action action, String forId) {
+    this.action = action;
+    this.forId = forId;
   }
 
-  public static Popup createPopup(final AbstractUICommand component) {
-    String command = null;
-    Boolean immediate = null;
-
-    final String popupClose = ComponentUtils.getStringAttribute(component, Attributes.popupClose);
-    if (popupClose != null) {
-      command = "close";
-      immediate = popupClose.equals("immediate");
-    } else {
-      final boolean popupAction = ComponentUtils.containsPopupActionListener(component);
-      if (popupAction) {
-        command = "open";
-      }
-    }
-    if (command != null) {
-      return new Popup(command, immediate);
-    } else {
-      return null;
-    }
+  public Action getAction() {
+    return action;
   }
 
-  public String getCommand() {
-    return command;
+  public String getFor() {
+    return forId;
   }
 
-  public Boolean isImmediate() {
-    return immediate;
+  public enum Action {
+    show, hide, drop
   }
 }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java Wed Jun 29 13:58:18 2016
@@ -51,7 +51,9 @@ public class Command {
   private String focus;
   private String confirmation;
   private Integer delay;
+  @Deprecated
   private Popup popup;
+  private Collapse collapse;
   private Boolean omit;
 
   public Command() {
@@ -59,8 +61,8 @@ public class Command {
 
   public Command(
       final String action, final Boolean transition, final String target, final String url, final String execute,
-      final String render, final String focus, final String confirmation, final Integer delay, final Popup popup,
-      final Boolean omit) {
+      final String render, final String focus, final String confirmation, final Integer delay,
+      @Deprecated final Popup popup, final Collapse collapse, final Boolean omit) {
     this.action = action;
     this.transition = transition;
     this.target = target;
@@ -71,6 +73,7 @@ public class Command {
     this.confirmation = confirmation;
     this.delay = delay;
     this.popup = popup;
+    this.collapse = collapse;
     this.omit = omit;
   }
 
@@ -80,7 +83,8 @@ public class Command {
   @Deprecated
   public Command(
       final String action, final Boolean transition, final String target, final String url, final String partially,
-      final String focus, final String confirmation, final Integer delay, final Popup popup, final Boolean omit) {
+      final String focus, final String confirmation, final Integer delay, final Popup popup, final Collapse collapse,
+      final Boolean omit) {
     this.action = action;
     this.transition = transition;
     this.target = target;
@@ -90,6 +94,7 @@ public class Command {
     this.confirmation = confirmation;
     this.delay = delay;
     this.popup = popup;
+    this.collapse = collapse;
     this.omit = omit;
   }
 
@@ -104,6 +109,7 @@ public class Command {
         getConfirmation(command),
         null,
         Popup.createPopup(command),
+        AjaxClientBehaviorRenderer.createCollapsible(facesContext, command),
         command.isOmit());
   }
 
@@ -118,6 +124,7 @@ public class Command {
         getConfirmation(command),
         null,
         Popup.createPopup(command),
+        AjaxClientBehaviorRenderer.createCollapsible(facesContext, command),
         command.isOmit());
   }
 
@@ -262,6 +269,14 @@ public class Command {
     this.popup = popup;
   }
 
+  public Collapse getCollapse() {
+    return collapse;
+  }
+
+  public void setCollapse(Collapse collapse) {
+    this.collapse = collapse;
+  }
+
   public Boolean getOmit() {
     return omit;
   }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/JsonUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/JsonUtils.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/JsonUtils.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/JsonUtils.java Wed Jun 29 13:58:18 2016
@@ -161,6 +161,10 @@ public class JsonUtils {
     if (render != null) {
       encode(builder, "render", render);
     }
+    final Collapse collapse = command.getCollapse();
+    if (collapse != null) {
+      encode(builder, "collapse", collapse);
+    }
     final String focus = command.getFocus();
     if (focus != null) {
       encode(builder, "focus", focus);
@@ -206,6 +210,28 @@ public class JsonUtils {
     }
     if (builder.length() - initialLength > 0) {
       assert builder.charAt(builder.length() - 1) == ',';
+      builder.deleteCharAt(builder.length() - 1);
+    }
+
+    builder.append("},");
+  }
+
+  static void encode(final StringBuilder builder, final String name, final Collapse collapse) {
+    builder.append("\"");
+    builder.append(name);
+    builder.append("\":{");
+    final int initialLength = builder.length();
+
+    final Collapse.Action action = collapse.getAction();
+    if (action != null) {
+      encode(builder, "transition", action.name());
+    }
+    final String forId = collapse.getFor();
+    if (forId != null) {
+      encode(builder, "forId", forId);
+    }
+    if (builder.length() - initialLength > 0) {
+      assert builder.charAt(builder.length() - 1) == ',';
       builder.deleteCharAt(builder.length() - 1);
     }
 

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BoxRenderer.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/BoxRenderer.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BoxRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BoxRenderer.java Wed Jun 29 13:58:18 2016
@@ -19,10 +19,10 @@
 package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
 
 import org.apache.myfaces.tobago.component.Facets;
-import org.apache.myfaces.tobago.component.UIBox;
 import org.apache.myfaces.tobago.component.UIMenuBar;
+import org.apache.myfaces.tobago.internal.component.AbstractUIBox;
 import org.apache.myfaces.tobago.internal.util.Deprecation;
-import org.apache.myfaces.tobago.renderkit.RendererBase;
+import org.apache.myfaces.tobago.model.CollapseState;
 import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
 import org.apache.myfaces.tobago.renderkit.css.Classes;
 import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
@@ -32,22 +32,18 @@ import org.apache.myfaces.tobago.renderk
 import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIPanel;
 import javax.faces.context.FacesContext;
 import java.io.IOException;
 
-public class BoxRenderer extends RendererBase {
-
-  private static final Logger LOG = LoggerFactory.getLogger(BoxRenderer.class);
+public class BoxRenderer extends PanelRendererBase {
 
   @Override
   public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws IOException {
 
-    final UIBox box = (UIBox) component;
+    final AbstractUIBox box = (AbstractUIBox) component;
     final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
 
     final UIComponent label = ComponentUtils.getFacet(box, Facets.label);
@@ -56,8 +52,14 @@ public class BoxRenderer extends Rendere
     final UIComponent bar = ComponentUtils.getFacet(box, Facets.bar);
 
     writer.startElement(HtmlElements.DIV);
-    writer.writeClassAttribute(Classes.create(box), BootstrapClass.CARD, box.getCustomClass());
-    writer.writeIdAttribute(box.getClientId(facesContext));
+    final CollapseState collapsed = box.getCollapsed();
+    writer.writeClassAttribute(
+        Classes.create(box),
+        collapsed == CollapseState.visible ? null : TobagoClass.COLLAPSED,
+        BootstrapClass.CARD,
+        box.getCustomClass());
+    final String clientId = box.getClientId(facesContext);
+    writer.writeIdAttribute(clientId);
     final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, box);
     if (title != null) {
       writer.writeAttribute(HtmlAttributes.TITLE, title, true);
@@ -65,6 +67,8 @@ public class BoxRenderer extends Rendere
     HtmlRendererUtils.writeDataAttributes(facesContext, writer, box);
     writer.writeStyleAttribute(box.getStyle());
 
+    encodeHidden(writer, clientId);
+
     if (label != null || labelString != null || bar != null || toolbar != null) {
       writer.startElement(HtmlElements.DIV);
       writer.writeClassAttribute(BootstrapClass.CARD_HEADER);
@@ -103,19 +107,6 @@ public class BoxRenderer extends Rendere
   }
 
   @Override
-  public boolean getRendersChildren() {
-    return true;
-  }
-
-  @Override
-  public void encodeChildren(final FacesContext facesContext, final UIComponent component) throws IOException {
-    if (component instanceof UIBox && ((UIBox) component).isCollapsed()) {
-      return;
-    }
-    super.encodeChildren(facesContext, component);
-  }
-
-  @Override
   public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
     final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
     writer.endElement(HtmlElements.DIV);

Added: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/OperationRenderer.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/OperationRenderer.java?rev=1750640&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/OperationRenderer.java (added)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/OperationRenderer.java Wed Jun 29 13:58:18 2016
@@ -0,0 +1,8 @@
+package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
+
+import org.apache.myfaces.tobago.renderkit.RendererBase;
+
+public class OperationRenderer extends RendererBase {
+
+  // no needed
+}

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRenderer.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/PanelRenderer.java?rev=1750640&r1=1750639&r2=1750640&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRenderer.java Wed Jun 29 13:58:18 2016
@@ -23,13 +23,13 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.UIPanel;
 import org.apache.myfaces.tobago.component.UIReload;
 import org.apache.myfaces.tobago.internal.util.FacesContextUtils;
-import org.apache.myfaces.tobago.renderkit.RendererBase;
+import org.apache.myfaces.tobago.model.CollapseState;
 import org.apache.myfaces.tobago.renderkit.css.Classes;
+import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
 import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
-import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 
@@ -37,31 +37,22 @@ import javax.faces.component.UIComponent
 import javax.faces.context.FacesContext;
 import java.io.IOException;
 
-public class PanelRenderer extends RendererBase {
-
-  @Override
-  public boolean getRendersChildren() {
-    return true;
-  }
-
-  @Override
-  public void encodeChildren(final FacesContext facesContext, final UIComponent component) throws IOException {
-    final UIPanel panel = (UIPanel) component;
-    for (final UIComponent child : panel.getChildren()) {
-      RenderUtils.encode(facesContext, child);
-    }
-  }
+public class PanelRenderer extends PanelRendererBase {
 
   @Override
   public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws IOException {
 
     final UIPanel panel = (UIPanel) component;
     final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
-
     final String clientId = panel.getClientId(facesContext);
+    final CollapseState collapsed = panel.getCollapsed();
+
     writer.startElement(HtmlElements.DIV);
     writer.writeIdAttribute(clientId);
-    writer.writeClassAttribute(Classes.create(panel), panel.getCustomClass());
+    writer.writeClassAttribute(
+        Classes.create(panel),
+        panel.getCustomClass(),
+        collapsed == CollapseState.visible ? null : TobagoClass.COLLAPSED);
     writer.writeStyleAttribute(panel.getStyle());
 
     HtmlRendererUtils.writeDataAttributes(facesContext, writer, panel);
@@ -79,6 +70,8 @@ public class PanelRenderer extends Rende
     }
     HtmlRendererUtils.renderCommandFacet(panel, facesContext, writer);
     HtmlRendererUtils.encodeContextMenu(facesContext, writer, panel);
+
+    encodeHidden(writer, clientId);
   }
 
   @Override




Mime
View raw message