Author: alexsmirnov
Date: 2011-01-11 18:45:11 -0500 (Tue, 11 Jan 2011)
New Revision: 20956
Added:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorRendererProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/GeneratedFacesComponent.java
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestBehavior.java
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/TestBehaviorRenderer.java
Modified:
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ViewElement.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
trunk/cdk/generator/src/main/resources/META-INF/templates/behavior.ftl
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/RendererUtils.java
Log:
RESOLVED - issue RF-9847: @JsfBehaviorRenderer annotation ignored
https://issues.jboss.org/browse/RF-9847
Modified:
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java
===================================================================
---
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java 2011-01-11
20:06:50 UTC (rev 20955)
+++
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -28,6 +28,8 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import javax.faces.render.RenderKitFactory;
+
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
@@ -39,8 +41,10 @@
public String type() default "";
- public String renderKitId() default "";
+ public String renderKitId() default RenderKitFactory.HTML_BASIC_RENDER_KIT;
+ public String generate() default "";
+
public Description description() default @Description();
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java 2011-01-11
20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -27,6 +27,7 @@
import org.richfaces.cdk.apt.processors.AttributesProcessor;
import org.richfaces.cdk.apt.processors.AttributesProcessorImpl;
import org.richfaces.cdk.apt.processors.BehaviorProcessor;
+import org.richfaces.cdk.apt.processors.BehaviorRendererProcessor;
import org.richfaces.cdk.apt.processors.CdkAnnotationProcessor;
import org.richfaces.cdk.apt.processors.ComponentProcessor;
import org.richfaces.cdk.apt.processors.ConverterProcessor;
@@ -58,6 +59,7 @@
Multibinder<CdkAnnotationProcessor> setBinder =
Multibinder.newSetBinder(binder(), CdkAnnotationProcessor.class);
setBinder.addBinding().to(ComponentProcessor.class);
setBinder.addBinding().to(BehaviorProcessor.class);
+ setBinder.addBinding().to(BehaviorRendererProcessor.class);
setBinder.addBinding().to(RendererProcessor.class);
setBinder.addBinding().to(ConverterProcessor.class);
setBinder.addBinding().to(ValidatorProcessor.class);
Modified:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java 2011-01-11
20:06:50 UTC (rev 20955)
+++
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -57,6 +57,11 @@
setTagInfo(behavior, behaviorModel);
processAttributes((TypeElement) element, behaviorModel, behavior);
setDescription(behaviorModel, behavior, getDocComment(element));
+ // Behavior renderer
+ if(!sourceUtils.isDefaultValue(behavior, "renderer")){
+ AnnotationMirror renderer = sourceUtils.getAnnotationValue(behavior,
"renderer", AnnotationMirror.class);
+ sourceUtils.setModelProperty(behaviorModel, renderer,
"rendererType","type");
+ }
library.getBehaviors().add(behaviorModel);
}
Added:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorRendererProcessor.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorRendererProcessor.java
(rev 0)
+++
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorRendererProcessor.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -0,0 +1,65 @@
+/*
+ * $Id: BehaviorRendererProcessor.java 20938 2011-01-10 22:35:38Z alexsmirnov $
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.apt.processors;
+
+import java.lang.annotation.Annotation;
+
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+
+import org.richfaces.cdk.CdkProcessingException;
+import org.richfaces.cdk.annotations.JsfBehaviorRenderer;
+import org.richfaces.cdk.apt.SourceUtils;
+import org.richfaces.cdk.model.BehaviorRendererModel;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.FacesId;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class BehaviorRendererProcessor extends ProcessorBase implements
CdkAnnotationProcessor {
+
+ @Override
+ public void process(Element element, ComponentLibrary library) throws
CdkProcessingException {
+ SourceUtils sourceUtils = getSourceUtils();
+ AnnotationMirror behaviorRenderer = sourceUtils.getAnnotationMirror(element,
JsfBehaviorRenderer.class);
+
+ BehaviorRendererModel behaviorRendererModel = new BehaviorRendererModel();
+ setClassNames((TypeElement) element, behaviorRendererModel, behaviorRenderer);
+ sourceUtils.setModelProperty(behaviorRendererModel, behaviorRenderer,
"id","type");
+
+ setDescription(behaviorRendererModel, behaviorRenderer, getDocComment(element));
+ FacesId renderKitId = sourceUtils.getAnnotationValue(behaviorRenderer,
"renderKitId", FacesId.class);
+
library.addRenderKit(renderKitId).getBehaviorRenderers().add(behaviorRendererModel);
+ }
+
+ @Override
+ public Class<? extends Annotation> getProcessedAnnotation() {
+ return JsfBehaviorRenderer.class;
+ }
+
+}
Property changes on:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorRendererProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2011-01-11
20:06:50 UTC (rev 20955)
+++
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -14,6 +14,7 @@
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.DescriptionGroup;
+import org.richfaces.cdk.model.GeneratedFacesComponent;
import org.richfaces.cdk.model.ModelCollection;
import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.TagModel;
@@ -63,7 +64,7 @@
return tagModel;
}
- protected void setClassNames(TypeElement componentElement, ModelElementBase
modelElement, AnnotationMirror behavior) {
+ protected void setClassNames(TypeElement componentElement, GeneratedFacesComponent
modelElement, AnnotationMirror behavior) {
SourceUtils sourceUtils = getSourceUtils();
if (componentElement.getModifiers().contains(Modifier.ABSTRACT)
|| !sourceUtils.isDefaultValue(behavior, "generate")) {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java 2011-01-11
20:06:50 UTC (rev 20955)
+++
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -45,7 +45,6 @@
}
}
});
-
/**
* <p class="changed_added_4_0">
* Represents JSF component attributes and properties.
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java 2011-01-11
20:06:50 UTC (rev 20955)
+++
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -33,7 +33,10 @@
public class BehaviorModel extends ModelElementBase implements
ModelElement<BehaviorModel> {
private static final long serialVersionUID = -5023589072935390357L;
+
+ private FacesId rendererType;
+
public BehaviorModel() {
}
@@ -41,6 +44,23 @@
setId(behaviorId);
}
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param rendererType the rendererType to set
+ */
+ public void setRendererType(FacesId rendererType) {
+ this.rendererType = rendererType;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the rendererType
+ */
+ @Merge
+ public FacesId getRendererType() {
+ return rendererType;
+ }
+
public <R,D> R accept(Visitor<R,D> visitor, D data) {
return visitor.visitBehavior(this,data);
}
Modified:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java 2011-01-11
20:06:50 UTC (rev 20955)
+++
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -31,11 +31,14 @@
*
*/
@SuppressWarnings("serial")
-public class BehaviorRendererModel implements ModelElement<BehaviorRendererModel>,
FacesComponent {
+public class BehaviorRendererModel extends DescriptionGroupBase implements
ModelElement<BehaviorRendererModel>, GeneratedFacesComponent {
private ClassName baseClass;
private ClassName targetClass;
- private boolean generate;
private FacesId id;
+ /**
+ * <p class="changed_added_4_0">Is that bean property generate in
the class or should be generated ?</p>
+ */
+ private Boolean generate;
public BehaviorRendererModel(FacesId type) {
this.id = type;
@@ -95,22 +98,7 @@
this.baseClass = baseClass;
}
- /**
- * <p class="changed_added_4_0"></p>
- * @return the generate
- */
- public Boolean getGenerate() {
- return this.generate;
- }
- /**
- * <p class="changed_added_4_0"></p>
- * @param generate the generate to set
- */
- public void setGenerate(Boolean generate) {
- this.generate = generate;
- }
-
@Override
public void merge(BehaviorRendererModel other) {
ComponentLibrary.merge(this, other);
@@ -133,4 +121,13 @@
}
return false;
}
+
+ @Merge
+ public Boolean getGenerate() {
+ return generate;
+ }
+
+ public void setGenerate(Boolean generate) {
+ this.generate = generate;
+ }
}
Modified:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2011-01-11
20:06:50 UTC (rev 20955)
+++
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -29,11 +29,6 @@
public class DescriptionGroupBase implements DescriptionGroup,
Extensible<ConfigExtension> {
/**
- * <p class="changed_added_4_0">Is that bean property generate in
the class or should be generated ?</p>
- */
- private Boolean generate ;
-
- /**
* <p class="changed_added_4_0">
* Long description for documentation
* </p>
@@ -82,15 +77,6 @@
this.icon = icon;
}
- @Merge
- public Boolean getGenerate() {
- return generate;
- }
-
- public void setGenerate(Boolean generate) {
- this.generate = generate;
- }
-
/**
* <p class="changed_added_4_0"></p>
*
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java 2011-01-11
20:06:50 UTC (rev 20955)
+++
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -1,24 +1,9 @@
package org.richfaces.cdk.model;
-
import org.richfaces.cdk.util.ComparatorUtils;
import com.google.common.base.Predicate;
-
-/**
- * <p class="changed_added_4_0">This Interface describes all JSF objects
that can be generated by cdk:</p>
- * <ul>
- * <li>{@link UIComponent}</li>
- * <li>{@link Renderer}</li>
- * <li>{@link Converter}</li>
- * <li>{@link Validator}</li>
- * <li>{@link ClientBehavior}</li>
- * <li>{@link javax.faces.render.ClientBehaviorRenderer}
- * </ul>
- * @author asmirnov(a)exadel.com
- *
- */
public interface FacesComponent {
/**
@@ -26,10 +11,10 @@
* @author asmirnov(a)exadel.com
*
*/
- public static final class ComponentPredicate implements
Predicate<FacesComponent> {
+ public static final class ComponentPredicate implements
Predicate<GeneratedFacesComponent> {
private final FacesId id;
-
+
/**
* <p class="changed_added_4_0"></p>
* @param id
@@ -37,7 +22,7 @@
public ComponentPredicate(FacesId id) {
this.id = id;
}
-
+
/**
* <p class="changed_added_4_0"></p>
* @param name
@@ -47,56 +32,33 @@
}
@Override
- public boolean apply(FacesComponent input) {
+ public boolean apply(GeneratedFacesComponent input) {
return ComparatorUtils.nullSafeEquals(input.getId(), this.id);
}
}
+
/**
* <p class="changed_added_4_0"></p>
* @return
*/
- public FacesId getId();
+ FacesId getId();
/**
* <p class="changed_added_4_0"></p>
* @param id
*/
- public void setId(FacesId id);
+ void setId(FacesId id);
/**
* <p class="changed_added_4_0"></p>
* @param targetClass the targetClass to set
*/
- public void setTargetClass(ClassName targetClass);
+ void setTargetClass(ClassName targetClass);
/**
* <p class="changed_added_4_0"></p>
* @return the targetClass
*/
- public ClassName getTargetClass();
+ ClassName getTargetClass();
- /**
- * <p class="changed_added_4_0"></p>
- * @return the baseClass
- */
- public ClassName getBaseClass();
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param baseClass
- */
- public abstract void setBaseClass(ClassName baseClass);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return
- */
- public Boolean getGenerate();
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param generate
- */
- public void setGenerate(Boolean generate);
-
}
\ No newline at end of file
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java 2011-01-11
20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -38,6 +38,11 @@
private String name;
+ /**
+ * <p class="changed_added_4_0">Is that bean property generate in
the class or should be generated ?</p>
+ */
+ private Boolean generate;
+
public FacetModel() {
}
@@ -70,4 +75,13 @@
public boolean same(FacetModel other) {
return ComparatorUtils.nullSafeEquals(this.getName(), other.getName());
}
+
+ @Merge
+ public Boolean getGenerate() {
+ return generate;
+ }
+
+ public void setGenerate(Boolean generate) {
+ this.generate = generate;
+ }
}
Copied:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/GeneratedFacesComponent.java
(from rev 20948,
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java)
===================================================================
---
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/GeneratedFacesComponent.java
(rev 0)
+++
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/GeneratedFacesComponent.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -0,0 +1,46 @@
+package org.richfaces.cdk.model;
+
+
+
+
+
+/**
+ * <p class="changed_added_4_0">This Interface describes all JSF objects
that can be generated by cdk:</p>
+ * <ul>
+ * <li>{@link UIComponent}</li>
+ * <li>{@link Renderer}</li>
+ * <li>{@link Converter}</li>
+ * <li>{@link Validator}</li>
+ * <li>{@link ClientBehavior}</li>
+ * <li>{@link javax.faces.render.ClientBehaviorRenderer}
+ * </ul>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface GeneratedFacesComponent extends FacesComponent {
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the baseClass
+ */
+ public ClassName getBaseClass();
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param baseClass
+ */
+ public abstract void setBaseClass(ClassName baseClass);
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return
+ */
+ public Boolean getGenerate();
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param generate
+ */
+ public void setGenerate(Boolean generate);
+
+}
\ No newline at end of file
Property changes on:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/GeneratedFacesComponent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java 2011-01-11
20:06:50 UTC (rev 20955)
+++
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -10,7 +10,7 @@
* @author asmirnov(a)exadel.com
*
*/
-public class ModelElementBase extends BeanModelBase implements FacesComponent,
ViewElement {
+public class ModelElementBase extends BeanModelBase implements GeneratedFacesComponent,
ViewElement {
private FacesId id;
@@ -22,7 +22,12 @@
private final Collection<ClassName> interfaces = Lists.newArrayList();
+ /**
+ * <p class="changed_added_4_0">Is that bean property generate in
the class or should be generated ?</p>
+ */
+ private Boolean generate;
+
/* (non-Javadoc)
* @see org.richfaces.cdk.model.ViewElement#getTags()
*/
@@ -40,28 +45,28 @@
}
/* (non-Javadoc)
- * @see org.richfaces.cdk.model.FacesComponent#getId()
+ * @see org.richfaces.cdk.model.GeneratedFacesComponent#getId()
*/
public FacesId getId() {
return id;
}
/* (non-Javadoc)
- * @see
org.richfaces.cdk.model.FacesComponent#setId(org.richfaces.cdk.model.FacesId)
+ * @see
org.richfaces.cdk.model.GeneratedFacesComponent#setId(org.richfaces.cdk.model.FacesId)
*/
public void setId(FacesId id) {
this.id = id;
}
/* (non-Javadoc)
- * @see
org.richfaces.cdk.model.FacesComponent#setTargetClass(org.richfaces.cdk.model.ClassName)
+ * @see
org.richfaces.cdk.model.GeneratedFacesComponent#setTargetClass(org.richfaces.cdk.model.ClassName)
*/
public void setTargetClass(ClassName targetClass) {
this.targetClass = targetClass;
}
/* (non-Javadoc)
- * @see org.richfaces.cdk.model.FacesComponent#getTargetClass()
+ * @see org.richfaces.cdk.model.GeneratedFacesComponent#getTargetClass()
*/
public ClassName getTargetClass() {
return targetClass;
@@ -77,9 +82,18 @@
}
/* (non-Javadoc)
- * @see org.richfaces.cdk.model.FacesComponent#getBaseClass()
+ * @see org.richfaces.cdk.model.GeneratedFacesComponent#getBaseClass()
*/
public ClassName getBaseClass() {
return baseClass;
}
+
+ @Merge
+ public Boolean getGenerate() {
+ return generate;
+ }
+
+ public void setGenerate(Boolean generate) {
+ this.generate = generate;
+ }
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java 2011-01-11
20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -61,7 +61,12 @@
private boolean binding;
private String aliasFor;
+
/**
+ * <p class="changed_added_4_0">Is that bean property generate in
the class or should be generated ?</p>
+ */
+ private Boolean generate;
+ /**
* <p class="changed_added_4_0"></p>
*/
public PropertyBase() {
@@ -335,4 +340,13 @@
public String toString() {
return "PropertyModel {name: " + getName() + ", type: " +
getType().getName() + "}";
}
+
+ @Merge
+ public Boolean getGenerate() {
+ return generate;
+ }
+
+ public void setGenerate(Boolean generate) {
+ this.generate = generate;
+ }
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java 2011-01-11
20:06:50 UTC (rev 20955)
+++
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -40,8 +40,6 @@
private ClassName targetClass;
- private ClassName baseClass;
-
private FacesId id;
public RenderKitModel() {
@@ -82,22 +80,6 @@
/**
* <p class="changed_added_4_0"></p>
- * @return the baseClass
- */
- public ClassName getBaseClass() {
- return this.baseClass;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param baseClass the baseClass to set
- */
- public void setBaseClass(ClassName baseClass) {
- this.baseClass = baseClass;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
* @return the renderers
*/
public ModelCollection<RendererModel> getRenderers() {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ViewElement.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ViewElement.java 2011-01-11
20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ViewElement.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -1,5 +1,10 @@
package org.richfaces.cdk.model;
+/**
+ * <p class="changed_added_4_0">Defines element for view elements, for
which tags should be generated.</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
public interface ViewElement {
/**
Modified:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2011-01-11
20:06:50 UTC (rev 20955)
+++
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -48,7 +48,7 @@
import org.richfaces.cdk.model.ConverterModel;
import org.richfaces.cdk.model.DescriptionGroup;
import org.richfaces.cdk.model.EventModel;
-import org.richfaces.cdk.model.FacesComponent;
+import org.richfaces.cdk.model.GeneratedFacesComponent;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.FacetModel;
import org.richfaces.cdk.model.InvalidNameException;
@@ -478,7 +478,7 @@
}
}
- private <T extends FacesComponent> T findParent(Iterable<T> components,
final T component)
+ private <T extends GeneratedFacesComponent> T findParent(Iterable<T>
components, final T component)
throws NoSuchElementException {
return Iterables.find(components, new Predicate<T>() {
@@ -536,7 +536,7 @@
* callback to corresponding naming conventions.
* @return
*/
- protected boolean verifyTypes(FacesComponent component, NamingConventionsCallback
callback) {
+ protected boolean verifyTypes(GeneratedFacesComponent component,
NamingConventionsCallback callback) {
// Check JsfComponent type.
try {
if (null == component.getId()) {
@@ -570,7 +570,7 @@
return true;
}
- private void verifyGeneratedClasses(FacesComponent component,
NamingConventionsCallback callback) throws CallbackException {
+ private void verifyGeneratedClasses(GeneratedFacesComponent component,
NamingConventionsCallback callback) throws CallbackException {
if (null == component.getBaseClass()) {
component.setBaseClass(callback.getDefaultBaseClass());
// return;
@@ -580,7 +580,7 @@
}
}
- protected void verifyAttribute(PropertyBase attribute, FacesComponent component) {
+ protected void verifyAttribute(PropertyBase attribute, GeneratedFacesComponent
component) {
// Check name.
if (Strings.isEmpty(attribute.getName())) {
log.error("No name for attribute " + attribute);
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates/behavior.ftl
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/behavior.ftl 2011-01-11
20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/behavior.ftl 2011-01-11
23:45:11 UTC (rev 20956)
@@ -14,12 +14,14 @@
* ${description?if_exists}
**/
@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
-public class ${targetClass.simpleName} extends ${baseClass} implements Behavior,
PartialStateHolder {
+public class ${targetClass.simpleName} extends ${baseClass} implements Behavior,
PartialStateHolder
+<#if (implemented?size > 0)>, <@util.concat seq=implemented ;
interface>${interface.simpleName}</(a)util.concat></#if> {
- @Override
- public void broadcast(BehaviorEvent event) {
+ <#if rendererType?exists >
+ public String getRendererType() {
+ return "${rendererType}";
}
-
+ </#if>
<#include "_attributes-old.ftl">
<#include "_state-holder-methods-old.ftl">
Added:
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestBehavior.java
===================================================================
---
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestBehavior.java
(rev 0)
+++
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestBehavior.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -0,0 +1,45 @@
+/*
+ * $Id$
+ * 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.cdk.test.event;
+
+import javax.faces.component.behavior.ClientBehaviorBase;
+
+import org.richfaces.cdk.annotations.JsfBehavior;
+import org.richfaces.cdk.annotations.JsfBehaviorRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.test.component.Html5Attributes;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+@JsfBehavior(interfaces = Html5Attributes.class, id =
"richfaces.test.TestBehavior", renderer = @JsfBehaviorRenderer(type
=TestBehavior.RICHFACES_TEST_TEST_BEHAVIOR_RENDERER), tag = @Tag(name =
"testBehavior"))
+public abstract class TestBehavior extends ClientBehaviorBase {
+
+ public static final String RICHFACES_TEST_TEST_BEHAVIOR_RENDERER =
"richfaces.test.TestBehaviorRenderer";
+
+}
Property changes on:
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestBehavior.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/RendererUtils.java
===================================================================
---
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/RendererUtils.java 2011-01-11
20:06:50 UTC (rev 20955)
+++
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/RendererUtils.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -21,8 +21,45 @@
// TODO Auto-generated method stub
return null;
}
+ /**
+ * Wrapper class around object value used to transform values into particular JS
objects
+ *
+ * @author Nick Belaevski
+ * @since 3.3.2
+ */
+ public enum ScriptHashVariableWrapper {
+ /**
+ * No-op default wrapper
+ */
+ noop,
+
+ /**
+ * Convert parameter to array of srings.
+ */
+ asArray
+ ,
+
+ /**
+ * Event handler functions wrapper. Wraps <pre>functionCode</pre>
object into:
+ * <pre>function(event) {
+ * functionCode
+ * }</pre>
+ */
+ eventHandler;
+ /**
+ * Method that does the wrapping
+ *
+ * @param o object to wrap
+ * @return wrapped object
+ */
+ Object wrap(Object o){
+ return o;
+ }
+ }
+
+
public class Attributes {
public Attributes generic(String string, String string2,String ...events) {
Added:
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/TestBehaviorRenderer.java
===================================================================
---
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/TestBehaviorRenderer.java
(rev 0)
+++
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/TestBehaviorRenderer.java 2011-01-11
23:45:11 UTC (rev 20956)
@@ -0,0 +1,39 @@
+/*
+ * $Id$
+ * 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.cdk.test.renderkit;
+
+import javax.faces.render.ClientBehaviorRenderer;
+
+import org.richfaces.cdk.annotations.JsfBehaviorRenderer;
+import org.richfaces.cdk.test.event.TestBehavior;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)JsfBehaviorRenderer(type=TestBehavior.RICHFACES_TEST_TEST_BEHAVIOR_RENDERER)
+public class TestBehaviorRenderer extends ClientBehaviorRenderer {
+
+}
Property changes on:
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/TestBehaviorRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain