JBoss Rich Faces SVN: r16590 - in root/cdk/trunk/plugins/generator/src: main/resources/META-INF/templates and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-17 16:40:27 -0400 (Wed, 17 Mar 2010)
New Revision: 16590
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/ModelElementBaseTemplateModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/PropertyModel.java
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/_attributes_import.ftl
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java
Log:
RF-8232 Tags support
some fixes for integration tests
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/ModelElementBaseTemplateModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/ModelElementBaseTemplateModel.java 2010-03-17 20:35:18 UTC (rev 16589)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/ModelElementBaseTemplateModel.java 2010-03-17 20:40:27 UTC (rev 16590)
@@ -32,6 +32,7 @@
import freemarker.ext.beans.BeansWrapper;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
+import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.EventName;
import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.Property;
@@ -40,6 +41,7 @@
import java.util.Collection;
import java.util.NoSuchElementException;
import java.util.Set;
+import java.util.TreeSet;
/**
* <p class="changed_added_4_0">
@@ -74,11 +76,38 @@
return eventNames();
} else if ("defaultEvent".equals(key)) {
return defaultEvent();
+ } else if ("importClasses".equals(key)) {
+ return getImportClasses();
}
return super.get(key);
}
+
+ public TemplateModel getImportClasses() throws TemplateModelException {
+ Set<String> result = new TreeSet<String>();
+ for (Property entry : model.getAttributes()) {
+ if (entry.isGenerate() && !isPredefined(entry)) {
+ result.add(entry.getType().getName());
+// System.out.println(entry.getType().getTypeParameters());
+ }
+ }
+
+ Collection<String> list = new ArrayList<String>(result.size());
+ for (String imp : result) {
+ list.add(imp);
+ }
+ return this.wrapper.wrap(list);
+ }
+
+ public boolean isPredefined(Property property) {
+ return property.isPrimitive() || isFromJavaLang(property.getType());
+ }
+
+ public boolean isFromJavaLang(ClassName type) {
+ return "java.lang".equals(type.getPackage());
+ }
+
private TemplateModel eventNames() throws TemplateModelException {
return wrapper.wrap(getEventNames());
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/PropertyModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/PropertyModel.java 2010-03-17 20:35:18 UTC (rev 16589)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/PropertyModel.java 2010-03-17 20:40:27 UTC (rev 16590)
@@ -43,7 +43,6 @@
/**
* <p class="changed_added_4_0"></p>
- * @param name
* @param object
* @param wrapper
*/
@@ -88,6 +87,8 @@
value = isBingingAttribute();
} else if ("isBinging".equals(key)) {
value = isBinging();
+ } else if ("type".equals(key)) {
+ value = this.property.getType().getName();
} else {
return super.get(key);
}
Modified: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/_attributes_import.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/_attributes_import.ftl 2010-03-17 20:35:18 UTC (rev 16589)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/_attributes_import.ftl 2010-03-17 20:40:27 UTC (rev 16590)
@@ -1,2 +1,2 @@
-<#list generatedAttributes as attribute><#if (!attribute.isPredefined) >import ${attribute.type};
-</#if></#list>
\ No newline at end of file
+<#list importClasses as imp>import ${imp};
+</#list>
\ No newline at end of file
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java 2010-03-17 20:35:18 UTC (rev 16589)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java 2010-03-17 20:40:27 UTC (rev 16590)
@@ -24,25 +24,21 @@
import java.io.File;
import java.util.ArrayList;
import java.util.List;
+import java.util.Arrays;
import javax.el.ELContext;
import javax.faces.component.UIComponent;
-import org.richfaces.cdk.CdkClassLoader;
-import org.richfaces.cdk.CdkTestBase;
-import org.richfaces.cdk.FileManager;
-import org.richfaces.cdk.Logger;
-import org.richfaces.cdk.Mock;
-import org.richfaces.cdk.Source;
-import org.richfaces.cdk.SourceFileManager;
-import org.richfaces.cdk.SourceImpl;
-import org.richfaces.cdk.Sources;
+import org.richfaces.cdk.*;
import org.richfaces.cdk.annotations.Family;
import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.apache.maven.plugin.MojoExecutionException;
import com.google.common.collect.ImmutableList;
import com.google.inject.Binder;
import com.google.inject.Inject;
+import com.google.inject.Injector;
/**
* @author akolonitsky
@@ -57,6 +53,21 @@
@Mock
protected Logger log;
+ @Inject
+ private Injector injector;
+
+ protected void process(String javaFilePath) throws Exception {
+ Generator generator = new Generator();
+ generator.setLoader(createClassLoader());
+ generator.addSources(Sources.JAVA_SOURCES, ImmutableList.of(getJavaFile(javaFilePath)), null);
+
+ generator.init();
+ injector.injectMembers(new ComponentProcessor());
+
+ LibraryBuilder builder = injector.getInstance(LibraryBuilder.class);
+ builder.build();
+ }
+
@Override
public void configure(Binder binder) {
super.configure(binder);
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-03-17 20:35:18 UTC (rev 16589)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-03-17 20:40:27 UTC (rev 16590)
@@ -42,6 +42,7 @@
import javax.faces.component.UIOutput;
import javax.faces.el.MethodBinding;
import java.io.StringWriter;
+import java.util.ArrayList;
import java.util.Set;
/**
@@ -111,6 +112,18 @@
attribute.setType(new ClassName(String.class));
attribute.setGenerate(false);
+ attribute = component.getOrCreateAttribute("listStrings");
+ attribute.setType(new ClassName(new ArrayList<String>().getClass()));
+ attribute.setGenerate(true);
+
+ attribute = component.getOrCreateAttribute("listInteger");
+ attribute.setType(new ClassName(new ArrayList<Integer>().getClass()));
+ attribute.setGenerate(true);
+
+ attribute = component.getOrCreateAttribute("list");
+ attribute.setType(new ClassName(ArrayList.class));
+ attribute.setGenerate(true);
+
Set<EventName> eventNames = attribute.getEventNames();
eventNames.add(getEvent("id", false));
eventNames.add(getEvent("action", true));
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-03-17 20:35:18 UTC (rev 16589)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java 2010-03-17 20:40:27 UTC (rev 16590)
@@ -36,8 +36,9 @@
import javax.faces.component.StateHelper;
import org.richfaces.PartialStateHolderHelper;
import javax.faces.component.UIOutput;
+import java.util.ArrayList;
+import javax.el.MethodExpression;
import javax.faces.el.MethodBinding;
-import javax.el.MethodExpression;
/**
*
@@ -64,7 +65,10 @@
testValue,
testFlag,
testBinding,
- testExpr
+ testExpr,
+ listStrings,
+ listInteger,
+ list
}
@@ -99,4 +103,28 @@
public void setTestExpr(MethodExpression testExpr) {
getStateHelper().put(Properties.testExpr, testExpr);
}
+
+ public ArrayList getListStrings() {
+ return (ArrayList) getStateHelper().eval(Properties.listStrings);
+ }
+
+ public void setListStrings(ArrayList listStrings) {
+ getStateHelper().put(Properties.listStrings, listStrings);
+ }
+
+ public ArrayList getListInteger() {
+ return (ArrayList) getStateHelper().eval(Properties.listInteger);
+ }
+
+ public void setListInteger(ArrayList listInteger) {
+ getStateHelper().put(Properties.listInteger, listInteger);
+ }
+
+ 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
14 years, 9 months
JBoss Rich Faces SVN: r16589 - in root/cdk/trunk/plugins/generator/src: main/java/org/richfaces/cdk/apt and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-17 16:35:18 -0400 (Wed, 17 Mar 2010)
New Revision: 16589
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/ComponentProcessor.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/model/ComponentLibrary.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/templatecompiler/model/Template.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
Log:
RF-8232 Tags support
JsfRenderer processor
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-17 15:47:54 UTC (rev 16588)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java 2010-03-17 20:35:18 UTC (rev 16589)
@@ -84,4 +84,8 @@
public String inferComponentFamily(RendererModel.Type type);
public String inferTemplate(RendererModel.Type type);
+
+ public String inferRendererTypeByTemplatePath(String templateName);
+
+ public String inferRendererName(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-17 15:47:54 UTC (rev 16588)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java 2010-03-17 20:35:18 UTC (rev 16589)
@@ -102,16 +102,6 @@
return componentType.toString();
}
-
- /**
- * @param generatedClass - component name in format
- * <prefix>.component.Abstract<Name>
- * <prefix>.component.UI<Name>
- *
- * @return tag handler name as
- * <prefix>.taglib.html.<Name>TagHandler
- *
- * */
@Override
public ClassName inferTagHandlerClass(FacesId componentType, String markup) {
if (null == componentType) {
@@ -154,4 +144,13 @@
public String inferTemplate(RendererModel.Type type) {
return null;
}
+
+ public String inferRendererTypeByTemplatePath(String templateName) {
+ return null;
+ }
+
+ public String inferRendererName(RendererModel.Type type) {
+ return null;
+ }
}
+
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java 2010-03-17 15:47:54 UTC (rev 16588)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java 2010-03-17 20:35:18 UTC (rev 16589)
@@ -26,6 +26,8 @@
package org.richfaces.cdk.apt;
import com.google.common.collect.Lists;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.annotations.*;
import org.richfaces.cdk.annotations.EventName;
@@ -56,6 +58,9 @@
*/
@SupportedAnnotationTypes({"javax.faces.component.FacesComponent", JsfComponent.NAME})
public class ComponentProcessor extends ProcessorBase implements CdkAnnotationProcessor {
+
+ @Inject
+ private Injector injector;
public void process(TypeElement componentElement) {
ComponentLibrary library = getLibrary();
@@ -100,7 +105,12 @@
// process Events.
setEvents(componentElement, component);
- // TODO - process renderers ( @JsfRenderer and @RendererTemplate attribute.
+
+ RendererProcessor rendererProcessor = injector.getInstance(RendererProcessor.class);
+ JsfComponent componentAnnotation = componentElement.getAnnotation(JsfComponent.class);
+ JsfRenderer renderer = componentAnnotation.renderer();
+ rendererProcessor.process(componentElement, renderer);
+
// TODO - process @Test annotations.
// Process attributes.
processAttributes(componentElement, component);
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-17 15:47:54 UTC (rev 16588)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/RendererProcessor.java 2010-03-17 20:35:18 UTC (rev 16589)
@@ -21,6 +21,8 @@
package org.richfaces.cdk.apt;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.Family;
@@ -30,6 +32,7 @@
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.Property;
import org.richfaces.cdk.model.RendererModel;
+import org.richfaces.cdk.templatecompiler.RendererTemplateParser;
import org.richfaces.cdk.util.Strings;
import javax.annotation.processing.SupportedAnnotationTypes;
@@ -43,8 +46,10 @@
*/
@SupportedAnnotationTypes({"javax.faces.component.FacesComponent", JsfRenderer.NAME})
public class RendererProcessor extends ProcessorBase implements CdkAnnotationProcessor {
+
+ @Inject
+ private Injector injector;
-
public void process(TypeElement rendererElement) {
JsfRenderer annotation = rendererElement.getAnnotation(JsfRenderer.class);
@@ -83,8 +88,15 @@
template = getNamingConventions().inferTemplate(rendererModel.getType());
}
rendererModel.setTemplatePath(template);
+
+ processRendererTemplate(rendererModel);
}
+ private void processRendererTemplate(RendererModel renderer) {
+ RendererTemplateParser templateParser = injector.getInstance(RendererTemplateParser.class);
+// templateParser.
+ }
+
private void setComponentFamily(RendererModel rendererModel, JsfRenderer annotation) {
String family = annotation.family();
if (Strings.isEmpty(family)) {
@@ -173,5 +185,4 @@
public Class<? extends Annotation> getProcessedAnnotation() {
return JsfRenderer.class;
}
-
}
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-17 15:47:54 UTC (rev 16588)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2010-03-17 20:35:18 UTC (rev 16589)
@@ -60,10 +60,6 @@
public static final String TAGLIB_SCHEMA_LOCATION =
"http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd";
- /**
- * <p class="changed_added_4_0">
- * </p>
- */
private static final long serialVersionUID = -6055670836731899832L;
private final ModelCollection<ComponentModel> components = ModelCollection.<ComponentModel>create();
@@ -77,7 +73,11 @@
private final ModelCollection<ConverterModel> converters = ModelCollection.<ConverterModel>create();
private final ModelCollection<ValidatorModel> validators = ModelCollection.<ValidatorModel>create();
+
private final ModelCollection<ListenerModel> listeners = ModelCollection.<ListenerModel>create();
+
+ private final ModelCollection<RendererModel> renderers = ModelCollection.<RendererModel>create();
+
private long lastModified = Long.MIN_VALUE;
/**
@@ -108,6 +108,10 @@
this.tagLibrary = new TagLibrary();
}
+ public ModelCollection<RendererModel> getRenderers() {
+ return renderers;
+ }
+
@Override
public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
R result = accept(components, visitor, param, null);
@@ -199,6 +203,10 @@
return renderKits;
}
+ public RenderKitModel getRenderKit(RenderKitModel.Id id) {
+ return renderKits.get(id);
+ }
+
/**
* <p class="changed_added_4_0">
* </p>
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-03-17 15:47:54 UTC (rev 16588)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-03-17 20:35:18 UTC (rev 16589)
@@ -26,9 +26,26 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
-import org.richfaces.cdk.*;
-import org.richfaces.cdk.model.*;
-import org.richfaces.cdk.templatecompiler.model.*;
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.FileManager;
+import org.richfaces.cdk.Logger;
+import org.richfaces.cdk.ModelBuilder;
+import org.richfaces.cdk.Source;
+import org.richfaces.cdk.Sources;
+import org.richfaces.cdk.NamingConventions;
+import org.richfaces.cdk.RichFacesConventions;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.EventName;
+import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.RenderKitModel;
+import org.richfaces.cdk.model.RendererModel;
+import org.richfaces.cdk.templatecompiler.model.Attribute;
+import org.richfaces.cdk.templatecompiler.model.ClientBehavior;
+import org.richfaces.cdk.templatecompiler.model.CompositeInterface;
+import org.richfaces.cdk.templatecompiler.model.ImportAttributes;
+import org.richfaces.cdk.templatecompiler.model.Template;
+import org.richfaces.cdk.util.Strings;
import org.richfaces.cdk.xmlconfig.FragmentParser;
import org.richfaces.cdk.xmlconfig.JAXB;
@@ -62,9 +79,10 @@
private FileManager sources;
private FragmentParser fragmentParser;
-
-
+// @Inject
+ private NamingConventions namingConventions;
+
/**
* <p class="changed_added_4_0"></p>
* @param library
@@ -140,34 +158,41 @@
Iterable<File> sources = this.sources.getFiles();
if (null != sources) {
for (File file : sources) {
- Template template = parseTemplate(file);
- mergeTemplateIntoModel(template);
+ build(file, null);
}
}
}
- protected void mergeTemplateIntoModel(Template template) throws CdkException {
+ private void build(File file, RendererModel rendererModel) {
+ Template template = parseTemplate(file);
+
+ // TODO rewrite it
+ final String defaultTemplate = "src\\main\\templates";
+ String path = file.getPath();
+ String templateRelativePath = path.substring(path.indexOf(defaultTemplate) + defaultTemplate.length());
+ template.setTemplatePath(templateRelativePath);
+
+ mergeTemplateIntoModel(template, rendererModel);
+ }
+
+ protected void mergeTemplateIntoModel(Template template, RendererModel renderer) throws CdkException {
CompositeInterface compositeInterface = template.getInterface();
// TODO - infer values ?
- RenderKitModel renderKit = library.addRenderKit(compositeInterface.getRenderKitId());
- RendererModel renderer = new RendererModel(new RendererModel.Type(compositeInterface.getRendererType()));
- renderKit.getRenderers().add(renderer);
- // component.getRenderers().add(renderer);
-
- //TODO set default values according to template name
- String family = compositeInterface.getComponentFamily();
-
- if (null != family) {
- renderer.setFamily(family);
+ if (renderer == null) {
+ renderer = new RendererModel();
}
-
- renderer.setRendererClass(new ClassName(compositeInterface.getJavaClass()));
renderer.setTemplate(template);
+ setRendererType(template, compositeInterface, renderer);
+ setFamily(compositeInterface, renderer); //TODO set default values according to template name
+ setRendererClass(compositeInterface, renderer);
+ RenderKitModel renderKit = library.addRenderKit(compositeInterface.getRenderKitId());
+ renderKit.getRenderers().add(renderer);
+
Boolean rendersChildren = compositeInterface.getRendersChildren();
if (rendersChildren != null) {
- renderer.setRendersChildren(rendersChildren.booleanValue());
+ renderer.setRendersChildren(rendersChildren);
}
Collection<Property> rendererAttributes = renderer.getAttributes();
@@ -186,46 +211,73 @@
List<Attribute> templateAttributes = compositeInterface.getAttributes();
if (templateAttributes != null) {
for (Attribute templateAttribute : templateAttributes) {
- Property rendererProperty = new Property();
- rendererProperty.setName(templateAttribute.getName());
- rendererProperty.setDefaultValue(templateAttribute.getDefaultValue());
+ rendererAttributes.add(buildProperty(templateAttribute));
+ }
+ }
+ }
- // TODO is it the right one?
- rendererProperty.setDescription(templateAttribute.getShortDescription());
- rendererProperty.setDisplayname(templateAttribute.getDisplayName());
+ private Property buildProperty(Attribute templateAttribute) {
+ Property rendererProperty = new Property();
+ rendererProperty.setName(templateAttribute.getName());
+ rendererProperty.setDefaultValue(templateAttribute.getDefaultValue());
- Set<EventName> eventNamesSet = convert(templateAttribute.getClientBehaviors());
- if (eventNamesSet != null) {
- rendererProperty.getEventNames().addAll(eventNamesSet);
- }
+ // TODO is it the right one?
+ rendererProperty.setDescription(templateAttribute.getShortDescription());
+ rendererProperty.setDisplayname(templateAttribute.getDisplayName());
- // rendererProperty.setAliases(aliases)
- // rendererProperty.setExtension(extension)
- // rendererProperty.setGenerate(exists)
- // rendererProperty.setHidden(hidden)
- // rendererProperty.setIcon(icon)
- // rendererProperty.setLiteral(literal)
- // rendererProperty.setPassThrough(passThrough)
- // rendererProperty.setReadOnly(readOnly)
- // rendererProperty.setSuggestedValue(suggestedValue)
+ Set<EventName> eventNamesSet = convert(templateAttribute.getClientBehaviors());
+ if (eventNamesSet != null) {
+ rendererProperty.getEventNames().addAll(eventNamesSet);
+ }
- rendererProperty.setRequired(templateAttribute.isRequired());
+ // rendererProperty.setAliases(aliases)
+ // rendererProperty.setExtension(extension)
+ // rendererProperty.setGenerate(exists)
+ // rendererProperty.setHidden(hidden)
+ // rendererProperty.setIcon(icon)
+ // rendererProperty.setLiteral(literal)
+ // rendererProperty.setPassThrough(passThrough)
+ // rendererProperty.setReadOnly(readOnly)
+ // rendererProperty.setSuggestedValue(suggestedValue)
- List<ClassName> parsedSignature = parseSignature(templateAttribute.getMethodSignature());
- if (parsedSignature != null) {
- rendererProperty.getSignature().addAll(parsedSignature);
- }
+ rendererProperty.setRequired(templateAttribute.isRequired());
- String templateAttributeType = templateAttribute.getType();
- if (templateAttributeType != null) {
- rendererProperty.setType(new ClassName(templateAttributeType));
- }
+ List<ClassName> parsedSignature = parseSignature(templateAttribute.getMethodSignature());
+ if (parsedSignature != null) {
+ rendererProperty.getSignature().addAll(parsedSignature);
+ }
- rendererAttributes.add(rendererProperty);
- }
+ String templateAttributeType = templateAttribute.getType();
+ if (templateAttributeType != null) {
+ rendererProperty.setType(new ClassName(templateAttributeType));
}
+ return rendererProperty;
}
+ private void setRendererClass(CompositeInterface compositeInterface, RendererModel renderer) {
+ String javaClass = compositeInterface.getJavaClass();
+ if (javaClass == null) {
+ javaClass = getNamingConventions().inferRendererName(renderer.getType());
+ }
+ renderer.setRendererClass(new ClassName(javaClass));
+ }
+
+ private void setFamily(CompositeInterface compositeInterface, RendererModel renderer) {
+ String family = compositeInterface.getComponentFamily();
+ if (family == null) {
+ family = getNamingConventions().inferComponentFamily(renderer.getType());
+ }
+ renderer.setFamily(family);
+ }
+
+ private void setRendererType(Template template, CompositeInterface compositeInterface, RendererModel renderer) {
+ String type = compositeInterface.getRendererType();
+ if (Strings.isEmpty(type)) {
+ type = getNamingConventions().inferRendererTypeByTemplatePath(template.getTemplatePath());
+ }
+ renderer.setType(new RendererModel.Type(type));
+ }
+
protected Template parseTemplate(String templateLocation) throws CdkException {
return jaxbBinding.unmarshal(templateLocation, "http://richfaces.org/cdk/cdk-template.xsd", Template.class);
}
@@ -234,9 +286,14 @@
return jaxbBinding.unmarshal(file, "http://richfaces.org/cdk/cdk-template.xsd", Template.class);
}
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.cdk.ModelBuilder#init(org.richfaces.cdk.CdkContext)
- */
+ public NamingConventions getNamingConventions() {
+ if (namingConventions == null) {
+ namingConventions = new RichFacesConventions();
+ }
+ return namingConventions;
+ }
+
+ public void setNamingConventions(NamingConventions namingConventions) {
+ this.namingConventions = namingConventions;
+ }
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Template.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Template.java 2010-03-17 15:47:54 UTC (rev 16588)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Template.java 2010-03-17 20:35:18 UTC (rev 16589)
@@ -23,10 +23,9 @@
package org.richfaces.cdk.templatecompiler.model;
-import java.io.Serializable;
-
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
/**
* <p class="changed_added_4_0"></p>
@@ -48,10 +47,20 @@
private static final long serialVersionUID = -6900382133123748812L;
+ private String templatePath;
+
private CompositeInterface compositeInterface;
private CompositeImplementation compositeImplementation;
+ public String getTemplatePath() {
+ return templatePath;
+ }
+
+ public void setTemplatePath(String templatePath) {
+ this.templatePath = templatePath;
+ }
+
/**
* <p class="changed_added_4_0"></p>
*
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-03-17 15:47:54 UTC (rev 16588)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-03-17 20:35:18 UTC (rev 16589)
@@ -21,21 +21,21 @@
*/
package org.richfaces.cdk.templatecompiler;
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.faces.event.ActionEvent;
-import javax.faces.render.RenderKitFactory;
-import javax.faces.validator.Validator;
-
+import com.google.common.collect.Lists;
+import com.google.inject.Inject;
import org.easymock.EasyMock;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.isNull;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -46,15 +46,27 @@
import org.richfaces.cdk.Mock;
import org.richfaces.cdk.Source;
import org.richfaces.cdk.Sources;
-import org.richfaces.cdk.model.*;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.EventName;
+import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.RenderKitModel;
import org.richfaces.cdk.model.RenderKitModel.Id;
+import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.templatecompiler.model.Template;
import org.richfaces.cdk.xmlconfig.JAXB;
import org.richfaces.cdk.xmlconfig.JAXBBinding;
import org.xml.sax.ext.EntityResolver2;
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
+import javax.faces.event.ActionEvent;
+import javax.faces.render.RenderKitFactory;
+import javax.faces.validator.Validator;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* @author Nick Belaevski
@@ -210,7 +222,7 @@
* Checks that method signature satisfies the following declaration:
* <code>float coolMethod(int, java.lang.String, javax.faces.validator.Validator)</code>
*
- * @param actionListenerProperty
+ * @param coolMethodProperty
*/
private void checkDummyComponentCoolMethod(Property coolMethodProperty) {
assertNotNull(coolMethodProperty);
@@ -224,7 +236,7 @@
}
/**
- * @param property
+ * @param integerAttribute
*/
private void checkDummyComponentIntegerAttribute(Property integerAttribute) {
assertNotNull(integerAttribute);
@@ -237,7 +249,7 @@
}
/**
- * @param property
+ * @param requiredAttribute
*/
private void checkDummyComponentRequiredAttribute(Property requiredAttribute) {
assertNotNull(requiredAttribute);
@@ -265,7 +277,7 @@
Template template = parser.parseTemplate(getJavaFile("org/richfaces/cdk/templatecompiler/basic.template.xml"));
assertNotNull(template);
- parser.mergeTemplateIntoModel(template);
+ parser.mergeTemplateIntoModel(template, null);
RenderKitModel renderKit = getRenderkitFromModel(RenderKitFactory.HTML_BASIC_RENDER_KIT);
RendererModel renderer = getFirstRendererFromRenderkit(renderKit);
@@ -285,7 +297,7 @@
Template template = parser.parseTemplate(getJavaFile("org/richfaces/cdk/templatecompiler/dummy.template.xml"));
assertNotNull(template);
- parser.mergeTemplateIntoModel(template);
+ parser.mergeTemplateIntoModel(template, null);
verify(resolver, templatesSource);
RenderKitModel renderKit = getRenderkitFromModel("org.richfaces.CUSTOM_RENDERKIT");
14 years, 9 months
JBoss Rich Faces SVN: r16588 - in root/ui-sandbox/trunk/components/datascroller/ui/src/main: java/org/richfaces/renderkit and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-03-17 11:47:54 -0400 (Wed, 17 Mar 2010)
New Revision: 16588
Modified:
root/ui-sandbox/trunk/components/datascroller/ui/src/main/java/org/richfaces/component/UIDataScroller.java
root/ui-sandbox/trunk/components/datascroller/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java
root/ui-sandbox/trunk/components/datascroller/ui/src/main/resources/META-INF/resources/script/datascroller.js
Log:
add initial data scroll support
Modified: root/ui-sandbox/trunk/components/datascroller/ui/src/main/java/org/richfaces/component/UIDataScroller.java
===================================================================
--- root/ui-sandbox/trunk/components/datascroller/ui/src/main/java/org/richfaces/component/UIDataScroller.java 2010-03-17 15:42:23 UTC (rev 16587)
+++ root/ui-sandbox/trunk/components/datascroller/ui/src/main/java/org/richfaces/component/UIDataScroller.java 2010-03-17 15:47:54 UTC (rev 16588)
@@ -1,5 +1,7 @@
package org.richfaces.component;
+import java.util.Collection;
+import java.util.LinkedHashSet;
import java.util.Map;
import javax.el.ELException;
@@ -39,20 +41,28 @@
style, styleClass, stepControls
}
- protected enum Facets {
- first, last, fastforward, fastrewind, first_disabled, last_disabled, fastforward_disabled, fastrewind_disabled
- }
-
protected enum PageMode {
full, part //part - prev short
}
+ public static final String FIRST_FACET_NAME = "first";
+ public static final String LAST_FACET_NAME = "last";
+
+ public static final String FAST_FORWARD_FACET_NAME = "fastforward";
+
+ public static final String FAST_REWIND_FACET_NAME = "fastrewind";
+
+ public static final String FIRST_DISABLED_FACET_NAME = "first_disabled";
+
+ public static final String LAST_DISABLED_FACET_NAME = "last_disabled";
+
+
+
//TODO: anton - fix
private Integer page;
-
public void addScrollerListener(DataScrollerListener listener) {
addFacesListener(listener);
}
@@ -68,23 +78,25 @@
public void broadcast(FacesEvent event) throws AbortProcessingException {
super.broadcast(event);
+
if (event instanceof DataScrollerEvent) {
DataScrollerEvent dataScrollerEvent = (DataScrollerEvent) event;
updateModel(dataScrollerEvent.getPage());
FacesContext context = getFacesContext();
-
- MethodExpression scrollerListener = (MethodExpression)getAttributes().get(PropertyKeys.scrollerListener); //getScrollerListener();
+
+ MethodExpression scrollerListener = (MethodExpression)getStateHelper().eval(PropertyKeys.scrollerListener);
if (scrollerListener != null) {
scrollerListener.invoke(context.getELContext(), new Object[]{event});
}
+
+ context.getPartialViewContext().getRenderIds().add(dataScrollerEvent.getComponent().getClientId(context));
+ context.getPartialViewContext().getRenderIds().add(getDataTable().getClientId(context));
}
}
-
-
- /**
+ /**
* Finds the dataTable which id is mapped to the "for" property
*
* @return the dataTable component
@@ -123,8 +135,7 @@
}
private int getFastStepOrDefault() {
- int step = (Integer)getStateHelper().get(PropertyKeys.fastStep);
- return step <= 0 ? 1 : step;
+ return (Integer)getStateHelper().eval(PropertyKeys.fastStep,1);
}
public int getPageForFacet(String facetName) {
@@ -135,19 +146,22 @@
int newPage = 1;
int pageCount = getPageCount();
- switch (Facets.valueOf(facetName)) {
- case first : newPage = 1; break;
- case last : newPage = pageCount > 0 ? pageCount : 1; break;
- case fastforward : newPage = getPage() + getFastStepOrDefault(); break;
- case fastrewind : newPage = getPage() - getFastStepOrDefault(); break;
- default:
- try {
- newPage = Integer.parseInt(facetName.toString());
- } catch (NumberFormatException e) {
- throw new FacesException(e.getLocalizedMessage(), e);
- }
- break;
- }
+
+ if (FIRST_FACET_NAME.equals(facetName)) {
+ newPage = 1;
+ } else if (LAST_FACET_NAME.equals(facetName)) {
+ newPage = pageCount > 0 ? pageCount : 1;
+ } else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
+ newPage = getPage() + getFastStepOrDefault();
+ } else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
+ newPage = getPage() - getFastStepOrDefault();
+ } else {
+ try {
+ newPage = Integer.parseInt(facetName.toString());
+ } catch (NumberFormatException e) {
+ throw new FacesException(e.getLocalizedMessage(), e);
+ }
+ }
if (newPage >= 1 && newPage <= pageCount) {
return newPage;
@@ -216,22 +230,22 @@
// facet getter methods
public UIComponent getFirst() {
- return getFacet(Facets.first.toString());
+ return getFacet(FIRST_FACET_NAME);
}
public UIComponent getLast() {
- return getFacetByKey(Facets.last);
+ return getFacetByKey(LAST_FACET_NAME);
}
public UIComponent getFastForward() {
- return getFacetByKey(Facets.fastforward);
+ return getFacetByKey(FAST_FORWARD_FACET_NAME);
}
public UIComponent getFastRewind() {
- return getFacetByKey(Facets.fastrewind);
+ return getFacetByKey(FAST_REWIND_FACET_NAME);
}
- private UIComponent getFacetByKey(Object key) {
+ private UIComponent getFacetByKey(String key) {
return getFacet(key.toString());
}
Modified: root/ui-sandbox/trunk/components/datascroller/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/datascroller/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java 2010-03-17 15:42:23 UTC (rev 16587)
+++ root/ui-sandbox/trunk/components/datascroller/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java 2010-03-17 15:47:54 UTC (rev 16588)
@@ -32,7 +32,6 @@
import javax.faces.component.UIParameter;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import javax.faces.render.Renderer;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
@@ -40,6 +39,7 @@
import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.renderkit.AjaxEventOptions;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.RendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.UIDataScroller;
import org.richfaces.event.DataScrollerEvent;
@@ -53,13 +53,13 @@
@ResourceDependency(name = "css/datascroller.css")
})
-public class DataScrollerBaseRenderer extends Renderer {
+public class DataScrollerBaseRenderer extends RendererBase {
public void doDecode(FacesContext context, UIComponent component) {
Map <String, String> paramMap = context.getExternalContext().getRequestParameterMap();
String clientId = component.getClientId(context);
- String param = (String) paramMap.get(clientId);
+ String param = (String) paramMap.get(clientId + ":page");
if (param != null) {
@@ -72,12 +72,7 @@
}
}
}
- @Override
- public void decode(FacesContext context, UIComponent component) {
- Map <String, String> paramMap = context.getExternalContext().getRequestParameterMap();
-
- }
public ControlsState getControlsState(FacesContext context, UIComponent component) {
@@ -119,7 +114,6 @@
boolean isAuto;
String boundaryControls = (String)component.getAttributes().get("boundaryControls");
- String stepControls = (String)component.getAttributes().get("stepControls");
String fastControls = (String)component.getAttributes().get("fastControls");
if ((isAuto = "auto".equals(boundaryControls)) || "show".equals(
@@ -136,20 +130,6 @@
controlsState.setLastRendered(false);
}
- /*
- if ((isAuto = "auto".equals(stepControls)) || "show".equals(stepControls)) {
- if (isAuto) {
- controlsState.setPreviousRendered(useFirst);
- controlsState.setNextRendered(useLast);
- }
-
- controlsState.setPreviousEnabled(useFirst);
- controlsState.setNextEnabled(useLast);
- } else {
- controlsState.setPreviousRendered(false);
- controlsState.setNextRendered(false);
- }*/
-
if ((isAuto = "auto".equals(fastControls)) || "show".equals(
fastControls)) {
if (isAuto) {
@@ -230,14 +210,6 @@
out.writeAttribute(HTML.CLASS_ATTRIBUTE, "ds_digital ds_current "+styleClass, null);
} else {
out.writeAttribute(HTML.CLASS_ATTRIBUTE, "ds_digital "+styleClass, null);
- /*
- out.writeAttribute(HTML.ONMOUSEOVER_ATTRIBUTE, "this.className='ds_digital ds_over'", null);
- out.writeAttribute(HTML.ONMOUSEOUT_ATTRIBUTE, "this.className='ds_digital'", null);
- out.writeAttribute(HTML.ONMOUSEUP_ATTRIBUTE, "this.className='ds_digital ds_over'", null);
- out.writeAttribute(HTML.ONMOUSEDOWN_ATTRIBUTE, "this.className='ds_digital ds_press'", null);
-
- out.writeAttribute(HTML.ONCLICK_ATTRIBUTE, getOnClick(context, component, Integer.toString(i + 1)), null);
- */
}
if (null != style) {
@@ -257,7 +229,7 @@
}
public Map<String, Map<String,String>> getControls(FacesContext context, UIComponent component, ControlsState controlsState) {
- //will be refactored
+
Map<String, Map<String, String>> controls = new HashMap<String, Map<String,String>>();
Map<String, String> right = new HashMap<String, String>();
Map<String, String> left = new HashMap<String, String>();
@@ -265,20 +237,19 @@
String clientId = component.getClientId(context);
if(controlsState.getFirstRendered() && controlsState.getFirstEnabled()) {
-
- left.put(clientId + "_ds_f", "first");
+ left.put(clientId + "_ds_f", UIDataScroller.FIRST_FACET_NAME);
}
if(controlsState.getFastRewindRendered()&& controlsState.getFastRewindEnabled()) {
- left.put(clientId + "_ds_fr", "fastRewind");
+ left.put(clientId + "_ds_fr", UIDataScroller.FAST_REWIND_FACET_NAME);
}
if(controlsState.getFastForwardRendered()&& controlsState.getFastForwardEnabled()) {
- right.put(clientId + "_ds_ff", "fastForward");
+ right.put(clientId + "_ds_ff", UIDataScroller.FAST_FORWARD_FACET_NAME);
}
if(controlsState.getLastRendered()&& controlsState.getLastEnabled()) {
- right.put(clientId + "_ds_l", "last");
+ right.put(clientId + "_ds_l", UIDataScroller.LAST_FACET_NAME);
}
if(!left.isEmpty()) {
@@ -299,6 +270,7 @@
Map<String, Object> options = new HashMap<String, Object>();
options.put("buttons", buttons);
options.put("digitals", digitals);
+ options.put("currentPage", (Integer)component.getAttributes().get("page"));
function.addParameter(getSubmitFunction(context, component));
function.addParameter(options);
Modified: root/ui-sandbox/trunk/components/datascroller/ui/src/main/resources/META-INF/resources/script/datascroller.js
===================================================================
--- root/ui-sandbox/trunk/components/datascroller/ui/src/main/resources/META-INF/resources/script/datascroller.js 2010-03-17 15:42:23 UTC (rev 16587)
+++ root/ui-sandbox/trunk/components/datascroller/ui/src/main/resources/META-INF/resources/script/datascroller.js 2010-03-17 15:47:54 UTC (rev 16588)
@@ -7,7 +7,8 @@
$super.constructor.call(this,id);
this.options = options;
-
+ this.currentPage = options.currentPage;
+
var buttons = options.buttons;
var digitals = options.digitals;
@@ -63,7 +64,7 @@
var processStyles = function(event) {
var data = event.data;
- if(data) {
+ if(data && (data.page != this.currentPage)) {
var element = data.element;
var css = data.css;
14 years, 9 months
JBoss Rich Faces SVN: r16587 - root/ui-sandbox/trunk/components/datascroller/ui/src/main/templates.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-03-17 11:42:23 -0400 (Wed, 17 Mar 2010)
New Revision: 16587
Modified:
root/ui-sandbox/trunk/components/datascroller/ui/src/main/templates/datascroller.template.xml
Log:
move script inside parent span script
Modified: root/ui-sandbox/trunk/components/datascroller/ui/src/main/templates/datascroller.template.xml
===================================================================
--- root/ui-sandbox/trunk/components/datascroller/ui/src/main/templates/datascroller.template.xml 2010-03-17 13:19:31 UTC (rev 16586)
+++ root/ui-sandbox/trunk/components/datascroller/ui/src/main/templates/datascroller.template.xml 2010-03-17 15:42:23 UTC (rev 16587)
@@ -79,12 +79,13 @@
</c:otherwise>
</c:choose>
</c:if>
+ <cdk:object type="java.util.Map" name="buttons" value="#{getControls(facesContext, component, controlsState)}" />
+
+ <script type="text/javascript">
+ <cdk:call expression="buildScript(responseWriter, facesContext, component, buttons, digitals);"/>
+ </script>
</span>
- <cdk:object type="java.util.Map" name="buttons" value="#{getControls(facesContext, component, controlsState)}" />
- <script type="text/javascript">
- <cdk:call expression="buildScript(responseWriter, facesContext, component, buttons, digitals);"/>
- </script>
</cc:implementation>
</cdk:root>
\ No newline at end of file
14 years, 9 months
JBoss Rich Faces SVN: r16586 - in root/framework/trunk/impl/src: test/java/org/richfaces/javascript and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-03-17 09:19:31 -0400 (Wed, 17 Mar 2010)
New Revision: 16586
Added:
root/framework/trunk/impl/src/test/resources/javascript/jquery-position-qunit.js
Modified:
root/framework/trunk/impl/src/main/resources/META-INF/resources/jquery.position.js
root/framework/trunk/impl/src/test/java/org/richfaces/javascript/QUnitTest.java
root/framework/trunk/impl/src/test/resources/javascript/richfaces-client-api.html
Log:
jquery.position plugin changes + qunit tests
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/jquery.position.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/jquery.position.js 2010-03-17 12:05:36 UTC (rev 16585)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/jquery.position.js 2010-03-17 13:19:31 UTC (rev 16586)
@@ -82,7 +82,7 @@
function getElementRect (element) {
var jqe = $(element);
var offset = jqe.offset();
- return {width: jqe.width(), height: jqe.height(), left: offset.left, top: offset.top};
+ return {width: jqe.width(), height: jqe.height(), left: Math.floor(offset.left), top: Math.floor(offset.top)};
};
function checkCollision (elementRect, windowRect) {
@@ -220,7 +220,6 @@
}
if (isNaN(rect.top)) rect.top = top;
- var elementOffset = element.offset();
var pos = {};
if (options.noPositionType) {
pos.left = rect.left + rect.width + options.offset[0];
@@ -234,8 +233,9 @@
pos = calculatePosition(rect, options.offset, winRect, {width:width, height:height}, options);
}
- //pos.left -= elementOffset.left;
- //pos.top -= elementOffset.top;
+ var elementOffset = element.offset();
+ pos.left += left - Math.floor(elementOffset.left);
+ pos.top += top - Math.floor(elementOffset.top);
if (left!=pos.left) {
element.css('left', (pos.left + 'px'));
Modified: root/framework/trunk/impl/src/test/java/org/richfaces/javascript/QUnitTest.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/richfaces/javascript/QUnitTest.java 2010-03-17 12:05:36 UTC (rev 16585)
+++ root/framework/trunk/impl/src/test/java/org/richfaces/javascript/QUnitTest.java 2010-03-17 13:19:31 UTC (rev 16586)
@@ -98,7 +98,7 @@
}
if (sb.length() > 0) {
- fail("Failures:\n" + sb + "User Agent: " + doc.getElementById("userAgent").getTextContent());
+ fail("Failures:\n" + sb + "User Agent: " + doc.getElementById("qunit-userAgent").getTextContent());
}
}
@@ -117,5 +117,6 @@
public void test() throws Exception {
runTest(getClass().getClassLoader().getResource("javascript/4_0_0.html"));
runTest(getClass().getClassLoader().getResource("javascript/richfaces-client-api.html"), "?richfaces-event");
+ runTest(getClass().getClassLoader().getResource("javascript/richfaces-client-api.html"), "?jquery-position");
}
}
Added: root/framework/trunk/impl/src/test/resources/javascript/jquery-position-qunit.js
===================================================================
--- root/framework/trunk/impl/src/test/resources/javascript/jquery-position-qunit.js (rev 0)
+++ root/framework/trunk/impl/src/test/resources/javascript/jquery-position-qunit.js 2010-03-17 13:19:31 UTC (rev 16586)
@@ -0,0 +1,318 @@
+RichFaces.QUnit.run(function(){
+ module("jquery-position");
+
+ var body = document.getElementsByTagName("body")[0];
+
+ function appendDomElements(parent, html) {
+ var element = document.createElement("div");
+ element.innerHTML = html;
+ var elements = [], e;
+ while (e = element.firstChild) {
+ elements.push(e);
+ parent.appendChild(e);
+ }
+ return elements;
+ }
+
+ function removeDomElements(elements) {
+ var element;
+ while (elements.length>0) {
+ element = elements.pop();
+ element.parentNode.removeChild(element);
+ }
+ }
+
+ function testPositioning(element, left, top, comment) {
+ equals(element.style.left, left+"px", comment);
+ equals(element.style.top, top+"px", comment);
+ equals(jQuery(element).offset().left, left, comment);
+ equals(jQuery(element).offset().top, top, comment);
+ }
+
+ function testPositioning1(element, left, top, left1, top1, comment) {
+ equals(element.style.left, left+"px", comment);
+ equals(element.style.top, top+"px", comment);
+ equals(jQuery(element).offset().left, left1, comment);
+ equals(jQuery(element).offset().top, top1, comment);
+ }
+
+ // position general tests
+ test("source parameter test", function() {
+ expect(24);
+
+ try {
+
+ var elements = appendDomElements(body, '<div style="position:absolute; width:200px; height:200px; background-color:red" id="testElement">some text</div><div style="width:300px; height:300px; background-color:blue" id="testElement1">some text</div>');
+
+ var e = document.getElementById("testElement");
+ var e1 = jQuery("#testElement1");
+
+ jQuery(e).setPosition("#testElement1", {from:"RB", to:"RB"});
+ testPositioning(e, e1.offset().left+e1.width(), e1.offset().top+e1.height(), "jQuery selector");
+ e.style.left=e.style.top="0px";
+
+ jQuery(e).setPosition({id:"testElement1"}, {from:"RB", to:"RB"});
+ testPositioning(e, e1.offset().left+e1.width(), e1.offset().top+e1.height(), "object with id");
+ e.style.left=e.style.top="0px";
+
+ jQuery(e).setPosition({left:300,top:300}, {from:"RB", to:"RB"});
+ testPositioning(e, 300, 300, "object with left,top");
+ e.style.left=e.style.top="0px";
+
+ jQuery(e).setPosition(jQuery("#testElement1"), {from:"RB", to:"RB"});
+ testPositioning(e, e1.offset().left+e1.width(), e1.offset().top+e1.height(), "jQuery object");
+ e.style.left=e.style.top="0px";
+
+ jQuery(e).setPosition(document.getElementById("testElement1"), {from:"RB", to:"RB"});
+ testPositioning(e, e1.offset().left+e1.width(), e1.offset().top+e1.height(), "DOM element");
+ e.style.left=e.style.top="0px";
+
+ jQuery(e).setPosition({type:"customEvent", pageX:300, pageY:300}, {from:"RB", to:"RB"});
+ testPositioning(e, 300, 300, "Event");
+ e.style.left=e.style.top="0px";
+
+ } finally {
+ removeDomElements(elements);
+ }
+ });
+
+ // position html markup's tests
+/*
+ https://jira.jboss.org/jira/browse/RF-645
+ Calendar: incorrectly positioned popup in richfaces-demo
+ IE7
+*/
+ test("html markup 1", function() {
+ expect(4);
+
+ try {
+
+ var elements = appendDomElements(body,
+ '<form>'+
+ '<table id="parent" width="100%" cellspacing="0" cellpadding="10" border="1" style="position: relative;">'+
+ '<tbody>'+
+ '<tr>'+
+ '<td>'+
+ '<table style="position:absolute; background-color:red" id="testElement">'+
+ '<tr>'+
+ '<td style="width:200px;height:200px">some text</td>'+
+ '</tr>'+
+ '</table>'+
+ '</td>'+
+ '</tr>'+
+ '</tbody>'+
+ '</table>'+
+ '</form>');
+
+ var e = document.getElementById("testElement");
+ var jqe = jQuery(e);
+ jqe.css('left', '0px');
+ jqe.css('top', '0px');
+ var offset = jqe.offset();
+ jQuery(e).setPosition({left:300, top:300});
+ testPositioning1(e, 300-Math.floor(offset.left), 300-Math.floor(offset.top), 300,300);
+
+ } finally {
+ removeDomElements(elements);
+ }
+ });
+
+/*
+ https://jira.jboss.org/jira/browse/RF-1314
+ Calendar positioning bug.
+*/
+ test("html markup 2", function() {
+ expect(8);
+
+ try {
+
+ var elements = appendDomElements(body,
+ '<div style="height:350px;overflow-x:hidden;overflow-y:auto;width:300px">'+
+ '<div style="height:200px"></div>'+
+ '<table style="position:absolute; background-color:red" id="testElement">'+
+ '<tr>'+
+ '<td style="width:200px;height:200px">some text</td>'+
+ '</tr>'+
+ '</table>'+
+ '<div style="position:absolute; width:200px; height:200px; background-color:blue" id="testElement1">some text</div>'+
+ '<div style="height:200px"></div> '+
+ '</div>');
+
+ var e = document.getElementById("testElement");
+ jQuery(e).setPosition({left:300, top:300});
+ testPositioning(e,300,300);
+
+ var e = document.getElementById("testElement1");
+ jQuery(e).setPosition({left:500, top:500});
+ testPositioning(e,500,500);
+
+ } finally {
+ removeDomElements(elements);
+ }
+ });
+
+ // ---
+ test("html markup 3", function() {
+ expect(4);
+
+ try {
+ var elements = appendDomElements(body,
+ '<table width="400" align="center">'+
+ '<tr>'+
+ '<td>'+
+ '<table style="position:absolute; background-color:red" id="testElement">'+
+ '<tr>'+
+ '<td style="width:200px;height:200px">some text</td>'+
+ '</tr>'+
+ '</table>'+
+ '</td>'+
+ '</tr>'+
+ '</table>');
+
+ var e = document.getElementById("testElement");
+ jQuery(e).setPosition({left:300, top:300});
+ testPositioning(e,300,300);
+
+ } finally {
+ removeDomElements(elements);
+ }
+ });
+
+ // ---
+ test("html markup 4", function() {
+ expect(8);
+
+ try {
+ var elements = appendDomElements(body,
+ '<div style="position:absolute; top: 0px; bottom: 0px; left: 0px; right: 0px; overflow: auto;">'+
+ '<table style="position:absolute; background-color:red" id="testElement">'+
+ '<tr>'+
+ '<td style="width:200px;height:200px">some text</td>'+
+ '</tr>'+
+ '</table>'+
+ '<div style="position:absolute; width:200px; height:200px; background-color:blue" id="testElement1">some text</div>'+
+ '</div>');
+
+ var e = document.getElementById("testElement");
+ jQuery(e).setPosition({left:300, top:300});
+ testPositioning(e,300,300);
+
+ var e = document.getElementById("testElement1");
+ jQuery(e).setPosition({left:500, top:500});
+ testPositioning(e,500,500);
+
+ } finally {
+ removeDomElements(elements);
+ }
+ });
+
+ // ---
+ test("html markup 5", function() {
+ expect(8);
+
+ try {
+ var elements = appendDomElements(body,
+ '<div style="position:absolute; top: 0px; bottom: 0px; left: 0px; right: 0px; overflow: auto;">'+
+ '<div>'+
+ '<table style="position:absolute; background-color:red" id="testElement">'+
+ '<tr>'+
+ '<td style="width:200px;height:200px">some text</td>'+
+ '</tr>'+
+ '</table>'+
+ '<div style="position:absolute; width:200px; height:200px; background-color:blue" id="testElement1">some text</div>'+
+ '</div>'+
+ '</div>');
+
+ var e = document.getElementById("testElement");
+ jQuery(e).setPosition({left:300, top:300});
+ testPositioning(e,300,300);
+
+ var e = document.getElementById("testElement1");
+ jQuery(e).setPosition({left:500, top:500});
+ testPositioning(e,500,500);
+
+ } finally {
+ removeDomElements(elements);
+ }
+ });
+
+ // ---
+ test("html markup 6", function() {
+ expect(8);
+
+ try {
+
+ var elements = appendDomElements(body,
+ '<div style="position:absolute; width:400px; top: 200px; left: 200px;">'+
+ '<table style="position:absolute; background-color:red" id="testElement">'+
+ '<tr>'+
+ '<td style="width:200px;height:200px">some text</td>'+
+ '</tr>'+
+ '</table>'+
+ '<div style="position:absolute; width:200px; height:200px; background-color:blue" id="testElement1">some text</div>'+
+ '</div>');
+
+ var e = document.getElementById("testElement");
+ jQuery(e).setPosition({left:300, top:300});
+ testPositioning1(e,100,100,300,300);
+
+ var e = document.getElementById("testElement1");
+ jQuery(e).setPosition({left:500, top:500});
+ testPositioning1(e,300,300,500,500);
+
+ } finally {
+ removeDomElements(elements);
+ }
+ });
+
+ // ---
+ test("html markup 7", function() {
+ expect(8);
+
+ try {
+
+ var elements = appendDomElements(body,
+ '<div style="position:absolute; width:400px; top: 200px; left: 200px;">'+
+ '<div>'+
+ '<table style="position:absolute; background-color:red" id="testElement">'+
+ '<tr>'+
+ '<td style="width:200px;height:200px">some text</td>'+
+ '</tr>'+
+ '</table>'+
+ '<div style="position:absolute; width:200px; height:200px; background-color:blue" id="testElement1">some text</div>'+
+ '</div>'+
+ '</div>');
+
+ var e = document.getElementById("testElement");
+ jQuery(e).setPosition({left:300, top:300});
+ testPositioning1(e,100,100,300,300);
+
+ var e = document.getElementById("testElement1");
+ jQuery(e).setPosition({left:500, top:500});
+ testPositioning1(e,300,300,500,500);
+
+ } finally {
+ removeDomElements(elements);
+ }
+ });
+
+ test("set the same position", function() {
+ expect(4);
+
+ try {
+
+ var elements = appendDomElements(body,
+ '<div id="testElement" style="position:absolute; width:400px; height: 400px, top: 200px; left: 200px;">some text</div>');
+
+ var e = document.getElementById("testElement");
+ jQuery(e).setPosition({left:200, top:200});
+ testPositioning(e,200,200);
+
+ } finally {
+ removeDomElements(elements);
+ }
+ });
+
+ //TODO: add auto position tests // depends on some refactoring and optimization (not done yet)
+
+});
\ No newline at end of file
Modified: root/framework/trunk/impl/src/test/resources/javascript/richfaces-client-api.html
===================================================================
--- root/framework/trunk/impl/src/test/resources/javascript/richfaces-client-api.html 2010-03-17 12:05:36 UTC (rev 16585)
+++ root/framework/trunk/impl/src/test/resources/javascript/richfaces-client-api.html 2010-03-17 13:19:31 UTC (rev 16586)
@@ -8,10 +8,12 @@
<script type="text/javascript" src="../../classes/META-INF/resources/jquery.js"></script>
<script type="text/javascript" src="qunit/qunit.js"></script>
<script type="text/javascript" src="../../classes/META-INF/resources/richfaces.js"></script>
+ <script type="text/javascript" src="../../classes/META-INF/resources/jquery.position.js"></script>
<script type="text/javascript" src="../../classes/META-INF/resources/richfaces-base-component.js"></script>
<script type="text/javascript" src="../../classes/META-INF/resources/richfaces-event.js"></script>
<script type="text/javascript" src="richfaces-qunit.js"></script>
<script type="text/javascript" src="richfaces-event-qunit.js"></script>
+ <script type="text/javascript" src="jquery-position-qunit.js"></script>
</head>
<body>
<h1 id="qunit-header">Richfaces Client API Tests</h1>
14 years, 9 months
JBoss Rich Faces SVN: r16585 - in root: cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
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
14 years, 9 months
JBoss Rich Faces SVN: r16584 - in root/ui-sandbox/trunk/components/tables/ui/src/main: resources/META-INF/resources and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-03-16 12:27:40 -0400 (Tue, 16 Mar 2010)
New Revision: 16584
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.css
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
Log:
RF-7869
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-03-16 14:26:13 UTC (rev 16583)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-03-16 16:27:40 UTC (rev 16584)
@@ -46,8 +46,9 @@
import org.richfaces.component.util.HtmlUtil;
@ResourceDependencies({ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
- @ResourceDependency(name = "jquery.js"), @ResourceDependency(name = "jquery.position.js"), @ResourceDependency(name = "richfaces.js"),
- @ResourceDependency(name = "extendedDataTable.js"), @ResourceDependency(name = "extendedDataTable.css") })
+ @ResourceDependency(name = "jquery.js"), @ResourceDependency(name = "jquery.position.js"),
+ @ResourceDependency(name = "richfaces.js"), @ResourceDependency(name = "extendedDataTable.js"),
+ @ResourceDependency(name = "extendedDataTable.css") })
public class ExtendedDataTableRenderer extends AbstractTableRenderer {
private class RendererState extends RowHolderBase {
@@ -128,12 +129,6 @@
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, HtmlUtil.concatClasses("rich-extable", (String) component
.getAttributes().get("styleClass")), null);
getUtils().writeAttribute(writer, HTML.STYLE_ATTRIBUTE, component.getAttributes().get("style"));
- UIComponent caption = component.getFacet("caption");
- if (caption != null && caption.isRendered()) {
- writer.startElement(HTML.DIV_ELEM, component);
- caption.encodeAll(context);
- writer.endElement(HTML.DIV_ELEM);
- }
UIComponent header = component.getFacet("header");
if (header != null && header.isRendered()) {
writer.startElement(HTML.DIV_ELEM, component);
@@ -192,6 +187,10 @@
writer.endElement(HTML.TD_ELEM);
writer.endElement(HTML.TR_ELEMENT);
writer.endElement(HTML.TABLE_ELEMENT);
+ writer.startElement(HTML.DIV_ELEM, component);
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, component.getClientId(context) + ":rm", null);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-reorder-marker", null);
+ writer.endElement(HTML.DIV_ELEM);
writer.startElement(HTML.INPUT_ELEM, component);
writer.writeAttribute(HTML.ID_ATTRIBUTE, component.getClientId(context) + ":wi", null);
writer.writeAttribute(HTML.NAME_ATTRIBUTE, component.getClientId(context) + ":wi", null);
@@ -367,11 +366,14 @@
.writeAttribute(HTML.CLASS_ATTRIBUTE, HtmlUtil.concatClasses("rich-extable-" + facetName + "-cell",
"rich-extable-cell-width-" + column.getId(), (String) column.getAttributes().get(classAttribute)),
null);
+ writer.startElement(HTML.DIV_ELEM, column);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-" + facetName + "-cell-content", null);
UIComponent facet = column.getFacet(facetName);
if (facet != null && facet.isRendered()) {
facet.encodeAll(context);
}
writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HTML.DIV_ELEM);
writer.endElement(HTML.TD_ELEM);
}
}
@@ -396,8 +398,11 @@
writer.startElement(HTML.DIV_ELEM, table);
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-cell rich-extable-cell-width-"
+ column.getId(), null);
+ writer.startElement(HTML.DIV_ELEM, column);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-cell-content", null);
renderChildren(context, column);
writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HTML.DIV_ELEM);
writer.endElement(HTML.TD_ELEM);
}
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.css
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.css 2010-03-16 14:26:13 UTC (rev 16583)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.css 2010-03-16 16:27:40 UTC (rev 16584)
@@ -95,4 +95,17 @@
overflow: hidden;
border-bottom: 1px solid #C4C0C9;
border-right: 1px solid #C4C0C9;
+}
+
+.rich-extable-reorder-marker {
+ position:absolute;
+ height: 9px;
+ font-size: 9px;
+ width:9px;
+ background-image: url("#{resource['reorderMarker.gif']}");
+ display: none;
+}
+
+.rich-extable-cell-content, .rich-extable-header-cell-content, .rich-extable-footer-cell-content{
+ padding: 2px;
}
\ No newline at end of file
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2010-03-16 14:26:13 UTC (rev 16583)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2010-03-16 16:27:40 UTC (rev 16584)
@@ -44,6 +44,7 @@
var contentElement = jQuery(bodyElement).children("div:first").get(0);
var dragElement = document.getElementById(id + ":d");
var reorderElement = document.getElementById(id + ":r");
+ var reorderMarkerElement = document.getElementById(id + ":rm");
var widthInput = document.getElementById(id + ":wi");
var normalPartStyle = richfaces.getCSSRule(".rich-extable-part-width").style;
@@ -143,15 +144,15 @@
jQuery(dragElement).setPosition({left:Math.max(resizeData.left + MIN_WIDTH, event.pageX)});
return false;
};
+
var beginResize = function(event) {
var className = this.parentNode.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "[^\w]*"))[0];
- var thisElement = jQuery(this);
resizeData = {
className : className,
- left : thisElement.parent().offset().left
+ left : jQuery(this).parent().offset().left
};
- dragElement.style.height = element.clientHeight + "px";
- jQuery(dragElement).setPosition({top:thisElement.offset().top, left:event.pageX});
+ dragElement.style.height = element.offsetHeight + "px";
+ jQuery(dragElement).setPosition({top:jQuery(element).offset().top, left:event.pageX});
dragElement.style.display = "block";
jQuery(document).bind("mousemove", drag);
jQuery(document).one("mouseup", endResize);
@@ -183,12 +184,28 @@
var beginReorder = function(event) {
idOfReorderingColumn = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "[^\w]*"))[0].substr(WIDTH_CLASS_NAME_BASE.length); //To try to do this without substr.
jQuery(document).bind("mousemove", reorder);
- jQuery(element).children(".rich-extable-header").find(".rich-extable-header-cell").one("mouseup", endReorder);
+ jQuery(element).children(".rich-extable-header").find(".rich-extable-header-cell").bind("mouseover", overReorder);
jQuery(document).one("mouseup", cancelReorder);
return false;
};
+ var overReorder = function(event) {
+ var thisElement = jQuery(this);
+ var offset = thisElement.offset();
+ jQuery(reorderMarkerElement).setPosition({top:offset.top + thisElement.height(), left:offset.left - 5});
+ reorderMarkerElement.style.display = "block";
+ thisElement.one("mouseout", outReorder);
+ thisElement.one("mouseup", endReorder);
+ };
+
+ var outReorder = function(event) {
+ reorderMarkerElement.style.display = "";
+ jQuery(this).unbind("mouseup", endReorder);
+ };
+
var endReorder = function(event) {
+ reorderMarkerElement.style.display = "";
+ jQuery(this).unbind("mouseout", outReorder);
var id = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "[^\w]*"))[0].substr(WIDTH_CLASS_NAME_BASE.length); //To try to do this without substr.
var colunmsOrder = "";
jQuery(element).children(".rich-extable-header").find(".rich-extable-header-cell").each(function() {
@@ -214,7 +231,7 @@
var cancelReorder = function(event) {
jQuery(document).unbind("mousemove", reorder);
- jQuery(element).children(".rich-extable-header").find(".rich-extable-header-cell").unbind("mouseup", endReorder);
+ jQuery(element).children(".rich-extable-header").find(".rich-extable-header-cell").unbind("mouseover", overReorder);
reorderElement.style.display = "none";
};
14 years, 9 months
JBoss Rich Faces SVN: r16583 - in root/framework/trunk/impl/src: test/resources/javascript and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-03-16 10:26:13 -0400 (Tue, 16 Mar 2010)
New Revision: 16583
Modified:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js
root/framework/trunk/impl/src/test/resources/javascript/richfaces-client-api.html
root/framework/trunk/impl/src/test/resources/javascript/richfaces-event-qunit.js
Log:
Events api changes + new qtest was added
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-03-16 11:17:44 UTC (rev 16582)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-03-16 14:26:13 UTC (rev 16583)
@@ -25,6 +25,9 @@
}
result[result.length] = this.name;
return result.join(', ');
+ },
+ getEventElement: function() {
+ return "#"+this.id;
}
};
})(params));
@@ -34,7 +37,7 @@
(function (jQuery, richfaces, params) {
richfaces.MyComponent = function(componentId) {
- $super.constructor.call(this);
+ $super.constructor.call(this, componentId);
};
var $super = richfaces.BaseComponent.extend(richfaces.BaseComponent, richfaces.MyComponent);
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-03-16 11:17:44 UTC (rev 16582)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-03-16 14:26:13 UTC (rev 16583)
@@ -1,6 +1,20 @@
(function($, richfaces) {
richfaces.Event = richfaces.Event || {};
+ var getEventElement = function (selector) {
+ if (!selector) {
+ throw "RichFaces.Event: empty selector";
+ }
+ var element;
+ if (RichFaces.BaseComponent && selector instanceof RichFaces.BaseComponent) {
+ element = jQuery(selector.getEventElement());
+ } else {
+ element = jQuery(selector);
+ }
+
+ return element;
+ }
+
$.extend(richfaces.Event, {
RICH_NAMESPACE : "RICH:",
ready : function(fn) {
@@ -17,7 +31,7 @@
var f = function (e,d){
e.data.fn.call(e.data.component||this, e, this, d);
};
- $(selector).bind(type, {component: data, fn:fn}, f);
+ getEventElement(selector).bind(type, {component: data, fn:fn}, f);
return f;
},
bindById : function(id, type, fn, data) {
@@ -33,7 +47,7 @@
var f = function (e,d){
e.data.fn.call(e.data.component||this, e, this, d);
};
- $(selector).one(type, {component: data, fn:fn}, f);
+ getEventElement(selector).one(type, {component: data, fn:fn}, f);
return f;
},
bindOneById: function(id, type, fn, data) {
@@ -46,20 +60,20 @@
},
unbind : function(selector, type, fn) {
// type: namespace can be used, like onclick.rf.conponentName
- return $(selector).unbind(type, fn);
+ return getEventElement(selector).unbind(type, fn);
},
unbindById : function(id, type, fn) {
// type: namespace can be used, like onclick.rf.conponentName
return $(document.getElementById(id)).unbind(type, fn);
},
fire : function(selector, event, data) {
- return $(selector).trigger(event, data);
+ return getEventElement(selector).trigger(event, data);
},
fireById : function(id, event, data) {
return $(document.getElementById(id)).trigger(event, data);
},
callHandler : function(selector, event, data) {
- return $(selector).triggerHandler(event, data);
+ return getEventElement(selector).triggerHandler(event, data);
},
callHandlerById : function(id, event, data) {
return $(document.getElementById(id)).triggerHandler(event, data);
Modified: root/framework/trunk/impl/src/test/resources/javascript/richfaces-client-api.html
===================================================================
--- root/framework/trunk/impl/src/test/resources/javascript/richfaces-client-api.html 2010-03-16 11:17:44 UTC (rev 16582)
+++ root/framework/trunk/impl/src/test/resources/javascript/richfaces-client-api.html 2010-03-16 14:26:13 UTC (rev 16583)
@@ -8,6 +8,7 @@
<script type="text/javascript" src="../../classes/META-INF/resources/jquery.js"></script>
<script type="text/javascript" src="qunit/qunit.js"></script>
<script type="text/javascript" src="../../classes/META-INF/resources/richfaces.js"></script>
+ <script type="text/javascript" src="../../classes/META-INF/resources/richfaces-base-component.js"></script>
<script type="text/javascript" src="../../classes/META-INF/resources/richfaces-event.js"></script>
<script type="text/javascript" src="richfaces-qunit.js"></script>
<script type="text/javascript" src="richfaces-event-qunit.js"></script>
Modified: root/framework/trunk/impl/src/test/resources/javascript/richfaces-event-qunit.js
===================================================================
--- root/framework/trunk/impl/src/test/resources/javascript/richfaces-event-qunit.js 2010-03-16 11:17:44 UTC (rev 16582)
+++ root/framework/trunk/impl/src/test/resources/javascript/richfaces-event-qunit.js 2010-03-16 14:26:13 UTC (rev 16583)
@@ -50,6 +50,18 @@
RichFaces.Event.fire("#"+elementId, "click");
ok(element.onEvent, "fire event");
});
+
+ // component bind test
+ test("RichFaces.Event.bind selector as BaseComponent", function() {
+ expect(2);
+ var element = createNextTestElement();
+ var c = new RichFaces.BaseComponent(element.id);
+ var fn = setupEmptyCallback(element);
+ var f = RichFaces.Event.bind(c, "click", fn);
+ equals(typeof f, "function");
+ RichFaces.Event.fire(c, "click");
+ ok(element.onEvent, "fire event");
+ });
// fire test
test("RichFaces.Event.fire", function() {
14 years, 9 months
JBoss Rich Faces SVN: r16582 - root/framework/trunk/impl.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-16 07:17:44 -0400 (Tue, 16 Mar 2010)
New Revision: 16582
Modified:
root/framework/trunk/impl/pom.xml
Log:
RF-8489 Integrate JSDoc build
Modified: root/framework/trunk/impl/pom.xml
===================================================================
--- root/framework/trunk/impl/pom.xml 2010-03-15 23:02:23 UTC (rev 16581)
+++ root/framework/trunk/impl/pom.xml 2010-03-16 11:17:44 UTC (rev 16582)
@@ -119,6 +119,16 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>gr.abiss.mvn.plugins</groupId>
+ <artifactId>maven-jstools-plugin</artifactId>
+ <version>0.7</version>
+ <configuration>
+ <jsDir>${basedir}/src/main/resources/Meta-inf/resources</jsDir>
+ <includes>**/*.js</includes>
+ <caseSensitive>true</caseSensitive>
+ </configuration>
+ </plugin>
</plugins>
</build>
@@ -215,37 +225,5 @@
</plugins>
</build>
</profile>
- <profile>
- <id>jsdoc</id>
- <activation>
- <property>
- <name>release</name>
- </property>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <groupId>gr.abiss.mvn.plugins</groupId>
- <artifactId>maven-jstools-plugin</artifactId>
- <version>0.7</version>
- <executions>
- <execution>
- <id>jsdoc</id>
- <configuration>
- <jsDir>${basedir}/src/main/resources/META-INF/resources</jsDir>
- <includes>**/*.js</includes>
- <caseSensitive>true</caseSensitive>
- </configuration>
- <goals>
- <goal>jsdoc</goal>
- </goals>
- <phase>process-sources</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
</profiles>
</project>
\ No newline at end of file
14 years, 9 months
JBoss Rich Faces SVN: r16581 - in root: cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-03-15 19:02:23 -0400 (Mon, 15 Mar 2010)
New Revision: 16581
Added:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java
Removed:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Renderer.java
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/package-info.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.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/model/ComponentModel.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.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:
CODING IN PROGRESS - issue RF-8523: Refactor CDK annotations
https://jira.jboss.org/jira/browse/RF-8523
Added: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java (rev 0)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java 2010-03-15 23:02:23 UTC (rev 16581)
@@ -0,0 +1,40 @@
+/*
+ * $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.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)Retention(RetentionPolicy.SOURCE)
+(a)Target(ElementType.TYPE)
+public @interface JsfBehaviorRenderer {
+
+}
Property changes on: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java 2010-03-15 18:03:04 UTC (rev 16580)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java 2010-03-15 23:02:23 UTC (rev 16581)
@@ -111,12 +111,12 @@
/**
* <p class="changed_added_4_0">
- * Renderer associated with this component.
+ * JsfRenderer associated with this component.
* </p>
*
* @return
*/
- public Renderer renderer() default @Renderer();
+ public JsfRenderer renderer() default @JsfRenderer();
/**
* <p class="changed_added_4_0">
Copied: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java (from rev 16579, root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Renderer.java)
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java (rev 0)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java 2010-03-15 23:02:23 UTC (rev 16581)
@@ -0,0 +1,54 @@
+/*
+ * $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.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p class="changed_added_4_0">
+ * The presence of this annotation in the JSF component class associated particular renderer with component.
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ */
+(a)Retention(RetentionPolicy.SOURCE)
+(a)Target(ElementType.TYPE)
+public @interface JsfRenderer {
+
+ public static final String NAME = "org.richfaces.cdk.annotations.JsfRenderer";
+
+ /**
+ * <p class="changed_added_4_0">
+ * The value of this annotation attribute is taken to be JSF <em>renderer-type</em>. If this value was empty,
+ * component type will be inferred from by the CDK.
+ * </p>
+ *
+ * @return JSF <em>renderer-type</em>.
+ */
+ public String value() default "";
+
+}
Property changes on: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Deleted: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Renderer.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Renderer.java 2010-03-15 18:03:04 UTC (rev 16580)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Renderer.java 2010-03-15 23:02:23 UTC (rev 16581)
@@ -1,54 +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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p class="changed_added_4_0">
- * The presence of this annotation in the JSF component class associated particular renderer with component.
- * </p>
- *
- * @author asmirnov(a)exadel.com
- */
-(a)Retention(RetentionPolicy.SOURCE)
-(a)Target(ElementType.TYPE)
-public @interface Renderer {
-
- public static final String NAME = "org.richfaces.cdk.annotations.Renderer";
-
- /**
- * <p class="changed_added_4_0">
- * The value of this annotation attribute is taken to be JSF <em>renderer-type</em>. If this value was empty,
- * component type will be inferred from by the CDK.
- * </p>
- *
- * @return JSF <em>renderer-type</em>.
- */
- public String value() default "";
-
-}
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/package-info.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/package-info.java 2010-03-15 18:03:04 UTC (rev 16580)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/package-info.java 2010-03-15 23:02:23 UTC (rev 16581)
@@ -8,7 +8,7 @@
* <li>@{@link Family}("component.Family") defines component family used in the generated class.<br /></li>
* <li>@{@link Generate}("component.UIClass") tells CDK to generate concrete component class ( base UI... or renderer-specific ).</li>
* <li>@{@link Test}(testClass="component.Test",testMethod="testFoo",testType={@link TestType}.DECODE) tells CDK to generate unit test for that component.</li>
- * <li>@{@link Renderer}("retnderer.Type") , @{@link RendererTemplate}("/renderer/template.xml") associate renderer with that component. The first one defines independently created renderer, while @{@link RendererTemplate tells CDK to generate renderer class from that template. It is possible to define more than one template with component class using @{@link RendererTemplates}({@{@link RendererTemplate}("one.xml"),@{@link RendererTemplate}("two.xml").<br /></li>
+ * <li>@{@link JsfRenderer}("retnderer.Type") , @{@link RendererTemplate}("/renderer/template.xml") associate renderer with that component. The first one defines independently created renderer, while @{@link RendererTemplate tells CDK to generate renderer class from that template. It is possible to define more than one template with component class using @{@link RendererTemplates}({@{@link RendererTemplate}("one.xml"),@{@link RendererTemplate}("two.xml").<br /></li>
* <li>@{@link Attributes}({"base.xml","command.xml"}) defines fragments of faces-config.xml which contain standart attributes definitions. CDK also tries to read META-INF/cdk/attributes/[classname].xml file for all component superclasses and interfaces, therefore it is not necessary to explicit include definitions for UIComponent and any other standard JSF classes. CDK defines couple of its own "urn" namespaces: "urn:resource:" for classpath resources, "urn:config:" for for project configuration folder and "urn:attributes:" for META-INF/cdk/attributes/ in the annotations library.<br /></li>
* <li>@{@link Fires}({MyEvent.class}) defines event classes that this component could fire.</li>
* <li>@{@link Icon} , @{@link DisplayName} - optional IDE-related parameters.<br /></li>
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java 2010-03-15 18:03:04 UTC (rev 16580)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java 2010-03-15 23:02:23 UTC (rev 16581)
@@ -100,7 +100,7 @@
// process Events.
setEvents(componentElement, component);
- // TODO - process renderers ( @Renderer and @RendererTemplate attribute.
+ // TODO - process renderers ( @JsfRenderer and @RendererTemplate attribute.
// TODO - process @Test annotations.
// Process attributes.
processAttributes(componentElement, component);
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-15 18:03:04 UTC (rev 16580)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/RendererProcessor.java 2010-03-15 23:02:23 UTC (rev 16581)
@@ -25,7 +25,7 @@
import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.Family;
import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.Renderer;
+import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.Property;
import org.richfaces.cdk.model.RendererModel;
@@ -38,7 +38,7 @@
* @author akolonitsky
* @since Dec 30, 2009
*/
-@SupportedAnnotationTypes({"javax.faces.component.FacesComponent", Renderer.NAME})
+@SupportedAnnotationTypes({"javax.faces.component.FacesComponent", JsfRenderer.NAME})
public class RendererProcessor extends ProcessorBase implements CdkAnnotationProcessor {
@@ -81,7 +81,7 @@
// process Events.
// setEvents(componentElement, renderer);
- // TODO - process renderers ( @Renderer and @RendererTemplate attribute.
+ // TODO - process renderers ( @JsfRenderer and @RendererTemplate attribute.
// TODO - process @Test annotations.
// Process attributes.
// processAttributes(componentElement, component);
@@ -156,7 +156,7 @@
@Override
public Class<? extends Annotation> getProcessedAnnotation() {
- return Renderer.class;
+ return JsfRenderer.class;
}
}
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-15 18:03:04 UTC (rev 16580)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-03-15 23:02:23 UTC (rev 16581)
@@ -61,7 +61,7 @@
Element tag = createTag(getComponentTagName(model)); // TODO change to tag name!
Element component = tag.addElement(COMPONENT);
component.addElement(COMPONENT_TYPE).addText(model.getType().getType());
- component.addElement("renderer-type").addText(model.getType().getType() + "Renderer");
+ component.addElement("renderer-type").addText(model.getType().getType() + "JsfRenderer");
addTagHandler(component, model.getTag());
appendAttributs(tag, model);
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-03-15 18:03:04 UTC (rev 16580)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-03-15 23:02:23 UTC (rev 16581)
@@ -30,7 +30,7 @@
/**
* <p class="changed_added_4_0">
- * Renderer for the final component. This is bidirectional many to many
+ * JsfRenderer for the final component. This is bidirectional many to many
* relation.
* </p>
*/
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java 2010-03-15 18:03:04 UTC (rev 16580)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java 2010-03-15 23:02:23 UTC (rev 16581)
@@ -37,7 +37,7 @@
import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.Icon;
import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.Renderer;
+import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
@@ -139,7 +139,7 @@
}
@Override
- public Renderer renderer() {
+ public JsfRenderer renderer() {
return null;
}
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2010-03-15 18:03:04 UTC (rev 16580)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2010-03-15 23:02:23 UTC (rev 16581)
@@ -156,7 +156,7 @@
protected String[] sourceIncludes;
/**
- * The list of Renderer template files that will be processed by CDK.
+ * The list of JsfRenderer template files that will be processed by CDK.
* By default, CDK looks for all files in the <code>src/main/templates</code> folder
* with "xml" extension.
*
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java 2010-03-15 18:03:04 UTC (rev 16580)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java 2010-03-15 23:02:23 UTC (rev 16581)
@@ -32,7 +32,7 @@
import org.richfaces.component.AbstractPush;
import org.richfaces.component.html.HtmlPush;
import org.richfaces.resource.PushResource;
-import org.richfaces.cdk.annotations.Renderer;
+import org.richfaces.cdk.annotations.JsfRenderer;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
@@ -52,7 +52,7 @@
@ResourceDependency(name = "jquery.js"),
@ResourceDependency(name = "richfaces.js")
})
-@Renderer
+@JsfRenderer
public class AjaxPushRenderer extends RendererBase {
public static final String PUSH_INTERVAL_PARAMETER = "A4J.AJAX.Push.INTERVAL";
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-15 18:03:04 UTC (rev 16580)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/QueueRenderer.java 2010-03-15 23:02:23 UTC (rev 16581)
@@ -34,7 +34,7 @@
* @author Nick Belaevski
*
*/
-(a)org.richfaces.cdk.annotations.Renderer
+(a)org.richfaces.cdk.annotations.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-15 18:03:04 UTC (rev 16580)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/RepeatRenderer.java 2010-03-15 23:02:23 UTC (rev 16581)
@@ -35,7 +35,7 @@
* @author Nick Belaevski
*
*/
-(a)org.richfaces.cdk.annotations.Renderer("org.richfaces.RepeatRenderer")
+(a)org.richfaces.cdk.annotations.JsfRenderer("org.richfaces.RepeatRenderer")
public class RepeatRenderer extends Renderer {
@Override
14 years, 9 months