JBoss Rich Faces SVN: r21793 - trunk/examples/iteration-demo.
by richfaces-svn-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2011-02-18 20:13:05 -0500 (Fri, 18 Feb 2011)
New Revision: 21793
Modified:
trunk/examples/iteration-demo/pom.xml
Log:
RF-10083 removed unneeded enforcer config
Modified: trunk/examples/iteration-demo/pom.xml
===================================================================
--- trunk/examples/iteration-demo/pom.xml 2011-02-19 01:12:33 UTC (rev 21792)
+++ trunk/examples/iteration-demo/pom.xml 2011-02-19 01:13:05 UTC (rev 21793)
@@ -91,14 +91,6 @@
<build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <version>1.0-beta-1</version>
- <configuration>
- <fail>false</fail>
- </configuration>
- </plugin>
- <plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
15 years, 2 months
JBoss Rich Faces SVN: r21792 - in trunk: cdk/generator/src/main/java/org/richfaces/cdk/apt/processors and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-02-18 20:12:33 -0500 (Fri, 18 Feb 2011)
New Revision: 21792
Added:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FacetTemplateModel.java
trunk/cdk/generator/src/main/resources/META-INF/templates/_facets.ftl
Modified:
trunk/cdk/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.UIColumn.xml
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java
trunk/cdk/generator/src/main/resources/META-INF/templates/component.ftl
trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/Html5Attributes.java
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataTable.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTab.java
Log:
CODING IN PROGRESS - issue RF-10229: CDK generated faces-config does not create a format that Tools can process
https://issues.jboss.org/browse/RF-10229
Modified: trunk/cdk/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.UIColumn.xml
===================================================================
--- trunk/cdk/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.UIColumn.xml 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/cdk/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.UIColumn.xml 2011-02-19 01:12:33 UTC (rev 21792)
@@ -1,24 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!--
- JBoss, Home of Professional Open Source Copyright ${year}, 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.
- -->
+<!-- JBoss, Home of Professional Open Source Copyright ${year}, 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. -->
<cdk:properties xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:cdk="http://jboss.org/schema/richfaces/cdk/extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee">
<xi:include
xpointer="xmlns(cdk=http://jboss.org/schema/richfaces/cdk/extensions)xpointer(/cdk:..."
href="urn:attributes:javax.faces.component.UIComponent.xml" />
+ <facet>
+ <description></description>
+ <facet-name>footer</facet-name>
+ </facet>
+ <facet>
+ <description></description>
+ <facet-name>header</facet-name>
+ </facet>
+
</cdk:properties>
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -215,7 +215,7 @@
log.debug(" -- Process Java files.");
Set<BeanProperty> properties = Sets.newHashSet();
properties.addAll(sourceUtils.getBeanPropertiesAnnotatedWith(Attribute.class, element));
- properties.addAll(sourceUtils.getAbstractBeanProperties(element));
+// properties.addAll(sourceUtils.getAbstractBeanProperties(element));
for (BeanProperty beanProperty : properties) {
processAttribute(beanProperty, component.getOrCreateAttribute(beanProperty.getName()));
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -29,6 +29,8 @@
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.annotations.Facet;
@@ -109,6 +111,15 @@
processFacets(componentElement, component, annotation);
processAttributes(componentElement, component, annotation);
processEvents(componentElement, component, annotation);
+ for (TypeMirror atributesInterface : sourceUtils
+ .getAnnotationValues(annotation, "interfaces", TypeMirror.class)) {
+ if (TypeKind.DECLARED.equals(atributesInterface.getKind())) {
+ processFacetsFromType(sourceUtils.asTypeElement(atributesInterface), component, sourceUtils);
+ } else {
+ // TODO - record warning.
+ }
+ }
+
setTagInfo(annotation, component);
// TODO - process @Test annotations.
@@ -130,6 +141,19 @@
final void processFacets(TypeElement componentElement, ComponentModel component, AnnotationMirror annotation) {
SourceUtils sourceUtils = getSourceUtils();
+ processFacetsFromType(componentElement, component, sourceUtils);
+ for (AnnotationMirror facet : sourceUtils.getAnnotationValues(annotation, "facets", AnnotationMirror.class)) {
+ if (!sourceUtils.isDefaultValue(facet, "name")) {
+ String name = sourceUtils.getAnnotationValue(facet, "name", String.class);
+ FacetModel facetModel = component.getOrCreateFacet(name);
+ processFacet(facet, facetModel, null);
+ } else {
+ throw new CdkException("Facet name should be set");
+ }
+ }
+ }
+
+ private void processFacetsFromType(TypeElement componentElement, ComponentModel component, SourceUtils sourceUtils) {
if (null != componentElement) {
Set<BeanProperty> properties = sourceUtils.getBeanPropertiesAnnotatedWith(Facet.class, componentElement);
@@ -145,15 +169,6 @@
}
}
- for (AnnotationMirror facet : sourceUtils.getAnnotationValues(annotation, "facets", AnnotationMirror.class)) {
- if (!sourceUtils.isDefaultValue(facet, "name")) {
- String name = sourceUtils.getAnnotationValue(facet, "name", String.class);
- FacetModel facetModel = component.getOrCreateFacet(name);
- processFacet(facet, facetModel, null);
- } else {
- throw new CdkException("Facet name should be set");
- }
- }
}
final void processFacet(AnnotationMirror facet, FacetModel facetModel, String docComment) {
Added: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FacetTemplateModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FacetTemplateModel.java (rev 0)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FacetTemplateModel.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -0,0 +1,104 @@
+/*
+ * $Id: PropertyModel.java 21464 2011-02-04 18:31:43Z alexsmirnov $
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+package org.richfaces.cdk.generate.freemarker;
+
+import org.richfaces.cdk.model.FacetModel;
+import org.richfaces.cdk.util.Strings;
+
+import freemarker.ext.beans.BeansWrapper;
+import freemarker.ext.beans.StringModel;
+import freemarker.ext.util.ModelFactory;
+import freemarker.template.ObjectWrapper;
+import freemarker.template.TemplateModel;
+import freemarker.template.TemplateModelException;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class FacetTemplateModel extends StringModel implements TemplateModel {
+ static final ModelFactory FACTORY = new ModelFactory() {
+ public TemplateModel create(Object object, ObjectWrapper wrapper) {
+ return new FacetTemplateModel((FacetModel) object, (BeansWrapper) wrapper);
+ }
+ };
+ private final FacetModel facet;
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param object
+ * @param wrapper
+ */
+ public FacetTemplateModel(FacetModel object, BeansWrapper wrapper) {
+ super(object, wrapper);
+ facet = object;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the name
+ */
+ public String getAsString() {
+ return facet.getName();
+ }
+
+ @Override
+ public TemplateModel get(String key) throws TemplateModelException {
+ Object value;
+
+ if ("getterName".equals(key)) {
+ value = getGetterName();
+ } else if ("setterName".equals(key)) {
+ value = getSetterName();
+ } else if ("name".equals(key)) {
+ value = getAsString();
+ } else if ("capitalizeName".equals(key)) {
+ value = capitalizeName();
+ } else {
+ return super.get(key);
+ }
+
+ return wrapper.wrap(value);
+ }
+
+
+
+ // Model utility methods.
+ public String getGetterName() {
+ return "get" + capitalizeName();
+ }
+
+ public String getSetterName() {
+ return "set" + capitalizeName();
+ }
+
+ public String capitalizeName() {
+ return Strings.firstToUpperCase(getAsString());
+ }
+
+
+}
Property changes on: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FacetTemplateModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -26,6 +26,7 @@
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.EventModel;
import org.richfaces.cdk.model.FacesId;
+import org.richfaces.cdk.model.FacetModel;
import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.TagModel;
@@ -72,6 +73,8 @@
return create(obj, EventTemplateModel.FACTORY);
} else if (obj instanceof TagModel) {
return create(obj, TagTemplateModel.FACTORY);
+ } else if (obj instanceof FacetModel) {
+ return create(obj, FacetTemplateModel.FACTORY);
} else if (obj instanceof ModelElementBase ) {
return create(obj, ModelElementBaseTemplateModel.FACTORY);
} else {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -41,7 +41,7 @@
/**
* <p class="changed_added_4_0">Is that bean property generate in the class or should be generated ?</p>
*/
- private Boolean generate;
+ private Boolean generate = Boolean.FALSE; // TODO - check in model validator.
public FacetModel() {
}
Added: trunk/cdk/generator/src/main/resources/META-INF/templates/_facets.ftl
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/_facets.ftl (rev 0)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/_facets.ftl 2011-02-19 01:12:33 UTC (rev 21792)
@@ -0,0 +1,10 @@
+ <#list facets as facet>
+ <#if facet.generate >
+ public UIComponent ${facet.getterName}() {
+ return getFacet("${facet.name}");
+ }
+ public void ${facet.setterName}(UIComponent facet) {
+ getFacets().put("${facet.name}", facet);
+ }
+ </#if>
+ </#list>
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates/component.ftl
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/component.ftl 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/component.ftl 2011-02-19 01:12:33 UTC (rev 21792)
@@ -11,6 +11,7 @@
import java.util.List;
import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.el.MethodExpression;
import javax.el.ValueExpression;
@@ -58,6 +59,8 @@
<#include "_attributes.ftl">
+ <#include "_facets.ftl">
+
<#list events as event>
<#include "_event_source_accessors.ftl">
</#list>
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -90,7 +90,7 @@
BeanProperty beanProperty = createNiceMock(BeanProperty.class);
expect(utils.getBeanPropertiesAnnotatedWith(eq(Attribute.class), same(element))).andReturn(
Collections.singleton(beanProperty));
- expect(utils.getAbstractBeanProperties(same(element))).andReturn(new HashSet<BeanProperty>(0));
+// expect(utils.getAbstractBeanProperties(same(element))).andReturn(new HashSet<BeanProperty>(0));
expect(beanProperty.getName()).andReturn(FOO);
expect(beanProperty.getType()).andReturn(ClassName.parseName(String.class.getName()));
mockController.replay();
Modified: trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -27,6 +27,7 @@
import javax.el.MethodExpression;
import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.component.ValueHolder;
import javax.faces.el.MethodBinding;
@@ -78,8 +79,8 @@
)
public abstract class AbstractTestComponent extends UIComponentBase /*implements ValueHolder */{
- @Attribute
- private int length;
+ @Facet
+ public abstract UIComponent getFooter();
@Attribute
public abstract String getTitle();
Modified: trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/Html5Attributes.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/Html5Attributes.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/Html5Attributes.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -23,8 +23,11 @@
package org.richfaces.cdk.test.component;
+import javax.faces.component.UIComponent;
+
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.Facet;
/**
* <p class="changed_added_4_0"></p>
@@ -45,25 +48,27 @@
AUTO
}
+ @Facet
+ UIComponent getHeader();
/**
* @return
*/
@Attribute(events=@EventName("drag"))
- public abstract DraggableState getDraggable();
+ DraggableState getDraggable();
/**
* @param newValue
*/
- public abstract void setDraggable(DraggableState newValue);
+ void setDraggable(DraggableState newValue);
/**
* @return
*/
@Attribute
- public abstract boolean isHidden();
+ boolean isHidden();
/**
* @param newValue
*/
- public abstract void setHidden(boolean newValue);
+ void setHidden(boolean newValue);
}
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java
===================================================================
--- trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -25,6 +25,7 @@
import java.util.Date;
+import javax.el.MethodExpression;
import javax.faces.application.Resource;
import javax.faces.application.ResourceHandler;
import javax.faces.component.UIOutput;
@@ -129,6 +130,9 @@
public abstract String getMimeType();
@Attribute
+ public abstract MethodExpression getCreateContent();
+
+ @Attribute
public abstract String getRel();
@Attribute
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -27,6 +27,8 @@
import javax.el.ValueExpression;
import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.Description;
+import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.model.Filter;
@@ -41,6 +43,7 @@
@JsfComponent(
type = AbstractColumn.COMPONENT_TYPE,
family = AbstractColumn.COMPONENT_FAMILY,
+ facets={@Facet(name="header",description=@Description("Column header")),@Facet(name="footer",description=@Description("Column footer"))},
generate = "org.richfaces.component.UIColumn",
tag = @Tag(name="column")
)
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 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -36,6 +36,7 @@
import org.richfaces.cdk.annotations.Alias;
import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
@@ -92,21 +93,14 @@
@Attribute(aliases = @Alias(value="rows"))
public abstract int getElements();
- public UIComponent getHeaderFacet() {
- return getFacets().get(HEADER_FACET_NAME);
- }
-
- public UIComponent getFooterFacet() {
- return getFacets().get(FOOTER_FACET_NAME);
- }
-
- public UIComponent getCaptionFacet() {
- return getFacets().get(CAPTION_FACET_NAME);
- }
-
- public UIComponent getNoDataFacet() {
- return getFacets().get(NODATA_FACET_NAME);
- }
+ @Facet
+ public abstract UIComponent getHeader();
+ @Facet
+ public abstract UIComponent getFooter();
+ @Facet
+ public abstract UIComponent getCaption();
+ @Facet
+ public abstract UIComponent getNoData();
@Attribute
public int getColumns() {
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -41,6 +41,7 @@
import org.richfaces.application.ServiceTracker;
import org.richfaces.appplication.FacesMessages;
import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
@@ -258,34 +259,24 @@
}
// facet getter methods
+ @Facet
public UIComponent getFirst() {
return getFacet(FIRST_FACET_NAME);
}
- public UIComponent getLast() {
- return getFacetByKey(LAST_FACET_NAME);
- }
-
- public UIComponent getNext() {
- return getFacetByKey(NEXT_FACET_NAME);
- }
+ @Facet
+ public abstract UIComponent getLast();
+ @Facet
+ public abstract UIComponent getNext();
- public UIComponent getPrevious() {
- return getFacetByKey(PREVIOUS_FACET_NAME);
- }
+ @Facet
+ public abstract UIComponent getPrevious();
+ @Facet
+ public abstract UIComponent getFastForward();
+ @Facet
+ public abstract UIComponent getFastRewind();
- public UIComponent getFastForward() {
- return getFacetByKey(FAST_FORWARD_FACET_NAME);
- }
- public UIComponent getFastRewind() {
- return getFacetByKey(FAST_REWIND_FACET_NAME);
- }
-
- private UIComponent getFacetByKey(String key) {
- return getFacet(key.toString());
- }
-
private static boolean isRendered(UIComponent component) {
UIComponent c = component;
while (c != null) {
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataTable.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataTable.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataTable.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -25,6 +25,7 @@
import javax.faces.component.UIComponent;
import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
@@ -56,9 +57,8 @@
@Attribute
public abstract String getStyleClass();
- public UIComponent getCaption() {
- return getFacets().get(CAPTION_FACET_NAME);
- }
+ @Facet
+ public abstract UIComponent getCaption();
}
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 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -48,6 +48,7 @@
import org.ajax4jsf.model.Range;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.Facet;
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.context.ExtendedVisitContextMode;
import org.richfaces.event.FilteringEvent;
@@ -96,17 +97,12 @@
filterVar, sortPriority, sortMode, first, rows, noDataLabel, selection, header
}
- public UIComponent getHeader() {
- return getFacet(HEADER_FACET_NAME);
- }
-
- public UIComponent getFooter() {
- return getFacet(FOOTER_FACET_NAME);
- }
-
- public UIComponent getNoData() {
- return getFacet(NODATA_FACET_NAME);
- }
+ @Facet
+ public abstract UIComponent getHeader();
+ @Facet
+ public abstract UIComponent getFooter();
+ @Facet
+ public abstract UIComponent getNoData();
@Attribute
public abstract String getNoDataLabel();
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -186,22 +186,22 @@
}
public void encodeHeader(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid, boolean partial) throws IOException {
- UIComponent headerFacet = dataGrid.getHeaderFacet();
+ UIComponent headerFacet = dataGrid.getHeader();
encodeFacet(writer, facesContext, headerFacet, THEAD, dataGrid, new Object[] {partial});
}
public void encodeFooter(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid, boolean partial) throws IOException {
- UIComponent footerFacet = dataGrid.getFooterFacet();
+ UIComponent footerFacet = dataGrid.getFooter();
encodeFacet(writer, facesContext, footerFacet, TFOOT, dataGrid, new Object[] {partial});
}
public void encodeCaption(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid) throws IOException {
- UIComponent captionFacet = dataGrid.getCaptionFacet();
+ UIComponent captionFacet = dataGrid.getCaption();
encodeFacet(writer, facesContext, captionFacet, CAPTION, dataGrid, null);
}
public void encodeNoData(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid) throws IOException {
- UIComponent noDataFacet = dataGrid.getNoDataFacet();
+ UIComponent noDataFacet = dataGrid.getNoData();
encodeFacet(writer, facesContext, noDataFacet, NODATA, dataGrid, null);
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -4,12 +4,14 @@
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.renderkit.html.DropDownMenuRendererBase;
-@JsfComponent(family = AbstractDropDownMenu.COMPONENT_FAMILY, type = AbstractDropDownMenu.COMPONENT_TYPE,
+@JsfComponent(family = AbstractDropDownMenu.COMPONENT_FAMILY, type = AbstractDropDownMenu.COMPONENT_TYPE,
+ facets={@Facet(name="label",generate=false),@Facet(name="labelDisabled",generate=false)},
renderer=@JsfRenderer(type = DropDownMenuRendererBase.RENDERER_TYPE),
tag = @Tag(name="dropDownMenu"),
attributes = {"events-props.xml", "core-props.xml", "i18n-props.xml"})
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -4,12 +4,14 @@
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.renderkit.html.MenuGroupRendererBase;
@JsfComponent(family = AbstractDropDownMenu.COMPONENT_FAMILY, type = AbstractMenuGroup.COMPONENT_TYPE,
+ facets={@Facet(name="icon",generate=false),@Facet(name="iconDisabled",generate=false)},
renderer=@JsfRenderer(type = MenuGroupRendererBase.RENDERER_TYPE),
tag = @Tag(name="menuGroup"),
attributes = {"events-props.xml", "core-props.xml", "i18n-props.xml"})
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -1,6 +1,7 @@
package org.richfaces.component;
import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
@@ -9,6 +10,7 @@
@JsfComponent(
family = AbstractDropDownMenu.COMPONENT_FAMILY,
type = AbstractMenuItem.COMPONENT_TYPE,
+ facets={@Facet(name="icon",generate=false),@Facet(name="iconDisabled",generate=false)},
renderer=@JsfRenderer(type = MenuItemRendererBase.RENDERER_TYPE),
tag = @Tag(name="menuItem"),
attributes = {"events-props.xml", "core-props.xml", "i18n-props.xml", "ajax-props.xml"})
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTab.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTab.java 2011-02-19 01:12:32 UTC (rev 21791)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTab.java 2011-02-19 01:12:33 UTC (rev 21792)
@@ -32,7 +32,9 @@
* @author akolonitsky
* @since 2010-10-19
*/
-@JsfComponent(tag = @Tag(type = TagType.Facelets), renderer = @JsfRenderer(type = "org.richfaces.TabRenderer"))
+@JsfComponent(tag = @Tag(type = TagType.Facelets),
+ facets={@Facet(name="header",generate=false)},
+ renderer = @JsfRenderer(type = "org.richfaces.TabRenderer"))
public abstract class AbstractTab extends AbstractActionComponent implements AbstractTogglePanelTitledItem, AjaxProps, ClientBehaviorHolder {
public static final String COMPONENT_TYPE = "org.richfaces.Tab";
15 years, 2 months
JBoss Rich Faces SVN: r21791 - trunk/archetypes/richfaces-components-aggregator/src/main/resources/archetype-resources/trunk/parent.
by richfaces-svn-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2011-02-18 20:12:32 -0500 (Fri, 18 Feb 2011)
New Revision: 21791
Modified:
trunk/archetypes/richfaces-components-aggregator/src/main/resources/archetype-resources/trunk/parent/pom.xml
Log:
RF-10083 removed unneeded enforcer config
Modified: trunk/archetypes/richfaces-components-aggregator/src/main/resources/archetype-resources/trunk/parent/pom.xml
===================================================================
--- trunk/archetypes/richfaces-components-aggregator/src/main/resources/archetype-resources/trunk/parent/pom.xml 2011-02-19 00:09:47 UTC (rev 21790)
+++ trunk/archetypes/richfaces-components-aggregator/src/main/resources/archetype-resources/trunk/parent/pom.xml 2011-02-19 01:12:32 UTC (rev 21791)
@@ -95,17 +95,7 @@
</dependency>
</dependencies>
</plugin>
-
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <version>1.0-beta-1</version>
- <configuration>
- <fail>false</fail>
- </configuration>
- </plugin>
-
- <plugin>
<groupId>org.richfaces.cdk</groupId>
<artifactId>maven-cdk-plugin</artifactId>
<configuration>
15 years, 2 months
JBoss Rich Faces SVN: r21790 - in trunk: ui/iteration/ui/src/main/resources/META-INF and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2011-02-18 19:09:47 -0500 (Fri, 18 Feb 2011)
New Revision: 21790
Removed:
trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
trunk/ui/iteration/ui/src/main/resources/META-INF/org.richfaces.renderkit.html.images.ColumnHeaderGradientImage.resource
Log:
Removed garbage files
Deleted: trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
===================================================================
--- trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2011-02-19 00:08:14 UTC (rev 21789)
+++ trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2011-02-19 00:09:47 UTC (rev 21790)
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<PROCESS model-entity="JSFProcess"/>
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/org.richfaces.renderkit.html.images.ColumnHeaderGradientImage.resource
===================================================================
15 years, 2 months
JBoss Rich Faces SVN: r21789 - trunk/bom.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2011-02-18 19:08:14 -0500 (Fri, 18 Feb 2011)
New Revision: 21789
Modified:
trunk/bom/pom.xml
Log:
Updated atmosphere versio to 0.6.5
Modified: trunk/bom/pom.xml
===================================================================
--- trunk/bom/pom.xml 2011-02-18 23:23:45 UTC (rev 21788)
+++ trunk/bom/pom.xml 2011-02-19 00:08:14 UTC (rev 21789)
@@ -216,7 +216,7 @@
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
- <version>0.6.4</version>
+ <version>0.6.5</version>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
15 years, 2 months
JBoss Rich Faces SVN: r21788 - in trunk/core: impl/src/main/java/org/richfaces/application and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2011-02-18 18:23:45 -0500 (Fri, 18 Feb 2011)
New Revision: 21788
Added:
trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemsBundle.java
Modified:
trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItem.java
trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemSource.java
trunk/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java
trunk/core/impl/src/main/java/org/richfaces/application/configuration/ConfigurationServiceImpl.java
trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/PushContextImpl.java
Log:
https://issues.jboss.org/browse/RF-10454
Modified: trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItem.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItem.java 2011-02-18 23:13:24 UTC (rev 21787)
+++ trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItem.java 2011-02-18 23:23:45 UTC (rev 21788)
@@ -38,7 +38,7 @@
@Documented
public @interface ConfigurationItem {
- public ConfigurationItemSource source() default ConfigurationItemSource.contextInitParameter;
+ public ConfigurationItemSource source() default ConfigurationItemSource.defaultSource;
public String[] names();
Modified: trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemSource.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemSource.java 2011-02-18 23:13:24 UTC (rev 21787)
+++ trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemSource.java 2011-02-18 23:23:45 UTC (rev 21788)
@@ -27,6 +27,8 @@
*/
public enum ConfigurationItemSource {
+ defaultSource,
+
contextInitParameter,
webEnvironmentEntry
Added: trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemsBundle.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemsBundle.java (rev 0)
+++ trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemsBundle.java 2011-02-18 23:23:45 UTC (rev 21788)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, 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.application.configuration;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.TYPE)
+@Documented
+public @interface ConfigurationItemsBundle {
+
+ public String propertiesFile() default "";
+
+}
Modified: trunk/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java 2011-02-18 23:13:24 UTC (rev 21787)
+++ trunk/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java 2011-02-18 23:23:45 UTC (rev 21788)
@@ -23,6 +23,7 @@
import org.richfaces.application.configuration.ConfigurationItem;
import org.richfaces.application.configuration.ConfigurationItemSource;
+import org.richfaces.application.configuration.ConfigurationItemsBundle;
/**
* @author Nick Belaevski
@@ -95,4 +96,21 @@
pushJMSConnectionPasswordEnvRef
}
+
+ @ConfigurationItemsBundle(propertiesFile = "org/richfaces/push.properties")
+ public enum PushPropertiesItems {
+
+ @ConfigurationItem(names = "jms.connectionFactory")
+ pushPropertiesJMSConnectionFactory,
+
+ @ConfigurationItem(names = "jms.topicsNamespace")
+ pushPropertiesJMSTopicsNamespace,
+
+ @ConfigurationItem(names = "jms.connectionUsername")
+ pushPropertiesJMSConnectionUsername,
+
+ @ConfigurationItem(names = "jms.connectionPassword")
+ pushPropertiesJMSConnectionPassword
+
+ }
}
Modified: trunk/core/impl/src/main/java/org/richfaces/application/configuration/ConfigurationServiceImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/application/configuration/ConfigurationServiceImpl.java 2011-02-18 23:13:24 UTC (rev 21787)
+++ trunk/core/impl/src/main/java/org/richfaces/application/configuration/ConfigurationServiceImpl.java 2011-02-18 23:23:45 UTC (rev 21788)
@@ -23,8 +23,14 @@
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
import java.text.MessageFormat;
+import java.util.EnumSet;
+import java.util.Iterator;
import java.util.Map;
+import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -35,11 +41,13 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import org.ajax4jsf.resource.util.URLToStreamHelper;
import org.richfaces.el.util.ELUtils;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
import com.google.common.base.Strings;
+import com.google.common.io.Closeables;
import com.google.common.primitives.Primitives;
/**
@@ -56,7 +64,7 @@
private AtomicBoolean webEnvironmentUnavailableLogged = new AtomicBoolean();
- private final ConfigurationItem getConfigurationItemAnnotation(Enum<?> enumKey) {
+ private final ConfigurationItem getConfigurationItem(Enum<?> enumKey) {
try {
ConfigurationItem item = enumKey.getClass().getField(enumKey.name()).getAnnotation(ConfigurationItem.class);
if (item != null) {
@@ -98,17 +106,12 @@
throw new IllegalArgumentException(MessageFormat.format("Cannot convert {0} to object of {1} type", value, targetType.getName()));
}
- protected ValueExpressionHolder createValueExpressionHolder(FacesContext context, Enum<?> key, Class<?> targetType) {
- ConfigurationItem annotation = getConfigurationItemAnnotation(key);
-
- ValueExpression expression = createValueExpression(context, annotation, targetType);
-
+ protected ValueExpressionHolder createValueExpressionHolder(FacesContext context, ValueExpression expression, String defaultValueString, Class<?> returnType) {
Object defaultValue = null;
if (expression == null || !expression.isLiteralText()) {
- String defaultValueString = annotation.defaultValue();
if (!Strings.isNullOrEmpty(defaultValueString)) {
- defaultValue = coerce(context, defaultValueString, targetType);
+ defaultValue = coerce(context, defaultValueString, returnType);
}
}
@@ -167,9 +170,13 @@
return null;
}
- private final ValueExpression createValueExpression(FacesContext context, ConfigurationItem annotation, Class<?> targetType) {
+ private final ValueExpression createContextValueExpression(FacesContext context, ConfigurationItem annotation, Class<?> targetType) {
ConfigurationItemSource source = annotation.source();
+ if (source == ConfigurationItemSource.defaultSource) {
+ source = ConfigurationItemSource.contextInitParameter;
+ }
+
String parameterValue = null;
if (source == ConfigurationItemSource.contextInitParameter) {
@@ -181,36 +188,125 @@
}
if (!Strings.isNullOrEmpty(parameterValue)) {
- if (!annotation.literal() && ELUtils.isValueReference(parameterValue)) {
- ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
-
- if (expressionFactory == null) {
- throw new IllegalStateException("ExpressionFactory is null");
- }
-
- return expressionFactory.createValueExpression(context.getELContext(), parameterValue, targetType);
- } else {
- Object coercedValue = coerce(context, parameterValue, targetType);
- if (coercedValue != null) {
- return new ConstantValueExpression(coercedValue);
- }
- }
+ return createValueExpression(context, parameterValue, annotation.literal(), targetType);
}
return null;
}
+
+ private ValueExpression createValueExpression(FacesContext context, String parameterValue, boolean literal,
+ Class<?> targetType) {
+
+ ValueExpression result = null;
+
+ if (!literal && ELUtils.isValueReference(parameterValue)) {
+ ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
+
+ if (expressionFactory == null) {
+ throw new IllegalStateException("ExpressionFactory is null");
+ }
+
+ result = expressionFactory.createValueExpression(context.getELContext(), parameterValue, targetType);
+ } else {
+ Object coercedValue = coerce(context, parameterValue, targetType);
+ if (coercedValue != null) {
+ result = new ConstantValueExpression(coercedValue);
+ }
+ }
+
+ return result;
+ }
protected <T> T getValue(FacesContext facesContext, Enum<?> key, Class<T> returnType) {
ValueExpressionHolder holder = itemsMap.get(key);
if (holder == null) {
- holder = createValueExpressionHolder(facesContext, key, returnType);
- itemsMap.put(key, holder);
+ ConfigurationItemsBundle configurationItemsBundle = getConfigurationItemsBundle(key);
+
+ if (configurationItemsBundle == null) {
+ ConfigurationItem item = getConfigurationItem(key);
+ ValueExpression expression = createContextValueExpression(facesContext, item, returnType);
+ holder = createValueExpressionHolder(facesContext, expression, item.defaultValue(), returnType);
+ itemsMap.put(key, holder);
+ } else {
+ synchronized (key.getClass()) {
+ Properties properties = loadProperties(configurationItemsBundle.propertiesFile());
+
+ Iterator<Object> keys = EnumSet.allOf(key.getClass()).iterator();
+ while (keys.hasNext()) {
+ Enum<?> nextBundleKey = (Enum<?>) keys.next();
+
+ ConfigurationItem item = getConfigurationItem(nextBundleKey);
+
+ if (item.source() != ConfigurationItemSource.defaultSource) {
+ throw new IllegalArgumentException(item.toString());
+ }
+
+ String parameterValue = null;
+
+ for (String propertyName: item.names()) {
+ parameterValue = properties.getProperty(propertyName);
+
+ if (parameterValue != null) {
+ break;
+ }
+ }
+
+ ValueExpression expression = null;
+
+ if (parameterValue != null) {
+ expression = createValueExpression(facesContext, parameterValue, item.literal(), returnType);
+ }
+
+ ValueExpressionHolder siblingHolder = createValueExpressionHolder(facesContext, expression, item.defaultValue(),
+ returnType);
+
+ itemsMap.put(nextBundleKey, siblingHolder);
+
+ if (key == nextBundleKey) {
+ holder = siblingHolder;
+ }
+ }
+ }
+ }
}
return returnType.cast(holder.getValue(facesContext));
}
+ private Properties loadProperties(String resourceName) {
+ Properties properties = new Properties();
+
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ if (classLoader != null) {
+ URL url = classLoader.getResource(resourceName);
+ if (url != null) {
+ InputStream is = null;
+ try {
+ is = URLToStreamHelper.urlToStream(url);
+ properties.load(is);
+ } catch (IOException e) {
+ LOGGER.error(e.getMessage(), e);
+ } finally {
+ Closeables.closeQuietly(is);
+ }
+ }
+ }
+
+ return properties;
+ }
+
+ private ConfigurationItemsBundle getConfigurationItemsBundle(Enum<?> key) {
+ ConfigurationItem item = getConfigurationItem(key);
+ ConfigurationItemSource source = item.source();
+ if (source == ConfigurationItemSource.defaultSource) {
+ Class<?> enclosingClass = key.getClass();
+ return enclosingClass.getAnnotation(ConfigurationItemsBundle.class);
+ }
+
+ return null;
+ }
+
public Boolean getBooleanValue(FacesContext facesContext, Enum<?> key) {
return getValue(facesContext, key, Boolean.class);
}
Modified: trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/PushContextImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/PushContextImpl.java 2011-02-18 23:13:24 UTC (rev 21787)
+++ trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/PushContextImpl.java 2011-02-18 23:23:45 UTC (rev 21788)
@@ -27,6 +27,10 @@
import static org.richfaces.application.CoreConfiguration.Items.pushJMSConnectionUsername;
import static org.richfaces.application.CoreConfiguration.Items.pushJMSConnectionUsernameEnvRef;
import static org.richfaces.application.CoreConfiguration.Items.pushJMSTopicsNamespace;
+import static org.richfaces.application.CoreConfiguration.PushPropertiesItems.pushPropertiesJMSConnectionFactory;
+import static org.richfaces.application.CoreConfiguration.PushPropertiesItems.pushPropertiesJMSConnectionPassword;
+import static org.richfaces.application.CoreConfiguration.PushPropertiesItems.pushPropertiesJMSConnectionUsername;
+import static org.richfaces.application.CoreConfiguration.PushPropertiesItems.pushPropertiesJMSTopicsNamespace;
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
@@ -77,24 +81,17 @@
return servletContext.getContextPath();
}
- private String getConnectionUserName(FacesContext facesContext, ConfigurationService service) {
- String userName = service.getStringValue(facesContext, pushJMSConnectionUsername);
- if (Strings.isNullOrEmpty(userName)) {
- userName = service.getStringValue(facesContext, pushJMSConnectionUsernameEnvRef);
+ private String getFirstNonEmptyConfgirutationValue(FacesContext facesContext, ConfigurationService service, Enum<?>... keys) {
+ for (Enum<?> key : keys) {
+ String value = service.getStringValue(facesContext, key);
+ if (!Strings.isNullOrEmpty(value)) {
+ return value;
+ }
}
- return userName;
+ return "";
}
- private String getConnectionPassword(FacesContext facesContext, ConfigurationService service) {
- String password = service.getStringValue(facesContext, pushJMSConnectionPassword);
- if (Strings.isNullOrEmpty(password)) {
- password = service.getStringValue(facesContext, pushJMSConnectionPasswordEnvRef);
- }
-
- return password;
- }
-
public void init(FacesContext facesContext) {
try {
facesContext.getApplication().subscribeToEvent(PreDestroyApplicationEvent.class, this);
@@ -106,13 +103,14 @@
NameParser nameParser = initialContext.getNameParser("");
- Name cnfName = nameParser.parse(configurationService.getStringValue(facesContext, pushJMSConnectionFactory));
- Name topicsNamespace = nameParser.parse(configurationService.getStringValue(facesContext, pushJMSTopicsNamespace));
+ Name cnfName = nameParser.parse(getConnectionFactory(facesContext, configurationService));
+ Name topicsNamespace = nameParser.parse(getTopicsNamespace(facesContext, configurationService));
messagingContext = new MessagingContext(initialContext, cnfName, topicsNamespace,
getApplicationName(facesContext),
- getConnectionUserName(facesContext, configurationService),
- getConnectionPassword(facesContext, configurationService));
+ getUserName(facesContext, configurationService),
+ getPassword(facesContext, configurationService)
+ );
messagingContext.shareInstance(facesContext);
@@ -126,6 +124,26 @@
}
}
+ private String getPassword(FacesContext facesContext, ConfigurationService configurationService) {
+ return getFirstNonEmptyConfgirutationValue(facesContext, configurationService,
+ pushPropertiesJMSConnectionPassword, pushJMSConnectionPasswordEnvRef, pushJMSConnectionPassword);
+ }
+
+ private String getUserName(FacesContext facesContext, ConfigurationService configurationService) {
+ return getFirstNonEmptyConfgirutationValue(facesContext, configurationService,
+ pushPropertiesJMSConnectionUsername, pushJMSConnectionUsernameEnvRef, pushJMSConnectionUsername);
+ }
+
+ private String getConnectionFactory(FacesContext facesContext, ConfigurationService configurationService) {
+ return getFirstNonEmptyConfgirutationValue(facesContext, configurationService,
+ pushPropertiesJMSConnectionFactory, pushJMSConnectionFactory);
+ }
+
+ private String getTopicsNamespace(FacesContext facesContext, ConfigurationService configurationService) {
+ return getFirstNonEmptyConfgirutationValue(facesContext, configurationService,
+ pushPropertiesJMSTopicsNamespace, pushJMSTopicsNamespace);
+ }
+
public void destroy() {
if (pushHandlerImpl != null) {
try {
15 years, 2 months
JBoss Rich Faces SVN: r21787 - in trunk/cdk/generator/src: test/java/org/richfaces/cdk/generate/java and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-02-18 18:13:24 -0500 (Fri, 18 Feb 2011)
New Revision: 21787
Added:
trunk/cdk/generator/src/test/java/org/richfaces/cdk/generate/java/TestAttributesThatAreSet.java
Modified:
trunk/cdk/generator/src/main/resources/META-INF/templates/_attribute_accessors.ftl
trunk/cdk/generator/src/main/resources/META-INF/templates/_attributes.ftl
Log:
RESOLVED - issue RF-8362: CDK Pass-through attributes rendering: component-related code
https://issues.jboss.org/browse/RF-8362
RESOLVED - issue RF-10004: CDK: isEmpty method is generated incorrectly
https://issues.jboss.org/browse/RF-10004
RESOLVED - issue RF-10293: richfaces-showcase: message: not updated via ajax but h:message + outputPanel does.
https://issues.jboss.org/browse/RF-10293
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates/_attribute_accessors.ftl
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/_attribute_accessors.ftl 2011-02-18 20:26:27 UTC (rev 21786)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/_attribute_accessors.ftl 2011-02-18 23:13:24 UTC (rev 21787)
@@ -20,5 +20,8 @@
<#if ! attribute.readOnly >
public void ${attribute.setterName}(${attribute.typeName} ${propertyKey}) {
getStateHelper().put(Properties.${propertyKey}, ${propertyKey});
+ <#if attribute.passThrough >
+ handleAttribute("${attribute.name}",${propertyKey});
+ </#if>
}
</#if>
\ No newline at end of file
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates/_attributes.ftl
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/_attributes.ftl 2011-02-18 20:26:27 UTC (rev 21786)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/_attributes.ftl 2011-02-18 23:13:24 UTC (rev 21787)
@@ -15,7 +15,29 @@
return ((this.toString != null) ? this.toString : super.toString());
}</#if>
}
-
+ <#assign passThroughCount=0>
<#list generatedAttributes as attribute>
+ <#if attribute.passThrough >
+ <#assign passThroughCount=passThroughCount+1/>
+ </#if>
<#include "_attribute_accessors.ftl">
</#list>
+ <#if passThroughCount gt 0 >
+ private static final String ATTRIBUTES_THAT_ARE_SET_KEY = "javax.faces.component.UIComponentBase.attributesThatAreSet";
+
+ private void handleAttribute(String name, Object value) {
+ List<String> setAttributes = (List<String>) this.getAttributes().get(ATTRIBUTES_THAT_ARE_SET_KEY);
+ if (setAttributes == null) {
+ setAttributes = new ArrayList<String>(${passThroughCount});
+ this.getAttributes().put(ATTRIBUTES_THAT_ARE_SET_KEY, setAttributes);
+ }
+ if (value == null) {
+ ValueExpression ve = getValueExpression(name);
+ if (ve == null) {
+ setAttributes.remove(name);
+ }
+ } else if (!setAttributes.contains(name)) {
+ setAttributes.add(name);
+ }
+ }
+ </#if>
\ No newline at end of file
Added: trunk/cdk/generator/src/test/java/org/richfaces/cdk/generate/java/TestAttributesThatAreSet.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/generate/java/TestAttributesThatAreSet.java (rev 0)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/generate/java/TestAttributesThatAreSet.java 2011-02-18 23:13:24 UTC (rev 21787)
@@ -0,0 +1,187 @@
+package org.richfaces.cdk.generate.java;
+
+import static org.junit.Assert.*;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIInput;
+import javax.faces.component.html.HtmlCommandLink;
+
+import org.junit.Test;
+
+/**
+ * <p class="changed_added_4_0">
+ * Test functionality of 'attributesThatAreSet' collection
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class TestAttributesThatAreSet {
+
+ private static final String RENDERED = "rendered";
+
+ private static final String ID = "id";
+
+ private static final String ATTRIBUTES_THAT_ARE_SET_KEY = UIComponentBase.class.getName() + ".attributesThatAreSet";
+
+ private static final @SuppressWarnings("serial")
+ ValueExpression DUMMY_EXPRESSION = new ValueExpression() {
+
+ @Override
+ public boolean isLiteralText() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getExpressionString() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void setValue(ELContext context, Object value) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isReadOnly(ELContext context) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Object getValue(ELContext context) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Class<?> getType(ELContext context) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Class<?> getExpectedType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ };
+
+
+ @Test
+ public void testId() throws Exception {
+ UIComponentBase component = createComponentBase();
+ assertAttributeNotSet(component, ID);
+ component.setId("foo");
+ assertAttributeNotSet(component, ID);
+ }
+
+ @Test
+ public void testIdByAttributes() throws Exception {
+ UIComponentBase component = createComponentBase();
+ assertAttributeNotSet(component, ID);
+ component.getAttributes().put(ID,"foo");
+ assertAttributeNotSet(component, ID);
+ }
+
+ @Test
+ public void testRenderedSet() throws Exception {
+ UIComponentBase component = createComponentBase();
+ assertAttributeNotSet(component, RENDERED);
+ component.setRendered(true);
+ assertAttributeNotSet(component, RENDERED);
+ }
+
+ @Test
+ public void testRenderedAttribute() throws Exception {
+ UIComponentBase component = createComponentBase();
+ assertAttributeNotSet(component, RENDERED);
+ component.getAttributes().put(RENDERED, true);
+ assertAttributeNotSet(component, RENDERED);
+ }
+
+ @Test
+ public void testRenderedByEl() throws Exception {
+ UIComponentBase component = createComponentBase();
+ assertAttributeNotSet(component, RENDERED);
+ component.setValueExpression(RENDERED, DUMMY_EXPRESSION);
+ assertAttributeSet(component, RENDERED);
+ }
+
+ @Test
+ public void testInputMessage() throws Exception {
+ UIInput input = new UIInput();
+ input.setConverterMessage("foo");
+ assertAttributeNotSet(input, "converterMessage");
+ }
+
+ @Test
+ public void testCustomProperty() throws Exception {
+ UIInput input = new UIInput();
+ input.getAttributes().put("foobar", RENDERED);
+ assertAttributeSet(input, "foobar");
+ }
+
+ @Test
+ public void testHtmlAttribute() throws Exception {
+ HtmlCommandLink link = new HtmlCommandLink();
+ link.setDir("lefttoright");
+ assertAttributeSet(link, "dir");
+ }
+
+ private UIComponentBase createComponentBase() {
+ UIComponentBase component = new UIComponentBase() {
+
+ @Override
+ public String getFamily() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ };
+ return component;
+ }
+
+ private void assertAttributeSet(UIComponent component, String attribute) {
+ List<String> list = getAttributesList(component);
+ assertTrue(list.contains(attribute));
+ }
+
+ private void assertAttributeNotSet(UIComponent component, String attribute) {
+ List<String> list = getAttributesList(component);
+ assertFalse(list.contains(attribute));
+ }
+
+ private List<String> getAttributesList(UIComponent component) {
+ Object attributesList = component.getAttributes().get(ATTRIBUTES_THAT_ARE_SET_KEY);
+ if (null != attributesList) {
+ assertTrue(attributesList instanceof List<?>);
+ List<String> list = (List<String>) attributesList;
+ return list;
+
+ } else {
+ return Collections.emptyList();
+ }
+ }
+}
Property changes on: trunk/cdk/generator/src/test/java/org/richfaces/cdk/generate/java/TestAttributesThatAreSet.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
15 years, 2 months
JBoss Rich Faces SVN: r21786 - in trunk/core: impl and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2011-02-18 15:26:27 -0500 (Fri, 18 Feb 2011)
New Revision: 21786
Modified:
trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemSource.java
trunk/core/impl/richfaces-suppressions.xml
trunk/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java
trunk/core/impl/src/main/java/org/richfaces/application/configuration/ConfigurationServiceImpl.java
trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/PushContextImpl.java
Log:
https://issues.jboss.org/browse/RF-10454
Modified: trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemSource.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemSource.java 2011-02-18 19:37:36 UTC (rev 21785)
+++ trunk/core/api/src/main/java/org/richfaces/application/configuration/ConfigurationItemSource.java 2011-02-18 20:26:27 UTC (rev 21786)
@@ -27,6 +27,8 @@
*/
public enum ConfigurationItemSource {
- contextInitParameter
+ contextInitParameter,
+ webEnvironmentEntry
+
}
Modified: trunk/core/impl/richfaces-suppressions.xml
===================================================================
--- trunk/core/impl/richfaces-suppressions.xml 2011-02-18 19:37:36 UTC (rev 21785)
+++ trunk/core/impl/richfaces-suppressions.xml 2011-02-18 20:26:27 UTC (rev 21786)
@@ -17,4 +17,5 @@
<suppress checks="IllegalThrows" files="AbstractThreadedTest.java" />
<suppress checks="ModifiedControlVariable" files="URLCodec.java" />
<suppress checks="IllegalCatch" files="AbstractRequest.java" />
+ <suppress checks="IllegalCatch" files="ConfigurationServiceImpl.java" />
</suppressions>
Modified: trunk/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java 2011-02-18 19:37:36 UTC (rev 21785)
+++ trunk/core/impl/src/main/java/org/richfaces/application/CoreConfiguration.java 2011-02-18 20:26:27 UTC (rev 21786)
@@ -22,6 +22,7 @@
package org.richfaces.application;
import org.richfaces.application.configuration.ConfigurationItem;
+import org.richfaces.application.configuration.ConfigurationItemSource;
/**
* @author Nick Belaevski
@@ -84,8 +85,14 @@
@ConfigurationItem(defaultValue = "", names = "org.richfaces.push.jms.connectionUsername")
pushJMSConnectionUsername,
+ @ConfigurationItem(defaultValue = "", names = "org.richfaces.push.jms.connectionUsername", source = ConfigurationItemSource.webEnvironmentEntry)
+ pushJMSConnectionUsernameEnvRef,
+
@ConfigurationItem(defaultValue = "", names = "org.richfaces.push.jms.connectionPassword")
- pushJMSConnectionPassword
+ pushJMSConnectionPassword,
+ @ConfigurationItem(defaultValue = "", names = "org.richfaces.push.jms.connectionPassword", source = ConfigurationItemSource.webEnvironmentEntry)
+ pushJMSConnectionPasswordEnvRef
+
}
}
Modified: trunk/core/impl/src/main/java/org/richfaces/application/configuration/ConfigurationServiceImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/application/configuration/ConfigurationServiceImpl.java 2011-02-18 19:37:36 UTC (rev 21785)
+++ trunk/core/impl/src/main/java/org/richfaces/application/configuration/ConfigurationServiceImpl.java 2011-02-18 20:26:27 UTC (rev 21786)
@@ -26,12 +26,18 @@
import java.text.MessageFormat;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
import javax.faces.context.FacesContext;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.richfaces.el.util.ELUtils;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
import com.google.common.base.Strings;
import com.google.common.primitives.Primitives;
@@ -42,8 +48,14 @@
*/
public class ConfigurationServiceImpl implements ConfigurationService {
+ private static final Logger LOGGER = RichfacesLogger.APPLICATION.getLogger();
+
+ private static final String JNDI_COMP_PREFIX = "java:comp/env/";
+
private Map<Enum<?>, ValueExpressionHolder> itemsMap = new ConcurrentHashMap<Enum<?>, ValueExpressionHolder>();
+ private AtomicBoolean webEnvironmentUnavailableLogged = new AtomicBoolean();
+
private final ConfigurationItem getConfigurationItemAnnotation(Enum<?> enumKey) {
try {
ConfigurationItem item = enumKey.getClass().getField(enumKey.name()).getAnnotation(ConfigurationItem.class);
@@ -103,37 +115,89 @@
return new ValueExpressionHolder(expression, defaultValue);
}
- private final ValueExpression createValueExpression(FacesContext context, ConfigurationItem annotation, Class<?> targetType) {
- ConfigurationItemSource source = annotation.source();
+ private String getInitParameterValue(FacesContext context, ConfigurationItem configurationItem) {
+ for (String name : configurationItem.names()) {
+ String value = (String) context.getExternalContext().getInitParameter(name);
+
+ if (!Strings.isNullOrEmpty(value)) {
+ return value;
+ }
+ }
- if (source == ConfigurationItemSource.contextInitParameter) {
- for (String name : annotation.names()) {
- String value = (String) context.getExternalContext().getInitParameter(name);
+ return null;
+ }
+
+ private String getWebEnvironmentEntryValue(ConfigurationItem configurationItem) {
+ Context context = null;
+
+ try {
+ context = new InitialContext();
+ } catch (Throwable e) {
+ //Throwable is caught here due to GAE requirements
+ if (!webEnvironmentUnavailableLogged.getAndSet(true)) {
+ LOGGER.error(e.getMessage(), e);
+ }
+ }
+
+ if (context != null) {
+ for (String envName: configurationItem.names()) {
+ String qualifiedName;
- if (Strings.isNullOrEmpty(value)) {
- continue;
+ if (!envName.startsWith(JNDI_COMP_PREFIX)) {
+ qualifiedName = JNDI_COMP_PREFIX + envName;
+ } else {
+ qualifiedName = envName;
}
-
- if (!annotation.literal() && ELUtils.isValueReference(value)) {
- ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
-
- if (expressionFactory == null) {
- throw new IllegalStateException("ExpressionFactory is null");
+
+ String value = null;
+ try {
+ value = (String) context.lookup(qualifiedName);
+ } catch (NamingException e) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug(e.getMessage(), e);
}
-
- return expressionFactory.createValueExpression(context.getELContext(), value, targetType);
- } else {
- Object coercedValue = coerce(context, value, targetType);
- if (coercedValue != null) {
- return new ConstantValueExpression(coercedValue);
- }
}
+
+ if (!Strings.isNullOrEmpty(value)) {
+ return value;
+ }
}
-
- return null;
+ }
+
+ return null;
+ }
+
+ private final ValueExpression createValueExpression(FacesContext context, ConfigurationItem annotation, Class<?> targetType) {
+ ConfigurationItemSource source = annotation.source();
+
+ String parameterValue = null;
+
+ if (source == ConfigurationItemSource.contextInitParameter) {
+ parameterValue = getInitParameterValue(context, annotation);
+ } else if (source == ConfigurationItemSource.webEnvironmentEntry) {
+ parameterValue = getWebEnvironmentEntryValue(annotation);
} else {
throw new IllegalArgumentException(source.toString());
}
+
+ if (!Strings.isNullOrEmpty(parameterValue)) {
+ if (!annotation.literal() && ELUtils.isValueReference(parameterValue)) {
+ ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
+
+ if (expressionFactory == null) {
+ throw new IllegalStateException("ExpressionFactory is null");
+ }
+
+ return expressionFactory.createValueExpression(context.getELContext(), parameterValue, targetType);
+ } else {
+ Object coercedValue = coerce(context, parameterValue, targetType);
+ if (coercedValue != null) {
+ return new ConstantValueExpression(coercedValue);
+ }
+ }
+ }
+
+ return null;
}
protected <T> T getValue(FacesContext facesContext, Enum<?> key, Class<T> returnType) {
Modified: trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/PushContextImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/PushContextImpl.java 2011-02-18 19:37:36 UTC (rev 21785)
+++ trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/PushContextImpl.java 2011-02-18 20:26:27 UTC (rev 21786)
@@ -23,7 +23,9 @@
import static org.richfaces.application.CoreConfiguration.Items.pushJMSConnectionFactory;
import static org.richfaces.application.CoreConfiguration.Items.pushJMSConnectionPassword;
+import static org.richfaces.application.CoreConfiguration.Items.pushJMSConnectionPasswordEnvRef;
import static org.richfaces.application.CoreConfiguration.Items.pushJMSConnectionUsername;
+import static org.richfaces.application.CoreConfiguration.Items.pushJMSConnectionUsernameEnvRef;
import static org.richfaces.application.CoreConfiguration.Items.pushJMSTopicsNamespace;
import javax.faces.FacesException;
@@ -50,6 +52,8 @@
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
+import com.google.common.base.Strings;
+
/**
* @author Nick Belaevski
*
@@ -73,6 +77,24 @@
return servletContext.getContextPath();
}
+ private String getConnectionUserName(FacesContext facesContext, ConfigurationService service) {
+ String userName = service.getStringValue(facesContext, pushJMSConnectionUsername);
+ if (Strings.isNullOrEmpty(userName)) {
+ userName = service.getStringValue(facesContext, pushJMSConnectionUsernameEnvRef);
+ }
+
+ return userName;
+ }
+
+ private String getConnectionPassword(FacesContext facesContext, ConfigurationService service) {
+ String password = service.getStringValue(facesContext, pushJMSConnectionPassword);
+ if (Strings.isNullOrEmpty(password)) {
+ password = service.getStringValue(facesContext, pushJMSConnectionPasswordEnvRef);
+ }
+
+ return password;
+ }
+
public void init(FacesContext facesContext) {
try {
facesContext.getApplication().subscribeToEvent(PreDestroyApplicationEvent.class, this);
@@ -89,8 +111,8 @@
messagingContext = new MessagingContext(initialContext, cnfName, topicsNamespace,
getApplicationName(facesContext),
- configurationService.getStringValue(facesContext, pushJMSConnectionUsername),
- configurationService.getStringValue(facesContext, pushJMSConnectionPassword));
+ getConnectionUserName(facesContext, configurationService),
+ getConnectionPassword(facesContext, configurationService));
messagingContext.shareInstance(facesContext);
15 years, 2 months
JBoss Rich Faces SVN: r21785 - in trunk: ui/input/ui/src/main/java/org/richfaces/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2011-02-18 14:37:36 -0500 (Fri, 18 Feb 2011)
New Revision: 21785
Modified:
trunk/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
trunk/ui/input/ui/src/main/templates/autocomplete.template.xml
Log:
https://jira.jboss.org/browse/RF-10520
Modified: trunk/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml
===================================================================
--- trunk/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml 2011-02-18 19:22:55 UTC (rev 21784)
+++ trunk/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml 2011-02-18 19:37:36 UTC (rev 21785)
@@ -22,6 +22,13 @@
<ui:define name="body_head">Autocomplete Example</ui:define>
<ui:define name="body">
+
+ <style type="text/css">
+ .myPopupClass .rf-au-lst-scrl {
+ border: 1px solid red;
+ width: 400px;
+ }
+ </style>
<h:form id="form">
<h:selectOneMenu value="#{autoCompleteBean.mode}" onchange="submit()">
@@ -37,7 +44,7 @@
}
</script>
- <input:autocomplete autofill="false" id="myAutocomplete" clientFilterFunction="customFilterFunction" mode="#{autoCompleteBean.mode}" minChars="2" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}" showButton="true"
+ <input:autocomplete popupClass="myPopupClass" autofill="false" id="myAutocomplete" clientFilterFunction="customFilterFunction" mode="#{autoCompleteBean.mode}" minChars="2" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}" showButton="true"
value = "#{autoCompleteBean.value}" layout="list"
onchange="return onEvent.call(this, event);" onselectitem="return onEvent.call(this, event);" onblur="return onEvent.call(this, event);" onfocus="return onEvent.call(this, event);">
#{country.name} #{country.iso} #{country.domain}
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 2011-02-18 19:22:55 UTC (rev 21784)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2011-02-18 19:37:36 UTC (rev 21785)
@@ -81,6 +81,9 @@
@Attribute(defaultValue = "rf-au-itm-sel")
public abstract String getSelectedItemClass();
+
+ @Attribute()
+ public abstract String getPopupClass();
@Attribute
public abstract AutocompleteMode getMode();
Modified: trunk/ui/input/ui/src/main/templates/autocomplete.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/autocomplete.template.xml 2011-02-18 19:22:55 UTC (rev 21784)
+++ trunk/ui/input/ui/src/main/templates/autocomplete.template.xml 2011-02-18 19:37:36 UTC (rev 21785)
@@ -55,7 +55,7 @@
<div class="rf-au-shdw-r"></div>
<div class="rf-au-shdw-b"></div>
- <div class="rf-au-lst-dcrtn">
+ <div class="rf-au-lst-dcrtn #{component.attributes['popupClass']}">
<div class="rf-au-lst-scrl">
<cdk:body>
<cdk:call expression="encodeItemsContainer(facesContext, component)"/>
15 years, 2 months
JBoss Rich Faces SVN: r21784 - in trunk/ui/output/ui/src: main/resources/META-INF/resources/org.richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-02-18 14:22:55 -0500 (Fri, 18 Feb 2011)
New Revision: 21784
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.js
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml
Log:
https://issues.jboss.org/browse/RF-10463 richfaces-showcase: tooltip sample throws JS exception in ajax mode (MyFaces)
https://issues.jboss.org/browse/RF-10529 Tooltip is rerendered when mouse enters tooltip's div
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2011-02-18 19:15:04 UTC (rev 21783)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2011-02-18 19:22:55 UTC (rev 21784)
@@ -105,13 +105,18 @@
writer.startElement(getMarkupElement(tooltip), component);
writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context), "clientId");
+
+ writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, "display: none;", null);
+ writer.startElement(getMarkupElement(tooltip), component);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context) + ":wrp", null);
writer.writeAttribute(CLASS_ATTRIBUTE, getStyleClass(component), null);
+
int zindex = tooltip.getZindex();
if (zindex == Integer.MIN_VALUE) {
zindex = DEFAULT_ZINDEX_VALUE;
}
+
String style = concatStyles("z-index:"+zindex, getStyle(component));
-
if (style != null && style.trim().length() > 0) {
writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, style, null);
}
@@ -231,6 +236,8 @@
writer.endElement(getMarkupElement((AbstractTooltip) component));
+ writer.endElement(getMarkupElement((AbstractTooltip) component));
+
writeJavaScript(writer, context, component);
writer.endElement(getMarkupElement((AbstractTooltip) component));
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.js 2011-02-18 19:15:04 UTC (rev 21783)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.js 2011-02-18 19:22:55 UTC (rev 21784)
@@ -117,8 +117,8 @@
this.__addUserEventHandler("show");
this.__addUserEventHandler("beforehide");
this.__addUserEventHandler("beforeshow");
-
- this.popup = new rf.ui.Popup(this.id, {
+ this.popupId = this.id+':wrp';
+ this.popup = new rf.ui.Popup(this.popupId, {
attachTo: this.target,
attachToBody: true,
positionType: "TOOLTIP",
@@ -133,10 +133,8 @@
rf.Event.bindById(this.target, handlers, this);
-
-
if (this.options.hideEvent == 'mouseleave') {
- rf.Event.bindById(this.id, this.options.hideEvent + this.namespace, this.__hideHandler, this);
+ rf.Event.bindById(this.popupId, this.options.hideEvent + this.namespace, this.__hideHandler, this);
}
},
@@ -150,21 +148,22 @@
* @return {void} TODO ...
*/
hide: function () {
- var continueProcess = this.__fireBeforeHide();
- if (!continueProcess) {
- return false;
+
+ var tooltip = this;
+ if (tooltip.hidingTimerHandle) {
+ window.clearTimeout(tooltip.hidingTimerHandle);
+ tooltip.hidingTimerHandle = undefined;
}
-
- this.__hide();
-
- return this.__fireHide()
+ if (this.shown) {
+ this.__hide();
+ }
},
__hideHandler: function(event) {
if (event.type == 'mouseleave' && this.__isInside(event.relatedTarget)) {
return;
}
-
+
this.hide();
if (this.options.followMouse) {
@@ -180,8 +179,10 @@
__hide: function () {
var tooltip = this;
this.__delay(this.options.hideDelay, function () {
+ tooltip.__fireBeforeHide();
tooltip.popup.hide();
tooltip.shown = false;
+ tooltip.__fireHide();
});
},
@@ -210,12 +211,16 @@
* @return {void} TODO ...
*/
show: function (event) {
- var continueProcess = this.__fireBeforeShow();
- if (!continueProcess) {
- return false;
+ var tooltip = this;
+ if (tooltip.hidingTimerHandle) {
+ window.clearTimeout(tooltip.hidingTimerHandle);
+ tooltip.hidingTimerHandle = undefined;
}
- SHOW_ACTION.exec(this, event);
+ if (!this.shown) {
+ SHOW_ACTION.exec(this, event);
+ }
+
},
onCompleteHandler : function () {
@@ -233,12 +238,13 @@
var tooltip = this;
this.__delay(this.options.showDelay, function () {
if (!tooltip.options.followMouse) {
- tooltip.popup.show(event);
- } else if (!tooltip.shown) {
- {
- tooltip.popup.show(tooltip.saveShowEvent);
- }
+ tooltip.saveShowEvent = event;
}
+ if (!tooltip.shown) {
+ tooltip.__fireBeforeShow();
+ tooltip.popup.show(tooltip.saveShowEvent);
+ }
+ //for showing tooltip in followMouse mode
tooltip.shown = true;
});
},
@@ -246,10 +252,7 @@
/***************************** Private Methods ****************************************************************/
__delay : function (delay, action) {
var tooltip = this;
- if (tooltip.hidingTimerHandle) {
- window.clearTimeout(tooltip.hidingTimerHandle);
- tooltip.hidingTimerHandle = undefined;
- }
+
if (delay > 0) {
tooltip.hidingTimerHandle = window.setTimeout(function() {
action();
@@ -297,8 +300,6 @@
return rf.Event.fireById(this.id, "beforeshow", { id: this.id });
},
-
-
/**
* @private
* */
@@ -317,16 +318,15 @@
elt = elt.parentNode;
}
-
return false;
},
__isInside: function(elt) {
- return this.__contains(this.target, elt) || this.__contains(this.id, elt);
+ return this.__contains(this.target, elt) || this.__contains(this.popupId, elt);
},
destroy: function () {
- rf.Event.unbindById(this.id, this.namespace);
+ rf.Event.unbindById(this.popupId, this.namespace);
rf.Event.unbindById(this.target, this.namespace);
this.popup.destroy();
this.popup = null;
@@ -336,4 +336,4 @@
// define super class link
var $super = rf.ui.Tooltip.$super;
-})(jQuery, RichFaces);
+})(jQuery, RichFaces);
\ No newline at end of file
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml 2011-02-18 19:15:04 UTC (rev 21783)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml 2011-02-18 19:22:55 UTC (rev 21784)
@@ -1,6 +1,8 @@
-<span id="f:tooltip" class="rf-tt" style="z-index:1000">
- <span id="f:tooltip:cntr" class="rf-tt-cntr">
- <span id="f:tooltip:content" class="rf-tt-cnt"></span>
+<span id="f:tooltip" style="display: none;">
+ <span id="f:tooltip:wrp" class="rf-tt" style="z-index:1000">
+ <span id="f:tooltip:cntr" class="rf-tt-cntr">
+ <span id="f:tooltip:content" class="rf-tt-cnt"></span>
+ </span>
</span>
<script type="text/javascript">
// Text
15 years, 2 months