Author: Alex.Kolonitsky
Date: 2010-03-17 08:05:36 -0400 (Wed, 17 Mar 2010)
New Revision: 16585
Removed:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/ComponentTagGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGeneratorBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/ValidatorTagGenerator.java
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taglib/
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/taglib/
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Icon.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java
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/RendererProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibModule.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/QueueRenderer.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/RepeatRenderer.java
Log:
RF-8232 Tags support
JsfRenderer annotation processor
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Icon.java
===================================================================
---
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Icon.java 2010-03-16
16:27:40 UTC (rev 16584)
+++
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Icon.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -23,12 +23,6 @@
package org.richfaces.cdk.annotations;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
/**
* <p class="changed_added_4_0">
* Icon used that would be used in IDE to display.
@@ -36,9 +30,6 @@
*
* @author asmirnov(a)exadel.com
*/
-(a)Retention(RetentionPolicy.CLASS)
-@Target( { ElementType.TYPE, ElementType.METHOD, ElementType.FIELD })
-@Inherited
public @interface Icon {
public static final String NAME = "org.richfaces.cdk.annotations.Icon";
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java
===================================================================
---
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java 2010-03-16
16:27:40 UTC (rev 16584)
+++
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -49,6 +49,15 @@
*
* @return JSF <em>renderer-type</em>.
*/
- public String value() default "";
+ public String type() default "";
+ public String family() default "";
+
+ public String renderKitId() default "";
+
+ public String template() default "";
+
+ public Icon icon() default @Icon();
+
+ public String displayName() default "";
}
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-03-16
16:27:40 UTC (rev 16584)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -26,6 +26,7 @@
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.InvalidNameException;
+import org.richfaces.cdk.model.RendererModel;
/**
* <p class="changed_added_4_0">
@@ -78,4 +79,9 @@
public String inferTagName(FacesId componentType) throws InvalidNameException;
+ public String inferRendererTypeByRendererClass(ClassName rendererClass);
+
+ 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-03-16
16:27:40 UTC (rev 16584)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -4,6 +4,7 @@
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.InvalidNameException;
import org.richfaces.cdk.model.Name;
+import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.model.Name.Classifier;
import org.richfaces.cdk.util.Strings;
@@ -141,4 +142,16 @@
protected String getBaseName() {
return baseName;
}
+
+ public String inferRendererTypeByRendererClass(ClassName rendererClass) {
+ return null;
+ }
+
+ public String inferComponentFamily(RendererModel.Type type) {
+ return null;
+ }
+
+ public String inferTemplate(RendererModel.Type type) {
+ return null;
+ }
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/RendererProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/RendererProcessor.java 2010-03-16
16:27:40 UTC (rev 16584)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/RendererProcessor.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -26,11 +26,14 @@
import org.richfaces.cdk.annotations.Family;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.Property;
import org.richfaces.cdk.model.RendererModel;
+import org.richfaces.cdk.util.Strings;
import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.faces.render.RenderKitFactory;
import javax.lang.model.element.TypeElement;
import java.lang.annotation.Annotation;
@@ -43,25 +46,61 @@
public void process(TypeElement rendererElement) {
- ComponentLibrary library = getLibrary();
+ JsfRenderer annotation = rendererElement.getAnnotation(JsfRenderer.class);
- // Process class-level annotations. Calculate type for base UI component class.
- String explicitType = getComponentType(rendererElement);
+ RendererModel rendererModel = process(rendererElement, annotation);
- // Because component type is a primary key for components collection, we have to
infer explicit value here.
-// String type = getNamingConventions()
-// .inferComponentType(explicitType,
rendererElement.getQualifiedName().toString());
+ ComponentModel componentModel =
getLibrary().getComponentModel(rendererModel.getFamily());
+ if (componentModel != null) {
+ componentModel.getRenderers().add(rendererModel);
+ } else {
+ System.out.println("For renderer with type (" +
rendererModel.getType() + ") and family ("
+ + rendererModel.getFamily() + ") comopnent was not
found");
+ }
+ }
- RendererModel renderer = new RendererModel();
- renderer.setType(new RendererModel.Type(explicitType));
+ public RendererModel process(TypeElement rendererElement, JsfRenderer annotation) {
+ RendererModel rendererModel = new RendererModel();
+ rendererModel.setRendererClass(new
ClassName(rendererElement.getQualifiedName().toString()));
- // Should that component be generated ?
-// setClassNames(rendererElement, renderer);
- setRendererProperties(rendererElement, renderer);
+ setRendererType(rendererModel, annotation);
+ setComponentFamily(rendererModel, annotation);
+ setTemplate(rendererModel, annotation);
+ setDescription(rendererElement, rendererModel);
- //library.getComponents().add(renderer);
+ String renderKitId = annotation.renderKitId();
+ if (Strings.isEmpty(renderKitId)) {
+ renderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT; // TODO ???
+ }
+
+ setRendererProperties(rendererElement, rendererModel);
+ return rendererModel;
}
+ private void setTemplate(RendererModel rendererModel, JsfRenderer annotation) {
+ String template = annotation.template();
+ if (Strings.isEmpty(template)) {
+ template = getNamingConventions().inferTemplate(rendererModel.getType());
+ }
+ rendererModel.setTemplatePath(template);
+ }
+
+ private void setComponentFamily(RendererModel rendererModel, JsfRenderer annotation)
{
+ String family = annotation.family();
+ if (Strings.isEmpty(family)) {
+ family =
this.getNamingConventions().inferComponentFamily(rendererModel.getType());
+ }
+ rendererModel.setFamily(family);
+ }
+
+ private void setRendererType(RendererModel rendererModel, JsfRenderer annotation) {
+ String type = annotation.type();
+ if (Strings.isEmpty(type)) {
+ type =
this.getNamingConventions().inferRendererTypeByRendererClass(rendererModel.getRendererClass());
+ }
+ rendererModel.setType(new RendererModel.Type(type));
+ }
+
protected String getComponentType(TypeElement componentElement) {
JsfComponent annotation = componentElement.getAnnotation(JsfComponent.class);
if (annotation != null) {
@@ -76,7 +115,6 @@
// JsfComponent family
setRendererFamily(componentElement, renderer);
- setDescription(componentElement, renderer);
// processFacets(componentElement, renderer);
// process Events.
@@ -91,8 +129,6 @@
Family family = rendererElement.getAnnotation(Family.class);
if (null != family) {
-
- // @Family annotation
renderer.setFamily(family.value());
} else {
// static final COMPONENT_FAMILY string constant.
@@ -122,27 +158,6 @@
// }
// }
// }
-//
-// private void setClassNames(TypeElement componentElement,
org.richfaces.cdk.model.Renderer renderer) {
-// Generate generate = componentElement.getAnnotation(Generate.class);
-//
-// // Set generated and base class names.
-// ClassName baseClass = new
ClassName(componentElement.getQualifiedName().toString());
-//
-// if (null != generate) {
-// renderer.setRendererClass(new ClassName(generate.value()));
-// renderer.setBaseClass(baseClass);
-// renderer.setGenerate(true);
-// } else if (componentElement.getModifiers().contains(Modifier.ABSTRACT)) {
-//
-// // Final component class will be set by validator.
-// renderer.setBaseClass(baseClass);
-// renderer.setGenerate(true);
-// } else {
-// renderer.setRendererClass(baseClass);
-// renderer.setGenerate(false);
-// }
-// }
private void setBehaviorEvent(Property attribute, EventName eventName) {
if (null != eventName) {
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/ComponentTagGenerator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/ComponentTagGenerator.java 2010-03-16
16:27:40 UTC (rev 16584)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/ComponentTagGenerator.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -1,49 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.generate.taglib;
-
-import org.richfaces.cdk.model.ComponentModel;
-
-import com.google.inject.Inject;
-
-import freemarker.template.Configuration;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public class ComponentTagGenerator extends TagGeneratorBase<ComponentModel> {
-
- @Inject
- public ComponentTagGenerator(Configuration configuration) {
- super(configuration);
- }
-
- @Override
- protected String getTemplateName() {
- return "taglib/component.ftl";
- }
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGenerator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGenerator.java 2010-03-16
16:27:40 UTC (rev 16584)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGenerator.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -1,40 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.generate.taglib;
-
-import java.io.Writer;
-
-import org.richfaces.cdk.CdkException;
-import org.richfaces.cdk.model.Visitable;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public interface TagGenerator<E extends Visitable> {
-
- public void generate(E model,Writer out) throws CdkException;
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGeneratorBase.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGeneratorBase.java 2010-03-16
16:27:40 UTC (rev 16584)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TagGeneratorBase.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -1,66 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.generate.taglib;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import org.richfaces.cdk.CdkException;
-import org.richfaces.cdk.model.Visitable;
-
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public abstract class TagGeneratorBase<T extends Visitable> implements
TagGenerator<T>{
-
- protected Template template;
-
- public TagGeneratorBase(Configuration configuration) {
- try {
- template = configuration.getTemplate(getTemplateName());
- } catch (IOException e) {
- throw new CdkException(e);
- }
- }
-
- @Override
- public void generate(T model,Writer out) throws CdkException {
- try {
- template.process(model, out);
- } catch (TemplateException e) {
- throw new CdkException(e);
- } catch (IOException e) {
- throw new CdkException(e);
- }
- }
-
- protected abstract String getTemplateName();
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGenerator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGenerator.java 2010-03-16
16:27:40 UTC (rev 16584)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGenerator.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -1,107 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.generate.taglib;
-
-import com.google.inject.Inject;
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-import org.richfaces.cdk.*;
-import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.model.LibraryVisitor;
-import org.richfaces.cdk.model.Visitable;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Map;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-public class TaglibGenerator implements CdkWriter, LibraryVisitor<Boolean, Writer>
{
-
- private final Map<Class<? extends Visitable>, TagGenerator<? extends
Visitable>> tagGenerators;
-
- private final Template prolog;
-
- private final ComponentLibrary library;
-
- private final FileManager output;
-
- private Template epilog;
-
- @Inject
- public TaglibGenerator(Configuration configuration, ComponentLibrary library,
- @Output(Outputs.RESOURCES) FileManager output,
- Map<Class<? extends Visitable>, TagGenerator<? extends
Visitable>> tagGenerators) {
- this.library = library;
- this.output = output;
- this.tagGenerators = tagGenerators;
- try {
- prolog = configuration.getTemplate("taglib/prolog.ftl");
- epilog = configuration.getTemplate("taglib/epilog.ftl");
- } catch (IOException e) {
- throw new CdkException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.cdk.CdkWriter#render()
- */
- @Override
- public void render() throws CdkException {
- // TODO - calculate library name.
- try {
- Writer writer =
- output.createOutput("META-INF/" +
library.getTagLibrary().getShortName() + ".taglib.xml", library
- .lastModified());
- if (null != writer) {
- prolog.process(library, writer);
- library.accept(this, writer);
- epilog.process(library, writer);
- writer.close();
- }
- } catch (IOException e) {
- throw new CdkException(e);
- } catch (TemplateException e) {
- throw new CdkException(e);
- }
- }
-
- @Override
- public Boolean visit(Visitable c, Writer output) throws CdkException {
- TagGenerator<Visitable> tagGenerator = (TagGenerator<Visitable>)
tagGenerators.get(c.getClass());
- if (null != tagGenerator) {
- tagGenerator.generate(c, output);
- }
- return false;
- }
-
-}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-03-16
16:27:40 UTC (rev 16584)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -25,7 +25,23 @@
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
-import org.richfaces.cdk.model.*;
+import org.richfaces.cdk.model.BeanModelBase;
+import org.richfaces.cdk.model.BehaviorModel;
+import org.richfaces.cdk.model.BehaviorRenderer;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.ConverterModel;
+import org.richfaces.cdk.model.EventModel;
+import org.richfaces.cdk.model.FacetModel;
+import org.richfaces.cdk.model.ListenerModel;
+import org.richfaces.cdk.model.ModelElement;
+import org.richfaces.cdk.model.ModelElementBase;
+import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.RenderKitModel;
+import org.richfaces.cdk.model.RendererModel;
+import org.richfaces.cdk.model.TagModel;
+import org.richfaces.cdk.model.ValidatorModel;
+import org.richfaces.cdk.model.Visitor;
import java.util.List;
@@ -224,7 +240,7 @@
}
public void visitListener(ListenerModel model) {
- //To change body of implemented methods use File | Settings | File Templates.
+ // TODO
}
public void visit(ModelElement model) {
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibModule.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibModule.java 2010-03-16
16:27:40 UTC (rev 16584)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibModule.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -24,12 +24,8 @@
package org.richfaces.cdk.generate.taglib;
import com.google.inject.AbstractModule;
-import com.google.inject.TypeLiteral;
-import com.google.inject.multibindings.MapBinder;
import com.google.inject.multibindings.Multibinder;
import org.richfaces.cdk.CdkWriter;
-import org.richfaces.cdk.model.ValidatorModel;
-import org.richfaces.cdk.model.Visitable;
/**
* <p class="changed_added_4_0"></p>
@@ -42,12 +38,5 @@
protected void configure() {
Multibinder<CdkWriter> setBinder = Multibinder.newSetBinder(binder(),
CdkWriter.class);
setBinder.addBinding().to(TaglibWriter.class);
- MapBinder<Class<? extends Visitable>, TagGenerator<? extends
Visitable>> mapBinder =
- MapBinder.newMapBinder(binder(),
- new TypeLiteral<Class<? extends Visitable>>(){},
- new TypeLiteral<TagGenerator<? extends Visitable>>(){});
- mapBinder.addBinding(ValidatorModel.class).to(ValidatorTagGenerator.class);
-// mapBinder.addBinding(ComponentModel.class).to(ComponentTagGenerator.class);
TODO
}
-
}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/ValidatorTagGenerator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/ValidatorTagGenerator.java 2010-03-16
16:27:40 UTC (rev 16584)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/ValidatorTagGenerator.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright , 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.generate.taglib;
-
-import org.richfaces.cdk.model.ValidatorModel;
-
-import com.google.inject.Inject;
-
-import freemarker.template.Configuration;
-
-/**
- * @author akolonitsky
- * @since Jan 18, 2010
- */
-public class ValidatorTagGenerator extends TagGeneratorBase<ValidatorModel>{
-
-
-
-
- @Inject
- public ValidatorTagGenerator(Configuration configuration) {
- super(configuration);
- }
-
- @Override
- protected String getTemplateName() {
- return "taglib/validator.ftl";
- }
-
-}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2010-03-16
16:27:40 UTC (rev 16584)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -25,6 +25,10 @@
package org.richfaces.cdk.model;
+import com.google.inject.Singleton;
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.model.RenderKitModel.Id;
+
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
@@ -35,11 +39,6 @@
import java.util.Map;
import java.util.NoSuchElementException;
-import org.richfaces.cdk.CdkException;
-import org.richfaces.cdk.model.RenderKitModel.Id;
-
-import com.google.inject.Singleton;
-
/**
* <p class="changed_added_4_0">
* That class contains model of all JSF components asscoiated with that project
@@ -177,6 +176,19 @@
return components;
}
+ public ComponentModel getComponentModel(String componentFamily) {
+ if (componentFamily == null) {
+ return null;
+ }
+
+ for (ComponentModel component : components) {
+ if (componentFamily.equals(component.getFamily())) {
+ return component;
+ }
+ }
+ return null;
+ }
+
/**
* <p class="changed_added_4_0">
* </p>
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java 2010-03-16
16:27:40 UTC (rev 16584)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -40,6 +40,7 @@
private String family;
private ClassName rendererClass;
+ private String templatePath;
private Template template;
private Type type;
@@ -155,6 +156,14 @@
this.tag = tag;
}
+ public String getTemplatePath() {
+ return templatePath;
+ }
+
+ public void setTemplatePath(String templatePath) {
+ this.templatePath = templatePath;
+ }
+
@Override
public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws
CdkException {
return visitor.visit(this, param);
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/QueueRenderer.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/QueueRenderer.java 2010-03-16
16:27:40 UTC (rev 16584)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/QueueRenderer.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -34,7 +34,7 @@
* @author Nick Belaevski
*
*/
-(a)org.richfaces.cdk.annotations.JsfRenderer
+//@JsfRenderer
@ResourceDependencies( { @ResourceDependency(library = "javax.faces", name =
"jsf.js"),
@ResourceDependency(name = "jquery.js"), @ResourceDependency(name =
"richfaces.js"),
@ResourceDependency(name = "richfaces-queue.js")
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/RepeatRenderer.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/RepeatRenderer.java 2010-03-16
16:27:40 UTC (rev 16584)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/RepeatRenderer.java 2010-03-17
12:05:36 UTC (rev 16585)
@@ -21,21 +21,20 @@
*/
package org.richfaces.renderkit.html;
-import java.io.IOException;
+import org.ajax4jsf.model.DataVisitResult;
+import org.ajax4jsf.model.DataVisitor;
+import org.richfaces.component.UIRepeat;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.render.Renderer;
+import java.io.IOException;
-import org.ajax4jsf.model.DataVisitResult;
-import org.ajax4jsf.model.DataVisitor;
-import org.richfaces.component.UIRepeat;
-
/**
* @author Nick Belaevski
*
*/
-(a)org.richfaces.cdk.annotations.JsfRenderer("org.richfaces.RepeatRenderer")
+//@JsfRenderer(type = "org.richfaces.RepeatRenderer")
public class RepeatRenderer extends Renderer {
@Override