You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2013/06/10 22:03:03 UTC
svn commit: r1491587 - in /myfaces/core/trunk/impl/src:
main/java/org/apache/myfaces/config/
main/java/org/apache/myfaces/config/annotation/
main/java/org/apache/myfaces/config/element/
main/java/org/apache/myfaces/config/impl/digester/ main/java/org/a...
Author: lu4242
Date: Mon Jun 10 20:03:02 2013
New Revision: 1491587
URL: http://svn.apache.org/r1491587
Log:
MYFACES-3734 Implement @FacesComponent createTag, namespace and tagName attributes
Added:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/ComponentTagDeclaration.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/ComponentTagDeclarationImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ComponentTagDeclarationLibrary.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/FacesComponentAnnotationMyFacesRequestTestCase.java
- copied, changed from r1490518, myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel1.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel2.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel2Renderer.java
- copied, changed from r1490518, myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/renderkit/ProbeComponentRenderer.java
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/test/
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/test/component/
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/test/component/testMyUIPanel1.xhtml
- copied, changed from r1490518, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/index.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/test/component/testMyUIPanel2.xhtml
- copied, changed from r1490518, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/index.xhtml
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/RuntimeConfig.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/FacesConfig.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/FacesConfigData.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigDispenserImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/FacesConfig.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java?rev=1491587&r1=1491586&r2=1491587&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java Mon Jun 10 20:03:02 2013
@@ -75,6 +75,7 @@ import org.apache.myfaces.config.annotat
import org.apache.myfaces.config.annotation.LifecycleProviderFactory;
import org.apache.myfaces.config.element.Behavior;
import org.apache.myfaces.config.element.ClientBehaviorRenderer;
+import org.apache.myfaces.config.element.ComponentTagDeclaration;
import org.apache.myfaces.config.element.ContractMapping;
import org.apache.myfaces.config.element.FaceletsProcessing;
import org.apache.myfaces.config.element.FacesConfig;
@@ -758,6 +759,12 @@ public class FacesConfigurator
RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(_externalContext);
FacesConfigData dispenser = getDispenser();
+
+ for (ComponentTagDeclaration declaration : dispenser.getComponentTagDeclarations())
+ {
+ runtimeConfig.addComponentTagDeclaration(declaration);
+ }
+
for (ManagedBean bean : dispenser.getManagedBeans())
{
if (log.isLoggable(Level.WARNING) && runtimeConfig.getManagedBean(bean.getManagedBeanName()) != null)
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/RuntimeConfig.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/RuntimeConfig.java?rev=1491587&r1=1491586&r2=1491587&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/RuntimeConfig.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/RuntimeConfig.java Mon Jun 10 20:03:02 2013
@@ -38,6 +38,7 @@ import javax.faces.el.PropertyResolver;
import javax.faces.el.VariableResolver;
import org.apache.commons.collections.Predicate;
+import org.apache.myfaces.config.element.ComponentTagDeclaration;
import org.apache.myfaces.config.element.FaceletsProcessing;
import org.apache.myfaces.config.element.ManagedBean;
import org.apache.myfaces.config.element.NavigationRule;
@@ -104,6 +105,9 @@ public class RuntimeConfig
private Set<String> _resourceLibraryContracts = new HashSet<String>();
private Map<String, List<String>> _contractMappings = new HashMap<String, List<String>>();
+
+ private List<ComponentTagDeclaration> _componentTagDeclarations =
+ new ArrayList<ComponentTagDeclaration>();
public static RuntimeConfig getCurrentInstance(ExternalContext externalContext)
{
@@ -180,7 +184,16 @@ public class RuntimeConfig
_oldManagedBeans.remove(name);
}
}
-
+
+ public void addComponentTagDeclaration(ComponentTagDeclaration declaration)
+ {
+ _componentTagDeclarations.add(declaration);
+ }
+
+ public List<ComponentTagDeclaration> getComponentTagDeclarations()
+ {
+ return Collections.unmodifiableList(_componentTagDeclarations);
+ }
public final void addConverterConfiguration(final String converterClassName,
final org.apache.myfaces.config.element.Converter configuration)
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java?rev=1491587&r1=1491586&r2=1491587&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java Mon Jun 10 20:03:02 2013
@@ -47,6 +47,7 @@ import javax.faces.validator.FacesValida
import org.apache.myfaces.config.impl.digester.elements.Application;
import org.apache.myfaces.config.impl.digester.elements.Behavior;
+import org.apache.myfaces.config.impl.digester.elements.ComponentTagDeclarationImpl;
import org.apache.myfaces.config.impl.digester.elements.Converter;
import org.apache.myfaces.config.impl.digester.elements.FacesConfig;
import org.apache.myfaces.spi.AnnotationProvider;
@@ -120,6 +121,13 @@ public class AnnotationConfigurator
}
facesConfig.addComponent(comp.value(), clazz.getName());
+
+ if (comp.createTag())
+ {
+ facesConfig.addComponentTagDeclaration(comp.value(),
+ new ComponentTagDeclarationImpl(comp.value(),
+ comp.namespace(), comp.tagName()));
+ }
}
}
}
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/ComponentTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/ComponentTagDeclaration.java?rev=1491587&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/ComponentTagDeclaration.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/ComponentTagDeclaration.java Mon Jun 10 20:03:02 2013
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.config.element;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author lu4242
+ */
+public abstract class ComponentTagDeclaration implements Serializable
+{
+ public abstract String getComponentType();
+
+ public abstract String getNamespace();
+
+ public abstract String getTagName();
+
+}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/FacesConfig.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/FacesConfig.java?rev=1491587&r1=1491586&r2=1491587&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/FacesConfig.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/FacesConfig.java Mon Jun 10 20:03:02 2013
@@ -89,4 +89,13 @@ public abstract class FacesConfig implem
{
return Collections.emptyList();
}
+
+ /**
+ * @since 2.2.0
+ * @return
+ */
+ public Map<String, ComponentTagDeclaration> getComponentTagDeclarations()
+ {
+ return Collections.emptyMap();
+ }
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/FacesConfigData.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/FacesConfigData.java?rev=1491587&r1=1491586&r2=1491587&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/FacesConfigData.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/FacesConfigData.java Mon Jun 10 20:03:02 2013
@@ -260,4 +260,9 @@ public abstract class FacesConfigData im
{
return Collections.emptyList();
}
+
+ public Collection<ComponentTagDeclaration> getComponentTagDeclarations()
+ {
+ return Collections.emptyList();
+ }
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigDispenserImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigDispenserImpl.java?rev=1491587&r1=1491586&r2=1491587&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigDispenserImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigDispenserImpl.java Mon Jun 10 20:03:02 2013
@@ -37,6 +37,7 @@ import org.apache.myfaces.config.element
import org.apache.myfaces.config.element.NavigationRule;
import org.apache.myfaces.config.element.Renderer;
import org.apache.myfaces.config.element.Application;
+import org.apache.myfaces.config.element.ComponentTagDeclaration;
import org.apache.myfaces.config.element.ContractMapping;
import org.apache.myfaces.config.element.Converter;
import org.apache.myfaces.config.element.FacesConfig;
@@ -119,6 +120,8 @@ public class DigesterFacesConfigDispense
private List<String> protectedViewUrlPatterns = new ArrayList<String>();
private List<ContractMapping> resourceLibraryContractMappings = new ArrayList<ContractMapping>();
+ private List<ComponentTagDeclaration> componentTagDeclarations = new ArrayList<ComponentTagDeclaration>();
+
/**
* Add another unmarshalled faces config object.
*
@@ -258,6 +261,11 @@ public class DigesterFacesConfigDispense
}
}
}
+
+ for (ComponentTagDeclaration declaration : config.getComponentTagDeclarations().values())
+ {
+ componentTagDeclarations.add(declaration);
+ }
lifecyclePhaseListeners.addAll(config.getLifecyclePhaseListener());
managedBeans.addAll(config.getManagedBeans());
@@ -751,5 +759,11 @@ public class DigesterFacesConfigDispense
{
return resourceLibraryContractMappings;
}
-
+
+ @Override
+ public Collection<ComponentTagDeclaration> getComponentTagDeclarations()
+ {
+ return componentTagDeclarations;
+ }
+
}
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/ComponentTagDeclarationImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/ComponentTagDeclarationImpl.java?rev=1491587&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/ComponentTagDeclarationImpl.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/ComponentTagDeclarationImpl.java Mon Jun 10 20:03:02 2013
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.config.impl.digester.elements;
+
+import java.io.Serializable;
+import org.apache.myfaces.config.element.ComponentTagDeclaration;
+
+/**
+ *
+ * @author lu4242
+ */
+public class ComponentTagDeclarationImpl extends ComponentTagDeclaration implements Serializable
+{
+ private String componentType;
+ private String namespace;
+ private String tagName;
+
+ public ComponentTagDeclarationImpl(String componentType, String namespace, String tagName)
+ {
+ this.componentType = componentType;
+ this.namespace = namespace;
+ this.tagName = tagName;
+ }
+
+ /**
+ * @return the namespace
+ */
+ public String getNamespace()
+ {
+ return namespace;
+ }
+
+ /**
+ * @param namespace the namespace to set
+ */
+ public void setNamespace(String namespace)
+ {
+ this.namespace = namespace;
+ }
+
+ /**
+ * @return the tagName
+ */
+ public String getTagName()
+ {
+ return tagName;
+ }
+
+ /**
+ * @param tagName the tagName to set
+ */
+ public void setTagName(String tagName)
+ {
+ this.tagName = tagName;
+ }
+
+ /**
+ * @return the componentType
+ */
+ public String getComponentType()
+ {
+ return componentType;
+ }
+
+ /**
+ * @param componentType the componentType to set
+ */
+ public void setComponentType(String componentType)
+ {
+ this.componentType = componentType;
+ }
+}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/FacesConfig.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/FacesConfig.java?rev=1491587&r1=1491586&r2=1491587&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/FacesConfig.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/FacesConfig.java Mon Jun 10 20:03:02 2013
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.myfaces.config.element.ComponentTagDeclaration;
import org.apache.myfaces.config.element.FacesFlowDefinition;
/**
@@ -36,6 +37,10 @@ public class FacesConfig extends org.apa
private List<org.apache.myfaces.config.element.Factory> factories
= new ArrayList<org.apache.myfaces.config.element.Factory>();
private Map<String, String> components = new HashMap<String, String>();
+
+ private Map<String, org.apache.myfaces.config.element.ComponentTagDeclaration> componentTagDeclarations =
+ new HashMap<String, org.apache.myfaces.config.element.ComponentTagDeclaration>();
+
private List<org.apache.myfaces.config.element.Converter> converters
= new ArrayList<org.apache.myfaces.config.element.Converter>();
private List<org.apache.myfaces.config.element.ManagedBean> managedBeans
@@ -69,7 +74,7 @@ public class FacesConfig extends org.apa
public void addApplication(org.apache.myfaces.config.element.Application application)
{
- applications.add(application);
+ applications.add(application);
}
public void addFactory(org.apache.myfaces.config.element.Factory factory)
@@ -81,6 +86,12 @@ public class FacesConfig extends org.apa
{
components.put(componentType, componentClass);
}
+
+ public void addComponentTagDeclaration(String componentType,
+ org.apache.myfaces.config.element.ComponentTagDeclaration tagDeclaration)
+ {
+ componentTagDeclarations.put(componentType, tagDeclaration);
+ }
public void addConverter(org.apache.myfaces.config.element.Converter converter)
{
@@ -136,6 +147,11 @@ public class FacesConfig extends org.apa
{
return components;
}
+
+ public Map<String, ComponentTagDeclaration> getComponentTagDeclarations()
+ {
+ return componentTagDeclarations;
+ }
public List<org.apache.myfaces.config.element.Converter> getConverters()
{
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java?rev=1491587&r1=1491586&r2=1491587&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java Mon Jun 10 20:03:02 2013
@@ -90,6 +90,7 @@ import javax.servlet.http.HttpServletRes
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
import org.apache.myfaces.config.RuntimeConfig;
+import org.apache.myfaces.config.element.ComponentTagDeclaration;
import org.apache.myfaces.shared.application.DefaultViewHandlerSupport;
import org.apache.myfaces.shared.application.ViewHandlerSupport;
import org.apache.myfaces.shared.config.MyfacesConfig;
@@ -133,6 +134,7 @@ import org.apache.myfaces.view.facelets.
import static org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.*;
import org.apache.myfaces.view.facelets.compiler.RefreshDynamicComponentListener;
import org.apache.myfaces.view.facelets.impl.SectionUniqueIdCounter;
+import org.apache.myfaces.view.facelets.tag.ComponentTagDeclarationLibrary;
import org.apache.myfaces.view.facelets.tag.composite.CreateDynamicCompositeComponentListener;
import org.apache.myfaces.view.facelets.tag.jsf.JsfLibrary;
import org.apache.myfaces.view.facelets.tag.jsf.PartialMethodExpressionActionListener;
@@ -2575,7 +2577,27 @@ public class FaceletViewDeclarationLangu
CompositeResourceLibrary.ALIAS_NAMESPACE_PREFIX));
compiler.addTagLibrary(new JsfLibrary());
compiler.addTagLibrary(new PassThroughLibrary());
-
+
+ RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(eContext);
+ if (!runtimeConfig.getComponentTagDeclarations().isEmpty())
+ {
+ ComponentTagDeclarationLibrary componentTagDeclarationLibrary = new ComponentTagDeclarationLibrary();
+ for (ComponentTagDeclaration declaration : runtimeConfig.getComponentTagDeclarations())
+ {
+ // We have here probably an inconsistency, because the annotation does not
+ // have a default renderer type. Let the renderer type be null will cause problems
+ // later, because application.createComponent() may not scan the renderer class if
+ // a rendererType is not provided. The easy way to overcome this situation is create
+ // a dummy instance and check its rendererType. If is set the renderer if any will be
+ // scanned for annotations, if not it just do things as usual. It is unlikely to create
+ // a component and does not set a default renderer type if is required.
+ UIComponent component = context.getApplication().createComponent(declaration.getComponentType());
+ componentTagDeclarationLibrary.addComponent(declaration.getNamespace(),
+ declaration.getTagName(), declaration.getComponentType(), component.getRendererType());
+ }
+ compiler.addTagLibrary(componentTagDeclarationLibrary);
+ }
+
String param = WebConfigParamUtils.getStringInitParameter(eContext, PARAMS_LIBRARIES);
if (param != null)
{
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ComponentTagDeclarationLibrary.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ComponentTagDeclarationLibrary.java?rev=1491587&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ComponentTagDeclarationLibrary.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ComponentTagDeclarationLibrary.java Mon Jun 10 20:03:02 2013
@@ -0,0 +1,294 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.tag;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.FaceletHandler;
+import javax.faces.view.facelets.Tag;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagHandler;
+
+/**
+ *
+ * @author lu4242
+ */
+public class ComponentTagDeclarationLibrary implements TagLibrary
+{
+ private final Map<String, Map<String, TagHandlerFactory>> _factories;
+
+ public ComponentTagDeclarationLibrary()
+ {
+ _factories = new HashMap<String, Map<String, TagHandlerFactory>>();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.myfaces.view.facelets.tag.TagLibrary#containsNamespace(java.lang.String)
+ */
+ public boolean containsNamespace(String ns)
+ {
+ return _factories.containsKey(ns);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.myfaces.view.facelets.tag.TagLibrary#containsTagHandler(java.lang.String, java.lang.String)
+ */
+ public boolean containsTagHandler(String ns, String localName)
+ {
+ if (containsNamespace(ns))
+ {
+ Map<String, TagHandlerFactory> map = _factories.get(ns);
+ if (map == null)
+ {
+ return false;
+ }
+ return map.containsKey(localName);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.myfaces.view.facelets.tag.TagLibrary#createTagHandler(java.lang.String, java.lang.String,
+ * org.apache.myfaces.view.facelets.tag.TagConfig)
+ */
+ public TagHandler createTagHandler(String ns, String localName, TagConfig tag) throws FacesException
+ {
+ if (containsNamespace(ns))
+ {
+ Map<String, TagHandlerFactory> map = _factories.get(ns);
+ if (map == null)
+ {
+ map = new HashMap<String, TagHandlerFactory>();
+ _factories.put(ns, map);
+ }
+ TagHandlerFactory f = map.get(localName);
+ if (f != null)
+ {
+ return f.createHandler(tag);
+ }
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.myfaces.view.facelets.tag.TagLibrary#containsFunction(java.lang.String, java.lang.String)
+ */
+ public boolean containsFunction(String ns, String name)
+ {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.myfaces.view.facelets.tag.TagLibrary#createFunction(java.lang.String, java.lang.String)
+ */
+ public Method createFunction(String ns, String name)
+ {
+ return null;
+ }
+
+ /*
+ public String getNamespace()
+ {
+ return _namespace;
+ }*/
+
+ /**
+ * Add a ComponentHandler with the specified componentType and rendererType, aliased by the tag name.
+ *
+ * @see ComponentHandler
+ * @see javax.faces.application.Application#createComponent(java.lang.String)
+ * @param name
+ * name to use, "foo" would be <my:foo />
+ * @param componentType
+ * componentType to use
+ * @param rendererType
+ * rendererType to use
+ */
+ public final void addComponent(String namespace, String name, String componentType, String rendererType)
+ {
+ Map<String, TagHandlerFactory> map = _factories.get(namespace);
+ if (map == null)
+ {
+ map = new HashMap<String, TagHandlerFactory>();
+ _factories.put(namespace, map);
+ }
+ map.put(name, new ComponentHandlerFactory(componentType, rendererType));
+ }
+
+ /**
+ * Add a ComponentHandler with the specified componentType and rendererType, aliased by the tag name. The Facelet
+ * will be compiled with the specified HandlerType (which must extend AbstractComponentHandler).
+ *
+ * @see AbstractComponentHandler
+ * @param name
+ * name to use, "foo" would be <my:foo />
+ * @param componentType
+ * componentType to use
+ * @param rendererType
+ * rendererType to use
+ * @param handlerType
+ * a Class that extends AbstractComponentHandler
+ */
+ public final void addComponent(String namespace, String name, String componentType, String rendererType,
+ Class<? extends TagHandler> handlerType)
+ {
+ Map<String, TagHandlerFactory> map = _factories.get(namespace);
+ if (map == null)
+ {
+ map = new HashMap<String, TagHandlerFactory>();
+ _factories.put(namespace, map);
+ }
+ map.put(name, new UserComponentHandlerFactory(componentType, rendererType, handlerType));
+ }
+
+ private static class ComponentConfigWrapper implements ComponentConfig
+ {
+
+ protected final TagConfig parent;
+
+ protected final String componentType;
+
+ protected final String rendererType;
+
+ public ComponentConfigWrapper(TagConfig parent, String componentType, String rendererType)
+ {
+ this.parent = parent;
+ this.componentType = componentType;
+ this.rendererType = rendererType;
+ }
+
+ public String getComponentType()
+ {
+ return this.componentType;
+ }
+
+ public String getRendererType()
+ {
+ return this.rendererType;
+ }
+
+ public FaceletHandler getNextHandler()
+ {
+ return this.parent.getNextHandler();
+ }
+
+ public Tag getTag()
+ {
+ return this.parent.getTag();
+ }
+
+ public String getTagId()
+ {
+ return this.parent.getTagId();
+ }
+ }
+
+ private static class ComponentHandlerFactory implements TagHandlerFactory
+ {
+
+ protected final String componentType;
+
+ protected final String renderType;
+
+ /**
+ * @param handlerType
+ */
+ public ComponentHandlerFactory(String componentType, String renderType)
+ {
+ this.componentType = componentType;
+ this.renderType = renderType;
+ }
+
+ public TagHandler createHandler(TagConfig cfg) throws FacesException, ELException
+ {
+ ComponentConfig ccfg = new ComponentConfigWrapper(cfg, this.componentType, this.renderType);
+ return new javax.faces.view.facelets.ComponentHandler(ccfg);
+ }
+ }
+
+ private static class UserComponentHandlerFactory implements TagHandlerFactory
+ {
+
+ private final static Class<?>[] CONS_SIG = new Class[] { ComponentConfig.class };
+
+ protected final String componentType;
+
+ protected final String renderType;
+
+ protected final Class<? extends TagHandler> type;
+
+ protected final Constructor<? extends TagHandler> constructor;
+
+ /**
+ * @param handlerType
+ */
+ public UserComponentHandlerFactory(String componentType, String renderType, Class<? extends TagHandler> type)
+ {
+ this.componentType = componentType;
+ this.renderType = renderType;
+ this.type = type;
+ try
+ {
+ this.constructor = this.type.getConstructor(CONS_SIG);
+ }
+ catch (Exception e)
+ {
+ throw new FaceletException("Must have a Constructor that takes in a ComponentConfig", e);
+ }
+ }
+
+ public TagHandler createHandler(TagConfig cfg) throws FacesException, ELException
+ {
+ try
+ {
+ ComponentConfig ccfg = new ComponentConfigWrapper(cfg, componentType, renderType);
+ return constructor.newInstance(new Object[] { ccfg });
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new FaceletException(e.getCause().getMessage(), e.getCause().getCause());
+ }
+ catch (Exception e)
+ {
+ throw new FaceletException("Error Instantiating ComponentHandler: " + this.type.getName(), e);
+ }
+ }
+ }
+}
Copied: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/FacesComponentAnnotationMyFacesRequestTestCase.java (from r1490518, myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/FacesComponentAnnotationMyFacesRequestTestCase.java?p2=myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/FacesComponentAnnotationMyFacesRequestTestCase.java&p1=myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java&r1=1490518&r2=1491587&rev=1491587&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/FacesComponentAnnotationMyFacesRequestTestCase.java Mon Jun 10 20:03:02 2013
@@ -16,25 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.view.facelets.pss.acid;
+package org.apache.myfaces.view.facelets.test.component;
import javax.el.ExpressionFactory;
import javax.faces.application.StateManager;
-import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
-import javax.faces.component.UIPanel;
-import javax.faces.component.html.HtmlDataTable;
-
import junit.framework.Assert;
import org.apache.myfaces.mc.test.core.AbstractMyFacesRequestTestCase;
import org.apache.myfaces.shared.config.MyfacesConfig;
-import org.apache.myfaces.test.mock.MockPrintWriter;
-import org.apache.myfaces.view.facelets.pss.acid.managed.ResourceDependencyBean;
import org.junit.Test;
-public class AcidMyFacesRequestTestCase extends AbstractMyFacesRequestTestCase
+public class FacesComponentAnnotationMyFacesRequestTestCase extends AbstractMyFacesRequestTestCase
{
@Override
@@ -47,8 +40,7 @@ public class AcidMyFacesRequestTestCase
protected void setUpWebConfigParams() throws Exception
{
super.setUpWebConfigParams();
- servletContext.addInitParameter("org.apache.myfaces.annotation.SCAN_PACKAGES","org.apache.myfaces.view.facelets.pss.acid");
- servletContext.addInitParameter("javax.faces.FACELETS_LIBRARIES", "/WEB-INF/testcomponent.taglib.xml");
+ servletContext.addInitParameter("org.apache.myfaces.annotation.SCAN_PACKAGES","org.apache.myfaces.view.facelets.test.component");
servletContext.addInitParameter(StateManager.STATE_SAVING_METHOD_PARAM_NAME, StateManager.STATE_SAVING_METHOD_CLIENT);
servletContext.addInitParameter("javax.faces.PARTIAL_STATE_SAVING", "true");
servletContext.addInitParameter(MyfacesConfig.INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS, "auto");
@@ -60,657 +52,28 @@ public class AcidMyFacesRequestTestCase
}
@Test
- public void testIndex() throws Exception
- {
- setupRequest("/index.xhtml");
- processLifecycleExecuteAndRender();
-
- UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(1, comp.getChildCount());
- Assert.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
-
- /*
- MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
- Assert.assertTrue(new String(writer1.content()).contains(
- "<div style=\"border: 1px solid red; margin: 2px\">" +
- "<div style=\"background-color: #ffc0c0; padding: 2px; margin-bottom: 5px; display:block\">" +
- "TestComponent::encodeBegin <span style=\"color: #888888\">(1 children)</span>" +
- "</div>" +
- "Dynamically added child" +
- "<div style=\"background-color: #ffc0c0; padding: 2px; margin-top: 5px; display:block\">TestComponent::encodeEnd</div></div>"));
- */
- //System.out.println(writer1.content());
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
-
- comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(1, comp.getChildCount());
- Assert.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
- /*
- MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
- Assert.assertTrue(new String(writer2.content()).contains(
- "<div style=\"border: 1px solid red; margin: 2px\">" +
- "<div style=\"background-color: #ffc0c0; padding: 2px; margin-bottom: 5px; display:block\">" +
- "TestComponent::encodeBegin <span style=\"color: #888888\">(1 children)</span>" +
- "</div>" +
- "Dynamically added child" +
- "<div style=\"background-color: #ffc0c0; padding: 2px; margin-top: 5px; display:block\">TestComponent::encodeEnd</div></div>"));
- */
- //System.out.println(writer2.content());
- tearDownRequest();
- }
-
- @Test
- public void testInput() throws Exception
- {
- setupRequest("/input.xhtml");
- processLifecycleExecuteAndRender();
- UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
-
- Assert.assertEquals(1, comp.getChildCount());
- Assert.assertEquals(1, comp.getChildren().get(0).getChildCount());
- Assert.assertEquals("mainForm:input", comp.getChildren().get(0).getChildren().get(0).getClientId(facesContext));
- /*
- MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
- Assert.assertTrue(new String(writer1.content()).contains(
- "<div style=\"border: 1px solid red; margin: 2px\">" +
- "<div style=\"background-color: #ffc0c0; padding: 2px; margin-bottom: 5px; display:block\">" +
- "TestComponent::encodeBegin <span style=\"color: #888888\">(1 children)</span>" +
- "</div>" +
- "<span style=\"border: 1px dashed blue; padding: 5px; margin: 5px\">" +
- "<input id=\"mainForm:input\" name=\"mainForm:input\" type=\"text\" value=\"Foo\" style=\"background-color: red\" />" +
- "</span>" +
- "<div style=\"background-color: #ffc0c0; padding: 2px; margin-top: 5px; display:block\">TestComponent::encodeEnd</div></div>"));
- */
- //System.out.println(writer1.content());
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
-
- comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(1, comp.getChildCount());
- Assert.assertEquals(1, comp.getChildren().get(0).getChildCount());
- Assert.assertEquals("mainForm:input", comp.getChildren().get(0).getChildren().get(0).getClientId(facesContext));
-
- /*
- MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
- System.out.println(writer2.content());
- Assert.assertTrue(new String(writer2.content()).contains(
- "<div style=\"border: 1px solid red; margin: 2px\">" +
- "<div style=\"background-color: #ffc0c0; padding: 2px; margin-bottom: 5px; display:block\">" +
- "TestComponent::encodeBegin <span style=\"color: #888888\">(1 children)</span>" +
- "</div>" +
- "<span style=\"border: 1px dashed blue; padding: 5px; margin: 5px\">" +
- "<input id=\"mainForm:input\" name=\"mainForm:input\" type=\"text\" value=\"Foo\" style=\"background-color: red\" />" +
- "</span>" +
- "<div style=\"background-color: #ffc0c0; padding: 2px; margin-top: 5px; display:block\">TestComponent::encodeEnd</div></div>"));
- */
- }
-
- @Test
- public void testRecursive() throws Exception
- {
- setupRequest("/recursive.xhtml");
- processLifecycleExecuteAndRender();
- UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(2, comp.getChildCount());
- Assert.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
- Assert.assertEquals(1, comp.getChildren().get(1).getChildCount());
- Assert.assertEquals("Dynamically added child", comp.getChildren().get(1).getChildren().get(0).getAttributes().get("value"));
-
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
-
- comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(2, comp.getChildCount());
- Assert.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
- Assert.assertEquals(1, comp.getChildren().get(1).getChildCount());
- Assert.assertEquals("Dynamically added child", comp.getChildren().get(1).getChildren().get(0).getAttributes().get("value"));
-
- tearDownRequest();
- }
-
- @Test
- public void testStable() throws Exception
- {
- setupRequest("/stable.xhtml");
- processLifecycleExecuteAndRender();
- UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(3, comp.getChildCount());
- Assert.assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
- Assert.assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
- Assert.assertEquals("text3", comp.getChildren().get(2).getId());
-
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
-
- comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(3, comp.getChildCount());
- Assert.assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
- Assert.assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
- Assert.assertEquals("text3", comp.getChildren().get(2).getId());
-
- button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
-
- comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(3, comp.getChildCount());
- Assert.assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
- Assert.assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
- Assert.assertEquals("text3", comp.getChildren().get(2).getId());
-
- button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- UIInput input = (UIInput) facesContext.getViewRoot().findComponent("mainForm:text3");
- inputText(input, "3");
- submit(button);
- processLifecycleExecuteAndRender();
-
- comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(3, comp.getChildCount());
- Assert.assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
- Assert.assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
- Assert.assertEquals("text3", comp.getChildren().get(2).getId());
-
- }
-
- @Test
- public void testTable() throws Exception
- {
- setupRequest("/table.xhtml");
- processLifecycleExecuteAndRender();
-
- UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(1, comp.getChildCount());
- HtmlDataTable dataTable = (HtmlDataTable) comp.getChildren().get(0);
- Assert.assertEquals(1, dataTable.getChildCount());
-
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
-
- comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(1, comp.getChildCount());
- dataTable = (HtmlDataTable) comp.getChildren().get(0);
- Assert.assertEquals(1, dataTable.getChildCount());
- }
-
- @Test
- public void testToggle() throws Exception
- {
- setupRequest("/toggle.xhtml");
- processLifecycleExecuteAndRender();
-
- UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(2, comp.getChildCount());
- Assert.assertEquals("Manually added child 2<br/>", comp.getChildren().get(0).getAttributes().get("value"));
- Assert.assertEquals("Manually added child 1<br/>", comp.getChildren().get(1).getAttributes().get("value"));
-
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
-
- comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(2, comp.getChildCount());
- Assert.assertEquals("Manually added child 1<br/>", comp.getChildren().get(0).getAttributes().get("value"));
- Assert.assertEquals("Manually added child 2<br/>", comp.getChildren().get(1).getAttributes().get("value"));
-
- button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
-
- comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(2, comp.getChildCount());
- Assert.assertEquals("Manually added child 2<br/>", comp.getChildren().get(0).getAttributes().get("value"));
- Assert.assertEquals("Manually added child 1<br/>", comp.getChildren().get(1).getAttributes().get("value"));
-
- button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
-
- comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(2, comp.getChildCount());
- Assert.assertEquals("Manually added child 1<br/>", comp.getChildren().get(0).getAttributes().get("value"));
- Assert.assertEquals("Manually added child 2<br/>", comp.getChildren().get(1).getAttributes().get("value"));
-
- }
-
- @Test
- public void testInclude() throws Exception
- {
- setupRequest("/include.xhtml");
- processLifecycleExecute();
- //Build the view
- facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
- facesContext, facesContext.getViewRoot().getViewId()).buildView(facesContext, facesContext.getViewRoot());
- //Set a token to save on the state as delta
- UIComponent component = facesContext.getViewRoot().findComponent("mainForm:component1");
- component.getAttributes().put("test", "test1");
- processRender();
-
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page1");
- submit(button);
- processLifecycleExecute();
- //Check it is restored
- component = facesContext.getViewRoot().findComponent("mainForm:component1");
- Assert.assertEquals("test1", component.getAttributes().get("test"));
- processRender();
- //Check buildView does not destroy the state
- component = facesContext.getViewRoot().findComponent("mainForm:component1");
- Assert.assertEquals("test1", component.getAttributes().get("test"));
-
- //Go to page2
- button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
- submit(button);
-
- processLifecycleExecute();
- component = facesContext.getViewRoot().findComponent("mainForm:component1");
- //Check it is restored
- Assert.assertEquals("test1", component.getAttributes().get("test"));
-
- //Build the view
- facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
- facesContext, facesContext.getViewRoot().getViewId()).buildView(facesContext, facesContext.getViewRoot());
-
- //Check the page was changed and the state discarded, because it is a different component.
- component = facesContext.getViewRoot().findComponent("mainForm:component2");
- Assert.assertNull(component.getAttributes().get("test"));
- //Set a token to save on the state as delta
- component.getAttributes().put("test", "test2");
- processRender();
-
- component = facesContext.getViewRoot().findComponent("mainForm:component2");
- Assert.assertEquals("test2", component.getAttributes().get("test"));
-
- button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
- submit(button);
-
- processLifecycleExecute();
- component = facesContext.getViewRoot().findComponent("mainForm:component2");
- //Check it is restored
- Assert.assertNotNull("mainForm:component2 was not restored correctly",component);
- Assert.assertEquals("test2", component.getAttributes().get("test"));
-
- //Build the view
- facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
- facesContext, facesContext.getViewRoot().getViewId()).buildView(facesContext, facesContext.getViewRoot());
-
- //Check buildView does not destroy the state
- component = facesContext.getViewRoot().findComponent("mainForm:component2");
- Assert.assertEquals("test2", component.getAttributes().get("test"));
-
- button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
- submit(button);
-
- processLifecycleExecute();
- component = facesContext.getViewRoot().findComponent("mainForm:component2");
- //Check it is restored
- Assert.assertEquals("test2", component.getAttributes().get("test"));
- }
-
- /**
- * Same as testInclude, but only check the component is restored correctly.
- * Since there is no delta, no state is saved unless it is necessary.
- *
- * @throws Exception
- */
- @Test
- public void testInclude2() throws Exception
- {
- setupRequest("/include.xhtml");
- processLifecycleExecute();
- //Build the view
- facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
- facesContext, facesContext.getViewRoot().getViewId()).buildView(facesContext, facesContext.getViewRoot());
- //Set a token to save on the state as delta
- UIComponent component = facesContext.getViewRoot().findComponent("mainForm:component1");
- Assert.assertNotNull(component);
- processRender();
-
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page1");
- submit(button);
-
- processLifecycleExecute();
- //Check it is restored
- component = facesContext.getViewRoot().findComponent("mainForm:component1");
- Assert.assertNotNull(component);
- processRender();
- //Check buildView does not destroy the state
- component = facesContext.getViewRoot().findComponent("mainForm:component1");
- Assert.assertNotNull(component);
-
- //Go to page2
- button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
- submit(button);
-
- processLifecycleExecute();
- component = facesContext.getViewRoot().findComponent("mainForm:component1");
- //Check it is restored
- Assert.assertNotNull(component);
-
- //Build the view
- facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
- facesContext, facesContext.getViewRoot().getViewId()).buildView(facesContext, facesContext.getViewRoot());
-
- //Check the page was changed and the state discarded, because it is a different component.
- component = facesContext.getViewRoot().findComponent("mainForm:component2");
- Assert.assertNotNull(component);
- processRender();
-
- component = facesContext.getViewRoot().findComponent("mainForm:component2");
- Assert.assertNotNull(component);
-
- button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
- submit(button);
-
- processLifecycleExecute();
- component = facesContext.getViewRoot().findComponent("mainForm:component2");
- //Check it is restored
- Assert.assertNotNull(component);
-
- //Build the view
- facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
- facesContext, facesContext.getViewRoot().getViewId()).buildView(facesContext, facesContext.getViewRoot());
-
- //Check buildView does not destroy the state
- component = facesContext.getViewRoot().findComponent("mainForm:component2");
- Assert.assertNotNull(component);
-
- button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
- submit(button);
-
- processLifecycleExecute();
- component = facesContext.getViewRoot().findComponent("mainForm:component2");
- //Check it is restored
- Assert.assertNotNull(component);
- }
-
- /**
- * Check if a dynamic subtree can be created from a binding property, and if it
- * will be preserved across request.
- *
- * The idea is just inject a subtree using some code like this:
- * <code><h:panelGroup id="panel" binding="#{componentBindingBean.panel}"></code>
- *
- * The solution is if a binding returns a component that has children or facets
- * attached, it is not elegible for PSS algorithm because the additional components
- * are created outside facelets control, and there is no warrant that the same structure
- * will be generated across requests, violating PSS base principle (it is possible to
- * restore to the initial state calling vdl.buildView).
- *
- * This test is here because all state saving modes should support this method.
- *
- * @throws Exception
- */
- @Test
- public void testComponentBinding() throws Exception
+ public void testUIPanel1() throws Exception
{
- setupRequest("/componentBinding1.xhtml");
- processLifecycleExecuteAndRender();
-
- UIComponent comp = facesContext.getViewRoot().findComponent("panel");
- Assert.assertNotNull(comp);
- Assert.assertEquals(1, comp.getChildCount());
-
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
+ setupRequest("/testMyUIPanel1.xhtml");
processLifecycleExecuteAndRender();
- Assert.assertNotNull(comp);
- // Even if in the postback two components were added, pss algorithm must replace the
- // component with the one saved.
- Assert.assertEquals(1, comp.getChildCount());
-
- comp = facesContext.getViewRoot().findComponent("panel");
- Assert.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assert.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
-
- button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
-
- comp = facesContext.getViewRoot().findComponent("panel");
+ UIComponent comp = facesContext.getViewRoot().findComponent("panel1");
Assert.assertNotNull(comp);
- // Even if in the postback two components were added, pss algorithm must replace the
- // component with the one saved.
- Assert.assertEquals(1, comp.getChildCount());
-
- Assert.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assert.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
-
- tearDownRequest();
- }
-
- @Test
- public void testResourceDependency() throws Exception
- {
- setupRequest("/resourceDependency1.xhtml");
- processLifecycleExecute();
-
- executeBeforeRender(facesContext);
- executeBuildViewCycle(facesContext);
-
- UIPanel headPanel = (UIPanel) facesContext.getViewRoot().getFacet("head");
- Assert.assertNotNull(headPanel);
- Assert.assertEquals(1, headPanel.getChildCount());
-
- String nextUniqueId = facesContext.getViewRoot().createUniqueId(facesContext, null);
-
- executeViewHandlerRender(facesContext);
- executeAfterRender(facesContext);
-
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
-
- processLifecycleExecute();
-
- ResourceDependencyBean bean = facesContext.getApplication().evaluateExpressionGet(
- facesContext, "#{resourceDependencyBean}", ResourceDependencyBean.class);
- bean.setIncludeContent(true);
-
- executeBeforeRender(facesContext);
- executeBuildViewCycle(facesContext);
-
- headPanel = (UIPanel) facesContext.getViewRoot().getFacet("head");
- Assert.assertNotNull(headPanel);
- Assert.assertEquals(1, headPanel.getChildCount());
- Assert.assertNotSame(nextUniqueId, headPanel.getChildren().get(0).getId());
-
- executeViewHandlerRender(facesContext);
- executeAfterRender(facesContext);
- }
-
- @Test
- public void testAddSimpleComponentVDL() throws Exception
- {
- setupRequest("/addSimpleComponentVDL.xhtml");
- processLifecycleExecuteAndRender();
-
- UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(1, comp.getChildCount());
- Assert.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
-
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
-
- comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(1, comp.getChildCount());
- Assert.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
-
- tearDownRequest();
- }
-
- @Test
- public void testAddSimpleIncludeVDL_1() throws Exception
- {
- setupRequest("/addSimpleIncludeVDL_1.xhtml");
- processLifecycleExecuteAndRender();
-
- UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(1, comp.getChildCount());
- UIComponent wrapper = comp.getChildren().get(0);
- Assert.assertEquals(2, wrapper.getChildCount());
- Assert.assertEquals("Dynamically added child", wrapper.getChildren().get(1).getAttributes().get("value"));
- MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
- Assert.assertTrue(new String(writer1.content()).contains("Dynamically added markup"));
-
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
-
- comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(1, comp.getChildCount());
- wrapper = comp.getChildren().get(0);
- Assert.assertEquals(2, wrapper.getChildCount());
- Assert.assertEquals("Dynamically added child", wrapper.getChildren().get(1).getAttributes().get("value"));
- MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
- Assert.assertTrue(new String(writer2.content()).contains("Dynamically added markup"));
-
- tearDownRequest();
- }
-
- @Test
- public void testAddSimpleIncludeVDL_2() throws Exception
- {
- setupRequest("/addSimpleIncludeVDL_2.xhtml");
- processLifecycleExecuteAndRender();
-
- UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(1, comp.getChildCount());
- UIComponent wrapper = comp.getChildren().get(0);
- Assert.assertEquals(2, wrapper.getChildCount());
- Assert.assertEquals("Dynamically added child", wrapper.getChildren().get(1).getAttributes().get("value"));
- MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
- Assert.assertTrue(new String(writer1.content()).contains("Dynamically added markup"));
-
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
+ Assert.assertTrue(comp instanceof MyUIPanel1);
- comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(1, comp.getChildCount());
- wrapper = comp.getChildren().get(0);
- Assert.assertEquals(2, wrapper.getChildCount());
- Assert.assertEquals("Dynamically added child", wrapper.getChildren().get(1).getAttributes().get("value"));
- MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
- Assert.assertTrue(new String(writer2.content()).contains("Dynamically added markup"));
-
tearDownRequest();
- }
-
- @Test
- public void testAddSimpleCCVDL() throws Exception
- {
- setupRequest("/addSimpleCCVDL.xhtml");
- processLifecycleExecuteAndRender();
-
- UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(1, comp.getChildCount());
- UIComponent wrapper = comp.getChildren().get(0);
- Assert.assertNotNull(wrapper);
- Assert.assertTrue(UIComponent.isCompositeComponent(wrapper));
- UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assert.assertNotNull(ccContent);
- Assert.assertEquals(3, ccContent.getChildCount());
- Assert.assertEquals("Dynamically added header",
- ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assert.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
- MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
- Assert.assertTrue(new String(writer1.content()).contains("Dynamically added markup"));
-
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
-
- comp = facesContext.getViewRoot().findComponent("mainForm:component");
- Assert.assertEquals(1, comp.getChildCount());
- wrapper = comp.getChildren().get(0);
- Assert.assertNotNull(wrapper);
- Assert.assertTrue(UIComponent.isCompositeComponent(wrapper));
- ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assert.assertNotNull(ccContent);
- Assert.assertEquals(3, ccContent.getChildCount());
- Assert.assertEquals("Dynamically added header",
- ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assert.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
- MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
- Assert.assertTrue(new String(writer2.content()).contains("Dynamically added markup"));
+ }
- tearDownRequest();
- }
-
@Test
- public void testComponentBindingVDL_1() throws Exception
+ public void testUIPanel2() throws Exception
{
- setupRequest("/componentBindingVDL_1.xhtml");
+ setupRequest("/testMyUIPanel2.xhtml");
processLifecycleExecuteAndRender();
- UIComponent comp = facesContext.getViewRoot().findComponent("panel");
- Assert.assertNotNull(comp);
- Assert.assertEquals(2, comp.getChildCount());
-
- UIComponent wrapper = comp.getChildren().get(1);
- Assert.assertNotNull(wrapper);
- Assert.assertTrue(UIComponent.isCompositeComponent(wrapper));
- UIComponent ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assert.assertNotNull(ccContent);
- Assert.assertEquals(3, ccContent.getChildCount());
- Assert.assertEquals("Dynamically added header",
- ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assert.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
- MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
- Assert.assertTrue(new String(writer1.content()).contains("Dynamically added markup"));
-
- UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
+ UIComponent comp = facesContext.getViewRoot().findComponent("panel1");
Assert.assertNotNull(comp);
- Assert.assertEquals(2, comp.getChildCount());
-
- comp = facesContext.getViewRoot().findComponent("panel");
-
- Assert.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assert.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
-
- wrapper = comp.getChildren().get(1);
- Assert.assertNotNull(wrapper);
- Assert.assertTrue(UIComponent.isCompositeComponent(wrapper));
- ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assert.assertNotNull(ccContent);
- Assert.assertEquals(3, ccContent.getChildCount());
- Assert.assertEquals("Dynamically added header",
- ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assert.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
- MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
- Assert.assertTrue(new String(writer2.content()).contains("Dynamically added markup"));
-
- button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
- submit(button);
- processLifecycleExecuteAndRender();
- Assert.assertNotNull(comp);
- Assert.assertEquals(2, comp.getChildCount());
-
- comp = facesContext.getViewRoot().findComponent("panel");
-
- Assert.assertEquals("value1", comp.getAttributes().get("attr1"));
- Assert.assertEquals("value2", comp.getChildren().get(0).getAttributes().get("attr2"));
-
- wrapper = comp.getChildren().get(1);
- Assert.assertNotNull(wrapper);
- Assert.assertTrue(UIComponent.isCompositeComponent(wrapper));
- ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- Assert.assertNotNull(ccContent);
- Assert.assertEquals(3, ccContent.getChildCount());
- Assert.assertEquals("Dynamically added header",
- ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
- Assert.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
- MockPrintWriter writer3 = (MockPrintWriter) response.getWriter();
- Assert.assertTrue(new String(writer3.content()).contains("Dynamically added markup"));
+ Assert.assertTrue(comp instanceof MyUIPanel2);
tearDownRequest();
- }
+ }
}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel1.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel1.java?rev=1491587&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel1.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel1.java Mon Jun 10 20:03:02 2013
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.test.component;
+
+import javax.faces.component.FacesComponent;
+import javax.faces.component.UIPanel;
+
+/**
+ *
+ * @author Leonardo Uribe
+ */
+@FacesComponent(value="oam.my.UIPanel1", createTag=true, tagName="myUIPanel1")
+public class MyUIPanel1 extends UIPanel
+{
+
+ public MyUIPanel1()
+ {
+ super();
+ }
+
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel2.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel2.java?rev=1491587&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel2.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel2.java Mon Jun 10 20:03:02 2013
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.test.component;
+
+import javax.faces.component.FacesComponent;
+import javax.faces.component.UIPanel;
+
+/**
+ *
+ * @author Leonardo Uribe
+ */
+@FacesComponent(value="oam.my.UIPanel2", createTag=true, tagName="myUIPanel2",
+ namespace="http://my.coolorganization.org/tags")
+public class MyUIPanel2 extends UIPanel
+{
+
+ public MyUIPanel2()
+ {
+ super();
+ setRendererType("oam.my.UIPanel2");
+ }
+
+}
Copied: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel2Renderer.java (from r1490518, myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/renderkit/ProbeComponentRenderer.java)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel2Renderer.java?p2=myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel2Renderer.java&p1=myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/renderkit/ProbeComponentRenderer.java&r1=1490518&r2=1491587&rev=1491587&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/renderkit/ProbeComponentRenderer.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/MyUIPanel2Renderer.java Mon Jun 10 20:03:02 2013
@@ -16,43 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.view.facelets.pss.acid.renderkit;
+package org.apache.myfaces.view.facelets.test.component;
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
import javax.faces.render.FacesRenderer;
import javax.faces.render.Renderer;
-@FacesRenderer(componentFamily = "com.myapp", rendererType = "testcomponent")
-public class ProbeComponentRenderer extends Renderer
+@FacesRenderer(componentFamily = "oam.my.UIPanel2", rendererType = "oam.my.UIPanel2")
+public class MyUIPanel2Renderer extends Renderer
{
- //
- // Public methods
- //
-
- @Override
- public void encodeBegin(FacesContext context, UIComponent component)
- throws IOException
- {
-
- context.getResponseWriter()
- .write("<div style=\"border: 1px solid red; margin: 2px\"><div style=\"background-color: #ffc0c0; padding: 2px; margin-bottom: 5px; display:block\">TestComponent::encodeBegin <span style=\"color: #888888\">("
- + component.getChildCount() + " children)</span></div>");
-
- super.encodeBegin(context, component);
- }
-
- @Override
- public void encodeEnd(FacesContext context, UIComponent component)
- throws IOException
- {
-
- super.encodeEnd(context, component);
-
- context.getResponseWriter()
- .write("<div style=\"background-color: #ffc0c0; padding: 2px; margin-top: 5px; display:block\">TestComponent::encodeEnd</div></div>");
- }
}
Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/test/component/testMyUIPanel1.xhtml (from r1490518, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/index.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/test/component/testMyUIPanel1.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/test/component/testMyUIPanel1.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/index.xhtml&r1=1490518&r2=1491587&rev=1491587&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/index.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/test/component/testMyUIPanel1.xhtml Mon Jun 10 20:03:02 2013
@@ -16,27 +16,10 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:test="http://testcomponent"
- template="common.xhtml">
-
- <h2>Add Test Instructions</h2>
-
- <ol>
- <li>The component should have dynamically modified the tree so that 'Dynamically added child' appears inside the red box</li>
- <li>Click 'POSTback'. The 'Dynamically added child' should not disappear (because it should have been serialized in the ViewState)</li>
- </ol>
-
- <h:messages/>
-
- <h:form id="mainForm">
-
- <test:addcomponent id="component"/>
-
- <br/>
-
- <h:commandButton id="postback" value="POSTback" action="#{testManagedBean.save}"/>
-
- </h:form>
+ xmlns:custom="http://xmlns.jcp.org/jsf/component">
+<custom:myUIPanel1 id="panel1">
+ Hello World
+</custom:myUIPanel1>
</ui:composition>
Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/test/component/testMyUIPanel2.xhtml (from r1490518, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/index.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/test/component/testMyUIPanel2.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/test/component/testMyUIPanel2.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/index.xhtml&r1=1490518&r2=1491587&rev=1491587&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/index.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/test/component/testMyUIPanel2.xhtml Mon Jun 10 20:03:02 2013
@@ -16,27 +16,10 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:test="http://testcomponent"
- template="common.xhtml">
-
- <h2>Add Test Instructions</h2>
-
- <ol>
- <li>The component should have dynamically modified the tree so that 'Dynamically added child' appears inside the red box</li>
- <li>Click 'POSTback'. The 'Dynamically added child' should not disappear (because it should have been serialized in the ViewState)</li>
- </ol>
-
- <h:messages/>
-
- <h:form id="mainForm">
-
- <test:addcomponent id="component"/>
-
- <br/>
-
- <h:commandButton id="postback" value="POSTback" action="#{testManagedBean.save}"/>
-
- </h:form>
+ xmlns:custom="http://my.coolorganization.org/tags">
+<custom:myUIPanel2 id="panel1">
+ Hello World
+</custom:myUIPanel2>
</ui:composition>