Author: nbelaevski
Date: 2010-11-04 13:50:48 -0400 (Thu, 04 Nov 2010)
New Revision: 19937
Added:
trunk/core/api/src/main/java/org/richfaces/component/ComponentIterators.java
Modified:
trunk/core/api/src/main/java/org/richfaces/component/MetaComponentResolver.java
trunk/core/impl/src/main/java/org/richfaces/context/ComponentIdResolver.java
trunk/core/impl/src/test/java/org/richfaces/context/ComponentIdResolverTest.java
trunk/core/impl/src/test/java/org/richfaces/context/ComponentIdResolverTestBean.java
trunk/core/impl/src/test/resources/org/richfaces/context/ComponentIdResolver.xhtml
trunk/examples/core-demo/src/main/webapp/button.xhtml
trunk/examples/core-demo/src/main/webapp/link.xhtml
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractCommandButton.java
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractCommandLink.java
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractRegion.java
trunk/ui/core/ui/src/test/java/org/richfaces/component/RegionTest.java
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java
Log:
https://jira.jboss.org/browse/RF-9481
Added: trunk/core/api/src/main/java/org/richfaces/component/ComponentIterators.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/component/ComponentIterators.java
(rev 0)
+++
trunk/core/api/src/main/java/org/richfaces/component/ComponentIterators.java 2010-11-04
17:50:48 UTC (rev 19937)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.component;
+
+import java.util.Iterator;
+
+import javax.faces.component.UIComponent;
+
+import com.google.common.collect.AbstractIterator;
+import com.google.common.collect.Iterators;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public final class ComponentIterators {
+
+ private ComponentIterators() {}
+
+ public static Iterator<UIComponent> parents(final UIComponent component) {
+ if (component == null) {
+ return Iterators.<UIComponent>emptyIterator();
+ }
+
+ return new AbstractIterator<UIComponent>() {
+
+ private UIComponent currentComponent = component;
+
+ @Override
+ protected UIComponent computeNext() {
+ currentComponent = currentComponent.getParent();
+
+ if (currentComponent == null) {
+ endOfData();
+ }
+
+ return currentComponent;
+ }
+ };
+ }
+
+ public static Iterator<UIComponent> parentsAndSelf(final UIComponent component)
{
+ if (component == null) {
+ return Iterators.<UIComponent>emptyIterator();
+ }
+
+ return Iterators.concat(Iterators.singletonIterator(component),
parents(component));
+ }
+}
Modified: trunk/core/api/src/main/java/org/richfaces/component/MetaComponentResolver.java
===================================================================
---
trunk/core/api/src/main/java/org/richfaces/component/MetaComponentResolver.java 2010-11-04
17:47:38 UTC (rev 19936)
+++
trunk/core/api/src/main/java/org/richfaces/component/MetaComponentResolver.java 2010-11-04
17:50:48 UTC (rev 19937)
@@ -33,6 +33,26 @@
// TODO - do we want to make this configurable in web.xml?
public static final char META_COMPONENT_SEPARATOR_CHAR = '@';
+ /**
+ * Resolves and returns string identifying supported meta-component or
<code>null</code> if provided meta-component
+ * name is not a supported one.
+ *
+ * @param facesContext - current instance of {@link FacesContext}
+ * @param contextComponent - instance of {@link UIComponent} that requested
resolution of meta-component
+ * @param metaComponentId - name of meta-component (without leading '@'
sign)
+ * @return clientId, one of supported meta-names such as @all, @this, etc. or
<code>null</code>
+ */
public String resolveClientId(FacesContext facesContext, UIComponent
contextComponent, String metaComponentId);
+ /**
+ * Provides replacement for unresolved meta-component names. Returns identifier
string for the chosen substitution
+ * or <code>null</code>
+ *
+ * @param facesContext - current instance of {@link FacesContext}
+ * @param contextComponent - instance of {@link UIComponent} that requested
resolution of meta-component
+ * @param metaComponentId - name of meta-component (without leading '@'
sign)
+ * @return clientId, one of supported meta-names such as @all, @this, etc. or
<code>null</code>
+ */
+ public String substituteUnresolvedClientId(FacesContext facesContext, UIComponent
contextComponent, String metaComponentId);
+
}
Modified: trunk/core/impl/src/main/java/org/richfaces/context/ComponentIdResolver.java
===================================================================
---
trunk/core/impl/src/main/java/org/richfaces/context/ComponentIdResolver.java 2010-11-04
17:47:38 UTC (rev 19936)
+++
trunk/core/impl/src/main/java/org/richfaces/context/ComponentIdResolver.java 2010-11-04
17:50:48 UTC (rev 19937)
@@ -37,9 +37,12 @@
import javax.faces.context.FacesContext;
import org.richfaces.component.AjaxContainer;
+import org.richfaces.component.ComponentIterators;
import org.richfaces.component.MetaComponentResolver;
import org.richfaces.renderkit.util.CoreRendererUtils;
+import com.google.common.collect.Iterators;
+
/**
* @author Nick Belaevski
*
@@ -110,23 +113,40 @@
return c;
}
+ private static Iterator<MetaComponentResolver>
createResolversChainIterator(UIComponent component) {
+ return Iterators.filter(ComponentIterators.parentsAndSelf(component),
MetaComponentResolver.class);
+ }
+
+ private static String substituteUnresolvedMetaComponentId(FacesContext context,
UIComponent component, String metaComponentId) {
+ Iterator<MetaComponentResolver> iterator =
createResolversChainIterator(component);
+
+ while (iterator.hasNext()) {
+ MetaComponentResolver metaComponentResolver = (MetaComponentResolver)
iterator.next();
+
+ String resolvedId =
metaComponentResolver.substituteUnresolvedClientId(context, component, metaComponentId);
+
+ if (resolvedId != null) {
+ return resolvedId;
+ }
+ }
+
+ return null;
+ }
+
private static String resolveMetaComponentId(FacesContext context, UIComponent
component, String metaComponentId) {
- UIComponent c = component;
- while (c != null) {
- if (c instanceof MetaComponentResolver) {
- MetaComponentResolver metaComponentResolver = (MetaComponentResolver) c;
+ Iterator<MetaComponentResolver> iterator =
createResolversChainIterator(component);
+
+ while (iterator.hasNext()) {
+ MetaComponentResolver metaComponentResolver = (MetaComponentResolver)
iterator.next();
+
+ String resolvedId = metaComponentResolver.resolveClientId(context, component,
metaComponentId);
- String resolvedId = metaComponentResolver.resolveClientId(context,
component, metaComponentId);
-
- if (resolvedId != null) {
- return resolvedId;
- }
+ if (resolvedId != null) {
+ return resolvedId;
}
-
- c = c.getParent();
}
-
- return metaComponentSubstitutions.get(metaComponentId);
+
+ return null;
}
//used in unit tests
@@ -297,8 +317,16 @@
if (metaComponentId != null && metaComponentId.length() != 0) {
resolvedId = resolveMetaComponentId(facesContext, bottomMatch,
metaComponentId);
+
+ if (resolvedId == null) {
+ resolvedId = substituteUnresolvedMetaComponentId(facesContext,
bottomMatch, metaComponentId);
+ }
+
+ if (resolvedId == null) {
+ resolvedId = metaComponentSubstitutions.get(metaComponentId);
+ }
}
-
+
if (CoreRendererUtils.GLOBAL_META_COMPONENTS.contains(resolvedId)) {
resolvedIds.clear();
resolvedIds.add(resolvedId);
Modified:
trunk/core/impl/src/test/java/org/richfaces/context/ComponentIdResolverTest.java
===================================================================
---
trunk/core/impl/src/test/java/org/richfaces/context/ComponentIdResolverTest.java 2010-11-04
17:47:38 UTC (rev 19936)
+++
trunk/core/impl/src/test/java/org/richfaces/context/ComponentIdResolverTest.java 2010-11-04
17:50:48 UTC (rev 19937)
@@ -39,6 +39,7 @@
import org.junit.Before;
import org.junit.Test;
import org.richfaces.component.MetaComponentResolver;
+import org.richfaces.renderkit.AjaxConstants;
/**
* @author Nick Belaevski
@@ -239,4 +240,28 @@
Set<String> resolvedIds = resolver.getResolvedIds();
assertEquals(asSet("form:table:input",
"form:table:column@head", "form:table:[1]:column"), resolvedIds);
}
+
+ @Test
+ public void testUnresolvedMetaComponentSubstitutionCompatibility() throws Exception
{
+ ComponentIdResolver resolver = createComponentIdResolver();
+
+ resolver.addId(META_CLIENT_ID);
+
+
resolver.resolve(evaluateComponentExpression("#{testBean.linkInRegion}"));
+
+ Set<String> resolvedIds = resolver.getResolvedIds();
+ assertEquals(asSet("firstRegion"), resolvedIds);
+ }
+
+ @Test
+ public void testUnresolvedMetaComponentSubstitution() throws Exception {
+ ComponentIdResolver resolver = createComponentIdResolver();
+
+ resolver.addId(META_CLIENT_ID);
+
+
resolver.resolve(evaluateComponentExpression("#{testBean.linkOutRegion}"));
+
+ Set<String> resolvedIds = resolver.getResolvedIds();
+ assertEquals(asSet(AjaxConstants.ALL), resolvedIds);
+ }
}
Modified:
trunk/core/impl/src/test/java/org/richfaces/context/ComponentIdResolverTestBean.java
===================================================================
---
trunk/core/impl/src/test/java/org/richfaces/context/ComponentIdResolverTestBean.java 2010-11-04
17:47:38 UTC (rev 19936)
+++
trunk/core/impl/src/test/java/org/richfaces/context/ComponentIdResolverTestBean.java 2010-11-04
17:50:48 UTC (rev 19937)
@@ -26,6 +26,7 @@
import javax.faces.context.FacesContext;
import org.richfaces.component.MetaComponentResolver;
+import org.richfaces.renderkit.AjaxConstants;
/**
* @author Nick Belaevski
@@ -42,12 +43,40 @@
return null;
}
+ public String substituteUnresolvedClientId(FacesContext facesContext, UIComponent
contextComponent,
+ String metaComponentId) {
+
+ return null;
+ }
+
@Override
public String getFamily() {
return null;
}
}
+ private static class UICommandLink extends UIComponentBase implements
MetaComponentResolver {
+
+ public String resolveClientId(FacesContext facesContext, UIComponent
contextComponent, String metaComponentId) {
+ return null;
+ }
+
+ public String substituteUnresolvedClientId(FacesContext facesContext, UIComponent
contextComponent,
+ String metaComponentId) {
+
+ if (ComponentIdResolverTest.META_COMPONENT_ID.equals(metaComponentId)) {
+ return AjaxConstants.ALL;
+ }
+
+ return null;
+ }
+
+ @Override
+ public String getFamily() {
+ return null;
+ }
+ }
+
private String[] data = {"1", "2", "3"};
private UIComponent table;
@@ -58,6 +87,10 @@
private UIComponent outputOutRegion;
+ private UIComponent linkInRegion = new UICommandLink();
+
+ private UIComponent linkOutRegion = new UICommandLink();
+
public Object getData() {
return data;
}
@@ -93,4 +126,12 @@
public void setOutputOutRegion(UIComponent outputOutRegion) {
this.outputOutRegion = outputOutRegion;
}
+
+ public UIComponent getLinkInRegion() {
+ return linkInRegion;
+ }
+
+ public UIComponent getLinkOutRegion() {
+ return linkOutRegion;
+ }
}
\ No newline at end of file
Modified:
trunk/core/impl/src/test/resources/org/richfaces/context/ComponentIdResolver.xhtml
===================================================================
---
trunk/core/impl/src/test/resources/org/richfaces/context/ComponentIdResolver.xhtml 2010-11-04
17:47:38 UTC (rev 19936)
+++
trunk/core/impl/src/test/resources/org/richfaces/context/ComponentIdResolver.xhtml 2010-11-04
17:50:48 UTC (rev 19937)
@@ -22,9 +22,14 @@
<ui:fragment binding="#{testBean.firstRegion}"
id="firstRegion">
<h:outputText binding="#{testBean.outputInRegion}"
id="outputInRegion" />
+
+ <ui:fragment binding="#{testBean.linkInRegion}"
id="linkInRegion" />
</ui:fragment>
<h:outputText binding="#{testBean.outputOutRegion}"
id="outputOutRegion" />
+
+ <ui:fragment binding="#{testBean.linkOutRegion}"
id="linkOutRegion" />
+
</h:body>
</f:view>
</html>
\ No newline at end of file
Modified: trunk/examples/core-demo/src/main/webapp/button.xhtml
===================================================================
--- trunk/examples/core-demo/src/main/webapp/button.xhtml 2010-11-04 17:47:38 UTC (rev
19936)
+++ trunk/examples/core-demo/src/main/webapp/button.xhtml 2010-11-04 17:50:48 UTC (rev
19937)
@@ -15,13 +15,19 @@
<h:outputText value="Name:" />
<h:form>
<h:inputText value="#{commandBean.name}" />
- <a4j:commandButton action="#{commandBean.submit}"
render="out" value="Say Hello" execute="@form" />
- <a4j:commandButton action="#{commandBean.submit}"
render="out" value="Say Hello with limitRender"
- limitRender="true" execute="@form" />
- <a4j:commandButton action="#{commandBean.reset}"
render="out" value="Reset" execute="@form" />
- <a4j:commandButton value="Test AjaxBehavior">
- <f:ajax event="action" execute="@form"
render=":out" listener="#{commandBean.listener}" />
- </a4j:commandButton>
+
+ <h:panelGrid>
+ <a4j:commandButton action="#{commandBean.submit}"
render="out" value="Say Hello" />
+ <a4j:commandButton action="#{commandBean.submit}"
render="out" value="Say Hello with limitRender"
+ limitRender="true"/>
+ <a4j:commandButton action="#{commandBean.submit}"
render="out" execute="@this">
+ <h:outputText value="Say Hello with execute=@this" />
+ </a4j:commandButton>
+ <a4j:commandButton action="#{commandBean.reset}"
render="out" value="Reset" />
+ <a4j:commandButton value="Test AjaxBehavior">
+ <f:ajax event="action" execute="@form"
render=":out" listener="#{commandBean.listener}" />
+ </a4j:commandButton>
+ </h:panelGrid>
</h:form>
<br />
<h:panelGroup id="out">
Modified: trunk/examples/core-demo/src/main/webapp/link.xhtml
===================================================================
--- trunk/examples/core-demo/src/main/webapp/link.xhtml 2010-11-04 17:47:38 UTC (rev
19936)
+++ trunk/examples/core-demo/src/main/webapp/link.xhtml 2010-11-04 17:50:48 UTC (rev
19937)
@@ -15,19 +15,25 @@
<h:outputText value="Name:" />
<h:form>
<h:inputText value="#{commandBean.name}" />
- <a4j:commandLink action="#{commandBean.submit}" render="out"
execute="@form">
- <h:outputText value="Say Hello" />
- </a4j:commandLink>
- <a4j:commandLink action="#{commandBean.submit}" render="out"
limitRender="true" execute="@form">
- <h:outputText value="Say Hello with limitRender" />
- </a4j:commandLink>
- <a4j:commandLink action="#{commandBean.reset}" render="out"
execute="@form">
- <h:outputText value="Reset" />
- </a4j:commandLink>
- <a4j:commandLink>
- <f:ajax event="action" execute="@form"
render=":out" listener="#{commandBean.listener}" />
- <h:outputText value="Test AjaxBehavior" />
- </a4j:commandLink>
+
+ <h:panelGrid>
+ <a4j:commandLink action="#{commandBean.submit}"
render="out">
+ <h:outputText value="Say Hello" />
+ </a4j:commandLink>
+ <a4j:commandLink action="#{commandBean.submit}"
render="out" limitRender="true">
+ <h:outputText value="Say Hello with limitRender" />
+ </a4j:commandLink>
+ <a4j:commandLink action="#{commandBean.submit}"
render="out" execute="@this">
+ <h:outputText value="Say Hello with execute=@this" />
+ </a4j:commandLink>
+ <a4j:commandLink action="#{commandBean.reset}"
render="out">
+ <h:outputText value="Reset" />
+ </a4j:commandLink>
+ <a4j:commandLink>
+ <f:ajax event="action" execute="@form"
render=":out" listener="#{commandBean.listener}" />
+ <h:outputText value="Test AjaxBehavior" />
+ </a4j:commandLink>
+ </h:panelGrid>
</h:form>
<br />
<h:panelGroup id="out">
Modified:
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractCommandButton.java
===================================================================
---
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractCommandButton.java 2010-11-04
17:47:38 UTC (rev 19936)
+++
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractCommandButton.java 2010-11-04
17:50:48 UTC (rev 19937)
@@ -24,6 +24,8 @@
package org.richfaces.component;
import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
@@ -31,13 +33,14 @@
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.TagType;
+import org.richfaces.renderkit.AjaxConstants;
/**
* @author Nick Belaevski
*
*/
@JsfComponent(renderer = @JsfRenderer(type =
"org.richfaces.CommandButtonRenderer"), tag = @Tag(type = TagType.Facelets))
-public abstract class AbstractCommandButton extends AbstractActionComponent {
+public abstract class AbstractCommandButton extends AbstractActionComponent implements
MetaComponentResolver {
public static final String COMPONENT_TYPE = "org.richfaces.CommandButton";
@@ -81,4 +84,18 @@
@Attribute
public abstract boolean isLimitRender();
+
+ public String resolveClientId(FacesContext facesContext, UIComponent
contextComponent, String metaComponentId) {
+ return null;
+ }
+
+ public String substituteUnresolvedClientId(FacesContext facesContext, UIComponent
contextComponent,
+ String metaComponentId) {
+
+ if (AjaxContainer.META_COMPONENT_ID.equals(metaComponentId)) {
+ return AjaxConstants.FORM;
+ }
+
+ return null;
+ }
}
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractCommandLink.java
===================================================================
---
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractCommandLink.java 2010-11-04
17:47:38 UTC (rev 19936)
+++
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractCommandLink.java 2010-11-04
17:50:48 UTC (rev 19937)
@@ -23,6 +23,8 @@
package org.richfaces.component;
import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
@@ -30,6 +32,7 @@
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.TagType;
+import org.richfaces.renderkit.AjaxConstants;
/**
* @author Nick Belaevski
@@ -38,7 +41,7 @@
renderer = @JsfRenderer(type = "org.richfaces.CommandLinkRenderer"),
tag = @Tag(type = TagType.Facelets)
)
-public abstract class AbstractCommandLink extends AbstractActionComponent {
+public abstract class AbstractCommandLink extends AbstractActionComponent implements
MetaComponentResolver {
public static final String COMPONENT_TYPE = "org.richfaces.CommandLink";
@@ -82,4 +85,18 @@
@Attribute
public abstract boolean isLimitRender();
+
+ public String resolveClientId(FacesContext facesContext, UIComponent
contextComponent, String metaComponentId) {
+ return null;
+ }
+
+ public String substituteUnresolvedClientId(FacesContext facesContext, UIComponent
contextComponent,
+ String metaComponentId) {
+
+ if (AjaxContainer.META_COMPONENT_ID.equals(metaComponentId)) {
+ return AjaxConstants.FORM;
+ }
+
+ return null;
+ }
}
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractRegion.java
===================================================================
--- trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractRegion.java 2010-11-04
17:47:38 UTC (rev 19936)
+++ trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractRegion.java 2010-11-04
17:50:48 UTC (rev 19937)
@@ -50,4 +50,10 @@
return null;
}
+
+ public String substituteUnresolvedClientId(FacesContext facesContext, UIComponent
contextComponent,
+ String metaComponentId) {
+
+ return null;
+ }
}
Modified: trunk/ui/core/ui/src/test/java/org/richfaces/component/RegionTest.java
===================================================================
--- trunk/ui/core/ui/src/test/java/org/richfaces/component/RegionTest.java 2010-11-04
17:47:38 UTC (rev 19936)
+++ trunk/ui/core/ui/src/test/java/org/richfaces/component/RegionTest.java 2010-11-04
17:50:48 UTC (rev 19937)
@@ -34,6 +34,7 @@
import javax.el.ELContext;
import javax.el.ValueExpression;
import javax.faces.application.Application;
+import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
import javax.faces.component.UIViewRoot;
@@ -51,19 +52,20 @@
* Test page pseudo-code:
* <pre>
* <h:form id="form">
- * <a4j:testLink id="link"
- * binding="#{link}"
- * execute="#{linkExecute}" />
+ * <a4j:testCommandComponent id="testCommand"
+ * binding="#{testCommand}"
+ * execute="#{testCommandExecute}" />
*
* <a4j:region id="region">
- * <a4j:testLink id="regionLink"
- * binding="#{regionLink}"
- * execute="#{regionLinkExecute}" />
+ * <a4j:testCommandComponent id="testCommandRegion"
+ * binding="#{testCommandRegion}"
+ * execute="#{testCommandRegionExecute}" />
*
* </a4j:region>
* </h:form>
* </pre>
*
+ * TestCommandComponent is assumed to have execute=@this by default
*
* @author Nick Belaevski
*
@@ -76,17 +78,17 @@
private FacesContext facesContext;
- private UIComponent link;
+ private UIComponent testCommand;
- private String linkExecute;
+ private String testCommandExecute;
- private UIComponent regionLink;
+ private UIComponent testCommandRegion;
- private String regionLinkExecute;
+ private String testCommandRegionExecute;
- private String linkClientId;
+ private String testCommandClientId;
- private String regionLinkClientId;
+ private String testCommandRegionClientId;
private String regionClientId;
@@ -135,12 +137,12 @@
@Override
public void setValue(ELContext context, Object value) {
- linkExecute = (String) value;
+ testCommandExecute = (String) value;
}
@Override
public Object getValue(ELContext context) {
- return linkExecute;
+ return testCommandExecute;
}
};
}
@@ -151,12 +153,12 @@
@Override
public void setValue(ELContext context, Object value) {
- regionLinkExecute = (String) value;
+ testCommandRegionExecute = (String) value;
}
@Override
public Object getValue(ELContext context) {
- return regionLinkExecute;
+ return testCommandRegionExecute;
}
};
}
@@ -170,26 +172,26 @@
form.setId("form");
viewRoot.getChildren().add(form);
- link = createTestLink();
- link.setId("link");
- link.setValueExpression("execute",
createFirstLinkExecuteExpression());
- form.getChildren().add(link);
- linkClientId = link.getClientId(facesContext);
+ testCommand = createTestLink();
+ testCommand.setId("testCommand");
+ testCommand.setValueExpression("execute",
createFirstLinkExecuteExpression());
+ form.getChildren().add(testCommand);
+ testCommandClientId = testCommand.getClientId(facesContext);
UIComponent region = application.createComponent(AbstractRegion.COMPONENT_TYPE);
region.setId("region");
form.getChildren().add(region);
regionClientId = region.getClientId(facesContext);
- regionLink = createTestLink();
- regionLink.setId("regionLink");
- regionLink.setValueExpression("execute",
createNestedFirstLinkExecuteExpression());
- region.getChildren().add(regionLink);
- regionLinkClientId = regionLink.getClientId(facesContext);
+ testCommandRegion = createTestLink();
+ testCommandRegion.setId("testCommandRegion");
+ testCommandRegion.setValueExpression("execute",
createNestedFirstLinkExecuteExpression());
+ region.getChildren().add(testCommandRegion);
+ testCommandRegionClientId = testCommandRegion.getClientId(facesContext);
}
private UIComponent createTestLink() {
- return
facesContext.getApplication().createComponent(UICommandButton.COMPONENT_TYPE);
+ return facesContext.getApplication().createComponent(UICommand.COMPONENT_TYPE);
}
private void setActivatorComponentId(String clientId) {
@@ -219,14 +221,14 @@
@After
public void tearDown() throws Exception {
- linkClientId = null;
- regionLinkClientId = null;
+ testCommandClientId = null;
+ testCommandRegionClientId = null;
- link = null;
- regionLink = null;
+ testCommand = null;
+ testCommandRegion = null;
- linkExecute = null;
- regionLinkExecute = null;
+ testCommandExecute = null;
+ testCommandRegionExecute = null;
facesContext = null;
@@ -239,15 +241,15 @@
@Test
public void testDefaults() throws Exception {
- setActivatorComponentId(linkClientId);
+ setActivatorComponentId(testCommandClientId);
Collection<String> executeIds =
facesContext.getPartialViewContext().getExecuteIds();
- assertSingleElementCollection(linkClientId, executeIds);
+ assertSingleElementCollection(testCommandClientId, executeIds);
}
@Test
public void testDefaultsInRegion() throws Exception {
- setActivatorComponentId(regionLinkClientId);
+ setActivatorComponentId(testCommandRegionClientId);
Collection<String> executeIds =
facesContext.getPartialViewContext().getExecuteIds();
assertSingleElementCollection(regionClientId, executeIds);
@@ -255,26 +257,26 @@
@Test
public void testExecuteThis() throws Exception {
- linkExecute = THIS;
- setActivatorComponentId(linkClientId);
+ testCommandExecute = THIS;
+ setActivatorComponentId(testCommandClientId);
Collection<String> executeIds =
facesContext.getPartialViewContext().getExecuteIds();
- assertSingleElementCollection(linkClientId, executeIds);
+ assertSingleElementCollection(testCommandClientId, executeIds);
}
@Test
public void testExecuteThisInRegion() throws Exception {
- regionLinkExecute = THIS;
- setActivatorComponentId(regionLinkClientId);
+ testCommandRegionExecute = THIS;
+ setActivatorComponentId(testCommandRegionClientId);
Collection<String> executeIds =
facesContext.getPartialViewContext().getExecuteIds();
- assertSingleElementCollection(regionLinkClientId, executeIds);
+ assertSingleElementCollection(testCommandRegionClientId, executeIds);
}
@Test
public void testExecuteAll() throws Exception {
- linkExecute = ALL;
- setActivatorComponentId(linkClientId);
+ testCommandExecute = ALL;
+ setActivatorComponentId(testCommandClientId);
Collection<String> executeIds =
facesContext.getPartialViewContext().getExecuteIds();
assertSingleElementCollection(ALL, executeIds);
@@ -282,8 +284,8 @@
@Test
public void testExecuteAllInRegion() throws Exception {
- regionLinkExecute = ALL;
- setActivatorComponentId(regionLinkClientId);
+ testCommandRegionExecute = ALL;
+ setActivatorComponentId(testCommandRegionClientId);
Collection<String> executeIds =
facesContext.getPartialViewContext().getExecuteIds();
assertSingleElementCollection(ALL, executeIds);
@@ -291,17 +293,17 @@
@Test
public void testExecuteRegion() throws Exception {
- linkExecute = AjaxContainer.META_CLIENT_ID;
- setActivatorComponentId(linkClientId);
+ testCommandExecute = AjaxContainer.META_CLIENT_ID;
+ setActivatorComponentId(testCommandClientId);
Collection<String> executeIds =
facesContext.getPartialViewContext().getExecuteIds();
- assertSingleElementCollection(linkClientId, executeIds);
+ assertSingleElementCollection(testCommandClientId, executeIds);
}
@Test
public void testExecuteRegionInRegion() throws Exception {
- regionLinkExecute = AjaxContainer.META_CLIENT_ID;
- setActivatorComponentId(regionLinkClientId);
+ testCommandRegionExecute = AjaxContainer.META_CLIENT_ID;
+ setActivatorComponentId(testCommandRegionClientId);
Collection<String> executeIds =
facesContext.getPartialViewContext().getExecuteIds();
assertSingleElementCollection(regionClientId, executeIds);
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-11-04
17:47:38 UTC (rev 19936)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-11-04
17:50:48 UTC (rev 19937)
@@ -237,6 +237,12 @@
return null;
}
+ public String substituteUnresolvedClientId(FacesContext facesContext, UIComponent
contextComponent,
+ String metaComponentId) {
+
+ return null;
+ }
+
@Override
public boolean visitTree(VisitContext context, VisitCallback callback) {
if (context instanceof ExtendedVisitContext) {
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java 2010-11-04
17:47:38 UTC (rev 19936)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java 2010-11-04
17:50:48 UTC (rev 19937)
@@ -42,9 +42,9 @@
import org.richfaces.cdk.annotations.TagType;
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.context.ExtendedVisitContextMode;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.renderkit.MetaComponentRenderer;
-import org.richfaces.log.Logger;
/**
* @author Anton Belevich
@@ -200,4 +200,10 @@
return null;
}
+
+ public String substituteUnresolvedClientId(FacesContext facesContext, UIComponent
contextComponent,
+ String metaComponentId) {
+
+ return null;
+ }
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-04
17:47:38 UTC (rev 19936)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-04
17:50:48 UTC (rev 19937)
@@ -380,6 +380,12 @@
return null;
}
+ public String substituteUnresolvedClientId(FacesContext facesContext, UIComponent
contextComponent,
+ String metaComponentId) {
+
+ return null;
+ }
+
@Override
protected Iterator<UIComponent> dataChildren() {
AbstractTreeNode treeNodeComponent = getTreeNodeComponent();
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-11-04
17:47:38 UTC (rev 19936)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-11-04
17:50:48 UTC (rev 19937)
@@ -51,6 +51,7 @@
import org.richfaces.event.FilteringListener;
import org.richfaces.event.SortingEvent;
import org.richfaces.event.SortingListener;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.model.Arrangeable;
import org.richfaces.model.ArrangeableModel;
@@ -60,7 +61,6 @@
import org.richfaces.model.SortField;
import org.richfaces.model.SortMode;
import org.richfaces.renderkit.MetaComponentRenderer;
-import org.richfaces.log.Logger;
public abstract class UIDataTableBase extends UISequence implements Row,
MetaComponentResolver, MetaComponentEncoder {
@@ -243,6 +243,12 @@
return null;
}
+ public String substituteUnresolvedClientId(FacesContext facesContext, UIComponent
contextComponent,
+ String metaComponentId) {
+
+ return null;
+ }
+
public void encodeMetaComponent(FacesContext context, String metaComponentId) throws
IOException {
context.getApplication().publishEvent(context, PreRenderComponentEvent.class,
this);
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java 2010-11-04
17:47:38 UTC (rev 19936)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java 2010-11-04
17:50:48 UTC (rev 19937)
@@ -22,20 +22,21 @@
package org.richfaces.component;
-import org.richfaces.TooltipLayout;
-import org.richfaces.TooltipDirection;
-import org.richfaces.TooltipMode;
-import org.richfaces.context.ExtendedVisitContext;
-import org.richfaces.context.ExtendedVisitContextMode;
-import org.richfaces.renderkit.MetaComponentRenderer;
+import java.io.IOException;
import javax.faces.component.UIComponent;
import javax.faces.component.visit.VisitCallback;
import javax.faces.component.visit.VisitContext;
import javax.faces.component.visit.VisitResult;
import javax.faces.context.FacesContext;
-import java.io.IOException;
+import org.richfaces.TooltipDirection;
+import org.richfaces.TooltipLayout;
+import org.richfaces.TooltipMode;
+import org.richfaces.context.ExtendedVisitContext;
+import org.richfaces.context.ExtendedVisitContextMode;
+import org.richfaces.renderkit.MetaComponentRenderer;
+
/**
* @author amarkhel
* @since 2010-10-24
@@ -155,4 +156,10 @@
return null;
}
+
+ public String substituteUnresolvedClientId(FacesContext facesContext, UIComponent
contextComponent,
+ String metaComponentId) {
+
+ return null;
+ }
}