You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2016/07/01 17:49:20 UTC
svn commit: r1750989 - in /myfaces/tobago/trunk: src/site/apt/
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/facelets/ tobag...
Author: lofwyr
Date: Fri Jul 1 17:49:19 2016
New Revision: 1750989
URL: http://svn.apache.org/viewvc?rev=1750989&view=rev
Log:
TOBAGO-1565: Specification for "collapsible" for Popup, Box, Section, ...
Removed:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/AbstractPopupActionListener.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PopupActionListener.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PopupFacetActionListener.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/ValueExpressionPopupActionListener.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/PopupReferenceHandler.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupReferenceTagDeclaration.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Popup.java
Modified:
myfaces/tobago/trunk/src/site/apt/migration-3.0.apt
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.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/AbstractUIPopup.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ButtonTagDeclaration.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/CommandTagDeclaration.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LinkTagDeclaration.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupTagDeclaration.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarCommandTagDeclaration.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeCommandTagDeclaration.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CollapsibleController.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/bestpractice/BestPracticeController.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/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/MessagesRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.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/PanelRendererBase.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PopupRenderer.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/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/html/JsonUtilsUnitTest.java
Modified: myfaces/tobago/trunk/src/site/apt/migration-3.0.apt
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/src/site/apt/migration-3.0.apt?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/src/site/apt/migration-3.0.apt (original)
+++ myfaces/tobago/trunk/src/site/apt/migration-3.0.apt Fri Jul 1 17:49:19 2016
@@ -92,6 +92,12 @@ Migration from Tobago 2.0 to 3.0 (work i
* If using <<<org.apache.myfaces.tobago.component.Attributes>>> you may use the enum value instead of the
String contant.
+* Reimplementation of Popup
+
+ * Remove tc:popupReference
+
+ * No longer as "facet"
+
* No longer supported
Because of the changed layout model (no longer on the server, but with browser CSS) there a some
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java Fri Jul 1 17:49:19 2016
@@ -49,6 +49,10 @@ public enum Facets {
pagerPage,
pagerPageDirect,
pagerRow,
+ /**
+ * @deprecated since 3.0.0. Popup can now be placed normally in the code.
+ */
+ @Deprecated
popup,
radio,
reload,
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=1750989&r1=1750988&r2=1750989&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 Fri Jul 1 17:49:19 2016
@@ -19,13 +19,11 @@
package org.apache.myfaces.tobago.internal.component;
-import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.OnComponentPopulated;
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;
import org.slf4j.Logger;
@@ -62,12 +60,7 @@ public abstract class AbstractUICommand
@Override
public void onComponentPopulated(final FacesContext facesContext, final UIComponent parent) {
- final AbstractUIPopup popup = (AbstractUIPopup) ComponentUtils.getFacet(this, Facets.popup);
- if (popup != null) {
- if (!ComponentUtils.containsPopupActionListener(this)) {
- addActionListener(new PopupFacetActionListener());
- }
- }
+
final List<AbstractUIOperation> list = ComponentUtils.findDescendantList(this, AbstractUIOperation.class);
for (AbstractUIOperation operation : list) {
addActionListener(new CollapsibleActionListener(this, operation.getFor()));
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=1750989&r1=1750988&r2=1750989&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 Fri Jul 1 17:49:19 2016
@@ -19,127 +19,8 @@
package org.apache.myfaces.tobago.internal.component;
-import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.component.Visual;
-import org.apache.myfaces.tobago.internal.util.StringUtils;
-import org.apache.myfaces.tobago.util.ComponentUtils;
-
-import javax.el.ValueExpression;
import javax.faces.component.NamingContainer;
-import javax.faces.component.UICommand;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UINamingContainer;
-import javax.faces.context.FacesContext;
-import java.io.IOException;
-import java.util.Iterator;
-
-public abstract class AbstractUIPopup extends AbstractUIPanelBase
- implements NamingContainer, Visual {
-
- private boolean activated;
-
- public void setActivated(final boolean activated) {
- this.activated = activated;
- }
-
- @Override
- public void processDecodes(final FacesContext facesContext) {
- if (isSubmitted()) {
- for (final Iterator it = getFacetsAndChildren(); it.hasNext();) {
- final UIComponent childOrFacet = (UIComponent) it.next();
- childOrFacet.processDecodes(facesContext);
- }
- try {
- decode(facesContext);
- } catch (final RuntimeException e) {
- facesContext.renderResponse();
- throw e;
- }
- if (facesContext.getRenderResponse()) {
- setActivated(true);
- }
- }
- }
-
- @Override
- public boolean isRendered() {
- final ValueExpression expression = getValueExpression("rendered");
- if (expression != null) {
- final FacesContext context = FacesContext.getCurrentInstance();
- return (Boolean) expression.getValue(context.getELContext());
- } else {
- return isActivated() || isRedisplay();
- }
- }
-
- private boolean isSubmitted() {
- final FacesContext facesContext = getFacesContext();
- final String sourceId = facesContext.getExternalContext().getRequestParameterMap().get("javax.faces.source");
- return StringUtils.startsWith(
- sourceId, getClientId(facesContext) + UINamingContainer.getSeparatorChar(facesContext));
- }
-
- private boolean isRedisplay() {
- if (isSubmitted()) {
- final String sourceId = getFacesContext().getExternalContext().getRequestParameterMap().get("javax.faces.source");
- if (sourceId != null) {
- final UIComponent command = getFacesContext().getViewRoot()
- .findComponent(UINamingContainer.getSeparatorChar(getFacesContext()) + sourceId);
- if (command != null && command instanceof UICommand) {
- return ComponentUtils.getAttribute(command, Attributes.popupClose) == null;
- }
- }
- }
- return false;
- }
-
- private boolean isActivated() {
- return activated;
- }
-
-
- @Override
- public void processValidators(final FacesContext context) {
- if (isSubmitted()) {
- for (final Iterator it = getFacetsAndChildren(); it.hasNext();) {
- final UIComponent childOrFacet = (UIComponent) it.next();
- childOrFacet.processValidators(context);
- }
- //TODO: check if validation has failed and reset rendered if needed
- if (context.getRenderResponse()) {
- setActivated(true);
- }
- }
- }
-
- @Override
- public void processUpdates(final FacesContext context) {
- if (isSubmitted()) {
- for (final Iterator it = getFacetsAndChildren(); it.hasNext();) {
- final UIComponent childOrFacet = (UIComponent) it.next();
- childOrFacet.processUpdates(context);
- }
- }
- }
-
- @Override
- public Object saveState(final FacesContext context) {
- final Object[] saveState = new Object[2];
- saveState[0] = super.saveState(context);
- saveState[1] = activated;
- return saveState;
- }
-
- @Override
- public void restoreState(final FacesContext context, final Object savedState) {
- final Object[] values = (Object[]) savedState;
- super.restoreState(context, values[0]);
- activated = (Boolean) values[1];
- }
- @Override
- public void encodeEnd(final FacesContext context) throws IOException {
- super.encodeEnd(context);
- activated = false;
- }
+public abstract class AbstractUIPopup extends AbstractUICollapsiblePanel
+ implements NamingContainer {
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ButtonTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ButtonTagDeclaration.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ButtonTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ButtonTagDeclaration.java Fri Jul 1 17:49:19 2016
@@ -62,9 +62,8 @@ import javax.faces.component.UICommand;
allowedChildComponenents = "NONE",
facets = {
@Facet(name = Facets.CONFIRMATION, description = "Contains a UIOutput instance with the confirmation message.",
- allowedChildComponenents = "org.apache.myfaces.tobago.Out"),
- @Facet(name = Facets.POPUP, description = "Contains a UIPopup instance.",
- allowedChildComponenents = "org.apache.myfaces.tobago.Popup")})
+ allowedChildComponenents = "org.apache.myfaces.tobago.Out")
+ })
public interface ButtonTagDeclaration
extends HasAction, HasActionListener, IsImmediateCommand,
HasLink, HasResource, IsTransition, HasTarget, HasRenderedPartially,
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/CommandTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/CommandTagDeclaration.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/CommandTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/CommandTagDeclaration.java Fri Jul 1 17:49:19 2016
@@ -19,10 +19,8 @@
package org.apache.myfaces.tobago.internal.taglib.component;
-import org.apache.myfaces.tobago.apt.annotation.Facet;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
-import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasAction;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasActionListener;
@@ -51,12 +49,7 @@ import javax.faces.component.UICommand;
uiComponentFacesClass = "javax.faces.component.UICommand",
componentFamily = UICommand.COMPONENT_FAMILY,
rendererType = RendererTypes.COMMAND,
- allowedChildComponenents = "NONE",
- facets = {
- @Facet(
- name = Facets.POPUP,
- description = "Contains a UIPopup instance.",
- allowedChildComponenents = "org.apache.myfaces.tobago.Popup")})
+ allowedChildComponenents = "NONE")
public interface CommandTagDeclaration
extends HasIdBindingAndRendered, HasAction, HasActionListener, IsImmediateCommand,
HasLink, HasResource, IsTransition, HasTarget, HasRenderedPartially, IsDisabledBySecurity,
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LinkTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LinkTagDeclaration.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LinkTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LinkTagDeclaration.java Fri Jul 1 17:49:19 2016
@@ -61,11 +61,7 @@ import javax.faces.component.UICommand;
@Facet(
name = Facets.CONFIRMATION,
description = "Contains a UIOutput instance with the confirmation message.",
- allowedChildComponenents = "org.apache.myfaces.tobago.Out"),
- @Facet(
- name = Facets.POPUP,
- description = "Contains a UIPopup instance.",
- allowedChildComponenents = "org.apache.myfaces.tobago.Popup")})
+ allowedChildComponenents = "org.apache.myfaces.tobago.Out")})
public interface LinkTagDeclaration
extends HasIdBindingAndRendered, HasLabelAndAccessKey, HasAction, HasActionListener, IsImmediateCommand,
HasLink, HasResource, IsTransition, HasTarget, HasRenderedPartially, IsDisabledBySecurity, IsOmit,
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupTagDeclaration.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupTagDeclaration.java Fri Jul 1 17:49:19 2016
@@ -19,46 +19,26 @@
package org.apache.myfaces.tobago.internal.taglib.component;
-import org.apache.myfaces.tobago.apt.annotation.Facet;
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.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
+import org.apache.myfaces.tobago.internal.component.AbstractUIPopup;
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;
-
/**
* Renders a popup panel.
- * The popup gets a grid layout manager with columns="auto" and rows="auto" as definition.
- * So a popup should contain only one layout component.
- * The default layout manager can be overwritten with the layout facet.
*/
@Tag(name = "popup")
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UIPopup",
uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUIPopup",
uiComponentFacesClass = "javax.faces.component.UIPanel",
- componentFamily = UIPanel.COMPONENT_FAMILY,
- rendererType = RendererTypes.POPUP,
- facets = {
- @Facet(name = Facets.LAYOUT, description = "Deprecated. Contains an layout manager. "
- + "The layout manager tag should surround the content instead.")}
+ componentFamily = AbstractUIPopup.COMPONENT_FAMILY,
+ rendererType = RendererTypes.POPUP
)
public interface PopupTagDeclaration
- extends HasIdBindingAndRendered, IsVisual, HasTip {
-
- /**
- * The rest of the page will be faded off for the time the popup is displayed.
- * <br>
- * XXX Currently (since 3.0 branch) non-modal is not supported.
- */
- @TagAttribute
- @UIComponentTagAttribute(type = "boolean", defaultValue = "true")
- void setModal(String modal);
-
+ extends HasIdBindingAndRendered, IsVisual, IsCollapsible, HasTip {
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarCommandTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarCommandTagDeclaration.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarCommandTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarCommandTagDeclaration.java Fri Jul 1 17:49:19 2016
@@ -56,8 +56,6 @@ import javax.faces.component.UICommand;
facets = {
@Facet(name = Facets.CONFIRMATION, description = "Contains a UIOutput instance with the confirmation message.",
allowedChildComponenents = "org.apache.myfaces.tobago.Out"),
- @Facet(name = Facets.POPUP, description = "Contains a UIPopup instance.",
- allowedChildComponenents = "org.apache.myfaces.tobago.Popup"),
@Facet(name = Facets.DROP_DOWN_MENU, description = "Contains a UIMenu instance to render a drop down menu.",
allowedChildComponenents = "org.apache.myfaces.tobago.Menu")
})
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeCommandTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeCommandTagDeclaration.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeCommandTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeCommandTagDeclaration.java Fri Jul 1 17:49:19 2016
@@ -61,11 +61,7 @@ import javax.faces.component.UICommand;
@Facet(
name = Facets.CONFIRMATION,
description = "Contains a UIOutput instance with the confirmation message.",
- allowedChildComponenents = "org.apache.myfaces.tobago.Out"),
- @Facet(
- name = Facets.POPUP,
- description = "Contains a UIPopup instance.",
- allowedChildComponenents = "org.apache.myfaces.tobago.Popup")},
+ allowedChildComponenents = "org.apache.myfaces.tobago.Out")},
rendererType = RendererTypes.TREE_COMMAND)
public interface TreeCommandTagDeclaration
extends HasIdBindingAndRendered, HasAction, HasActionListener, IsImmediateCommand,
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/FacesContextUtils.java Fri Jul 1 17:49:19 2016
@@ -21,7 +21,6 @@ package org.apache.myfaces.tobago.intern
import org.apache.commons.collections.list.SetUniqueList;
import org.apache.commons.collections.set.ListOrderedSet;
-import org.apache.myfaces.tobago.internal.component.AbstractUIPopup;
import javax.faces.context.FacesContext;
import java.util.ArrayList;
@@ -31,12 +30,12 @@ import java.util.Set;
@SuppressWarnings("unchecked")
public final class FacesContextUtils {
+
private static final String TOBAGO_AJAX = "org.apache.myfaces.tobago.ajax";
private static final String TOBAGO_AJAX_COMPONENT_ID = "org.apache.myfaces.tobago.ajaxComponentId";
private static final String TOBAGO_ENCTYPE = "org.apache.myfaces.tobago.enctype";
private static final String TOBAGO_SCRIPT_FILES = "org.apache.myfaces.tobago.scriptFiles";
private static final String TOBAGO_STYLE_FILES = "org.apache.myfaces.tobago.styleFiles";
- private static final String TOBAGO_POPUPS = "org.apache.myfaces.tobago.popups";
private static final String TOBAGO_FOCUS_ID = "org.apache.myfaces.tobago.focusId";
private FacesContextUtils() {
@@ -89,7 +88,6 @@ public final class FacesContextUtils {
context.getAttributes().put(TOBAGO_SCRIPT_FILES, list);
}
list.add(file);
-
}
public static Set<String> getStyleFiles(final FacesContext context) {
@@ -108,21 +106,4 @@ public final class FacesContextUtils {
}
set.add(script);
}
-
- public static Set<AbstractUIPopup> getPopups(final FacesContext context) {
- final Set<AbstractUIPopup> set = (Set<AbstractUIPopup>) context.getAttributes().get(TOBAGO_POPUPS);
- if (set == null) {
- return Collections.emptySet();
- }
- return set;
- }
-
- public static void addPopup(final FacesContext context, final AbstractUIPopup popup) {
- Set<AbstractUIPopup> set = (Set<AbstractUIPopup>) context.getAttributes().get(TOBAGO_POPUPS);
- if (set == null) {
- set = new ListOrderedSet();
- context.getAttributes().put(TOBAGO_POPUPS, set);
- }
- set.add(popup);
- }
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java Fri Jul 1 17:49:19 2016
@@ -24,7 +24,6 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.context.Markup;
import org.apache.myfaces.tobago.context.TransientStateHolder;
-import org.apache.myfaces.tobago.event.AbstractPopupActionListener;
import org.apache.myfaces.tobago.internal.component.AbstractUIForm;
import org.apache.myfaces.tobago.internal.component.AbstractUIInput;
import org.apache.myfaces.tobago.internal.component.AbstractUIPage;
@@ -40,7 +39,6 @@ import javax.el.ValueExpression;
import javax.faces.FactoryFinder;
import javax.faces.application.FacesMessage;
import javax.faces.component.NamingContainer;
-import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.component.UINamingContainer;
@@ -53,7 +51,6 @@ import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import javax.faces.el.ValueBinding;
import javax.faces.event.ActionEvent;
-import javax.faces.event.ActionListener;
import javax.faces.event.ValueChangeEvent;
import javax.faces.render.RenderKit;
import javax.faces.render.RenderKitFactory;
@@ -100,16 +97,6 @@ public final class ComponentUtils {
return true;
}
}
- return false;
- }
-
- public static boolean containsPopupActionListener(final UICommand command) {
- final ActionListener[] actionListeners = command.getActionListeners();
- for (final ActionListener actionListener : actionListeners) {
- if (actionListener instanceof AbstractPopupActionListener) {
- return true;
- }
- }
return false;
}
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml Fri Jul 1 17:49:19 2016
@@ -33,7 +33,7 @@
<arquillian.browser>firefox</arquillian.browser>
<!-- phantomjs works not with CSP (report-only) -->
<!--<arquillian.browser>phantomjs</arquillian.browser>-->
- <selenium.version>2.53.0</selenium.version>
+ <selenium.version>2.53.1</selenium.version>
</properties>
<build>
<finalName>tobago-example-demo</finalName>
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CollapsibleController.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?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CollapsibleController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CollapsibleController.java Fri Jul 1 17:49:19 2016
@@ -19,6 +19,7 @@
package org.apache.myfaces.tobago.example.demo;
+import org.apache.myfaces.tobago.model.CollapseState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -32,55 +33,23 @@ public class CollapsibleController imple
private static final Logger LOG = LoggerFactory.getLogger(CollapsibleController.class);
-/* TODO
- private CollapseState collapsed1;
- private CollapseState collapsed2;
-
- public CollapsibleController() {
- }
-
- public String toggle1() {
- collapsed1 = collapsed1 == CollapseState.visible ? CollapseState.hidden : CollapseState.visible;
- // todo: define toggle in the "enum".
-
- LOG.info("new value of collapsed1={}", collapsed1);
-
- return null;
- }
-
- public String toggle2() {
- collapsed2 = collapsed2 == CollapseState.visible ? CollapseState.hidden : CollapseState.visible;
- // todo: define toggle in the "enum".
-
- LOG.info("new value of collapsed2={}", collapsed2);
-
- return null;
- }
+ private CollapseState collapsed = CollapseState.hidden;
public String action() {
- LOG.info("action(): collapsed2={}", collapsed2);
+ LOG.info("action(): collapsed={}", collapsed);
return null;
}
public String cancel() {
- LOG.info("cancel(): collapsed2={}", collapsed2);
+ LOG.info("cancel(): collapsed={}", collapsed);
return null;
}
- public CollapseState getCollapsed1() {
- return collapsed1;
- }
-
- public void setCollapsed1(CollapseState collapsed1) {
- this.collapsed1 = collapsed1;
- }
-
- public CollapseState getCollapsed2() {
- return collapsed2;
+ public CollapseState getCollapsed() {
+ return collapsed;
}
- public void setCollapsed2(CollapseState collapsed2) {
- this.collapsed2 = collapsed2;
+ public void setCollapsed(CollapseState collapsed) {
+ this.collapsed = collapsed;
}
-*/
}
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/bestpractice/BestPracticeController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/bestpractice/BestPracticeController.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/bestpractice/BestPracticeController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/bestpractice/BestPracticeController.java Fri Jul 1 17:49:19 2016
@@ -56,9 +56,10 @@ public class BestPracticeController {
InputStream inputStream = null;
try {
- inputStream = facesContext.getExternalContext().getResourceAsStream("content/12/03/x-sample.pdf");
+ final String path = "content/30-concept/24-non-faces-response/x-sample.pdf";
+ inputStream = facesContext.getExternalContext().getResourceAsStream(path);
if (inputStream == null) {
- inputStream = facesContext.getExternalContext().getResourceAsStream("/content/12/03/x-sample.pdf");
+ inputStream = facesContext.getExternalContext().getResourceAsStream("/" + path);
}
final HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
response.setContentType("application/pdf");
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=1750989&r1=1750988&r2=1750989&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 Fri Jul 1 17:49:19 2016
@@ -17,38 +17,50 @@
* limitations under the License.
-->
-<ui:composition template="/plain.xhtml"
+<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"/>
+ <ui:param name="title" value="Popup"/>
- <tc:form>
- <h1>Currently this is not a popup, but should work the same manner!</h1>
+ <tc:section label="Collapsible Popup">
- <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:buttons>
+ <tc:button label="Open (client site)" omit="true">
+ <tc:operation name="show" for="popup"/>
</tc:button>
- <tc:button label="Submit and Close" action="#{collapsibleController.action}">
- <tc:operation name="drop" for="popup"/>
+ <tc:button label="Open (server site)">
+ <tc:operation name="show" for="popup"/>
</tc:button>
- </tc:box>
+ </tc:buttons>
+
+ <!--<tc:popup id="popup" collapsed="hidden">-->
+ <tc:popup id="popup" collapsed="#{collapsibleController.collapsed}">
+ <tc:box label="Test for Popup">
+ Hallo, collapsible popup.
+ <tc:in required="true" label="Required"/>
+ <tc:buttons>
+ <tc:button label="Close (on client)" omit="true">
+ <tc:operation name="hide" for="popup"/>
+ </tc:button>
+ <tc:button label="Cancel and Close (immediate with action)" 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="hide" for="popup"/>
+ </tc:button>
+ </tc:buttons>
+ </tc:box>
+ </tc:popup>
<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:out value="#{collapsibleController.collapsed}" label="collapsed"/>-->
<tc:flowLayout>
<tc:style textAlign="right"/>
<tc:button label="Submit"/>
</tc:flowLayout>
- </tc:form>
+ </tc:section>
</ui:composition>
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=1750989&r1=1750988&r2=1750989&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 Fri Jul 1 17:49:19 2016
@@ -64,7 +64,6 @@ public class AjaxClientBehaviorRenderer
null,
null, // getConfirmation(command), // todo
null,
- Popup.createPopup(component),
collapse,
component.isOmit());
@@ -83,7 +82,6 @@ public class AjaxClientBehaviorRenderer
null,
null,
null,
- null,
collapse,
null);
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=1750989&r1=1750988&r2=1750989&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 Fri Jul 1 17:49:19 2016
@@ -51,8 +51,6 @@ public class Command {
private String focus;
private String confirmation;
private Integer delay;
- @Deprecated
- private Popup popup;
private Collapse collapse;
private Boolean omit;
@@ -62,7 +60,7 @@ 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,
- @Deprecated final Popup popup, final Collapse collapse, final Boolean omit) {
+ final Collapse collapse, final Boolean omit) {
this.action = action;
this.transition = transition;
this.target = target;
@@ -72,7 +70,6 @@ public class Command {
this.focus = focus;
this.confirmation = confirmation;
this.delay = delay;
- this.popup = popup;
this.collapse = collapse;
this.omit = omit;
}
@@ -83,8 +80,7 @@ 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 Collapse collapse,
- final Boolean omit) {
+ final String focus, final String confirmation, final Integer delay, final Collapse collapse, final Boolean omit) {
this.action = action;
this.transition = transition;
this.target = target;
@@ -93,7 +89,6 @@ public class Command {
this.focus = focus;
this.confirmation = confirmation;
this.delay = delay;
- this.popup = popup;
this.collapse = collapse;
this.omit = omit;
}
@@ -108,7 +103,6 @@ public class Command {
null,
getConfirmation(command),
null,
- Popup.createPopup(command),
AjaxClientBehaviorRenderer.createCollapsible(facesContext, command),
command.isOmit());
}
@@ -123,7 +117,6 @@ public class Command {
null,
getConfirmation(command),
null,
- Popup.createPopup(command),
AjaxClientBehaviorRenderer.createCollapsible(facesContext, command),
command.isOmit());
}
@@ -261,14 +254,6 @@ public class Command {
this.delay = delay;
}
- public Popup getPopup() {
- return popup;
- }
-
- public void setPopup(final Popup popup) {
- this.popup = popup;
- }
-
public Collapse getCollapse() {
return collapse;
}
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=1750989&r1=1750988&r2=1750989&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 Fri Jul 1 17:49:19 2016
@@ -177,10 +177,6 @@ public class JsonUtils {
if (delay != null) {
encode(builder, "delay", delay);
}
- final Popup popup = command.getPopup();
- if (popup != null) {
- encode(builder, "popup", popup);
- }
final Boolean omit = command.getOmit();
if (omit != null && omit) { // false is the default, so encoding is needed.
encode(builder, "omit", omit);
@@ -189,28 +185,6 @@ 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 Popup popup) {
- builder.append("\"");
- builder.append(name);
- builder.append("\":{");
- final int initialLength = builder.length();
-
- final String command = popup.getCommand();
- if (command != null) {
- encode(builder, "command", command);
- }
- final Boolean immediate = popup.isImmediate();
- if (immediate != null) {
- encode(builder, "immediate", immediate);
- }
- if (builder.length() - initialLength > 0) {
- assert builder.charAt(builder.length() - 1) == ',';
- builder.deleteCharAt(builder.length() - 1);
}
builder.append("},");
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=1750989&r1=1750988&r2=1750989&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 Fri Jul 1 17:49:19 2016
@@ -67,7 +67,7 @@ public class BoxRenderer extends PanelRe
HtmlRendererUtils.writeDataAttributes(facesContext, writer, box);
writer.writeStyleAttribute(box.getStyle());
- encodeHidden(writer, clientId);
+ encodeHidden(writer, clientId, collapsed);
if (label != null || labelString != null || bar != null || toolbar != null) {
writer.startElement(HtmlElements.DIV);
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.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/MessagesRenderer.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java Fri Jul 1 17:49:19 2016
@@ -19,15 +19,7 @@
package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
-import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.component.UIBox;
-import org.apache.myfaces.tobago.component.UIButton;
import org.apache.myfaces.tobago.component.UIMessages;
-import org.apache.myfaces.tobago.component.UIPanel;
-import org.apache.myfaces.tobago.component.UIPopup;
-import org.apache.myfaces.tobago.context.ResourceManagerUtils;
-import org.apache.myfaces.tobago.internal.util.FacesContextUtils;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
import org.apache.myfaces.tobago.renderkit.css.Classes;
@@ -40,7 +32,6 @@ import org.apache.myfaces.tobago.renderk
import org.apache.myfaces.tobago.renderkit.html.HtmlRoleValues;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
import org.apache.myfaces.tobago.util.ComponentUtils;
-import org.apache.myfaces.tobago.util.CreateComponentUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,16 +46,13 @@ public class MessagesRenderer extends Re
private static final Logger LOG = LoggerFactory.getLogger(MessagesRenderer.class);
- public static final String CLOSE_POPUP = "closePopup";
-
@Override
public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
final UIMessages messages = (UIMessages) component;
if (messages.isConfirmation()) {
- createPopup(facesContext, messages);
- return;
+ LOG.warn("'confirmation' is currently not supported for tc:messages!");
}
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
@@ -156,58 +144,6 @@ public class MessagesRenderer extends Re
}
}
- private void createPopup(final FacesContext facesContext, final UIMessages messages) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("POPUP");
- }
- final String id
- = messages.getId() != null ? messages.getId() + "popup" : facesContext.getViewRoot().createUniqueId();
- final UIPopup popup = (UIPopup)
- CreateComponentUtils.createComponent(facesContext, UIPopup.COMPONENT_TYPE, RendererTypes.Popup, id);
- ComponentUtils.setAttribute(popup, Attributes.zIndex, 10);
-
- popup.setRendered(true);
- popup.setActivated(true);
- popup.onComponentPopulated(facesContext, messages);
- FacesContextUtils.addPopup(facesContext, popup);
- ComponentUtils.setAttribute(popup, Attributes.popupReset, Boolean.TRUE);
-
- final UIComponent box = CreateComponentUtils.createComponent(
- facesContext, UIBox.COMPONENT_TYPE, RendererTypes.Box, "box");
- popup.getChildren().add(box);
- box.setId("box");
- // TODO: set string resources in renderer
- final String label
- = ResourceManagerUtils.getPropertyNotNull(facesContext, "tobago", "tobago.message.confirmation.title");
- ComponentUtils.setAttribute(box, Attributes.label, label);
-
- final UIPanel scrollPanel = (UIPanel)
- CreateComponentUtils.createComponent(facesContext, UIPanel.COMPONENT_TYPE, RendererTypes.Panel, "messagePanel");
- box.getChildren().add(scrollPanel);
-
- messages.getParent().getChildren().remove(messages);
- messages.setConfirmation(false);
- scrollPanel.onComponentPopulated(facesContext, messages);
- scrollPanel.getChildren().add(messages);
-
- final UIComponent buttonPanel = CreateComponentUtils.createComponent(
- facesContext, UIPanel.COMPONENT_TYPE, RendererTypes.Panel, "buttonPanel");
-
- box.getChildren().add(buttonPanel);
-
- final UIPanel space = (UIPanel)
- CreateComponentUtils.createComponent(facesContext, UIPanel.COMPONENT_TYPE, RendererTypes.Panel, "space");
- buttonPanel.getChildren().add(space);
- space.onComponentPopulated(facesContext, messages);
-
- final UIButton okButton = (UIButton) CreateComponentUtils.createComponent(
- facesContext, UIButton.COMPONENT_TYPE, RendererTypes.Button, CLOSE_POPUP);
- buttonPanel.getChildren().add(okButton);
- okButton.setLabel(
- ResourceManagerUtils.getPropertyNotNull(facesContext, "tobago", "tobago.message.confirmation.okay"));
- ComponentUtils.setAttribute(okButton, Attributes.popupClose, "immediate");
- }
-
private void encodeMessage(
final TobagoResponseWriter writer, final UIMessages messages, final FacesMessage message, final String clientId)
throws IOException {
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.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/PageRenderer.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java Fri Jul 1 17:49:19 2016
@@ -24,7 +24,6 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.UIMenuBar;
import org.apache.myfaces.tobago.component.UIPage;
-import org.apache.myfaces.tobago.component.UIPopup;
import org.apache.myfaces.tobago.config.TobagoConfig;
import org.apache.myfaces.tobago.context.ClientProperties;
import org.apache.myfaces.tobago.context.Markup;
@@ -341,16 +340,6 @@ public class PageRenderer extends Render
writer.endElement(HtmlElements.DIV);
*/
- // write popup components
- // beware of ConcurrentModificationException in cascading popups!
- // no foreach
-
- final UIPopup[] popupArray = FacesContextUtils.getPopups(facesContext).toArray(
- new UIPopup[FacesContextUtils.getPopups(facesContext).size()]);
- for (final UIPopup popup : popupArray) {
- RenderUtils.encode(facesContext, popup);
- }
-
final String clientId = page.getClientId(facesContext);
final ClientProperties clientProperties = ClientProperties.getInstance(facesContext);
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=1750989&r1=1750988&r2=1750989&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 Fri Jul 1 17:49:19 2016
@@ -71,7 +71,7 @@ public class PanelRenderer extends Panel
HtmlRendererUtils.renderCommandFacet(panel, facesContext, writer);
HtmlRendererUtils.encodeContextMenu(facesContext, writer, panel);
- encodeHidden(writer, clientId);
+ encodeHidden(writer, clientId, collapsed);
}
@Override
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=1750989&r1=1750988&r2=1750989&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 Fri Jul 1 17:49:19 2016
@@ -53,11 +53,13 @@ public class PanelRendererBase extends R
}
}
- protected void encodeHidden(final TobagoResponseWriter writer, final String clientId) throws IOException {
+ protected void encodeHidden(final TobagoResponseWriter writer, final String clientId, final CollapseState collapsed)
+ throws IOException {
writer.startElement(HtmlElements.INPUT);
writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN);
writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "collapse");
writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "collapse");
+ writer.writeAttribute(HtmlAttributes.VALUE, collapsed.name(), false);
writer.endElement(HtmlElements.INPUT);
}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PopupRenderer.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/PopupRenderer.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PopupRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PopupRenderer.java Fri Jul 1 17:49:19 2016
@@ -19,9 +19,8 @@
package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
-import org.apache.myfaces.tobago.component.UIPopup;
-import org.apache.myfaces.tobago.internal.util.FacesContextUtils;
-import org.apache.myfaces.tobago.renderkit.RendererBase;
+import org.apache.myfaces.tobago.internal.component.AbstractUIPopup;
+import org.apache.myfaces.tobago.model.CollapseState;
import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
@@ -32,29 +31,21 @@ import org.apache.myfaces.tobago.webapp.
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.faces.event.ComponentSystemEvent;
-import javax.faces.event.ComponentSystemEventListener;
-import javax.faces.event.ListenerFor;
-import javax.faces.event.PostAddToViewEvent;
import java.io.IOException;
-@ListenerFor(systemEventClass = PostAddToViewEvent.class)
-public class PopupRenderer extends RendererBase implements ComponentSystemEventListener {
-
- @Override
- public void processEvent(ComponentSystemEvent event) {
- final FacesContext facesContext = FacesContext.getCurrentInstance();
- final UIPopup popup = (UIPopup) event.getComponent();
- FacesContextUtils.addPopup(facesContext, popup);
- }
+public class PopupRenderer extends PanelRendererBase {
@Override
public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
- final UIPopup popup = (UIPopup) component;
+
+ final AbstractUIPopup popup = (AbstractUIPopup) component;
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+ final String clientId = popup.getClientId(facesContext);
+ final CollapseState collapsed = popup.getCollapsed();
+
writer.startElement(HtmlElements.DIV);
writer.writeClassAttribute(TobagoClass.POPUP, BootstrapClass.MODAL, BootstrapClass.FADE);
- writer.writeIdAttribute(popup.getClientId(facesContext));
+ writer.writeIdAttribute(clientId);
writer.writeAttribute(HtmlAttributes.TABINDEX, -1);
writer.writeAttribute(HtmlAttributes.ROLE, HtmlRoleValues.DIALOG.toString(), false);
// todo: aria-labelledby
@@ -69,6 +60,8 @@ public class PopupRenderer extends Rende
*/
writer.startElement(HtmlElements.DIV);
writer.writeClassAttribute(BootstrapClass.MODAL_CONTENT);
+
+ encodeHidden(writer, clientId, collapsed);
}
@Override
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SectionRenderer.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/SectionRenderer.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SectionRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SectionRenderer.java Fri Jul 1 17:49:19 2016
@@ -74,7 +74,7 @@ public class SectionRenderer extends Pan
tag = HtmlElements.H6;
}
- encodeHidden(writer, clientId);
+ encodeHidden(writer, clientId, collapsed);
writer.startElement(HtmlElements.DIV);
writer.writeClassAttribute(TobagoClass.SECTION__HEADER);
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js Fri Jul 1 17:49:19 2016
@@ -24,7 +24,13 @@ Tobago.Popup.init = function(elements) {
var popups = Tobago.Utils.selectWithJQuery(elements, ".modal");
popups.each(function() {
- jQuery(this).modal(); // opens the popup
+ var $popup = jQuery(this);
+ var $hidden = Tobago.Collapse.findHidden($popup);
+ if ($hidden.val() == "visible") {
+ jQuery(this).modal(); // inits and opens the popup
+ } else {
+ jQuery(this).modal("hide"); // inits and hides the popup
+ }
});
};
@@ -46,6 +52,7 @@ Tobago.Collapse.execute = function (coll
var transition = collapse.transition;
var $for = jQuery(Tobago.Utils.escapeClientId(collapse.forId));
var $hidden = Tobago.Collapse.findHidden($for);
+ var isPopup = $for.hasClass("tobago-popup");
var state = $hidden.val();
var newState;
switch (transition) {
@@ -61,11 +68,20 @@ Tobago.Collapse.execute = function (coll
default:
console.error("unknown transition: '" + transition + "'");
}
- if (newState == "visible") {
- $for.removeClass("tobago-collapsed");
- } else {
- $for.addClass("tobago-collapsed");
- }
+ if (newState == "hidden") {
+ if (isPopup) {
+ $for.modal("hide");
+ } else {
+ $for.addClass("tobago-collapsed");
+ }
+ } else if (newState == "visible") {
+ if (isPopup) {
+ $for.modal("show");
+ } else {
+ $for.removeClass("tobago-collapsed");
+ }
+ } // else (absent): nothing to do, because here comes an update from the server
+
var serverRequestRequired = state == "absent" || newState == "absent";
if (serverRequestRequired) {
console.info("serverRequestRequired!"); // todo: remove var serverRequestRequired: is not needed.
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/html/JsonUtilsUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/html/JsonUtilsUnitTest.java?rev=1750989&r1=1750988&r2=1750989&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/html/JsonUtilsUnitTest.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/html/JsonUtilsUnitTest.java Fri Jul 1 17:49:19 2016
@@ -91,7 +91,7 @@ public class JsonUtilsUnitTest extends A
"_blank", "http://www.apache.org/",
StringUtils.join(Arrays.asList("id1", "id2"), ' '),
"id_focus",
- "Really?", 1000, Popup.createPopup(command), null, true));
+ "Really?", 1000, new Collapse(Collapse.Action.show, "myId"), true));
final String expected = (
"{"
+ "'click':{"
@@ -100,13 +100,13 @@ public class JsonUtilsUnitTest extends A
+ "'target':'_blank',"
+ "'url':'http://www.apache.org/',"
+ "'partially':'id1 id2',"
+ + "'collapse':{"
+ + "'transition':'show',"
+ + "'forId':'myId'"
+ + "},"
+ "'focus':'id_focus',"
+ "'confirmation':'Really?',"
+ "'delay':1000,"
- + "'popup':{"
- + "'command':'close',"
- + "'immediate':true"
- + "},"
+ "'omit':true"
+ "}"
+ "}").replaceAll("'", "\"");