You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2016/09/03 13:21:11 UTC
svn commit: r1759090 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/
tobago-example/tobago-example-demo/src/main/webapp/content/20-c...
Author: weber
Date: Sat Sep 3 13:21:11 2016
New Revision: 1759090
URL: http://svn.apache.org/viewvc?rev=1759090&view=rev
Log:
TOBAGO-1590 - Remove attribute "renderedPartially": from TabGroup
Modified:
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/renderkit/html/DataAttributes.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/070-tab/01-ajax/tab-ajax.xhtml
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-tab.js
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=1759090&r1=1759089&r2=1759090&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 Sat Sep 3 13:21:11 2016
@@ -23,7 +23,6 @@ import org.apache.myfaces.tobago.compat.
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.OnComponentPopulated;
-import org.apache.myfaces.tobago.component.SupportsRenderedPartially;
import org.apache.myfaces.tobago.component.UITab;
import org.apache.myfaces.tobago.component.Visual;
import org.apache.myfaces.tobago.event.TabChangeEvent;
@@ -38,6 +37,7 @@ import javax.el.MethodExpression;
import javax.el.ValueExpression;
import javax.faces.component.ActionSource2;
import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionListener;
@@ -45,13 +45,17 @@ import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
public abstract class AbstractUITabGroup extends AbstractUIPanelBase
- implements TabChangeSource2, ActionSource2, OnComponentPopulated, SupportsRenderedPartially, Visual {
+ implements TabChangeSource2, ActionSource2, OnComponentPopulated, ClientBehaviorHolder, Visual {
private static final Logger LOG = LoggerFactory.getLogger(AbstractUITabGroup.class);
+ // todo generate
+ private static final Collection<String> EVENT_NAMES = Collections.singletonList("reload");
@Override
public void encodeChildren(final FacesContext facesContext) throws IOException {
}
@@ -293,4 +297,14 @@ public abstract class AbstractUITabGroup
public void onComponentPopulated(final FacesContext facesContext, final UIComponent parent) {
super.onComponentPopulated(facesContext, parent);
}
+
+ @Override
+ public String getDefaultEventName() {
+ return "reload";
+ }
+
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java?rev=1759090&r1=1759089&r2=1759090&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java Sat Sep 3 13:21:11 2016
@@ -27,6 +27,11 @@ package org.apache.myfaces.tobago.render
public enum DataAttributes implements MarkupLanguageAttributes {
/**
+ * Ajax behaviors execute and render attributes for TabGroup and Sheet reload
+ */
+ BEHAVIOR_COMMANDS("data-tobago-behavior-commands"),
+
+ /**
* The index of the column of a sheet. This index means the position of the rendered column. It can differ, if there
* are tc:column with rendered=false.
*/
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/070-tab/01-ajax/tab-ajax.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/070-tab/01-ajax/tab-ajax.xhtml?rev=1759090&r1=1759089&r2=1759090&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/070-tab/01-ajax/tab-ajax.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/070-tab/01-ajax/tab-ajax.xhtml Sat Sep 3 13:21:11 2016
@@ -100,7 +100,8 @@
<code class="language-markup"><tc:tabChangeListener type="org.apache.myfaces.tobago.example
.demo.actionlistener.SimpleTabChangeListener"
binding="\#{tabController.tabChangeListener}"/></code>
- <tc:tabGroup switchType="reloadTab" renderedPartially="outPanel">
+ <tc:tabGroup switchType="reloadTab">
+ <f:ajax render="outPanel"/>
<tc:tabChangeListener type="org.apache.myfaces.tobago.example.demo.actionlistener.SimpleTabChangeListener"
binding="#{tabController.tabChangeListener}"/>
<tc:tab label="One">
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.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/TabGroupRenderer.java?rev=1759090&r1=1759089&r2=1759090&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java Sat Sep 3 13:21:11 2016
@@ -100,8 +100,9 @@ public class TabGroupRenderer extends Re
HtmlRendererUtils.writeDataAttributes(facesContext, writer, tabGroup);
writer.writeStyleAttribute(tabGroup.getStyle());
writer.writeAttribute(HtmlAttributes.SWITCHTYPE, switchType.name(), false);
- writer.writeAttribute(DataAttributes.PARTIAL_IDS,
- ComponentUtils.evaluateClientIds(facesContext, tabGroup, tabGroup.getRenderedPartially()), false);
+
+ final String commands = RenderUtils.getBehaviorCommands(facesContext, tabGroup);
+ writer.writeAttribute(DataAttributes.BEHAVIOR_COMMANDS, commands, false);
writer.startElement(HtmlElements.INPUT);
writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN);
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tab.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-tab.js?rev=1759090&r1=1759089&r2=1759090&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tab.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tab.js Sat Sep 3 13:21:11 2016
@@ -39,18 +39,25 @@ Tobago.TabGroup.init = function(elements
var activeIndex = Tobago.TabGroup.updateHidden(tab);
console.debug("todo: ajax reload, activeIndex=" + activeIndex); // @DEV_ONLY
var tabGroup = tab.parents(".tobago-tabGroup:first");
- var partialIds = tabGroup.data("tobago-partial-ids");
- if (partialIds) {
- partialIds = partialIds + " " + tabGroup.attr("id");
- } else {
- partialIds = tabGroup.attr("id");
+ var tabGroupId = tabGroup.attr("id");
+ var executeIds = tabGroupId;
+ var renderIds = tabGroupId;
+ var behaviorCommands = tabGroup.data("tobago-behavior-commands");
+ if (behaviorCommands && behaviorCommands.reload) {
+ if (behaviorCommands.reload.execute) {
+ executeIds = behaviorCommands.reload.execute;
+ }
+ if (behaviorCommands.reload.render) {
+ renderIds += " " + behaviorCommands.reload.render;
+ }
}
+
jsf.ajax.request(
- tabGroup.attr("id"),
+ tabGroupId,
event,
{
- execute: partialIds,
- render: partialIds
+ execute: executeIds,
+ render: renderIds
});
})
});