JBoss Rich Faces SVN: r16794 - in root: cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-04-22 06:17:07 -0400 (Thu, 22 Apr 2010)
New Revision: 16794
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/_attribute_accessors.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxFunction.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxStatus.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandButton.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandLink.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractMediaOutput.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractOutputPanel.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractPush.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractQueue.java
Log:
RF-7826 Migrate A1 components to new CDK
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -83,6 +83,8 @@
public String inferRendererTypeByRendererClass(ClassName rendererClass);
+ public String inferRendererTypeByComponentType(FacesId componentType);
+
public String inferComponentFamily(RendererModel.Type type);
public String inferTemplate(RendererModel.Type type);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -150,6 +150,11 @@
return "";
}
+ @Override
+ public String inferRendererTypeByComponentType(FacesId componentType) {
+ return componentType + "Renderer";
+ }
+
public String inferComponentFamily(RendererModel.Type type) {
return null;
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -68,6 +68,13 @@
if (attributeAnnotarion == null) {
attribute.setGenerate(!beanProperty.isExists());
attribute.setDescription(beanProperty.getDocComment());
+
+ if (attribute.getType().isPrimitive()) {
+ String value = getPimitiveDefaultValue(attribute.getType().getName());
+ if (value != null) {
+ attribute.setDefaultValue(value);
+ }
+ }
} else {
attribute.setHidden(attributeAnnotarion.hidden());
attribute.setLiteral(attributeAnnotarion.literal());
@@ -111,25 +118,10 @@
String defaultValue = attributeAnnotarion.defaultValue();
if (Strings.isEmpty(defaultValue)) {
if (attribute.getType().isPrimitive()) {
- if (isInstace(attribute, byte.class)) {
- defaultValue = String.valueOf(false);
- } else if (isInstace(attribute, int.class)) {
- defaultValue = String.valueOf(Integer.MIN_VALUE);
- } else if (isInstace(attribute, long.class)) {
- defaultValue = String.valueOf(Long.MIN_VALUE);
- } else if (isInstace(attribute, byte.class)) {
- defaultValue = String.valueOf(Byte.MIN_VALUE);
- } else if (isInstace(attribute, short.class)) {
- defaultValue = String.valueOf(Short.MIN_VALUE);
- } else if (isInstace(attribute, float.class)) {
- defaultValue = String.valueOf(Float.MIN_VALUE);
- } else if (isInstace(attribute, double.class)) {
- defaultValue = String.valueOf(Double.MIN_VALUE);
- } else if (isInstace(attribute, char.class)) {
- defaultValue = String.valueOf(Character.MIN_VALUE);
+ String pimitiveDefaultValue = getPimitiveDefaultValue(attribute.getType().getName());
+ if (pimitiveDefaultValue != null) {
+ attribute.setDefaultValue(pimitiveDefaultValue);
}
-
- attribute.setDefaultValue(defaultValue);
}
} else {
if (STRING_NAME.equals(attribute.getType().toString())) {
@@ -139,10 +131,32 @@
}
}
- private boolean isInstace(PropertyBase attribute, Class<?> byteClass) {
- return byteClass.getSimpleName().equals(attribute.getType().getName());
+ private String getPimitiveDefaultValue(String typeName) {
+ if (isInstace(boolean.class, typeName)) {
+ return String.valueOf(false);
+ } else if (isInstace(int.class, typeName)) {
+ return String.valueOf(Integer.MIN_VALUE);
+ } else if (isInstace(long.class, typeName)) {
+ return String.valueOf(Long.MIN_VALUE);
+ } else if (isInstace(byte.class, typeName)) {
+ return String.valueOf(Byte.MIN_VALUE);
+ } else if (isInstace(short.class, typeName)) {
+ return String.valueOf(Short.MIN_VALUE);
+ } else if (isInstace(float.class, typeName)) {
+ return String.valueOf(Float.MIN_VALUE);
+ } else if (isInstace(double.class, typeName)) {
+ return String.valueOf(Double.MIN_VALUE);
+ } else if (isInstace(char.class, typeName)) {
+ return String.valueOf(Character.MIN_VALUE);
+ }
+
+ return null;
}
+ private boolean isInstace(Class<?> byteClass, String typeName) {
+ return byteClass.getSimpleName().equals(typeName);
+ }
+
private List<ClassName> getSignature(Signature signature, AnnotationValue signatureMirror) {
if (signature == null) {
return null;
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -121,10 +121,14 @@
private void setRendererType(ComponentModel component, JsfRenderer jsfRenderer) {
// TODO if jsfRenderer.empty set by naming convention
-
+
+ String type;
if (jsfRenderer != null && !Strings.isEmpty(jsfRenderer.type())) {
- component.setRendererType(new RendererModel.Type(jsfRenderer.type()));
+ type = jsfRenderer.type();
+ } else {
+ type = getNamingConventions().inferRendererTypeByComponentType(component.getType());
}
+ component.setRendererType(new RendererModel.Type(type));
}
private void processAttributes(TypeElement componentElement, ComponentModel component, JsfComponent annotation) {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -73,7 +73,7 @@
}
// one or both types are null, compare classes.
- return null != getComponentClass() && getComponentClass().equals(other.getComponentClass());
+ return null != getTargetClass() && getTargetClass().equals(other.getTargetClass());
}
/**
* <p class="changed_added_4_0"></p>
@@ -99,7 +99,7 @@
/**
* <p class="changed_added_4_0"></p>
- * @param rendererType the rendererType to set
+ * @param renderer the rendererType to set
*/
public void setRendererType(Type renderer) {
this.rendererType = renderer;
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -107,8 +107,8 @@
protected void verifyComponent(ComponentModel component) {
// Check JsfComponent type.
if (null == component.getType()) {
- if (null != component.getComponentClass()) {
- component.setType(namingConventions.inferComponentType(component.getComponentClass()));
+ if (null != component.getTargetClass()) {
+ component.setType(namingConventions.inferComponentType(component.getTargetClass()));
} else if (null != component.getBaseClass()) {
component.setType(namingConventions.inferComponentType(component.getBaseClass()));
} else {
@@ -122,10 +122,10 @@
if (null == component.getBaseClass()) {
log.error("Base class for generated component is not set :" + component.getType());
// return;
- } else if (null == component.getComponentClass()) {
+ } else if (null == component.getTargetClass()) {
component.setTargetClass(namingConventions.inferUIComponentClass(component.getType()));
}
- } else if (null == component.getComponentClass()) {
+ } else if (null == component.getTargetClass()) {
if (null != component.getBaseClass()) {
component.setTargetClass(component.getBaseClass());
} else {
Modified: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/_attribute_accessors.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/_attribute_accessors.ftl 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/_attribute_accessors.ftl 2010-04-22 10:17:07 UTC (rev 16794)
@@ -2,6 +2,8 @@
public ${attribute.simpleTypeName} ${attribute.getterName}() {
<#if attribute.typeForCasting?contains("Boolean")>
return Boolean.valueOf(getStateHelper().eval(Properties.${attribute.name}<#if attribute.defaultValue?exists>, ${attribute.defaultValue}</#if>).toString());
+ <#elseif attribute.typeForCasting?contains("Object") >
+ return getStateHelper().get(Properties.${attribute.name});
<#elseif attribute.bindingAttribute >
return (${attribute.typeForCasting}) getStateHelper().get(Properties.${attribute.name});
<#else>
Modified: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl 2010-04-22 10:17:07 UTC (rev 16794)
@@ -3,7 +3,7 @@
</#macro>
<#include "_copyright.ftl">
-package ${componentClass.package};
+package ${targetClass.package};
import javax.annotation.Generated;
import java.io.IOException;
@@ -31,7 +31,7 @@
<#assign implemented=interfaces>
</#if>
@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
-public class ${componentClass.simpleName} extends ${baseClass.simpleName}
+public class ${targetClass.simpleName} extends ${baseClass.simpleName}
<#if (implemented?size > 0)>implements <@concat seq=implemented ; interface>${interface}</@concat></#if> {
public static final String COMPONENT_TYPE="${type}";
@@ -44,6 +44,10 @@
return COMPONENT_FAMILY;
}</#if>
+ public ${targetClass.simpleName}() {
+ setRendererType("${rendererType}");
+ }
+
<#if (eventNames?size > 0)>
private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
<@concat seq=eventNames delimiter=",\n "; event>"${event.name}"</@concat>
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -37,6 +37,7 @@
import org.richfaces.cdk.model.EventName;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.PropertyBase;
+import org.richfaces.cdk.model.RendererModel;
import javax.el.MethodExpression;
import javax.faces.component.UIOutput;
@@ -91,6 +92,7 @@
component.setGenerate(true);
component.setTargetClass(ClassName.parseName("org.richfaces.cdk.generate.java.GeneratedComponent"));
component.setBaseClass(ClassName.parseName(UIOutput.class.getName()));
+ component.setRendererType(new RendererModel.Type("foo.barRenderer"));
PropertyBase attribute = component.getOrCreateAttribute("testValue");
attribute.setType(new ClassName(Object.class));
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -97,7 +97,7 @@
assertEquals("javax.faces.Panel", component.getType().toString());
assertEquals("javax.faces.Panel", component.getFamily());
- assertEquals("javax.faces.component.UIPanel", component.getComponentClass().getName());
+ assertEquals("javax.faces.component.UIPanel", component.getTargetClass().getName());
assertEquals("panel.gif", component.getIcon().getSmallIcon());
assertEquals("panel-large.gif", component.getIcon().getLargeIcon());
assertEquals("Panel component", component.getDescription());
Modified: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -52,6 +52,10 @@
+ public GeneratedComponent() {
+ setRendererType("foo.barRenderer");
+ }
+
private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
"id",
"action"
@@ -128,7 +132,7 @@
}
public Object getTestValue() {
- return (Object) getStateHelper().eval(Properties.testValue);
+ return getStateHelper().get(Properties.testValue);
}
public void setTestValue(Object testValue) {
Modified: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -80,7 +80,7 @@
}
public Object getTestObject() {
- return (Object) getStateHelper().eval(Properties.testObject);
+ return getStateHelper().get(Properties.testObject);
}
public void setTestObject(Object testObject) {
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxFunction.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxFunction.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxFunction.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -44,10 +44,6 @@
public static final String COMPONENT_TYPE = "org.richfaces.Function";
- public AbstractAjaxFunction() {
- setRendererType("org.richfaces.FunctionRenderer");
- }
-
public abstract boolean isLimitRender();
@Attribute(required = true)
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -50,16 +50,6 @@
public static final String COMPONENT_FAMILY = "org.richfaces.AjaxLog";
-
- public AbstractAjaxLog() {
- setRendererType("org.richfaces.AjaxLogRenderer");
- }
-
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
@Attribute(defaultValue = "")
public abstract String getStyle();
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxStatus.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxStatus.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxStatus.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -40,10 +40,6 @@
public static final String COMPONENT_FAMILY = "org.richfaces.Status";
- public AbstractAjaxStatus() {
- setRendererType("org.richfaces.StatusRenderer");
- }
-
@Attribute(events = @EventName("start"))
public abstract String getOnstart();
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandButton.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandButton.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandButton.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -40,10 +40,6 @@
public static final String COMPONENT_FAMILY = "org.richfaces.CommandButton";
- public AbstractCommandButton() {
- setRendererType("org.richfaces.CommandButtonRenderer");
- }
-
@Attribute(events = {@EventName("click"), @EventName(value = "action", defaultEvent = true)})
public abstract String getOnclick();
@@ -80,6 +76,5 @@
@Attribute(defaultValue = "")
public abstract String getStyleClass();
- @Attribute(defaultValue = "Boolean.FALSE")
public abstract boolean isLimitRender();
}
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandLink.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandLink.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandLink.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -38,10 +38,6 @@
public static final String COMPONENT_FAMILY = "org.richfaces.CommandLink";
- public AbstractCommandLink() {
- setRendererType("org.richfaces.CommandLinkRenderer");
- }
-
@Attribute(events = {@EventName("click"), @EventName(value = "action", defaultEvent = true)})
public abstract String getOnclick();
@@ -78,6 +74,5 @@
@Attribute(defaultValue = "")
public abstract String getStyleClass();
- @Attribute(defaultValue = "Boolean.FALSE")
public abstract boolean isLimitRender();
}
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractMediaOutput.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractMediaOutput.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractMediaOutput.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -145,7 +145,6 @@
public abstract String getBorder();
- @Attribute(defaultValue = "Boolean.FALSE")
public abstract boolean isCacheable();
public abstract String getCharset();
@@ -172,7 +171,6 @@
public abstract String getHspace();
- @Attribute(defaultValue = "Boolean.FALSE")
public abstract boolean isIsmap();
public abstract String getLang();
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractOutputPanel.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractOutputPanel.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractOutputPanel.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -42,14 +42,8 @@
public static final String COMPONENT_FAMILY = "javax.faces.Panel";
- public AbstractOutputPanel() {
- setRendererType("org.richfaces.OutputPanelRenderer");
- }
-
- @Attribute(defaultValue = "Boolean.FALSE")
public abstract boolean isAjaxRendered();
- @Attribute(defaultValue = "Boolean.FALSE")
public abstract boolean isKeepTransient();
@Attribute(defaultValue = "inline")
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractPush.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractPush.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractPush.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -122,7 +122,6 @@
@Attribute(defaultValue = "1000")
public abstract int getInterval();
- @Attribute(defaultValue = "Boolean.TRUE")
public abstract boolean isEnabled();
// TODO what wrong with that name?
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractQueue.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractQueue.java 2010-04-21 17:29:01 UTC (rev 16793)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractQueue.java 2010-04-22 10:17:07 UTC (rev 16794)
@@ -21,7 +21,6 @@
*/
package org.richfaces.component;
-import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.JsfComponent;
import javax.faces.component.UIComponentBase;
@@ -39,11 +38,6 @@
public static final String COMPONENT_FAMILY = "org.richfaces.Queue";
- public AbstractQueue() {
- setRendererType("org.richfaces.QueueRenderer");
- }
-
- @Attribute(defaultValue = "Integer.MIN_VALUE")
public abstract int getRequestDelay();
public abstract String getStatus();
14 years, 8 months
JBoss Rich Faces SVN: r16793 - in root/ui/trunk/components/core/src/main/java/org/richfaces: taglib/html and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-04-21 13:29:01 -0400 (Wed, 21 Apr 2010)
New Revision: 16793
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAttachQueue.java
root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AttachQueueHandler.java
root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AttachQueueInfo.java
root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AttachQueueStack.java
Removed:
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AjaxHandler.java
root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/BehaviorStack.java
root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/BehaviorsAddingComponentHandlerWrapper.java
Log:
https://jira.jboss.org/jira/browse/RFPL-518
Added: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAttachQueue.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAttachQueue.java (rev 0)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAttachQueue.java 2010-04-21 17:29:01 UTC (rev 16793)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.component;
+
+import javax.faces.component.UIComponentBase;
+
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.annotations.TagType;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@JsfComponent(
+ tag = @Tag(name = "attachQueue",
+ handler = "org.richfaces.taglib.html.facelets.AttachQueueHandler",
+ generate = false, type = TagType.Facelets)
+)
+public abstract class AbstractAttachQueue extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.AttachQueue";
+
+ public abstract String getRequestSimilarityId();
+
+ public abstract int getRequestDelay();
+
+ public abstract int getTimeout();
+
+ public abstract boolean isIgnoreDupresponses();
+
+ public abstract String getOnrequestqueue();
+
+ public abstract String getOnrequestdequeue();
+
+ @Override
+ public String getFamily() {
+ return null;
+ }
+
+}
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AjaxHandler.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AjaxHandler.java 2010-04-21 17:14:13 UTC (rev 16792)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AjaxHandler.java 2010-04-21 17:29:01 UTC (rev 16793)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.view.facelets.html;
import java.beans.BeanDescriptor;
@@ -13,6 +35,7 @@
import javax.el.MethodExpression;
import javax.faces.application.Application;
import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.ClientBehavior;
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
@@ -24,13 +47,13 @@
import javax.faces.view.BehaviorHolderAttachedObjectTarget;
import javax.faces.view.facelets.BehaviorConfig;
import javax.faces.view.facelets.ComponentHandler;
-import javax.faces.view.facelets.CompositeFaceletHandler;
import javax.faces.view.facelets.FaceletContext;
import javax.faces.view.facelets.TagAttribute;
import javax.faces.view.facelets.TagException;
import javax.faces.view.facelets.TagHandler;
import org.ajax4jsf.component.behavior.AjaxBehavior;
+import org.richfaces.view.facelets.html.BehaviorStack.BehaviorInfo;
public class AjaxHandler extends TagHandler implements BehaviorHolderAttachedObjectHandler {
@@ -47,11 +70,9 @@
private final TagAttribute oncomplete;
private final TagAttribute onerror;
private final TagAttribute onevent;
- private final TagAttribute queueId;
private final TagAttribute render;
private final TagAttribute similarityGroupingId;
private final TagAttribute statusId;
- private final boolean wrapping;
public AjaxHandler(BehaviorConfig config) {
super(config);
@@ -62,7 +83,6 @@
this.immediate = this.getAttribute("immediate");
this.listener = this.getAttribute("listener");
this.limitRender = this.getAttribute("limitRender");
- this.queueId = this.getAttribute("queueId");
this.statusId = this.getAttribute("status");
this.similarityGroupingId = this.getAttribute("similarityGroupingId");
this.onevent = this.getAttribute("onevent");
@@ -70,16 +90,33 @@
this.onbegin = this.getAttribute("onbegin");
this.oncomplete = this.getAttribute("oncomplete");
this.onbeforedomupdate = this.getAttribute("onbeforedomupdate");
- this.wrapping = isWrapping();
}
- public void apply(FaceletContext fContext, UIComponent parent) throws IOException {
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException {
String eventName = getEventName();
+ AjaxBehavior ajaxBehavior = createAjaxBehavior(ctx, eventName);
+ FacesContext context = ctx.getFacesContext();
+ BehaviorStack ajaxBehaviors = BehaviorStack.getBehaviorStack(context, true);
+ ajaxBehaviors.pushBehavior(context, ajaxBehavior, AjaxBehavior.BEHAVIOR_ID, eventName);
- if (this.wrapping) {
- applyWrapping(fContext, parent, eventName);
+ AttachQueueStack attachQueueStack = AttachQueueStack.getStack(context, true);
+ AttachQueueInfo attachQueueInfo = new AttachQueueInfo(parent);
+ attachQueueStack.push(attachQueueInfo);
+
+ nextHandler.apply(ctx, parent);
+
+ attachQueueStack.pop();
+
+ BehaviorInfo behaviorInfo = ajaxBehaviors.popBehavior();
+ if (behaviorInfo != null) {
+ if (behaviorInfo.isWrapping()) {
+ UIComponent attachQueue = attachQueueInfo.getAttachQueue();
+ assignAttachQueueComponent(context, attachQueue, behaviorInfo.getBehaviors());
+ } else {
+ applyNested(ctx, parent, ajaxBehavior);
+ }
} else {
- applyNested(fContext, parent, eventName);
+ //TODO nick - is this possible?
}
}
@@ -97,11 +134,12 @@
return list;
}
- private void applyNested(FaceletContext ctx, UIComponent parent, String eventName) {
+ private void applyNested(FaceletContext ctx, UIComponent parent, AjaxBehavior behavior) {
if (!ComponentHandler.isNew(parent)) {
return;
}
+ String eventName = getEventName();
if (UIComponent.isCompositeComponent(parent)) {
BeanInfo componentBeanInfo = (BeanInfo) parent.getAttributes().get(UIComponent.BEANINFO_KEY);
@@ -146,25 +184,33 @@
throw new TagException(tag, "Error: enclosing composite component does not support event " + eventName);
}
} else if (parent instanceof ClientBehaviorHolder) {
- applyAttachedObject(ctx, parent, eventName);
+ ClientBehaviorHolder bHolder = (ClientBehaviorHolder) parent;
+ eventName = resolveEventName(bHolder);
+ bHolder.addClientBehavior(eventName, behavior);
} else {
throw new TagException(this.tag, "Unable to attach <a4j:ajax> to non-ClientBehaviorHolder parent");
}
}
- private void applyWrapping(FaceletContext ctx, UIComponent parent, String eventName) throws IOException {
- AjaxBehavior ajaxBehavior = createAjaxBehavior(ctx, eventName);
- FacesContext context = ctx.getFacesContext();
- BehaviorStack ajaxBehaviors = BehaviorStack.getBehaviorStack(context, true);
+ private void assignAttachQueueComponent(FacesContext context, UIComponent attachQueue,
+ List<ClientBehavior> behaviors) {
- ajaxBehaviors.pushBehavior(context, ajaxBehavior, AjaxBehavior.BEHAVIOR_ID, eventName);
- nextHandler.apply(ctx, parent);
- ajaxBehaviors.popBehavior();
+ if (behaviors != null && attachQueue != null) {
+ String queueId = attachQueue.getClientId(context);
+
+ for (ClientBehavior behavior : behaviors) {
+ if (!(behavior instanceof AjaxBehavior)) {
+ continue;
+ }
+
+ AjaxBehavior ajaxBehavior = (AjaxBehavior) behavior;
+ ajaxBehavior.setQueueId(queueId);
+ }
+ }
}
- public void applyAttachedObject(FaceletContext fContext, UIComponent parent, String eventName) {
- ClientBehaviorHolder bHolder = (ClientBehaviorHolder) parent;
-
+ private String resolveEventName(ClientBehaviorHolder bHolder) {
+ String eventName = getEventName();
if (null == eventName) {
eventName = bHolder.getDefaultEventName();
@@ -177,13 +223,11 @@
if (!eventNames.contains(eventName)) {
throw new TagException(this.tag,
eventName + "event is not supported for the "
- + parent.getClass().getSimpleName());
+ + bHolder.getClass().getSimpleName());
}
}
- AjaxBehavior ajaxBehavior = createAjaxBehavior(fContext, eventName);
-
- bHolder.addClientBehavior(eventName, ajaxBehavior);
+ return eventName;
}
public AjaxBehavior createAjaxBehavior(FaceletContext fContext, String eventName) {
@@ -195,7 +239,6 @@
setBehaviorAttribute(fContext, ajaxBehavior, this.execute, Object.class);
setBehaviorAttribute(fContext, ajaxBehavior, this.render, Object.class);
setBehaviorAttribute(fContext, ajaxBehavior, this.limitRender, Boolean.class);
- setBehaviorAttribute(fContext, ajaxBehavior, this.queueId, String.class);
setBehaviorAttribute(fContext, ajaxBehavior, this.statusId, String.class);
setBehaviorAttribute(fContext, ajaxBehavior, this.similarityGroupingId, String.class);
setBehaviorAttribute(fContext, ajaxBehavior, this.onevent, String.class);
@@ -211,7 +254,11 @@
public void applyAttachedObject(FacesContext context, UIComponent parent) {
FaceletContext ctx = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
- applyAttachedObject(ctx, parent, getEventName());
+ ClientBehaviorHolder bHolder = (ClientBehaviorHolder) parent;
+ String eventName = resolveEventName(bHolder);
+
+ AjaxBehavior ajaxBehavior = createAjaxBehavior(ctx, eventName);
+ bHolder.addClientBehavior(eventName, ajaxBehavior);
}
private void setBehaviorAttribute(FaceletContext ctx, AjaxBehavior behavior, TagAttribute attr, Class<?> type) {
@@ -228,10 +275,6 @@
return null;
}
- private boolean isWrapping() {
- return (this.nextHandler instanceof TagHandler) || (this.nextHandler instanceof CompositeFaceletHandler);
- }
-
public void registerBehaviorListener(FaceletContext fContext, AjaxBehavior behavior, TagAttribute listenerAttr) {
if (listenerAttr != null) {
MethodExpression mExpression = listenerAttr.getMethodExpression(fContext, Object.class,
Added: root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AttachQueueHandler.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AttachQueueHandler.java (rev 0)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AttachQueueHandler.java 2010-04-21 17:29:01 UTC (rev 16793)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.view.facelets.html;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class AttachQueueHandler extends ComponentHandler {
+
+ /**
+ * @param config
+ */
+ public AttachQueueHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ public void onComponentCreated(FaceletContext ctx, UIComponent c, UIComponent parent) {
+ super.onComponentCreated(ctx, c, parent);
+
+ AttachQueueStack attachQueueStack = AttachQueueStack.getStack(ctx.getFacesContext(), false);
+ if (attachQueueStack != null) {
+ AttachQueueInfo attachQueueInfo = attachQueueStack.peek();
+ if (attachQueueInfo != null) {
+ UIComponent queueInfoParent = attachQueueInfo.getParentComponent();
+ if (queueInfoParent.equals(parent)) {
+ attachQueueInfo.setAttachQueue(c);
+ }
+ }
+ }
+ }
+}
Added: root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AttachQueueInfo.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AttachQueueInfo.java (rev 0)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AttachQueueInfo.java 2010-04-21 17:29:01 UTC (rev 16793)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.view.facelets.html;
+
+import javax.faces.component.UIComponent;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+final class AttachQueueInfo {
+
+ private UIComponent parentComponent;
+
+ private UIComponent attachQueue;
+
+ public AttachQueueInfo(UIComponent parentComponent) {
+ super();
+ this.parentComponent = parentComponent;
+ }
+
+ public UIComponent getParentComponent() {
+ return parentComponent;
+ }
+
+ public void setAttachQueue(UIComponent attachQueue) {
+ this.attachQueue = attachQueue;
+ }
+
+ public UIComponent getAttachQueue() {
+ return attachQueue;
+ }
+
+}
Added: root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AttachQueueStack.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AttachQueueStack.java (rev 0)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AttachQueueStack.java 2010-04-21 17:29:01 UTC (rev 16793)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.view.facelets.html;
+
+import java.util.LinkedList;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+final class AttachQueueStack {
+
+ private static final String STACK_ATTRIBUTE_NAME = "org.richfaces.AttachQueueStack";
+
+ private LinkedList<AttachQueueInfo> stack = null;
+
+ public AttachQueueStack() {
+ stack = new LinkedList<AttachQueueInfo>();
+ }
+
+ public static AttachQueueStack getStack(FacesContext context, boolean createIfNull) {
+ Map<Object, Object> attributes = context.getAttributes();
+ AttachQueueStack attachQueueStack = (AttachQueueStack) attributes.get(STACK_ATTRIBUTE_NAME);
+
+ if (attachQueueStack == null && createIfNull) {
+ attachQueueStack = new AttachQueueStack();
+ attributes.put(STACK_ATTRIBUTE_NAME, attachQueueStack);
+ }
+
+ return attachQueueStack;
+ }
+
+ public void push(AttachQueueInfo info) {
+ stack.addFirst(info);
+ }
+
+ public AttachQueueInfo pop() {
+ return stack.removeFirst();
+ }
+
+ public AttachQueueInfo peek() {
+ if (!stack.isEmpty()) {
+ return stack.getFirst();
+ } else {
+ return null;
+ }
+ }
+}
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/BehaviorStack.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/BehaviorStack.java 2010-04-21 17:14:13 UTC (rev 16792)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/BehaviorStack.java 2010-04-21 17:29:01 UTC (rev 16793)
@@ -21,8 +21,10 @@
*/
+
package org.richfaces.view.facelets.html;
+import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -46,10 +48,10 @@
//TODO - check for bug resolution
final class BehaviorStack {
private static final String BEHAVIOR_STACK = "org.richfaces.BehaviorStack";
- private LinkedList<BehaviorInfo> behaviorStack = null;
+ private LinkedList<BehaviorInfoImpl> behaviorStack = null;
public BehaviorStack() {
- behaviorStack = new LinkedList<BehaviorInfo>();
+ behaviorStack = new LinkedList<BehaviorInfoImpl>();
}
public static BehaviorStack getBehaviorStack(FacesContext context, boolean createIfNull) {
@@ -64,41 +66,65 @@
return behaviorStack;
}
+ public boolean isEmpty() {
+ return behaviorStack.isEmpty();
+ }
+
public void addBehaviors(FacesContext context, ClientBehaviorHolder behaviorHolder) {
if (behaviorStack == null || behaviorStack.isEmpty()) {
return;
}
- for (BehaviorInfo behaviorInfo : behaviorStack) {
+ for (BehaviorInfoImpl behaviorInfo : behaviorStack) {
behaviorInfo.addBehavior(context, behaviorHolder);
}
}
+ void markWrapping() {
+ if (!behaviorStack.isEmpty()) {
+ BehaviorInfoImpl behaviorInfo = behaviorStack.getFirst();
+ behaviorInfo.markWrapping();
+ }
+ }
+
public void pushBehavior(FacesContext context, ClientBehavior clientBehavior, String behaviorId, String eventName) {
+
Object behaviorState = ((StateHolder) clientBehavior).saveState(context);
// closer behaviors are processed earlier
- behaviorStack.addFirst(new BehaviorInfo(behaviorId, eventName, behaviorState));
+ behaviorStack.addFirst(new BehaviorInfoImpl(behaviorId, eventName, behaviorState));
}
- public void popBehavior() {
+ public BehaviorInfo popBehavior() {
if (!behaviorStack.isEmpty()) {
- behaviorStack.removeFirst();
+ return behaviorStack.removeFirst();
+ } else {
+ return null;
}
}
- private static class BehaviorInfo {
+ static interface BehaviorInfo {
+
+ public List<ClientBehavior> getBehaviors();
+
+ public boolean isWrapping();
+ }
+
+ private static class BehaviorInfoImpl implements BehaviorInfo {
+
private String behaviorId;
private Object behaviorState;
private String eventName;
+ private List<ClientBehavior> behaviors;
+ private boolean wrapping = false;
- public BehaviorInfo(String behaviorId, String eventName, Object behaviorState) {
+ public BehaviorInfoImpl(String behaviorId, String eventName, Object behaviorState) {
this.behaviorId = behaviorId;
this.eventName = eventName;
this.behaviorState = behaviorState;
}
- public void addBehavior(FacesContext context, ClientBehaviorHolder behaviorHolder) {
+ private void addBehavior(FacesContext context, ClientBehaviorHolder behaviorHolder) {
String eventName = this.eventName;
if (eventName == null) {
@@ -116,6 +142,18 @@
}
}
+ public List<ClientBehavior> getBehaviors() {
+ return behaviors;
+ }
+
+ public boolean isWrapping() {
+ return wrapping;
+ }
+
+ private void markWrapping() {
+ wrapping = true;
+ }
+
private boolean shouldAddBehavior(ClientBehaviorHolder behaviorHolder, String eventName) {
if (!behaviorHolder.getEventNames().contains(eventName)) {
return false;
@@ -145,6 +183,12 @@
((StateHolder) behavior).restoreState(context, behaviorState);
+ if (behaviors == null) {
+ behaviors = new ArrayList<ClientBehavior>();
+ }
+
+ behaviors.add(behavior);
+
return behavior;
}
}
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/BehaviorsAddingComponentHandlerWrapper.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/BehaviorsAddingComponentHandlerWrapper.java 2010-04-21 17:14:13 UTC (rev 16792)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/BehaviorsAddingComponentHandlerWrapper.java 2010-04-21 17:29:01 UTC (rev 16793)
@@ -26,7 +26,6 @@
import java.io.IOException;
import javax.el.ELException;
-
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.component.behavior.ClientBehaviorHolder;
@@ -100,7 +99,9 @@
FacesContext facesContext = ctx.getFacesContext();
BehaviorStack behaviorStack = BehaviorStack.getBehaviorStack(facesContext, false);
- if (behaviorStack != null) {
+ if (behaviorStack != null && !behaviorStack.isEmpty()) {
+ behaviorStack.markWrapping();
+
if (c instanceof ClientBehaviorHolder) {
ClientBehaviorHolder behaviorHolder = (ClientBehaviorHolder) c;
14 years, 8 months
JBoss Rich Faces SVN: r16792 - root/ui/trunk/components/core/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-04-21 13:14:13 -0400 (Wed, 21 Apr 2010)
New Revision: 16792
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxFunction.java
Log:
Small fixes for a4j:jsFunction
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxFunction.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxFunction.java 2010-04-21 12:36:37 UTC (rev 16791)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxFunction.java 2010-04-21 17:14:13 UTC (rev 16792)
@@ -23,14 +23,13 @@
package org.richfaces.component;
+import javax.faces.component.UICommand;
+
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.Tag;
-import javax.faces.component.UICommand;
-import javax.faces.component.behavior.ClientBehaviorHolder;
-
/**
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.2 $ $Date: 2007/01/23 20:01:04 $
@@ -39,7 +38,7 @@
@JsfComponent(
tag = @Tag(name = "jsFunction")
)
-public abstract class AbstractAjaxFunction extends UICommand implements ClientBehaviorHolder {
+public abstract class AbstractAjaxFunction extends UICommand {
public static final String COMPONENT_FAMILY = "javax.faces.Command";
@@ -49,9 +48,9 @@
setRendererType("org.richfaces.FunctionRenderer");
}
- @Attribute(defaultValue = "false")
public abstract boolean isLimitRender();
+ @Attribute(required = true)
public abstract String getName();
public abstract Object getExecute();
14 years, 8 months
JBoss Rich Faces SVN: r16791 - in root/ui/trunk/components/core/src/main: resources/META-INF/resources and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-04-21 08:36:37 -0400 (Wed, 21 Apr 2010)
New Revision: 16791
Added:
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css
Removed:
root/ui/trunk/components/core/src/main/resources/META-INF/resources/4_0_0.css
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java
Log:
Fix for missing CSS in a4j:log
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java 2010-04-21 12:31:39 UTC (rev 16790)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java 2010-04-21 12:36:37 UTC (rev 16791)
@@ -23,22 +23,22 @@
package org.richfaces.component;
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponentBase;
+
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.UIComponentBase;
-
/**
* @author Nick Belaevski
*
*/
@ResourceDependencies(value = {
@ResourceDependency(name = "jquery.js") , @ResourceDependency(name = "richfaces.js") ,
- @ResourceDependency(name = "richfaces-jsf-log.js")
+ @ResourceDependency(name = "richfaces-jsf-log.js"), @ResourceDependency(name = "richfaces.css")
})
@JsfComponent(
tag = @Tag(name = "log"),
@@ -80,10 +80,10 @@
//
// public abstract String getHeight();
// public abstract void setHeight(String newvalue);
-//
+//
// public abstract String getLevel();
// public abstract void setLevel(String newvalue);
-//
+//
// public abstract boolean isPopup();
// public abstract void setPopup(boolean popup);
}
Deleted: root/ui/trunk/components/core/src/main/resources/META-INF/resources/4_0_0.css
===================================================================
--- root/ui/trunk/components/core/src/main/resources/META-INF/resources/4_0_0.css 2010-04-21 12:31:39 UTC (rev 16790)
+++ root/ui/trunk/components/core/src/main/resources/META-INF/resources/4_0_0.css 2010-04-21 12:36:37 UTC (rev 16791)
@@ -1,10 +0,0 @@
-.rich-log {
- height: 300px;
- overflow: auto;
- width: 100%;
-}
-
-.rich-log-contents {
- font-family: Consolas, Courier New, Courier;
- font-size: 14px;
-}
Copied: root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css (from rev 16790, root/ui/trunk/components/core/src/main/resources/META-INF/resources/4_0_0.css)
===================================================================
--- root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css (rev 0)
+++ root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css 2010-04-21 12:36:37 UTC (rev 16791)
@@ -0,0 +1,10 @@
+.rich-log {
+ height: 300px;
+ overflow: auto;
+ width: 100%;
+}
+
+.rich-log-contents {
+ font-family: Consolas, Courier New, Courier;
+ font-size: 14px;
+}
14 years, 8 months
JBoss Rich Faces SVN: r16790 - root/ui/trunk/components/core/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-04-21 08:31:39 -0400 (Wed, 21 Apr 2010)
New Revision: 16790
Added:
root/ui/trunk/components/core/src/main/resources/META-INF/resources/4_0_0.css
Removed:
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/
Log:
Fix for missing CSS in a4j:log
Copied: root/ui/trunk/components/core/src/main/resources/META-INF/resources/4_0_0.css (from rev 16788, root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/4_0_0.css)
===================================================================
--- root/ui/trunk/components/core/src/main/resources/META-INF/resources/4_0_0.css (rev 0)
+++ root/ui/trunk/components/core/src/main/resources/META-INF/resources/4_0_0.css 2010-04-21 12:31:39 UTC (rev 16790)
@@ -0,0 +1,10 @@
+.rich-log {
+ height: 300px;
+ overflow: auto;
+ width: 100%;
+}
+
+.rich-log-contents {
+ font-family: Consolas, Courier New, Courier;
+ font-size: 14px;
+}
14 years, 8 months
JBoss Rich Faces SVN: r16789 - in root/cdk/trunk/plugins/generator/src: main/java/org/richfaces/cdk/model and 8 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-04-21 08:21:21 -0400 (Wed, 21 Apr 2010)
New Revision: 16789
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacesId.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelMap.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AnnotationProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/XmlTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedValidator.java
Log:
RF-7826 Migrate A1 components to new CDK
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -78,15 +78,8 @@
descriptionProcessor.processDescription(attribute, attributeAnnotarion.description(), beanProperty.getDocComment());
- String defaultValue = attributeAnnotarion.defaultValue();
- if (!Strings.isEmpty(defaultValue)) {
- if (STRING_NAME.equals(attribute.getType().toString())) {
- defaultValue = "\"" + defaultValue + "\"";
- }
- attribute.setDefaultValue(defaultValue);
- }
+ setDefaultValue(attribute, attributeAnnotarion);
-
String suggestedValue = attributeAnnotarion.suggestedValue();
if (!Strings.isEmpty(suggestedValue)) {
attribute.setSuggestedValue(suggestedValue);
@@ -114,6 +107,42 @@
}
}
+ private void setDefaultValue(PropertyBase attribute, Attribute attributeAnnotarion) {
+ String defaultValue = attributeAnnotarion.defaultValue();
+ if (Strings.isEmpty(defaultValue)) {
+ if (attribute.getType().isPrimitive()) {
+ if (isInstace(attribute, byte.class)) {
+ defaultValue = String.valueOf(false);
+ } else if (isInstace(attribute, int.class)) {
+ defaultValue = String.valueOf(Integer.MIN_VALUE);
+ } else if (isInstace(attribute, long.class)) {
+ defaultValue = String.valueOf(Long.MIN_VALUE);
+ } else if (isInstace(attribute, byte.class)) {
+ defaultValue = String.valueOf(Byte.MIN_VALUE);
+ } else if (isInstace(attribute, short.class)) {
+ defaultValue = String.valueOf(Short.MIN_VALUE);
+ } else if (isInstace(attribute, float.class)) {
+ defaultValue = String.valueOf(Float.MIN_VALUE);
+ } else if (isInstace(attribute, double.class)) {
+ defaultValue = String.valueOf(Double.MIN_VALUE);
+ } else if (isInstace(attribute, char.class)) {
+ defaultValue = String.valueOf(Character.MIN_VALUE);
+ }
+
+ attribute.setDefaultValue(defaultValue);
+ }
+ } else {
+ if (STRING_NAME.equals(attribute.getType().toString())) {
+ defaultValue = "\"" + defaultValue + "\"";
+ }
+ attribute.setDefaultValue(defaultValue);
+ }
+ }
+
+ private boolean isInstace(PropertyBase attribute, Class<?> byteClass) {
+ return byteClass.getSimpleName().equals(attribute.getType().getName());
+ }
+
private List<ClassName> getSignature(Signature signature, AnnotationValue signatureMirror) {
if (signature == null) {
return null;
@@ -148,7 +177,6 @@
AnnotationValue params = signatureMirror.accept(new EmptyAnnotationValueVisitor<AnnotationValue>() {
@Override
public AnnotationValue visitAnnotation(AnnotationMirror a, Object o) {
- log.debug("-14- AttributeProcessor.visit(" + a + ", " + o + ")");
for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : a.getElementValues().entrySet()) {
if ("parameters".equals(entry.getKey().getSimpleName().toString())) {
return entry.getValue();
@@ -161,7 +189,6 @@
List<? extends AnnotationValue> o = params.accept(new EmptyAnnotationValueVisitor<List<? extends AnnotationValue>>(){
@Override
public List<? extends AnnotationValue> visitArray(List<? extends AnnotationValue> vals, Object o) {
- log.debug("-15- AttributeProcessor.visit(" + vals + ", " + o + ")");
return vals;
}
}, null);
@@ -170,7 +197,6 @@
parameters.add(annotationValue.accept(new EmptyAnnotationValueVisitor<ClassName>() {
@Override
public ClassName visitType(TypeMirror t, Object o) {
- log.debug("-12- AttributeProcessor.visit(" + t + ", " + o + ")");
return new ClassName(t.toString());
}
}, null));
@@ -202,7 +228,7 @@
public void processType(final BeanModelBase component, TypeElement element) throws CdkException {
log.debug("AttributesProcessorImpl.processType");
log.debug(" -> component = " + component);
- log.debug(" -> typeElement = " + element.getQualifiedName());
+ log.debug(" -> typeElement = " + element);
log.debug(" -- Process XML files with standard attributes definitions.");
log.debug(" -> sourceUtils.visitSupertypes...");
@@ -213,7 +239,7 @@
public void visit(TypeMirror type) {
try {
log.debug(" -> visit - " + type.toString());
- component.getAttributes().addAll(
+ component.addAttributes(
parseProperties(CdkEntityResolver.URN_ATTRIBUTES + type.toString() + ".xml"));
} catch (CdkException e) {
// TODO - log errors ?
@@ -247,8 +273,7 @@
// Process all files from @Jsf.. attributes property.
for (String attributes : attributesConfig) {
try {
- component.getAttributes().addAll(parseProperties(
- CdkEntityResolver.URN_ATTRIBUTES + attributes));
+ component.addAttributes(parseProperties(CdkEntityResolver.URN_ATTRIBUTES + attributes));
} catch (CdkException e) {
// TODO - log errors ?
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -23,17 +23,7 @@
package org.richfaces.cdk.apt.processors;
-import java.lang.annotation.Annotation;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.MirroredTypeException;
-import javax.lang.model.type.MirroredTypesException;
-import javax.lang.model.type.TypeKind;
-import javax.lang.model.type.TypeMirror;
-
+import com.google.inject.Inject;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.annotations.Event;
import org.richfaces.cdk.annotations.Facet;
@@ -51,7 +41,15 @@
import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.util.Strings;
-import com.google.inject.Inject;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.MirroredTypeException;
+import javax.lang.model.type.MirroredTypesException;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import java.lang.annotation.Annotation;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
/**
* <p class="changed_added_4_0">
@@ -79,17 +77,20 @@
// Process class-level annotations.
ComponentModel component = new ComponentModel();
+
// Should that component be generated ?
setClassNames(componentElement, component, annotation.generate());
- setComponentProperties(componentElement, component, annotation, library);
+ setComponentProperties(componentElement, component, annotation);
+
// Process the second level annotations.
for (final SubComponent subcomponent : annotation.components()) {
JsfComponent subAnnotation = new JsfSubComponent(subcomponent, annotation);
ComponentModel subcomponentModel = new ComponentModel();
subcomponentModel.setBaseClass(component.getTargetClass());
subcomponentModel.setTargetClass(ClassName.parseName(subcomponent.generate()));
- setComponentProperties(null, subcomponentModel, subAnnotation, library);
+ setComponentProperties(null, subcomponentModel, subAnnotation);
}
+
library.getComponents().add(component);
}
@@ -98,25 +99,43 @@
* @param componentElement
* @param component
* @param annotation
- * @param library
* @throws CdkException
*/
void setComponentProperties(TypeElement componentElement, ComponentModel component,
- JsfComponent annotation, ComponentLibrary library) throws CdkException {
+ JsfComponent annotation) throws CdkException {
setComponentType(componentElement, component, annotation.type());
setComponeneFamily(componentElement, component, annotation.family());
setDescription(component, annotation.description(), getDocComment(componentElement));
+ setRendererType(component, annotation.renderer());
processFacets(componentElement, component, annotation);
- processEvents(componentElement, component, annotation);
+ processAttributes(componentElement, component, annotation);
+ for (Tag tag : annotation.tag()) {
+ setTagInfo(tag, component);
+ }
+
+ // TODO - process @Test annotations.
+ }
+
+ private void setRendererType(ComponentModel component, JsfRenderer jsfRenderer) {
+ // TODO if jsfRenderer.empty set by naming convention
+
+ if (jsfRenderer != null && !Strings.isEmpty(jsfRenderer.type())) {
+ component.setRendererType(new RendererModel.Type(jsfRenderer.type()));
+ }
+ }
+
+ private void processAttributes(TypeElement componentElement, ComponentModel component, JsfComponent annotation) {
AttributesProcessor attributesProcessor = getAttributeProcessor();
attributesProcessor.processXmlFragment(component, annotation.attributes());
- if(null != componentElement){
- attributesProcessor.processType(component,componentElement);
+
+ if (componentElement != null) {
+ attributesProcessor.processType(component, componentElement);
}
- Collection<ClassName> interfaceNames = component.getInterfaces();
+
+ Collection<ClassName> interfaceNames = component.getInterfaces();
try {
Class<?>[] interfaces = annotation.interfaces();
for (Class<?> clazz : interfaces) {
@@ -130,20 +149,11 @@
} catch (MirroredTypeException e) {
processInterface(component, attributesProcessor, e.getTypeMirror());
}
- for (Tag tag : annotation.tag()) {
- setTagInfo(tag, component);
- }
-
- JsfRenderer jsfRenderer = annotation.renderer();
- if(!Strings.isEmpty(jsfRenderer.type())){
- component.setRendererType(new RendererModel.Type(jsfRenderer.type()));
- }
- // TODO - process @Test annotations.
}
private void processInterface(ComponentModel component, AttributesProcessor attributesProcessor, TypeMirror mirror) {
component.getInterfaces().add(ClassName.parseName(mirror.toString()));
- if(TypeKind.DECLARED.equals(mirror.getKind())){
+ if (TypeKind.DECLARED.equals(mirror.getKind())) {
attributesProcessor.processType(component, getSourceUtils().asTypeElement(mirror));
} else {
// TODO - record warning.
@@ -154,6 +164,7 @@
if (!Strings.isEmpty(type)) {
component.setType(FacesId.parseId(type));
} else if (null != componentElement) {
+
// static final String COMPONENT_FAMILY = "...";
Object value = getSourceUtils().getConstant(componentElement, COMPONENT_TYPE);
if (value != null) {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -33,7 +33,7 @@
*/
public class BeanModelBase extends DescriptionGroupBase {
- private final ModelCollection<PropertyBase> attributes = ModelCollection.<PropertyBase>create();
+ private final ModelMap<String, PropertyBase> attributes = ModelMap.<String, PropertyBase>create();
/**
* <p class="changed_added_4_0">
@@ -43,17 +43,34 @@
* @return the attributes
*/
public Collection<PropertyBase> getAttributes() {
- return attributes;
+ return attributes.values();
}
+ public void addAttribute(PropertyBase attribute) {
+ if (attributes != null) {
+ this.attributes.put(attribute.getName(), attribute);
+ }
+ }
+
+ public void addAttributes(Iterable<? extends PropertyBase> attributes) {
+ if (attributes != null) {
+ for (PropertyBase attribute : attributes) {
+ addAttribute(attribute);
+ }
+ }
+ }
+
+ public int getAttributesCount() {
+ return this.attributes.size();
+ }
+
/**
* <p class="changed_added_4_0">Return bean attribute for given name.</p>
* @param name
* @return
*/
public PropertyBase getAttribute(final String name) {
- // OPTIMIZATION keep HashMap for name-property pair for fast lookup.
- return attributes.find(new Named.NamedPredicate(name));
+ return attributes.get(name);
}
public PropertyBase getOrCreateAttribute(String attributeName) {
@@ -61,7 +78,7 @@
if (null == attribute) {
attribute = new PropertyModel();
attribute.setName(attributeName);
- attributes.add(attribute);
+ attributes.put(attributeName, attribute);
}
return attribute;
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacesId.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacesId.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacesId.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -32,7 +32,7 @@
*
* @author asmirnov(a)exadel.com
*/
-public class FacesId implements Serializable {
+public class FacesId implements Serializable, Comparable<FacesId> {
private static final long serialVersionUID = -8199984910177820771L;
private final String type;
@@ -108,4 +108,9 @@
return true;
}
+
+ @Override
+ public int compareTo(FacesId o) {
+ return type.compareTo(o.getType());
+ }
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelMap.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelMap.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelMap.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -23,14 +23,14 @@
package org.richfaces.cdk.model;
-import java.util.LinkedHashMap;
+import java.util.TreeMap;
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
*
*/
-public class ModelMap<K, E extends ModelElement<? super E>> extends LinkedHashMap<K, E> {
+public class ModelMap<K, E extends ModelElement<? super E>> extends TreeMap<K, E> {
public static <I, T extends ModelElement<? super T>> ModelMap<I, T> create() {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -205,15 +205,13 @@
renderer.setRendersChildren(rendersChildren);
}
- Collection<PropertyBase> rendererAttributes = renderer.getAttributes();
-
List<ImportAttributes> attributesImports = compositeInterface.getAttributesImports();
if (attributesImports != null) {
for (ImportAttributes attributesImport : attributesImports) {
String importURI = attributesImport.getSource();
Collection<PropertyBase> properties = fragmentParser.parseProperties(importURI);
if (properties != null) {
- rendererAttributes.addAll(properties);
+ renderer.addAttributes(properties);
}
}
}
@@ -221,7 +219,7 @@
List<Attribute> templateAttributes = compositeInterface.getAttributes();
if (templateAttributes != null) {
for (Attribute templateAttribute : templateAttributes) {
- rendererAttributes.add(buildProperty(templateAttribute));
+ renderer.addAttribute(buildProperty(templateAttribute));
}
}
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -35,7 +35,7 @@
@Override
protected void postUnmarshal(Bean bean, Model model) {
- model.getAttributes().addAll(bean.getAllProperties());
+ model.addAttributes(bean.getAllProperties());
}
@Override
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -54,6 +54,16 @@
return this.attributes;
}
+ public void addAttributes(List<AttributeModel> attributes) {
+ if (attributes == null) {
+ return;
+ }
+
+ for (AttributeModel attribute : attributes) {
+// this.attributes.
+ }
+ }
+
public void setAttributes(List<AttributeModel> attributes) {
this.attributes = attributes;
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -45,6 +45,7 @@
import org.richfaces.cdk.Output;
import org.richfaces.cdk.Outputs;
import org.richfaces.cdk.Stub;
+import org.richfaces.cdk.Logger;
import org.richfaces.cdk.apt.processors.CdkAnnotationProcessor;
import org.richfaces.cdk.apt.processors.AnnotationProcessorTest;
import org.richfaces.cdk.model.ComponentLibrary;
@@ -97,6 +98,9 @@
@Mock
private ModelValidator validator;
+ @Mock
+ private Logger log;
+
@Override
public void configure(Binder binder) {
super.configure(binder);
@@ -138,7 +142,9 @@
builder.generate();
expectLastCall();
replay(log, element, roundEnv, builder, validator, cdkProcessor);
+
processor.process(Collections.singleton(element), roundEnv);
+
verify(log, element, roundEnv, builder, validator, cdkProcessor);
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -90,10 +90,12 @@
@Test
public void testGetTask() throws AptException, Exception {
expect(output.getFolders()).andReturn(null);
- replay(log, processor, output);
+ replay(processor, output);
+
CompilationTask task = factory.get();
+
assertNotNull(task);
- verify(log, processor, output);
+ verify(processor, output);
}
@Test
@@ -109,14 +111,14 @@
expect(processor.process(capture(capturedTypes), EasyMock.<RoundEnvironment> anyObject())).andReturn(true)
.times(2);
- replay(log, processor, output);
+ replay(processor, output);
CompilationTask task = factory.get();
assertTrue(task.call());
Set<? extends TypeElement> elements = capturedTypes.getValue();
assertFalse(elements.isEmpty());
assertEquals("TestAnnotation2", elements.iterator().next().getSimpleName().toString());
- verify(log, processor, output);
+ verify(processor, output);
}
@Override
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AnnotationProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AnnotationProcessorTest.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AnnotationProcessorTest.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -94,7 +94,7 @@
@Source(Sources.JAVA_SOURCES)
protected FileManager sources;
- @Mock
+ @Inject
protected Logger log;
@Inject
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AttributesProcessorTest.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -36,6 +36,7 @@
import org.richfaces.cdk.CdkTestRunner;
import org.richfaces.cdk.Mock;
import org.richfaces.cdk.MockController;
+import org.richfaces.cdk.Logger;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
@@ -66,15 +67,16 @@
@Inject
private AttributesProcessorImpl processor;
-
+
@Mock
private DescriptionProcessor descriptionProcessor;
-
+
@Mock
private JAXB xmlProcessor;
-
+
@Mock
private SourceUtils utils;
+
/**
* Test method for {@link org.richfaces.cdk.apt.processors.AttributesProcessorImpl#processType(org.richfaces.cdk.model.BeanModelBase, javax.lang.model.element.TypeElement)}.
*/
@@ -92,7 +94,7 @@
mockController.replay();replay(element,beanProperty);
processor.processType(bean, element);
mockController.verify();verify(element,beanProperty);
- assertEquals(1, bean.getAttributes().size());
+ assertEquals(1, bean.getAttributesCount());
}
/**
@@ -109,7 +111,7 @@
mockController.replay();
processor.processXmlFragment(bean, FOO_XML);
mockController.verify();
- assertEquals(1, bean.getAttributes().size());
+ assertEquals(1, bean.getAttributesCount());
}
@Override
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -23,14 +23,18 @@
package org.richfaces.cdk.apt.processors;
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-
-import javax.lang.model.element.Modifier;
-import javax.lang.model.element.TypeElement;
-
+import com.google.common.collect.Iterables;
+import com.google.inject.Inject;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.same;
+import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.cdk.CdkTestRunner;
@@ -45,14 +49,14 @@
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
-import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.FacetModel;
import org.richfaces.cdk.xmlconfig.JAXB;
-import com.google.common.collect.Iterables;
-import com.google.inject.Inject;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.TypeElement;
+import java.util.Collections;
/**
* <p class="changed_added_4_0">
@@ -119,9 +123,9 @@
public void testSetClassNames() throws Exception {
expect(componentElement.getModifiers()).andReturn(Collections.<Modifier>emptySet());
expect(componentElement.getQualifiedName()).andReturn(new TestName(FOO_BAR));
- replay(log, utils, componentElement, jaxb, annotation);
+ replay(utils, componentElement, jaxb, annotation);
processor.setClassNames(componentElement, model,"");
- verify(log, utils, componentElement, jaxb,annotation );
+ verify(utils, componentElement, jaxb,annotation );
assertFalse(model.isGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertNull(model.getTargetClass());
@@ -137,9 +141,11 @@
public void testSetClassNames1() throws Exception {
expect(componentElement.getModifiers()).andReturn(Collections.<Modifier>singleton(Modifier.ABSTRACT));
expect(componentElement.getQualifiedName()).andReturn(new TestName(FOO_BAR));
- replay(log, utils, componentElement, jaxb, annotation);
+ replay(utils, componentElement, jaxb, annotation);
+
processor.setClassNames(componentElement, model,"");
- verify(log, utils, componentElement, jaxb,annotation );
+
+ verify(utils, componentElement, jaxb,annotation );
assertTrue(model.isGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertNull(model.getTargetClass());
@@ -154,9 +160,11 @@
public void testSetClassNames2() throws Exception {
expect(componentElement.getModifiers()).andReturn(Collections.<Modifier>emptySet());
expect(componentElement.getQualifiedName()).andReturn(new TestName(FOO_BAR));
- replay(log, utils, componentElement, jaxb, annotation);
+ replay(utils, componentElement, jaxb, annotation);
+
processor.setClassNames(componentElement, model,FOO_HTML_BAR);
- verify(log, utils, componentElement, jaxb,annotation );
+
+ verify(utils, componentElement, jaxb,annotation );
assertTrue(model.isGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
assertEquals(FOO_HTML_BAR,model.getTargetClass().toString());
@@ -164,29 +172,33 @@
@Test
public void testSetFamily() throws Exception {
- replay(log, utils, componentElement, jaxb, annotation);
+ replay(utils, componentElement, jaxb, annotation);
+
processor.setComponeneFamily(componentElement, model,FOO_HTML_BAR);
- verify(log, utils, componentElement, jaxb,annotation );
+
+ verify(utils, componentElement, jaxb,annotation );
assertEquals(FOO_HTML_BAR, model.getFamily());
}
@Test
public void testSetFamily1() throws Exception {
- TestName fooBar = new TestName(FOO_BAR);
expect(utils.getConstant(same(componentElement), eq(ComponentProcessor.COMPONENT_FAMILY))).andReturn(FOO_HTML_BAR);
- replay(log, utils, componentElement, jaxb, annotation);
+ replay(utils, componentElement, jaxb, annotation);
+
processor.setComponeneFamily(componentElement, model,"");
- verify(log, utils, componentElement, jaxb,annotation );
+
+ verify(utils, componentElement, jaxb,annotation );
assertEquals(FOO_HTML_BAR, model.getFamily());
}
@Test
public void testSetFamily2() throws Exception {
- TestName fooBar = new TestName(FOO_BAR);
expect(utils.getConstant(same(componentElement), eq(ComponentProcessor.COMPONENT_FAMILY))).andReturn(null);
- replay(log, utils, componentElement, jaxb, annotation);
+ replay(utils, componentElement, jaxb, annotation);
+
processor.setComponeneFamily(componentElement, model,"");
- verify(log, utils, componentElement, jaxb,annotation );
+
+ verify(utils, componentElement, jaxb,annotation );
assertNull( model.getFamily());
}
@@ -207,9 +219,11 @@
// expect(this.description.largeIcon()).andReturn("");
// expect(this.description.displayName()).andReturn("fooFacet").times(2);
// expect(this.description.value()).andReturn("");
- replay(log, utils, componentElement, jaxb, annotation,property,facet,description);
+ replay(utils, componentElement, jaxb, annotation,property,facet,description);
+
processor.processFacets(componentElement, model, annotation);
- verify(log, utils, componentElement, jaxb,annotation,property,facet,description);
+
+ verify(utils, componentElement, jaxb,annotation,property,facet,description);
assertEquals(1, model.getFacets().size());
FacetModel facetModel = Iterables.getOnlyElement(model.getFacets());
assertTrue(facetModel.isGenerate());
@@ -230,9 +244,11 @@
// expect(this.description.largeIcon()).andReturn("");
// expect(this.description.displayName()).andReturn("fooFacet").times(2);
// expect(this.description.value()).andReturn("");
- replay(log, utils, componentElement, jaxb, annotation,property,facet,description);
+ replay(utils, componentElement, jaxb, annotation,property,facet,description);
+
processor.processFacets(componentElement, model, annotation);
- verify(log, utils, componentElement, jaxb,annotation,property,facet,description);
+
+ verify(utils, componentElement, jaxb,annotation,property,facet,description);
assertEquals(1, model.getFacets().size());
FacetModel facetModel = Iterables.getOnlyElement(model.getFacets());
assertTrue(facetModel.isGenerate());
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -32,6 +32,7 @@
import org.richfaces.cdk.Mock;
import org.richfaces.cdk.Output;
import org.richfaces.cdk.Outputs;
+import org.richfaces.cdk.Logger;
import org.richfaces.cdk.generate.freemarker.CdkConfiguration;
import org.richfaces.cdk.generate.freemarker.LibraryModelWrapper;
import org.richfaces.cdk.model.ClassName;
@@ -69,6 +70,9 @@
@Output(Outputs.RESOURCES)
protected FileManager output;
+ @Inject
+ protected Logger log;
+
protected static PropertyBase addAttribute(ModelElementBase model, String attributeName, Class<?> type, boolean generate) {
PropertyBase attribute = model.getOrCreateAttribute(attributeName);
attribute.setType(new ClassName(type));
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -73,9 +73,10 @@
ComponentLibrary library = new ComponentLibrary();
library.getBehaviors().add(behavior);
+
generator.generate(behavior);
+ log.debug(outputWriter.toString());
-// System.out.println(outputWriter);
verify(output);
compare(outputWriter, "GeneratedBehavior.java");
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -32,7 +32,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.cdk.CdkTestRunner;
-import org.richfaces.cdk.Logger;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.EventName;
@@ -60,9 +59,6 @@
@Inject
private ComponentClassGenerator generator;
- @Inject
- private Logger log;
-
@Test
public void testGetOutputFileComponent() throws Exception {
final StringWriter outputWriter = new StringWriter();
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ConverterClassGeneratorTest.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -31,7 +31,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.cdk.CdkTestRunner;
-import org.richfaces.cdk.Logger;
import org.richfaces.cdk.generate.freemarker.PropertyModel;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
@@ -52,9 +51,6 @@
@Inject
private ConverterClassGenerator generator;
- @Inject
- private Logger log;
-
@Test
public void testGetOutputFileValidator() throws Exception {
final StringWriter outputWriter = new StringWriter();
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -73,9 +73,10 @@
ComponentLibrary library = new ComponentLibrary();
library.getValidators().add(validator);
+
generator.generate(validator);
+ log.debug(outputWriter.toString());
-// System.out.println(outputWriter);
verify(output);
compare(outputWriter, "GeneratedValidator.java");
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/XmlTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/XmlTest.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/XmlTest.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -25,23 +25,33 @@
import org.custommonkey.xmlunit.Validator;
import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Assert;
+import org.junit.runner.RunWith;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.xmlconfig.model.FacesConfigAdapter;
+import org.richfaces.cdk.Logger;
+import org.richfaces.cdk.CdkTestRunner;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.xml.transform.stream.StreamResult;
import java.io.*;
+import com.google.inject.Inject;
+
/**
* @author akolonitsky
* @since Jan 13, 2010
*/
+(a)RunWith(CdkTestRunner.class)
public abstract class XmlTest extends JaxbTestBase {
+
static {
XMLUnit.setControlEntityResolver(new CdkEntityResolver());
}
+ @Inject
+ protected Logger log;
+
protected void validateXml(StringWriter facesConfig, String schemaLocation) throws SAXException, IOException {
InputSource is = new InputSource(new StringReader(facesConfig.toString()));
Validator validator = new Validator(is);
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -51,13 +51,13 @@
AttributeModel attributeModel = new AttributeModel();
attributeModel.setName("attr2");
attributeModel.setType(new ClassName(String.class));
- behaviorModel.getAttributes().add(attributeModel);
+ behaviorModel.addAttribute(attributeModel);
library.getBehaviors().add(behaviorModel);
// Jaxb marshaling
StringWriter facesConfig = generateFacesConfig(library);
-// System.out.println(facesConfig.toString());
+ log.debug(facesConfig.toString());
// Checks
checkXmlStructure(facesConfig);
Modified: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedBehavior.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -39,13 +39,29 @@
}
+ private Boolean testFlag;
+
+
private Object testValue;
- private Boolean testFlag;
+ public void setTestFlag(Boolean testFlag) {
+ this.testFlag = testFlag;
+ }
+ public Boolean isTestFlag() {
+ if (testFlag != null) {
+ return testFlag;
+ }
+ ValueBinding vb = getValueBinding("testFlag");
+ if (null != vb) {
+ return (Boolean) vb.getValue(getFacesContext());
+ }
+
+ return testFlag;
+ }
public void setTestValue(Object testValue) {
this.testValue = testValue;
}
@@ -62,22 +78,6 @@
return testValue;
}
- public void setTestFlag(Boolean testFlag) {
- this.testFlag = testFlag;
- }
-
- public Boolean isTestFlag() {
- if (testFlag != null) {
- return testFlag;
- }
-
- ValueBinding vb = getValueBinding("testFlag");
- if (null != vb) {
- return (Boolean) vb.getValue(getFacesContext());
- }
-
- return testFlag;
- }
private static FacesContext getFacesContext() {
return FacesContext.getCurrentInstance();
}
@@ -94,8 +94,8 @@
}
if (!initialStateMarked()) {
Object values[] = new Object[1];
- values[0] = this.getTestValue();
- values[1] = this.isTestFlag();
+ values[0] = this.isTestFlag();
+ values[1] = this.getTestValue();
return values;
}
@@ -112,8 +112,8 @@
}
Object values[] = (Object[]) state;
- setTestValue((Object) values[0]);
- setTestFlag((Boolean) values[1]);
+ setTestFlag((Boolean) values[0]);
+ setTestValue((Object) values[1]);
}
private boolean transientValue = false;
@@ -145,4 +145,4 @@
public void clearInitialState() {
initialState = false;
}
-}
+}
\ No newline at end of file
Modified: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -68,33 +68,41 @@
}
protected static enum Properties {
- testValue,
- testFlag,
+ list,
+ listInteger,
+ listStrings,
testBinding,
testExpr,
- listStrings,
- listInteger,
- list
+ testFlag,
+ testValue
}
- public Object getTestValue() {
- return (Object) getStateHelper().eval(Properties.testValue);
+ public ArrayList getList() {
+ return (ArrayList) getStateHelper().eval(Properties.list);
}
- public void setTestValue(Object testValue) {
- getStateHelper().put(Properties.testValue, testValue);
+ public void setList(ArrayList list) {
+ getStateHelper().put(Properties.list, list);
}
- public Boolean isTestFlag() {
- return Boolean.valueOf(getStateHelper().eval(Properties.testFlag).toString());
+ public ArrayList getListInteger() {
+ return (ArrayList) getStateHelper().eval(Properties.listInteger);
}
- public void setTestFlag(Boolean testFlag) {
- getStateHelper().put(Properties.testFlag, testFlag);
+ public void setListInteger(ArrayList listInteger) {
+ getStateHelper().put(Properties.listInteger, listInteger);
}
+ public ArrayList getListStrings() {
+ return (ArrayList) getStateHelper().eval(Properties.listStrings);
+ }
+
+ public void setListStrings(ArrayList listStrings) {
+ getStateHelper().put(Properties.listStrings, listStrings);
+ }
+
public MethodBinding getTestBinding() {
return (MethodBinding) getStateHelper().get(Properties.testBinding);
}
@@ -111,27 +119,19 @@
getStateHelper().put(Properties.testExpr, testExpr);
}
- public ArrayList getListStrings() {
- return (ArrayList) getStateHelper().eval(Properties.listStrings);
+ public Boolean isTestFlag() {
+ return Boolean.valueOf(getStateHelper().eval(Properties.testFlag).toString());
}
- public void setListStrings(ArrayList listStrings) {
- getStateHelper().put(Properties.listStrings, listStrings);
+ public void setTestFlag(Boolean testFlag) {
+ getStateHelper().put(Properties.testFlag, testFlag);
}
- public ArrayList getListInteger() {
- return (ArrayList) getStateHelper().eval(Properties.listInteger);
+ public Object getTestValue() {
+ return (Object) getStateHelper().eval(Properties.testValue);
}
- public void setListInteger(ArrayList listInteger) {
- getStateHelper().put(Properties.listInteger, listInteger);
+ public void setTestValue(Object testValue) {
+ getStateHelper().put(Properties.testValue, testValue);
}
-
- public ArrayList getList() {
- return (ArrayList) getStateHelper().eval(Properties.list);
- }
-
- public void setList(ArrayList list) {
- getStateHelper().put(Properties.list, list);
- }
}
\ No newline at end of file
Modified: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedConverter.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -48,9 +48,9 @@
protected enum Properties {
myClass,
- testObject,
testBoolean,
testInteger,
+ testObject,
visible
}
@@ -63,14 +63,6 @@
getStateHelper().put(Properties.myClass, myClass);
}
- public Object getTestObject() {
- return (Object) getStateHelper().eval(Properties.testObject);
- }
-
- public void setTestObject(Object testObject) {
- getStateHelper().put(Properties.testObject, testObject);
- }
-
public Boolean isTestBoolean() {
return Boolean.valueOf(getStateHelper().eval(Properties.testBoolean).toString());
}
@@ -87,6 +79,14 @@
getStateHelper().put(Properties.testInteger, testInteger);
}
+ public Object getTestObject() {
+ return (Object) getStateHelper().eval(Properties.testObject);
+ }
+
+ public void setTestObject(Object testObject) {
+ getStateHelper().put(Properties.testObject, testObject);
+ }
+
public boolean isVisible() {
return Boolean.valueOf(getStateHelper().eval(Properties.visible).toString());
}
Modified: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedValidator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedValidator.java 2010-04-21 07:36:09 UTC (rev 16788)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedValidator.java 2010-04-21 12:21:21 UTC (rev 16789)
@@ -41,13 +41,29 @@
}
+ private Boolean testFlag;
+
+
private Object testValue;
- private Boolean testFlag;
+ public void setTestFlag(Boolean testFlag) {
+ this.testFlag = testFlag;
+ }
+ public Boolean isTestFlag() {
+ if (testFlag != null) {
+ return testFlag;
+ }
+ ValueBinding vb = getValueBinding("testFlag");
+ if (null != vb) {
+ return (Boolean) vb.getValue(getFacesContext());
+ }
+
+ return testFlag;
+ }
public void setTestValue(Object testValue) {
this.testValue = testValue;
}
@@ -64,22 +80,6 @@
return testValue;
}
- public void setTestFlag(Boolean testFlag) {
- this.testFlag = testFlag;
- }
-
- public Boolean isTestFlag() {
- if (testFlag != null) {
- return testFlag;
- }
-
- ValueBinding vb = getValueBinding("testFlag");
- if (null != vb) {
- return (Boolean) vb.getValue(getFacesContext());
- }
-
- return testFlag;
- }
private static FacesContext getFacesContext() {
return FacesContext.getCurrentInstance();
}
@@ -96,8 +96,8 @@
}
if (!initialStateMarked()) {
Object values[] = new Object[1];
- values[0] = this.getTestValue();
- values[1] = this.isTestFlag();
+ values[0] = this.isTestFlag();
+ values[1] = this.getTestValue();
return values;
}
@@ -114,8 +114,8 @@
}
Object values[] = (Object[]) state;
- setTestValue((Object) values[0]);
- setTestFlag((Boolean) values[1]);
+ setTestFlag((Boolean) values[0]);
+ setTestValue((Object) values[1]);
}
private boolean transientValue = false;
@@ -147,4 +147,4 @@
public void clearInitialState() {
initialState = false;
}
-}
+}
\ No newline at end of file
14 years, 8 months
JBoss Rich Faces SVN: r16788 - root/docs/trunk/Developer_Guide/en-US.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-04-21 03:36:09 -0400 (Wed, 21 Apr 2010)
New Revision: 16788
Modified:
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Advanced_features.xml
Log:
Removed filter section from Advanced Features
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Advanced_features.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Advanced_features.xml 2010-04-21 06:24:02 UTC (rev 16787)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Advanced_features.xml 2010-04-21 07:36:09 UTC (rev 16788)
@@ -50,6 +50,7 @@
</para>
</section>
+ <!--
<section id="sect-Developer_Guide-Advanced_features-Filters">
<title>Filters</title>
<para>
@@ -124,6 +125,7 @@
</variablelist>
</para>
</section>
+ -->
<section id="sect-Developer_Guide-Advanced_features-Script_and_style_loading">
<title>Script and style loading</title>
14 years, 8 months
JBoss Rich Faces SVN: r16787 - in root/docs/trunk/Developer_Guide/en-US: extras and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-04-21 02:24:02 -0400 (Wed, 21 Apr 2010)
New Revision: 16787
Added:
root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Create_the_skin_bean.js
root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Using_XCSS_code_or_standard_CSS_code-CSS.xml_sample
root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Using_XCSS_code_or_standard_CSS_code-XCSS.xml_sample
Modified:
root/docs/trunk/Developer_Guide/en-US/Book_Info.xml
root/docs/trunk/Developer_Guide/en-US/Developer_Guide.xml
root/docs/trunk/Developer_Guide/en-US/Revision_History.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Basic_concepts.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Introduction.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml
Log:
Completed draft of skinning guide
Modified: root/docs/trunk/Developer_Guide/en-US/Book_Info.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/Book_Info.xml 2010-04-20 19:38:18 UTC (rev 16786)
+++ root/docs/trunk/Developer_Guide/en-US/Book_Info.xml 2010-04-21 06:24:02 UTC (rev 16787)
@@ -3,7 +3,7 @@
]>
<bookinfo id="book-Developer_Guide-Developer_Guide">
<title>Developer Guide</title>
- <subtitle>Developing projects using RichFaces &VERSIONLONG;<remark> (draft)</remark>
+ <subtitle>Developing applications using RichFaces &VERSIONLONG;<remark> (draft)</remark>
</subtitle>
<productname>RichFaces</productname>
<productnumber>4.0</productnumber>
Modified: root/docs/trunk/Developer_Guide/en-US/Developer_Guide.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/Developer_Guide.xml 2010-04-20 19:38:18 UTC (rev 16786)
+++ root/docs/trunk/Developer_Guide/en-US/Developer_Guide.xml 2010-04-21 06:24:02 UTC (rev 16787)
@@ -9,7 +9,6 @@
<xi:include href="chap-Developer_Guide-Basic_concepts.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Developer_Guide-Advanced_features.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Developer_Guide-Skinning_and_theming.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="appe-Developer_Guide-Resources.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="Revision_History.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</book>
Modified: root/docs/trunk/Developer_Guide/en-US/Revision_History.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/Revision_History.xml 2010-04-20 19:38:18 UTC (rev 16786)
+++ root/docs/trunk/Developer_Guide/en-US/Revision_History.xml 2010-04-21 06:24:02 UTC (rev 16787)
@@ -15,13 +15,29 @@
</author>
<revdescription>
<simplelist>
- <member>First draft of <xref linkend="chap-Developer_Guide-Introduction" /></member>
- <member>First draft of <xref linkend="chap-Developer_Guide-Getting_started_with_RichFaces" /></member>
- <member>First draft of <xref linkend="chap-Developer_Guide-RichFaces_overview" /></member>
- <member>First draft of <xref linkend="chap-Developer_Guide-Basic_concepts" /></member>
+ <member>First draft of <xref linkend="chap-Developer_Guide-Introduction" />.</member>
+ <member>First draft of <xref linkend="chap-Developer_Guide-Getting_started_with_RichFaces" />.</member>
+ <member>First draft of <xref linkend="chap-Developer_Guide-RichFaces_overview" />.</member>
+ <member>First draft of <xref linkend="chap-Developer_Guide-Basic_concepts" />.</member>
</simplelist>
</revdescription>
</revision>
+ <revision>
+ <revnumber>0.2</revnumber>
+ <date>Tue Apr 20 2010</date>
+ <author>
+ <firstname>Sean</firstname>
+ <surname>Rogers</surname>
+ <email>serogers(a)redhat.com</email>
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>First draft of <xref linkend="chap-Developer_Guide-Advanced_features" />.</member>
+ <member>First draft of <xref linkend="chap-Developer_Guide-Skinning_and_theming" />.</member>
+ <member>Revised previous draft chapters based on technical review.</member>
+ </simplelist>
+ </revdescription>
+ </revision>
</revhistory>
</simpara>
</appendix>
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Basic_concepts.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Basic_concepts.xml 2010-04-20 19:38:18 UTC (rev 16786)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Basic_concepts.xml 2010-04-21 06:24:02 UTC (rev 16787)
@@ -24,7 +24,7 @@
</listitem>
<listitem>
<para>
- The <sgmltag><a4j:support></sgmltag> tag allows you to add Ajax functionality to standard JSF components and send Ajax request on a chosen JavaScript event, such as <varname>onkeyup</varname> or <varname>onmouseover</varname>, for example.
+ The <sgmltag><a4j:ajax></sgmltag> tag allows you to add Ajax functionality to standard JSF components and send Ajax request on a chosen JavaScript event, such as <varname>onkeyup</varname> or <varname>onmouseover</varname>, for example.
</para>
</listitem>
<listitem>
@@ -36,16 +36,18 @@
</section>
<section id="sect-Developer_Guide-Basic_concepts-Receiving_events_and_updates">
- <title>Receiving events and updates</title>
+ <title>Receiving events and client-side updates</title>
<para>
- If no specific regions are specified, the whole page is updated when an Ajax response is received.
+ Updates are made only to those regions specified using the <varname>execute</varname>. If no specific regions are declared, the whole page is updated when an Ajax response is received.
</para>
+ <!--
<note>
<title>Rendering outside the active region</title>
<para>
If the content of an Ajax response needs to be rendered outside the active region, then the value of the <varname>renderRegionOnly</varname> attribute should be set to <literal>false</literal>. Otherwise, your Ajax updates are limited to elements of the active region. If not defined, the default setting is <code>renderRegionOnly="false"</code>.
</para>
</note>
+ -->
<section id="sect-Developer_Guide-Receiving_events_and_updates-Partial_page_updates">
<title>Partial page updates</title>
<para>
@@ -64,12 +66,14 @@
</section>
+ <!--
<section id="sect-Developer_Guide-Basic_concepts-Processing_data_on_the_server">
<title>Processing data on the server</title>
<para>
Use the <varname>process</varname> attribute to list the <varname>id</varname> identifiers of components that need to be processed together with a requesting component. This can be useful if more than one component needs to be processed, but not the entire view. Alternatively if only one component needs to be processed instead of the entire view, <code>process="@this"</code> can be specified.
</para>
</section>
+ -->
<section id="sect-Developer_Guide-Basic_concepts-Component_overview">
<title>Component overview</title>
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml 2010-04-20 19:38:18 UTC (rev 16786)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml 2010-04-21 06:24:02 UTC (rev 16787)
@@ -44,7 +44,7 @@
</listitem>
<listitem>
<para>
- Seam 1.2 – 2.1
+ Seam 1.2 and higher
</para>
</listitem>
<listitem>
@@ -79,11 +79,6 @@
</listitem>
<listitem>
<para>
- Jetty 6.1
- </para>
- </listitem>
- <listitem>
- <para>
Geronimo 2.0 and higher
</para>
</listitem>
@@ -130,7 +125,7 @@
</listitem>
<listitem>
<para>
- Opera 8.5 and higher
+ Opera 9.5 and higher
</para>
</listitem>
</itemizedlist>
@@ -166,12 +161,12 @@
</listitem>
<listitem>
<para>
- Internet Explorer 6.0 and higher
+ Internet Explorer 7.0 and higher
</para>
</listitem>
<listitem>
<para>
- Opera 8.5 and higher
+ Opera 9.5 and higher
</para>
</listitem>
<listitem>
@@ -190,7 +185,7 @@
<section id="sect-Developer_Guide-Getting_started_with_RichFaces-Installing_RichFaces">
<title>Installing RichFaces</title>
<para>
- Follow the instructions in this section to install the RichFaces framework on your computer.
+ Follow the instructions in this section to install the RichFaces framework and begin building applications.
</para>
<section id="sect-Developer_Guide-Installing_RichFaces-Downloading_RichFaces">
<title>Downloading RichFaces</title>
@@ -220,7 +215,7 @@
<step id="step-Developer_Guide-Creating_a_project-Create_a_new_project">
<title>Create a new project</title>
<para>
- In <application>JBoss Tools</application>, select <menuchoice><guimenu>File</guimenu><guimenuitem>New</guimenuitem><guimenuitem>JSF Project</guimenuitem></menuchoice> from the menu. Name the project, select <guilabel>JSF 2</guilabel> from the <guilabel>JSF Environment</guilabel> drop-down box, and click the <guibutton>Finish</guibutton> button to create the project.
+ Create a new project based on the JSF 2 environment by using the JSF Project wizard in <application>JBoss Tools</application>.
</para>
</step>
<step id="step-Developer_Guide-Creating_a_project-Add_the_RichFaces_libraries_to_the_project">
@@ -231,35 +226,35 @@
<note>
<title>Other required libraries</title>
<para>
- RichFaces also requires the following libraries to be referenced in your project. Typically they are already included when creating a JSF project in <application>JBoss Tools</application>.
- <itemizedlist>
- <listitem>
- <para>
- <filename>commons-beanutils.jar</filename>
- </para>
- </listitem>
- <listitem>
- <para>
- <filename>commons-collections.jar</filename>
- </para>
- </listitem>
- <listitem>
- <para>
- <filename>commons-digester.jar</filename>
- </para>
- </listitem>
- <listitem>
- <para>
- <filename>commons-logging.jar</filename>
- </para>
- </listitem>
- <listitem>
- <para>
- <filename>jhighlight.jar</filename>
- </para>
- </listitem>
- </itemizedlist>
+ RichFaces also requires the following libraries to be referenced in your project. Typically they are already included when creating a JSF project in <application>JBoss Tools</application>. <remark>These dependencies need to be confirmed.</remark>
</para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <filename>commons-beanutils.jar</filename>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <filename>commons-collections.jar</filename>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <filename>commons-digester.jar</filename>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <filename>commons-logging.jar</filename>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <filename>jhighlight.jar</filename>
+ </para>
+ </listitem>
+ </itemizedlist>
</note>
</step>
<step id="step-Developer_Guide-Creating_a_project-Reference_the_tag_libraries">
@@ -292,7 +287,7 @@
<step id="step-Developer_Guide-Using_RichFaces_with_Maven-Add_required_repositories">
<title>Add required repositories</title>
<para>
- A structure for the Maven project with minimal content can be created with the Maven archetype named <filename>maven-archetype-jsfwebapp</filename> included as part of the RichFaces Component Development Kit (<acronym>CDK</acronym>). The archetype and the project itself require extra repositories to be provided, namely <filename>http://snapshots.jboss.org/maven2/</filename> and <filename>http://repository.jboss.com/maven2/</filename>. To make the repositories accessible to Maven, add a profile in the <filename>maven_installation_folder/conf/settings.xml</filename> file under the <sgmltag><profiles></sgmltag> element:
+ A structure for the Maven project with minimal content can be created with the Maven archetype named <filename>maven-archetype-jsfwebapp</filename> <remark>(may be renamed in a later release)</remark> included as part of the RichFaces Component Development Kit (<acronym>CDK</acronym>). The archetype and the project itself require extra repositories to be provided, namely <filename>http://snapshots.jboss.org/maven2/</filename> and <filename>http://repository.jboss.com/maven2/</filename>. To make the repositories accessible to Maven, add a profile in the <filename>maven_installation_folder/conf/settings.xml</filename> file under the <sgmltag><profiles></sgmltag> element:
</para>
<programlisting language="XML" role="XML"><profiles>
@@ -342,7 +337,7 @@
<step id="step-Developer_Guide-Using_RichFaces_with_Maven-Generate_project_from_archetype">
<title>Generate project from archetype</title>
<para>
- The project can now be generated with the <filename>maven-archetype-jsfwebapp</filename> archetype. Create a new directory for your project, then run the following Maven command:
+ The project can now be generated with the <filename>maven-archetype-jsfwebapp</filename> <remark>(may be renamed in a later release)</remark> archetype. Create a new directory for your project, then run the following Maven command:
<screen>mvn archetype:generate -DarchetypeGroupId=org.richfaces.cdk -DarchetypeArtifactId=maven-archetype-jsfwebapp -DarchetypeVersion=4.0.0-SNAPSHOT -DgroupId=<replaceable>org.docs.richfaces</replaceable> -DartifactId=<replaceable>jsf-app</replaceable>
</screen>
</para>
@@ -505,7 +500,7 @@
<step id="step-Developer_Guide-Using_RichFaces_with_Maven-Add_tag_library_references">
<title>Add tag library references</title>
<para>
- After importing, edit the <filename><replaceable>jsf-app</replaceable>/src/main/webapp/pages/index.jsp</filename> file to include the tag library declaration as described in <xref linkend="step-Developer_Guide-Creating_a_project-Reference_the_tag_libraries" />
+ After importing, edit the <filename><replaceable>jsf-app</replaceable>/src/main/webapp/pages/index.xhtml</filename> file to include the tag library declaration as described in <xref linkend="step-Developer_Guide-Creating_a_project-Reference_the_tag_libraries" /> of <xref linkend="sect-Developer_Guide-Getting_started_with_RichFaces-Creating_a_project" />.
</para>
</step>
</procedure>
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Introduction.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Introduction.xml 2010-04-20 19:38:18 UTC (rev 16786)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Introduction.xml 2010-04-21 06:24:02 UTC (rev 16787)
@@ -4,7 +4,7 @@
<chapter id="chap-Developer_Guide-Introduction">
<title>Introduction</title>
<para>
- RichFaces is a rich component library for JavaServer Faces (<acronym>JSF</acronym>) 2 built on the open-source Ajax4jsf framework. It allows integration of Ajax capabilities into enterprise web application development without needing to use JavaScript.
+ The RichFaces framework is a rich component library for JavaServer Faces (<acronym>JSF</acronym>). It allows integration of Ajax capabilities into enterprise web application development without needing to use JavaScript.
</para>
<para>
RichFaces leverages several parts of the JSF2 framework including lifecycle, validation, conversion facilities, and management of static and dynamic resources. The RichFaces framework includes components with built-in Ajax support and a customizable look-and-feel that can be incorporated into JSF applications.
@@ -14,27 +14,27 @@
<itemizedlist>
<listitem>
<para>
- Build on the benefits of JavaServer Faces with support for Ajax. RichFaces is fully integrated into the JSF lifecycle. While other frameworks only give access to the managed bean facility, RichFaces uses the action and value change listeners, and invokes server-side validators and converters during the Ajax request-response cycle.
+ Build on the benefits of JavaServer Faces with support for Ajax. RichFaces is fully integrated into the JSF lifecycle: it uses the action and value change listeners, and invokes server-side validators and converters during the Ajax request-response cycle.
</para>
</listitem>
<listitem>
<para>
- Add Ajax capability to existing JSF applications. The core Ajax library (<classname>a4j</classname>) adds Ajax functionality into existing pages, such that extra JavaScript code is unnecessary and existing components do not need to be replaced with Ajax ones. RichFaces enables page-wide Ajax support instead of the traditional component-wide support, and events can be defined on the page for invoking an Ajax requests and JSF Component Tree synchronization.
+ Extend Ajax capability in existing JSF applications. The core Ajax library (<classname>a4j</classname>) adds extra Ajax functionality into existing pages, such that additional JavaScript code is unnecessary and existing components do not need to be replaced with Ajax ones. RichFaces enables page-wide Ajax support instead of the traditional component-wide support, and events can be defined on the page for invoking an Ajax requests and JSF Component Tree synchronization.
</para>
</listitem>
<listitem>
<para>
- Create complex application views using out-of-the-box components. The RichFaces user interface (<acronym>UI</acronym>) library (<classname>rich</classname>) contains components for adding rich interactive features to JSF applications. It extends the RichFaces framework to include a large set of Ajax-enabled components that come with extensive skinning support. Additionally, RichFaces components are designed to be used seamlessly with other 3d-party component libraries on the same page, so you have more options for developing your applications.
+ Create complex application views using out-of-the-box components. The RichFaces user interface (<acronym>UI</acronym>) library (<classname>rich</classname>) contains components for adding rich interactive features to JSF applications. It extends the RichFaces framework to include a large set of Ajax-enabled components that come with extensive skinning support. Additionally, the RichFaces framework is designed to be used seamlessly with other 3d-party libraries on the same page, so you have more options for developing applications.
</para>
</listitem>
<listitem>
<para>
- Write your own customized rich components with built-in Ajax support. The Component Development Kit (<acronym>CDK</acronym>), used for the RichFaces UI library creation, includes a code-generation facility and a templating facility using a JavaServer Pages (<acronym>JSP</acronym>)-like syntax.
+ Write your own customized rich components with built-in Ajax support. The Component Development Kit (<acronym>CDK</acronym>), used for the RichFaces UI library creation, includes a code-generation facility and a templating facility using <acronym>XHTML</acronym> (extended hyper-text markup language) syntax.
</para>
</listitem>
<listitem>
<para>
- Package resources with application Java classes. Ajax functionality in RichFaces provides an advanced support for the management of different resources, such as pictures, JavaScript code, and CSS stylesheets. The resource framework makes it possible to pack these resources into <filename>jar</filename> Java archive files along with the code for any custom components.
+ Package dynamic resources with application Java classes. Ajax functionality in RichFaces extends support for the management of different resources, such as pictures, JavaScript code, and CSS stylesheets. The resource framework makes it possible to pack dynamic resources along with the code for any custom components.
</para>
</listitem>
<listitem>
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml 2010-04-20 19:38:18 UTC (rev 16786)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml 2010-04-21 06:24:02 UTC (rev 16787)
@@ -4,7 +4,7 @@
<chapter id="chap-Developer_Guide-RichFaces_overview">
<title>RichFaces overview</title>
<para>
- The RichFaces framework is a component library which adds Ajax capability into existing pages, such that you don't need to write any extra JavaScript code or replace any existing components with new Ajax widgets. RichFaces also enables page-wide Ajax support instead of the traditional component-wide support. Events can be defined on pages that invoke Ajax requests. After an Ajax request, the areas of a page that are synchronized with the JSF Component Tree can themselves change data on the server according to events fired on the client.
+ The RichFaces framework is a component library which enhances JSF Ajax capabilities, such that you don't need to write any extra JavaScript code or replace any existing components with new Ajax widgets. RichFaces also enables page-wide Ajax support instead of the traditional component-wide support. Events can be defined on pages that invoke Ajax requests. After an Ajax request, the areas of a page that are synchronized with the JSF Component Tree can themselves change data on the server according to events fired on the client.
</para>
<para>
<xref linkend="figu-Developer_Guide-RichFaces_overview-Request_processing_flow" /> illustrates how requests are processed in the RichFaces framework.
@@ -35,11 +35,6 @@
<itemizedlist>
<listitem>
<para>
- Ajax Filter
- </para>
- </listitem>
- <listitem>
- <para>
Ajax Action Components
</para>
</listitem>
@@ -61,6 +56,7 @@
</itemizedlist>
Read this section for details on each element.
</para>
+ <!--
<section id="sect-Developer_Guide-Architecture-Ajax_Filter">
<title>Ajax Filter</title>
<para>
@@ -102,6 +98,7 @@
</mediaobject>
</figure>
</section>
+ -->
<section id="sect-Developer_Guide-Architecture-Ajax_Action_Components">
<title>Ajax Action Components</title>
@@ -113,7 +110,7 @@
<section id="sect-Developer_Guide-Architecture-Ajax_Containers">
<title>Ajax Containers</title>
<para>
- <classname>AjaxContainer</classname> is an interface that describes an area on a JSF page that is decoded during an Ajax request. <classname>AjaxViewRoot</classname> and <classname>AjaxRegion</classname> are implementations of this interface.
+ <classname>AjaxContainer</classname> <remark>(name possibly changed in release)</remark> is an interface that describes an area on a JSF page that is decoded during an Ajax request. <classname>AjaxViewRoot</classname> and <classname>AjaxRegion</classname> are implementations of this interface.
</para>
</section>
@@ -149,8 +146,20 @@
<section id="sect-Developer_Guide-RichFaces_overview-Differences_between_JSF_and_RichFaces_mechanisms">
<title>Differences between <acronym>JSF</acronym> and RichFaces mechanisms</title>
<para>
- JavaServer Faces (<acronym>JSF</acronym>) declares render and execute processes on the client side, while RichFaces declares server-side definitions of lists.
+ <remark>Needs additional clarification.</remark>
</para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ JavaServer Faces (<acronym>JSF</acronym>) declares render and execute processes on the client side, while RichFaces declares server-side definitions of lists.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ RichFaces components uses their own renderers. In the <emphasis>Render Response Phase</emphasis>, the RichFaces framework makes a traversal of the component tree, calls its own renderer, and passes the result to the Faces Response.
+ </para>
+ </listitem>
+ </itemizedlist>
</section>
<section id="sect-Developer_Guide-RichFaces_overview-Restrictions">
@@ -160,7 +169,8 @@
<itemizedlist>
<listitem>
<para>
- Any Ajax framework should not append or delete elements on a page, but should instead replace them. For successful updates, an element with the same identifier as in the response must exist on the page. If it is necessary to append code to a page, include a placeholder for it (an empty element). For the same reason, it is recommended that messages be placed in the <sgmltag><a4j:outputPanel></sgmltag> component.
+ Any Ajax framework should not append or delete elements on a page, but should instead replace them. For successful updates, an element with the same identifier as in the response must exist on the page. If it is necessary to append code to a page, include a placeholder for it (an empty element).
+ <!-- For the same reason, it is recommended that messages be placed in the <sgmltag><a4j:outputPanel></sgmltag> component.-->
</para>
</listitem>
<listitem>
@@ -168,21 +178,18 @@
<sgmltag><f:verbatim></sgmltag> should not be used for self-rendered containers, since it is transient and not saved in the tree.
</para>
</listitem>
+ <!--
<listitem>
<para>
Ajax requests are made by XMLHTTPRequest functions in XML format, but this XML bypasses most validations and the corrections that might be made in a browser. As such, a strict standards-compliant code for HTML and XHTML should be used, without skipping any required elements or attributes. Any necessary XML corrections are automatically made by the XML filter on the server, but unexpected effects can be produced through incorrect HTML code.
</para>
</listitem>
+ -->
<listitem>
<para>
The RichFaces <classname>ViewHandler</classname> puts itself in front of the Facelets <classname>ViewHandlers</classname> chain.
</para>
</listitem>
- <listitem>
- <para>
- RichFaces components uses their own renderers. In the <emphasis>Render Response Phase</emphasis>, the RichFaces framework makes a traversal of the component tree, calls its own renderer, and passes the result to the Faces Response.
- </para>
- </listitem>
</itemizedlist>
</para>
</section>
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml 2010-04-20 19:38:18 UTC (rev 16786)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml 2010-04-21 06:24:02 UTC (rev 16787)
@@ -89,7 +89,7 @@
<para>
To add one of these skins to your application, add the <literal>org.richfaces.SKIN</literal> context parameter to the <filename>web.xml</filename> configuration file:
</para>
-<programlisting language="XML" role="XML"><context-param>
+<programlisting><context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value><replaceable>skin_name</replaceable></param-value>
</context-param></programlisting>
@@ -176,7 +176,7 @@
<section id="sect-Developer_Guide-Skinning_and_theming-Skin_parameter_tables_in_RichFaces">
<title>Skin parameter tables in RichFaces</title>
<para>
- <xref linkend="tabl-Developer_Guide-Skin_parameter_tables_in_RichFaces-Parameter_settings_for_the_blueSky_skin" /> lists the default values for the parameter settings in the <literal>blueSky</literal> skin. These values can be customized and extended for a unique application theme as described in <xref linkend="sect-Developer_Guide-Skinning_and-theming-Advanced_skinning" />.
+ <xref linkend="tabl-Developer_Guide-Skin_parameter_tables_in_RichFaces-Parameter_settings_for_the_blueSky_skin" /> lists the default values for the parameter settings in the <literal>blueSky</literal> skin. These values can be customized and extended for a unique application theme as described in <xref linkend="sect-Developer_Guide-Skinning_and_theming-Customizing_skins" />.
</para>
<table id="tabl-Developer_Guide-Skin_parameter_tables_in_RichFaces-Parameter_settings_for_the_blueSky_skin">
<title>Parameter settings for the <literal>blueSky</literal> skin</title>
@@ -478,17 +478,7 @@
<step>
<title>Create the skin bean</title>
<para>The skin bean is a simple interface to manage the skin:</para>
-<programlisting language="Java" role="JAVA">public class SkinBean {
-
- private String skin;
-
- public String getSkin() {
- return skin;
- }
- public void setSkin(String skin) {
- this.skin = skin;
- }
-}</programlisting>
+<programlisting language="Java" role="JAVA"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-Create_the_skin_bean.js" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
</step>
<step>
<title>Reference the skin bean</title>
@@ -641,13 +631,17 @@
<step>
<title>Reference skin definition</title>
<para>Add a skin definition <sgmltag><context-param></sgmltag> to the <filename>web.xml</filename> settings file of your application:</para>
-<programlisting language="XML" role="XML"><context-param>
+<programlisting><context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value><replaceable>new_skin_name</replaceable></param-value>
</context-param></programlisting>
</step>
</procedure>
- <section id="sect-Developer_Guide-Skinning_and_Theming-Skinning_standard_JSF_components">
+ </section>
+
+ <section id="sect-Developer_Guide-Skinning_and_theming-Skinning_standard_controls">
+ <title>Skinning standard controls</title>
+ <section id="sect-Developer_Guide-Skinning_and_theming-Skinning_standard_JSF_components">
<title>Skinning standard JSF components</title>
<para>
The RichFaces framework can also use skinning to theme JSF (JavaServer Faces) components in addition to RichFaces components. Follow these additional steps to skin JSF components.
@@ -656,7 +650,7 @@
<step>
<title>Register a custom render kit</title>
<para>The custom render kit is created by registering it in the <filename>faces-config.xml</filename> configuration file:</para>
-<programlisting language="XML" role="XML"><render-kit>
+<programlisting><render-kit>
<render-kit-id><replaceable>new_skin_name</replaceable></render-kit-id>
<render-kit-class>org.ajax4jsf.framework.renderer.ChameleonRenderKitImpl</render-kit-class>
</render-kit></programlisting>
@@ -664,7 +658,7 @@
<step>
<title>Register custom renderers for the JSF component</title>
<para>Add custom renderers in the <filename>faces-config.xml</filename> configuration file for each JSF component you want to skin:</para>
-<programlisting language="XML" role="XML"><renderer>
+<programlisting><renderer>
<component-family>javax.faces.Command</component-family>
<renderer-type>javax.faces.Link</renderer-type>
<renderer-class><replaceable>new_skin_name</replaceable>.HtmlCommandLinkRenderer</renderer-class>
@@ -676,137 +670,136 @@
</step>
</procedure>
</section>
- </section>
-
- <section id="sect-Developer_Guide-Skinning_and_theming-Skinning_standard_HTML_controls">
- <title>Skinning standard HTML controls</title>
- <para>
- Standard HTML controls and components used alongside RichFaces and JSF components can also be themed to create a cohesive user interface. The following HTML elements accept skinning:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <sgmltag><a></sgmltag> (including <sgmltag>a:hover</sgmltag>, <sgmltag>a:visited</sgmltag> and other elements)
- </para>
- </listitem>
- <listitem>
- <para>
- <sgmltag><fieldset></sgmltag>
- </para>
- </listitem>
- <listitem>
- <para>
- <sgmltag><hr></sgmltag>
- </para>
- </listitem>
- <listitem>
- <para>
- <sgmltag><input></sgmltag>
- </para>
- </listitem>
- <listitem>
- <para>
- <sgmltag><isindex></sgmltag>
- </para>
- </listitem>
- <listitem>
- <para>
- <sgmltag><keygen></sgmltag>
- </para>
- </listitem>
- <listitem>
- <para>
- <sgmltag><legend></sgmltag>
- </para>
- </listitem>
- <listitem>
- <para>
- <sgmltag><select></sgmltag>
- </para>
- </listitem>
- <listitem>
- <para>
- <sgmltag><textarea></sgmltag>
- </para>
- </listitem>
- </itemizedlist>
- <para>
- Skinning for standard HTML controls can be included in one of two ways:
- </para>
- <variablelist>
- <varlistentry>
- <term>Automatic skinning</term>
+
+ <section id="sect-Developer_Guide-Skinning_and_theming-Skinning_standard_HTML_controls">
+ <title>Skinning standard HTML controls</title>
+ <para>
+ Standard HTML controls and components used alongside RichFaces and JSF components can also be themed to create a cohesive user interface. The following HTML elements accept skinning:
+ </para>
+ <itemizedlist>
<listitem>
<para>
- The skinning style properties are automatically applied to controls based on their element names and attribute types. Specify the <literal>org.richfaces.CONTROL_SKINNING</literal> context parameter in the <filename>web.xml</filename> configuration file:
+ <sgmltag><a></sgmltag> (including <sgmltag>a:hover</sgmltag>, <sgmltag>a:visited</sgmltag> and other elements)
</para>
-<programlisting language="XML" role="XML"><context-param>
- <param-name>org.richfaces.CONTROL_SKINNING</param-name>
- <param-value>enable</param-value>
-</context-param></programlisting>
</listitem>
- </varlistentry>
- <varlistentry>
- <term>Skinning with CSS classes</term>
<listitem>
<para>
- The skinning style properties are determined through CSS. This method is available by default, but can be disabled through the <literal>org.richfaces.CONTROL_SKINNING_CLASSES</literal> context parameter in the <filename>web.xml</filename> configuration file:
+ <sgmltag><fieldset></sgmltag>
</para>
-<programlisting language="XML" role="XML"><context-param>
- <param-name>org.richfaces.CONTROL_SKINNING_CLASSES</param-name>
- <param-value>disable</param-value>
-</context-param></programlisting>
+ </listitem>
+ <listitem>
<para>
- When enabled, the parameter offers a predefined CSS class named <literal>rich-container</literal>. Reference the class from any container-like component, and the standard HTML controls in the container will be skinned. Standard HTML controls can also be specifically defined in the CSS; refer to the <filename>org/richfaces/renderkit/html/css/basic_classes.xcss</filename> file in the <package>richfaces-ui.jar</package> package for examples of specially-defined CSS classes with skin parameters for HTML controls.
+ <sgmltag><hr></sgmltag>
</para>
</listitem>
- </varlistentry>
- </variablelist>
- <section id="sect-Developer_Guide-Skinning_and_theming-Skinning_levels_for_standard_HTML_controls">
- <title>Skinning levels for standard HTML controls</title>
- <para>
- There are two levels of skinning for HTML controls, depending on whether the browser viewing the application includes rich visual styling capabilities, and whether the browser supports features of CSS2 and CSS3.
- </para>
- <remark>Browser lists may need to be updated.</remark>
- <itemizedlist>
- <title>Basic skinning</title>
<listitem>
<para>
- <productname>Apple Safari</productname>
+ <sgmltag><input></sgmltag>
</para>
</listitem>
<listitem>
<para>
- <productname>Microsoft Internet Explorer 6</productname>
+ <sgmltag><isindex></sgmltag>
</para>
</listitem>
<listitem>
<para>
- <productname>Microsoft Internet Explorer 7</productname> in <literal>BackCompat</literal> mode (refer to <citetitle pubwork="article"><varname>compatMode</varname> Property</citetitle> at <ulink url="http://msdn.microsoft.com/en-us/library/ms533687(VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms533687(VS.85).aspx</ulink>
+ <sgmltag><keygen></sgmltag>
</para>
</listitem>
<listitem>
<para>
- <productname>Opera</productname>
+ <sgmltag><legend></sgmltag>
</para>
</listitem>
- </itemizedlist>
- <itemizedlist>
- <title>Extended skinning</title>
<listitem>
<para>
- <productname>Microsoft Internet Explorer 7</productname> in standards-compliant mode
+ <sgmltag><select></sgmltag>
</para>
</listitem>
<listitem>
<para>
- <productname>Mozilla Firefox</productname>
+ <sgmltag><textarea></sgmltag>
</para>
</listitem>
</itemizedlist>
<para>
- If the browser type cannot be identified, the extended level is used. Set the level explicitly by adding the following context parameter to the <filename>web.xml</filename> configuration file, and specifying the <sgmltag><param-value></sgmltag> element as either <literal>basic</literal> or <literal>extended</literal>:
+ Skinning for standard HTML controls can be included in one of two ways:
</para>
+ <variablelist>
+ <varlistentry>
+ <term>Automatic skinning</term>
+ <listitem>
+ <para>
+ The skinning style properties are automatically applied to controls based on their element names and attribute types. Specify the <literal>org.richfaces.CONTROL_SKINNING</literal> context parameter in the <filename>web.xml</filename> configuration file:
+ </para>
+ <programlisting language="XML" role="XML"><context-param>
+ <param-name>org.richfaces.CONTROL_SKINNING</param-name>
+ <param-value>enable</param-value>
+ </context-param></programlisting>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Skinning with CSS classes</term>
+ <listitem>
+ <para>
+ The skinning style properties are determined through CSS. This method is available by default, but can be disabled through the <literal>org.richfaces.CONTROL_SKINNING_CLASSES</literal> context parameter in the <filename>web.xml</filename> configuration file:
+ </para>
+ <programlisting language="XML" role="XML"><context-param>
+ <param-name>org.richfaces.CONTROL_SKINNING_CLASSES</param-name>
+ <param-value>disable</param-value>
+ </context-param></programlisting>
+ <para>
+ When enabled, the parameter offers a predefined CSS class named <literal>rich-container</literal>. Reference the class from any container-like component, and the standard HTML controls in the container will be skinned. Standard HTML controls can also be specifically defined in the CSS; refer to the <filename>org/richfaces/renderkit/html/css/basic_classes.xcss</filename> file in the <package>richfaces-ui.jar</package> package for examples of specially-defined CSS classes with skin parameters for HTML controls.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <section id="sect-Developer_Guide-Skinning_and_theming-Skinning_levels_for_standard_HTML_controls">
+ <title>Skinning levels for standard HTML controls</title>
+ <para>
+ There are two levels of skinning for HTML controls, depending on whether the browser viewing the application includes rich visual styling capabilities, and whether the browser supports features of CSS2 and CSS3.
+ </para>
+ <remark>Browser lists may need to be updated.</remark>
+ <itemizedlist>
+ <title>Basic skinning</title>
+ <listitem>
+ <para>
+ <productname>Apple Safari</productname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <productname>Microsoft Internet Explorer 6</productname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <productname>Microsoft Internet Explorer 7</productname> in <literal>BackCompat</literal> mode (refer to <citetitle pubwork="article"><varname>compatMode</varname> Property</citetitle> at <ulink url="http://msdn.microsoft.com/en-us/library/ms533687(VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms533687(VS.85).aspx</ulink>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <productname>Opera</productname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <itemizedlist>
+ <title>Extended skinning</title>
+ <listitem>
+ <para>
+ <productname>Microsoft Internet Explorer 7</productname> in standards-compliant mode
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <productname>Mozilla Firefox</productname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ If the browser type cannot be identified, the extended level is used. Set the level explicitly by adding the following context parameter to the <filename>web.xml</filename> configuration file, and specifying the <sgmltag><param-value></sgmltag> element as either <literal>basic</literal> or <literal>extended</literal>:
+ </para>
<programlisting language="XML" role="XML"><context-param>
<param-name>org.richfaces.CONTROL_SKINNING_LEVEL</param-name>
<param-value>basic</param-value>
@@ -826,22 +819,67 @@
</step>
</procedure>
-->
+ </section>
</section>
</section>
+ <section id="sect-Developer_Guide-Skinning_and_theming-Defining_skins_for_individual_components">
+ <title>Defining skins for individual components</title>
+ <para>
+ RichFaces uses <acronym>XCSS</acronym> (XML-formatted CSS) files to add extra functionality to the skinning process. XCSS files can contain all the styling information for each RichFaces component in the library.
+ </para>
+ <para>
+ XCSS files contain mappings between CSS properties and skin parameters. The <varname>name</varname> attribute of the <sgmltag><u:selector></sgmltag> element is the name of the CSS selector. Each <sgmltag><u:style></sgmltag> element defines a CSS property with the <varname>name</varname> attribute as its name. Using the <varname>skin</varname> attribute specifies a skin parameter from the current skin file, while using the <varname>value</varname> attribute enters the literal value in the CSS file. An example of this is shown in <xref linkend="exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings" />.
+ </para>
+ <example id="exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings">
+ <title>XCSS style mappings</title>
+ <para>
+ The XCSS code for the CSS selector named <literal>.rich-component-name</literal> is as follows:
+ </para>
+<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings-0.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ <para>
+ This renders the following CSS code to be read by a standard browser:
+ </para>
+<programlisting language="Java" role="JAVA"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings.css" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ <para>
+ CSS selectors with identical skinning properties can be listed in a single <varname>name</varname> attribute of a <sgmltag><u:selector></sgmltag> element, separated by commas.
+ </para>
+<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings-1.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ </example>
+ <para>
+ Style properties can be modified using XML-based XCSS code, or using embedded standard CSS code, as shown in <xref linkend="exam-Developer_Guide-Skinning_and_theming-Using_XCSS_code_or_standard_CSS_code" />
+ </para>
+ <example id="exam-Developer_Guide-Skinning_and_theming-Using_XCSS_code_or_standard_CSS_code">
+ <title>Using XCSS code or standard CSS code</title>
+ <formalpara>
+ <title>Using XCSS code</title>
+ <para>
+ XCSS code follows an XML structure, using <sgmltag><u:selector></sgmltag> elements to define style classes and <sgmltag><u:style></sgmltag> elements for each style parameter.
+ </para>
+ </formalpara>
+<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-Using_XCSS_code_or_standard_CSS_code-XCSS.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ <formalpara>
+ <title>Using standard CSS code</title>
+ <para>
+ CSS code can be included in an XCSS file through the use of a <sgmltag><f:verbatim></sgmltag> element with a character data (CDATA) section.
+ </para>
+ </formalpara>
+<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-Using_XCSS_code_or_standard_CSS_code-CSS.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ </example>
+ </section>
+
<section id="sect-Developer_Guide-Skinning_and_theming-Extended_skinning">
<title>Plug-n-skin</title>
<para>
<emphasis>Plug-n-skin</emphasis> is an alternate method to create, customize, and add a skin. The skin can be based on an existing RichFaces skin, and can include support for skinning standard HTML controls.
</para>
- <procedure id="proc-Developer_Guide-Skinning_and_theming-Using_plug-n-skin">
- <title>Using plug-n-skin</title>
+ <procedure>
<step>
<title>Create a template</title>
<para>Use the <productname>Maven</productname> build and deployment tool to create the skin template by using the following command:</para>
<screen>mvn archetype:create -DarchetypeGroupId=org.richfaces.cdk -DarchetypeArtifactId=maven-archetype-plug-n-skin -DarchetypeVersion=<replaceable>RF-VERSION</replaceable> -DartifactId=<replaceable>ARTIFACT-ID</replaceable> -DgroupId=<replaceable>GROUP-ID</replaceable> -Dversion=<replaceable>VERSION</replaceable></screen>
<para>
- Use the following keys for the command:
+ Use the following parameters for the command:
</para>
<variablelist>
<varlistentry>
@@ -883,7 +921,7 @@
<para>Change to the newly-created directory. Ensure it contains the <filename>pom.xml</filename> project file, then enter the following command to create a new skin and add it to the <acronym>CDK</acronym> (Component Development Kit):</para>
<screen>mvn cdk:add-skin -Dname=<replaceable>SKIN-NAME</replaceable> -Dpackage=<replaceable>SKIN-PACKAGE</replaceable></screen>
<para>
- Use the following keys for the command:
+ Use the following parameters for the command:
</para>
<variablelist>
<varlistentry>
@@ -924,34 +962,101 @@
</listitem>
</varlistentry>
</variablelist>
+ <para>
+ The command creates the following files:
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term><filename>src/main/java/<replaceable>SKIN-PACKAGE</replaceable>/<replaceable>SKIN-NAME</replaceable>/images/BaseImage.java</filename></term>
+ <listitem>
+ <para>
+ The base class to store images.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><filename>src/test/java/<replaceable>SKIN-PACKAGE</replaceable>/<replaceable>SKIN-NAME</replaceable>/images/BaseImage.java</filename></term>
+ <listitem>
+ <para>
+ A test version of the base class to store images.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><filename>src/main/resources/<replaceable>SKIN-PACKAGE</replaceable>/<replaceable>SKIN-NAME</replaceable>/css/</filename></term>
+ <listitem>
+ <para>
+ The directory that holds the XCSS files that define the themes for RichFaces components affected by the new skin.
+ </para>
+ <para>
+ If the <code>createExt=true</code> parameter was used with the command, the following XCSS files are included for defining styles for standard HTML controls:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <filename>extended_classes.xcss</filename>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <filename>extended.xcss</filename>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><filename>src/main/resources/<replaceable>SKIN-PACKAGE</replaceable>/<replaceable>SKIN-NAME</replaceable>/css/<replaceable>SKIN-NAME</replaceable>.properties</filename></term>
+ <listitem>
+ <para>
+ The file that contains the skin properties.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><filename>src/main/resources/META-INF/skins/<replaceable>SKIN-NAME</replaceable>.xcss</filename></term>
+ <listitem>
+ <para>
+ A global XCSS file that imports the component-specific XCSS files.
+ </para>
+ <para>
+ If the <code>createExt=true</code> parameter was used with the command, the following <filename><replaceable>skin-name</replaceable>-ext.xcss</filename> file is included, which imports the XCSS files for standard HTML controls.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><filename>src/main/config/resources/<replaceable>SKIN-NAME</replaceable>-resources.xml</filename></term>
+ <listitem>
+ <para>
+ The file that contains the description of all the files listed above.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</step>
+ <step>
+ <title>Edit XCSS files</title>
+ <para>
+ Edit the XCSS files contained in the <filename>src/main/resources/META-INF/skins/</filename> directory. Refer to <xref linkend="sect-Developer_Guide-Skinning_and_theming-Defining_skins_for_individual_components" /> for instructions on how to edit XCSS files.
+ </para>
+ </step>
+ <step>
+ <title>Build the skin</title>
+ <para>
+ After editing the XCSS files, build the skin by running the following command in the root directory of your skin project (the directory that contains the <filename>pom.xml</filename> file).
+ </para>
+<screen>mvn clean install</screen>
+ </step>
+ <step>
+ <title>Add the skin to the project configuration</title>
+ <para>Add the following context parameter to your project's <filename>web.xml</filename> configuration file to use the new skin in your application:</para>
+<programlisting><context-param>
+ <param-name>org.ajax4jsf.SKIN</param-name>
+ <param-value><replaceable>SKIN-NAME</replaceable></param-value>
+</context-param></programlisting>
+ </step>
</procedure>
</section>
-
- <section id="sect-Developer_Guide-Skinning_and_theming-Defining_skins_for_individual_components">
- <title>Defining skins for individual components</title>
- <para>
- RichFaces uses <acronym>XCSS</acronym> (XML-formatted CSS) files to add extra functionality to the skinning process. XCSS files can contain all the styling information for each RichFaces component in the library.
- </para>
- <para>
- XCSS files contain mappings between CSS properties and skin parameters. The <varname>name</varname> attribute of the <sgmltag><u:selector></sgmltag> element is the name of the CSS selector. Each <sgmltag><u:style></sgmltag> element defines a CSS property with the <varname>name</varname> attribute as its name. Using the <varname>skin</varname> attribute specifies a skin parameter from the current skin file, while using the <varname>value</varname> attribute enters the literal value in the CSS file. An example of this is shown in <xref linkend="exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings" />.
- </para>
- <example id="exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings">
- <title>XCSS style mappings</title>
- <para>
- The XCSS code for the CSS selector named <literal>.rich-component-name</literal> is as follows:
- </para>
-<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings-0.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
- <para>
- This renders the following CSS code to be read by a standard browser:
- </para>
-<programlisting language="CSS" role="CSS"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings.css" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
- <para>
- CSS selectors with identical skinning properties can be listed in a single <varname>name</varname> attribute of a <sgmltag><u:selector></sgmltag> element, separated by commas.
- </para>
-<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings-1.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
- </example>
- </section>
</chapter>
Added: root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Create_the_skin_bean.js
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Create_the_skin_bean.js (rev 0)
+++ root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Create_the_skin_bean.js 2010-04-21 06:24:02 UTC (rev 16787)
@@ -0,0 +1,11 @@
+public class SkinBean {
+
+ private String skin;
+
+ public String getSkin() {
+ return skin;
+ }
+ public void setSkin(String skin) {
+ this.skin = skin;
+ }
+}
Added: root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Using_XCSS_code_or_standard_CSS_code-CSS.xml_sample
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Using_XCSS_code_or_standard_CSS_code-CSS.xml_sample (rev 0)
+++ root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Using_XCSS_code_or_standard_CSS_code-CSS.xml_sample 2010-04-21 06:24:02 UTC (rev 16787)
@@ -0,0 +1,7 @@
+<f:verbatim><![CDATA[
+ ...
+ .rich-calendar-cell {
+ background: #537df8;
+ }
+ ...
+]]></f:verbatim>
Added: root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Using_XCSS_code_or_standard_CSS_code-XCSS.xml_sample
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Using_XCSS_code_or_standard_CSS_code-XCSS.xml_sample (rev 0)
+++ root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Using_XCSS_code_or_standard_CSS_code-XCSS.xml_sample 2010-04-21 06:24:02 UTC (rev 16787)
@@ -0,0 +1,9 @@
+...
+<u:selector name=".rich-calendar-cell">
+ <u:style name="border-bottom-color" skin="panelBorderColor"/>
+ <u:style name="border-right-color" skin="panelBorderColor"/>
+ <u:style name="background-color" skin="tableBackgroundColor"/>
+ <u:style name="font-size" skin="generalSizeFont"/>
+ <u:style name="font-family" skin="generalFamilyFont"/>
+</u:selector>
+...
14 years, 8 months
JBoss Rich Faces SVN: r16786 - in root: framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-04-20 15:38:18 -0400 (Tue, 20 Apr 2010)
New Revision: 16786
Modified:
root/framework/trunk/api/src/main/java/org/richfaces/component/MetaComponentResolver.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractRegion.java
Log:
https://jira.jboss.org/jira/browse/RF-7856
Modified: root/framework/trunk/api/src/main/java/org/richfaces/component/MetaComponentResolver.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/component/MetaComponentResolver.java 2010-04-20 18:47:01 UTC (rev 16785)
+++ root/framework/trunk/api/src/main/java/org/richfaces/component/MetaComponentResolver.java 2010-04-20 19:38:18 UTC (rev 16786)
@@ -33,7 +33,6 @@
// TODO - do we want to make this configurable in web.xml?
public static final char META_COMPONENT_SEPARATOR_CHAR = '@';
- public String resolveClientId(FacesContext facesContext, UIComponent contextComponent,
- String componentId, String metaId);
+ public String resolveClientId(FacesContext facesContext, UIComponent contextComponent, String metaComponentId);
}
Modified: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2010-04-20 18:47:01 UTC (rev 16785)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2010-04-20 19:38:18 UTC (rev 16786)
@@ -26,6 +26,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Locale;
@@ -85,6 +86,15 @@
public static final String THIS = "@this";
public static final String NONE = "@none";
+ public static final Set<String> GLOBAL_META_COMPONENTS;
+
+ static {
+ GLOBAL_META_COMPONENTS = new HashSet<String>(2);
+
+ GLOBAL_META_COMPONENTS.add(ALL);
+ GLOBAL_META_COMPONENTS.add(NONE);
+ }
+
/**
* Attribute to keep
*/
@@ -661,7 +671,7 @@
* @return
*/
public static String[] asArray(String valuesSet) {
- return valuesSet.trim().split("(\\s*,\\s*)|(\\s+)");
+ return IdSplitBuilder.split(valuesSet);
}
/**
Modified: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2010-04-20 18:47:01 UTC (rev 16785)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2010-04-20 19:38:18 UTC (rev 16786)
@@ -44,6 +44,7 @@
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
+import javax.faces.component.UINamingContainer;
import javax.faces.component.UIParameter;
import javax.faces.component.UIViewRoot;
import javax.faces.component.ValueHolder;
@@ -919,6 +920,136 @@
return false;
}
+ private static int findNextIdx(String string, char c, int startIdx) {
+ int result = string.indexOf(c, startIdx);
+
+ if (result < 0) {
+ result = string.length();
+ }
+
+ return result;
+ }
+
+ private static UIComponent findParentContainer(UIComponent component) {
+ UIComponent c = component;
+
+ do {
+ c = c.getParent();
+ } while (!(c instanceof NamingContainer) && c != null);
+
+ return c;
+ }
+
+ private static String computeClientId(FacesContext context,
+ UIComponent component, String cleanedId, String id) {
+
+ StringBuilder builder = new StringBuilder(id.length());
+
+ char separatorChar = UINamingContainer.getSeparatorChar(context);
+
+ int nameSegmentsCounter = 1;
+ int idx = 0;
+
+ //TODO nick - here hack is used - implement correct findComponent(...) method
+ while ((idx = cleanedId.indexOf(separatorChar, idx) + 1) > 0) {
+ nameSegmentsCounter++;
+ }
+
+ UIComponent container = component;
+
+ for (int i = 0; i < nameSegmentsCounter && container != null; i++) {
+ container = findParentContainer(container);
+ }
+
+ if (container != null) {
+ String clientId = container.getContainerClientId(context);
+ if (clientId.length() != 0) {
+ builder.append(clientId);
+ builder.append(separatorChar);
+ }
+ }
+
+ builder.append(id);
+
+ return builder.toString();
+ }
+
+ private static String cleanupId(char separatorChar, String id) {
+ if (id == null || id.length() == 0) {
+ return id;
+ }
+
+ StringBuilder sb = new StringBuilder();
+
+ boolean appendSeparator = false;
+ int lastIdx = 0;
+ int idx = 0;
+
+ do {
+ idx = findNextIdx(id, separatorChar, lastIdx);
+ //TODO nick - extract constants
+ if (idx == lastIdx || (id.charAt(lastIdx) != '[' && id.charAt(idx - 1) != ']')) {
+ //TODO nick - review this code for '*' selectors handling
+ if (idx - lastIdx != 1 || id.charAt(lastIdx) != '*') {
+ if (appendSeparator) {
+ sb.append(separatorChar);
+ } else {
+ appendSeparator = true;
+ }
+
+ sb.append(id.substring(lastIdx, idx));
+ }
+ }
+
+ lastIdx = idx + 1;
+ } while (idx != id.length());
+
+ return sb.toString();
+ }
+
+ private static String resolveMetaComponentId(FacesContext context, UIComponent component, String metaComponentId) {
+ UIComponent c = component;
+ while (c != null) {
+ if (c instanceof MetaComponentResolver) {
+ MetaComponentResolver metaComponentResolver = (MetaComponentResolver) c;
+
+ String resolvedId = metaComponentResolver.resolveClientId(context, component, metaComponentId);
+
+ if (resolvedId != null) {
+ return resolvedId;
+ }
+ }
+
+ c = c.getParent();
+ }
+
+ return metaComponentSubstitutions.get(metaComponentId);
+ }
+
+ private boolean addPredefinedMetaComponentId(FacesContext facesContext, UIComponent component,
+ Set<String> ids, String id) {
+
+ if (AjaxRendererUtils.ALL.equals(id)) {
+ ids.clear();
+ ids.add(AjaxRendererUtils.ALL);
+ return true;
+ } else if (AjaxRendererUtils.NONE.equals(id)) {
+ ids.clear();
+ return true;
+ } else if (AjaxRendererUtils.THIS.equals(id)) {
+ ids.add(component.getClientId(facesContext));
+ return true;
+ } else if (AjaxRendererUtils.FORM.equals(id)) {
+ UIForm nestingForm = getNestingForm(facesContext, component);
+ if (nestingForm != null) {
+ ids.add(nestingForm.getClientId(facesContext));
+ }
+ return true;
+ }
+
+ return false;
+ }
+
/**
* @param context
* @param component
@@ -934,82 +1065,79 @@
Set<String> result = new LinkedHashSet<String>(shortIds.size());
if (checkKeyword(shortIds, AjaxRendererUtils.ALL)) {
+ result.clear();
result.add(AjaxRendererUtils.ALL);
} else if (checkKeyword(shortIds, AjaxRendererUtils.NONE)) {
//do nothing, use empty set
} else {
for (String id : shortIds) {
- if (AjaxRendererUtils.THIS.equals(id)) {
- result.add(component.getClientId(context));
- } else if (AjaxRendererUtils.FORM.equals(id)) {
- result.add(getNestingForm(context, component).getClientId(context));
- } else {
- String componentId;
- String metaComponentId;
+ if (id.length() == 0) {
+ continue;
+ }
- int idx = id.indexOf(META_COMPONENT_SEPARATOR_CHAR);
- if (idx >= 0) {
- componentId = id.substring(0, idx);
- metaComponentId = id.substring(idx + 1);
- } else {
- componentId = id;
- metaComponentId = null;
- }
+ if (addPredefinedMetaComponentId(context, component, result, id)) {
+ continue;
+ }
- if (metaComponentId == null) {
- UIComponent foundComponent = findComponentFor(component, componentId);
- if (foundComponent != null) {
- result.add(foundComponent.getClientId(context));
- } else {
- result.add(componentId);
- }
- } else {
- UIComponent foundComponent;
+ char separatorChar = UINamingContainer.getSeparatorChar(context);
+ if (id.charAt(0) == separatorChar) {
+ //TODO nick - how to handle meta-component IDs attached to client IDs?
+ result.add(id.substring(1));
+ continue;
+ }
- if (componentId != null && componentId.length() != 0) {
- foundComponent = findComponentFor(component, componentId);
- } else {
- foundComponent = component;
- }
+ String componentId;
+ String metaComponentId;
- String convertedId = null;
+ int idx = id.indexOf(META_COMPONENT_SEPARATOR_CHAR);
+ if (idx >= 0) {
+ componentId = id.substring(0, idx);
+ metaComponentId = id.substring(idx + 1);
+ } else {
+ componentId = id;
+ metaComponentId = null;
+ }
- while (foundComponent != null) {
- if (foundComponent instanceof MetaComponentResolver) {
- MetaComponentResolver metadataConversionComponent =
- (MetaComponentResolver) foundComponent;
+ UIComponent baseComponent = null;
+ String cleanedId = null;
+ if (!isEmpty(componentId)) {
+ cleanedId = cleanupId(separatorChar, componentId);
+ baseComponent = findComponentFor(component, cleanedId);
- convertedId = metadataConversionComponent.resolveClientId(context, component,
- componentId, metaComponentId);
+ if (baseComponent == null) {
+ LOGGER.warn(MessageFormat.format(
+ "''{0}'' cannot be resolved in the current context", cleanedId));
+ }
+ }
- if (convertedId != null) {
- break;
- }
- }
+ if (!isEmpty(metaComponentId)) {
+ if (isEmpty(componentId)) {
+ baseComponent = component;
+ }
- foundComponent = foundComponent.getParent();
- }
-
- if (convertedId == null) {
- convertedId = metaComponentSubstitutions.get(metaComponentId);
- }
-
- if (convertedId != null) {
- if (AjaxRendererUtils.ALL.equals(convertedId)) {
- result.clear();
- result.add(AjaxRendererUtils.ALL);
+ if (baseComponent != null) {
+ String convertedId = resolveMetaComponentId(context, baseComponent, metaComponentId);
+ if (addPredefinedMetaComponentId(context, baseComponent, result, convertedId)) {
+ if (AjaxRendererUtils.GLOBAL_META_COMPONENTS.contains(convertedId)) {
break;
- } else {
- result.add(convertedId);
}
} else {
- //TODO - review
- LOGGER.warn(
- MessageFormat.format("''{0}'' cannot be resolved in the current context", id));
+ if (convertedId == null) {
+ convertedId = computeClientId(context, baseComponent, cleanedId, id);
+ }
- result.add(id);
+ result.add(convertedId);
}
+ } else {
+ result.add(id);
}
+ } else {
+ if (baseComponent != null) {
+ String computedId = computeClientId(context, baseComponent, cleanedId, id);
+ result.add(computedId);
+ } else {
+ result.add(id);
+ }
}
}
}
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractRegion.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractRegion.java 2010-04-20 18:47:01 UTC (rev 16785)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractRegion.java 2010-04-20 19:38:18 UTC (rev 16786)
@@ -37,8 +37,7 @@
)
public abstract class AbstractRegion extends UIComponentBase implements MetaComponentResolver, AjaxContainer {
- public String resolveClientId(FacesContext facesContext, UIComponent contextComponent,
- String componentId, String metaId) {
+ public String resolveClientId(FacesContext facesContext, UIComponent contextComponent, String metaId) {
if (META_COMPONENT_ID.equals(metaId)) {
return getClientId(facesContext);
14 years, 8 months
JBoss Rich Faces SVN: r16785 - in root/ui/trunk/components/core/src/main: old_configs/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-04-20 14:47:01 -0400 (Tue, 20 Apr 2010)
New Revision: 16785
Removed:
root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AjaxPushHandler1.java
Modified:
root/ui/trunk/components/core/src/main/old_configs/component/mediaOutput.xml
root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml
Log:
fix checkstyle
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AjaxPushHandler1.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AjaxPushHandler1.java 2010-04-20 16:48:51 UTC (rev 16784)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/view/facelets/html/AjaxPushHandler1.java 2010-04-20 18:47:01 UTC (rev 16785)
@@ -1,83 +0,0 @@
-/**
- * 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.view.facelets.html;
-
-import java.util.EventListener;
-
-import javax.faces.view.facelets.ComponentConfig;
-import javax.faces.view.facelets.ComponentHandler;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.MetaRule;
-import javax.faces.view.facelets.MetaRuleset;
-import javax.faces.view.facelets.Metadata;
-import javax.faces.view.facelets.MetadataTarget;
-import javax.faces.view.facelets.TagAttribute;
-
-import org.richfaces.component.AbstractPush;
-
-public class AjaxPushHandler1 extends ComponentHandler {
- private static final MetaRule AJAX_PUSH_META_RULE = new AjaxPushMetaRule();
-
- public AjaxPushHandler1(ComponentConfig config) {
- super(config);
- }
-
- @Override
- protected MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset metaRules = super.createMetaRuleset(type);
-
- metaRules.addRule(AJAX_PUSH_META_RULE);
-
- return metaRules;
- }
-
- static class AjaxPushActionMapper extends Metadata {
- private static final Class<?>[] AJAX_PUSH_ACTION_SIG = new Class[] {EventListener.class};
- private final TagAttribute send;
-
- public AjaxPushActionMapper(TagAttribute attribute) {
- send = attribute;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((AbstractPush) instance).setEventProducer(this.send.getMethodExpression(ctx, null, AJAX_PUSH_ACTION_SIG));
- }
- }
-
- static class AjaxPushMetaRule extends MetaRule {
-
- public AjaxPushMetaRule() {
- super();
- }
-
- public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
- if (meta.isTargetInstanceOf(AbstractPush.class)) {
- if ("eventProducer".equals(name)) {
- return new AjaxPushActionMapper(attribute);
- }
- }
-
- return null;
- }
- }
-}
Modified: root/ui/trunk/components/core/src/main/old_configs/component/mediaOutput.xml
===================================================================
--- root/ui/trunk/components/core/src/main/old_configs/component/mediaOutput.xml 2010-04-20 16:48:51 UTC (rev 16784)
+++ root/ui/trunk/components/core/src/main/old_configs/component/mediaOutput.xml 2010-04-20 18:47:01 UTC (rev 16785)
@@ -45,7 +45,7 @@
<icon>icon</icon>
</tag>
<taghandler generate="false">
- <classname>org.ajax4jsf.taglib.html.facelets.MediaOutputHandler</classname>
+ <classname>org.ajax4jsf.view.facelets.html.MediaOutputHandler</classname>
</taghandler>
&ui_component_attributes;
&html_event_handler_attributes;
Modified: root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml
===================================================================
--- root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml 2010-04-20 16:48:51 UTC (rev 16784)
+++ root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml 2010-04-20 18:47:01 UTC (rev 16785)
@@ -50,7 +50,7 @@
<component>
<component-type>org.richfaces.MediaOutput</component-type>
<renderer-type>org.richfaces.MediaOutputRenderer</renderer-type>
- <handler-class>org.richfaces.taglib.html.facelets.MediaOutputHandler</handler-class>
+ <handler-class>org.richfaces.view.facelets.html.MediaOutputHandler</handler-class>
</component>
</tag>
14 years, 8 months