JBoss Rich Faces SVN: r16393 - branches/community/3.3.X/ui/calendar/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-02-02 06:10:04 -0500 (Tue, 02 Feb 2010)
New Revision: 16393
Modified:
branches/community/3.3.X/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
Log:
RF-7746
Modified: branches/community/3.3.X/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
===================================================================
--- branches/community/3.3.X/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2010-02-02 10:04:56 UTC (rev 16392)
+++ branches/community/3.3.X/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2010-02-02 11:10:04 UTC (rev 16393)
@@ -253,7 +253,14 @@
// TODO onclick add users onclick
// currentDate processing -------------------------------------------------
-
+ @Override
+ public void processDecodes(FacesContext context) {
+ if (this.isDisabled()){
+ return;
+ }
+ super.decode(context);
+ }
+
public Calendar getCalendar() {
return Calendar.getInstance(getTimeZone(), getAsLocale(getLocale()));
}
14 years, 10 months
JBoss Rich Faces SVN: r16390 - in root/cdk/branches/guice/plugins/generator/src: main/java/org/richfaces/cdk/apt and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-02-01 20:17:30 -0500 (Mon, 01 Feb 2010)
New Revision: 16390
Added:
root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java
Modified:
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/FileManager.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/LibraryBuilder.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/OutputFileManager.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/SourceFileManager.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptBuilder.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/CompilationTaskFactory.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/TaskFactoryImpl.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/TemplateModule.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigGenerator.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigParser.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXB.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java
root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestBase.java
root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestRunner.java
root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java
root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/RunnerTest.java
root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java
root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
Log:
Test Java compilation tasks.
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/FileManager.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/FileManager.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/FileManager.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -26,6 +26,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.Writer;
/**
* <p class="changed_added_4_0"></p>
@@ -38,7 +39,7 @@
public Iterable<File> getFiles();
- public File createFile(String path, long lastModified) throws IOException;
+ public Writer createOutput(String path, long lastModified) throws IOException;
public abstract Iterable<File> getFolders();
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -33,7 +33,11 @@
import org.richfaces.cdk.xmlconfig.XmlModule;
import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.Writer;
import java.nio.charset.Charset;
+import java.util.Collections;
import java.util.Locale;
import java.util.Map;
@@ -43,6 +47,7 @@
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
+import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.inject.TypeLiteral;
@@ -66,7 +71,21 @@
private Map<StandardOutputFolders, FileManager> outputFolders = Maps.newHashMap();
private Map<StandardSources,FileManager> sources = Maps.newHashMap();
+
+ private LibraryBuilder libraryBuilder;
+
+ public Generator() {
+ EmptyFileManager emptyFileManager = new EmptyFileManager();
+ for (StandardSources source : StandardSources.values()) {
+ sources.put(source, emptyFileManager);
+ }
+
+ for (StandardOutputFolders output : StandardOutputFolders.values()) {
+ outputFolders.put(output, emptyFileManager);
+ }
+ }
+
public void setLoader(CdkClassLoader loader) {
this.loader = loader;
@@ -88,13 +107,37 @@
checkNotNull(loader, "classLoader");
injector = Guice.createInjector(new CdkConfigurationModule(),new AptModule(),new ModelModule(),
new ClassGeneratorModule(),new FreeMakerModule(),new TemplateModule(),new XmlModule());
+ // Create builder instance.
+ this.libraryBuilder = injector.getInstance(LibraryBuilder.class);
}
public void execute() {
- checkNotNull(injector, "initialized");
- injector.getInstance(LibraryBuilder.class).build();
+ checkNotNull(libraryBuilder, "initialized");
+ libraryBuilder.build();
}
+ public static final class EmptyFileManager implements FileManager {
+ @Override
+ public Iterable<File> getFolders() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Iterable<File> getFiles() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public File getFile(String path) throws FileNotFoundException {
+ throw new FileNotFoundException();
+ }
+
+ @Override
+ public Writer createOutput(String path, long lastModified) throws IOException {
+ throw new IOException("read-only");
+ }
+ }
+
public class CdkConfigurationModule extends AbstractModule {
@Override
@@ -109,7 +152,10 @@
for (Map.Entry<StandardSources, FileManager> entry : sources.entrySet()) {
bind(FileManager.class).annotatedWith(new SourceImpl(entry.getKey())).toInstance(entry.getValue());
}
+ bind(NamingConventions.class).to(RichFacesConventions.class);
+ bind(ModelValidator.class).to(ValidatorImpl.class);
}
+
}
}
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/LibraryBuilder.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/LibraryBuilder.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/LibraryBuilder.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -39,69 +39,26 @@
* @author asmirnov(a)exadel.com
*
*/
-public final class LibraryBuilder {
+public interface LibraryBuilder {
- @Inject
- private Logger log;
-
- private final ModelValidator validator;
- private final Iterable<ModelBuilder> builders;
- private final Iterable<CdkWriter> generators;
- private final ComponentLibrary library;
/**
* <p class="changed_added_4_0">
- * </p>
- *
- * @param context
- */
- @Inject
- public LibraryBuilder(ModelValidator validator,Iterable<ModelBuilder> builders,Iterable<CdkWriter> generators, ComponentLibrary library) {
- this.validator = validator;
- this.builders = builders;
- this.generators = generators;
- this.library = library;
- }
-
-
-
-
- /**
- * <p class="changed_added_4_0">
* Build library model from all available sources.
* </p>
*
* @param templates
* @throws CdkException
*/
- public void build() throws CdkException {
+ public void build() throws CdkException ;
- for (ModelBuilder builder : builders) {
- builder.build();
- }
-
- getValidator().verify();
-
- generate();
- }
-
/**
* Generate all types of files from library model.
* @param library
* @throws CdkException
*/
- public void generate() throws CdkException {
- if (0 == log.getErrorCount()) {
- for (CdkWriter generator : generators) {
- generator.render();
- }
- }
- }
+ public void generate() throws CdkException ;
-
- protected ModelValidator getValidator() throws CdkException {
- return validator;
- }
}
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -21,6 +21,8 @@
package org.richfaces.cdk;
+import com.google.inject.ImplementedBy;
+
/**
* That interface hides current logging system from generator classes.
* Concrete tools ( Maven, Ant, JUnit ) should provide appropriate logger instance that delegates
@@ -28,6 +30,7 @@
*
* @author shura
*/
+(a)ImplementedBy(JavaLogger.class)
public interface Logger {
public boolean isDebugEnabled();
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/OutputFileManager.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/OutputFileManager.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/OutputFileManager.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -25,7 +25,9 @@
import java.io.File;
import java.io.FileNotFoundException;
+import java.io.FileWriter;
import java.io.IOException;
+import java.io.Writer;
import java.util.Collections;
import org.richfaces.cdk.model.ComponentLibrary;
@@ -53,7 +55,7 @@
* @see org.richfaces.cdk.FileManager#createFile(java.lang.String)
*/
@Override
- public File createFile(String path, long lastModified) throws IOException {
+ public Writer createOutput(String path, long lastModified) throws IOException {
if (null == path) {
throw new NullPointerException();
}
@@ -86,7 +88,7 @@
outputFile.getParentFile().mkdirs();
outputFile.createNewFile();
- return outputFile;
+ return new FileWriter(outputFile);
}
/*
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/SourceFileManager.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/SourceFileManager.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/SourceFileManager.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -26,6 +26,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.Writer;
/**
* <p class="changed_added_4_0">
@@ -50,7 +51,7 @@
* @see org.richfaces.cdk.FileManager#createFile(java.lang.String)
*/
@Override
- public File createFile(String path, long lastModified) throws IOException {
+ public Writer createOutput(String path, long lastModified) throws IOException {
throw new UnsupportedOperationException("Cannot create file in source folder");
}
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptBuilder.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptBuilder.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptBuilder.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -25,19 +25,17 @@
package org.richfaces.cdk.apt;
-import java.io.File;
-import java.util.Arrays;
+import java.util.Set;
-import javax.annotation.processing.Processor;
-import com.google.inject.Inject;
import javax.tools.JavaCompiler.CompilationTask;
import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.CdkWriter;
+import org.richfaces.cdk.LibraryBuilder;
import org.richfaces.cdk.Logger;
-import org.richfaces.cdk.ModelBuilder;
-import org.richfaces.cdk.Source;
-import org.richfaces.cdk.StandardSources;
+import com.google.inject.Inject;
+
/**
* <p class="changed_added_4_0">
* That class compiles files from sources and process annotations
@@ -46,41 +44,33 @@
* @author asmirnov(a)exadel.com
*
*/
-public class AptBuilder implements ModelBuilder {
+public class AptBuilder implements LibraryBuilder {
@Inject
private static Logger LOG ;
- @Inject
- private Processor cdkProcessor;
- @Inject
- @Source(StandardSources.JAVA_SOURCES)
- private Iterable<File> sources;
@Inject
private CompilationTaskFactory taskFactory;
- public void build() throws CdkException {
+ @Inject
+ private Set<CdkWriter> generators;
- process(sources, cdkProcessor);
+ public void build() throws CdkException {
+ CompilationTask task = taskFactory.get();
+ if (!task.call()) {
+ throw new AptException("Compilation error");
+ }
}
- /**
- * <p class="changed_added_4_0">That method process source files and call appropriate annotation processors</p>
- * @param sources
- * @param processors
- * @throws AptException
- */
- protected void process(Iterable<File> sources, Processor... processors) throws AptException {
- if (sources != null && sources.iterator().hasNext()) {
- CompilationTask task = taskFactory.getTask(sources);
- task.setProcessors(Arrays.asList(processors));
-
- if (!task.call()) {
- throw new AptException("Compilation error");
+ @Override
+ public void generate() throws CdkException {
+ if (0 == LOG.getErrorCount()) {
+ // processing over, generate files.
+ for (CdkWriter generator : generators) {
+ generator.render();
}
- } else {
- LOG.info("No compilation units found, skipping Java sources processing");
- }
+
+ }
}
}
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -25,6 +25,8 @@
import javax.annotation.processing.Processor;
+import org.richfaces.cdk.LibraryBuilder;
+
import com.google.inject.AbstractModule;
import com.google.inject.multibindings.Multibinder;
@@ -49,6 +51,7 @@
setBinder.addBinding().to(ValidatorProcessor.class);
bind(Processor.class).to(CdkProcessor.class);
bind(CompilationTaskFactory.class).to(TaskFactoryImpl.class);
+ bind(LibraryBuilder.class).to(AptBuilder.class);
}
}
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -34,6 +34,7 @@
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.CdkWriter;
+import org.richfaces.cdk.LibraryBuilder;
import org.richfaces.cdk.Logger;
import org.richfaces.cdk.ModelBuilder;
import org.richfaces.cdk.ModelValidator;
@@ -56,13 +57,10 @@
private Logger log;
@Inject
- private Iterable<CdkAnnotationProcessor> processors;
+ private Set<CdkAnnotationProcessor> processors;
@Inject
- private Iterable<ModelBuilder> builders;
-
- @Inject
- private Iterable<CdkWriter> generators;
+ private Set<ModelBuilder> builders;
@Inject
private SourceUtils sourceUtils;
@@ -70,6 +68,9 @@
@Inject
private ModelValidator validator;
+ @Inject
+ private LibraryBuilder builder;
+
@Override
@@ -87,9 +88,7 @@
validator.verify();
} else if (0 == log.getErrorCount()) {
// processing over, generate files.
- for (CdkWriter generator : generators) {
- generator.render();
- }
+ builder.generate();
}
sourceUtils.release();
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/CompilationTaskFactory.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/CompilationTaskFactory.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/CompilationTaskFactory.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -23,7 +23,6 @@
package org.richfaces.cdk.apt;
-import java.io.File;
import javax.tools.JavaCompiler.CompilationTask;
@@ -34,6 +33,6 @@
*/
public interface CompilationTaskFactory {
- CompilationTask getTask(Iterable<File> sources) throws AptException;
+ CompilationTask get() throws AptException;
}
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/TaskFactoryImpl.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/TaskFactoryImpl.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/apt/TaskFactoryImpl.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -26,10 +26,13 @@
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Locale;
import com.google.inject.Inject;
+
+import javax.annotation.processing.Processor;
import javax.tools.Diagnostic;
import javax.tools.DiagnosticListener;
import javax.tools.JavaCompiler;
@@ -107,6 +110,9 @@
@Source(StandardSources.JAVA_SOURCES)
private FileManager sourceFolders;
+ @Inject
+ private Processor cdkProcessor;
+
private JavaCompiler javaCompiler;
private StandardJavaFileManager fileManager;
@@ -119,27 +125,26 @@
* @see org.richfaces.cdk.apt.CompilationTaskFactory#getTask(java.lang.Iterable)
*/
@Override
- public CompilationTask getTask(Iterable<File> sources) throws AptException {
+ public CompilationTask get() throws AptException {
diagnosticListener = new DiagnosticListenerImplementation();
- Iterable<? extends JavaFileObject> sourceObjects = getFileManager().getJavaFileObjectsFromFiles(sources);
+ Iterable<? extends JavaFileObject> sourceObjects = getFileManager().getJavaFileObjectsFromFiles(sourceFolders.getFiles());
CompilationTask task =
getJavaCompiler().getTask(null, getFileManager(), diagnosticListener, options, null, sourceObjects);
task.setLocale(locale);
+ task.setProcessors(Collections.singleton(cdkProcessor));
return task;
}
private StandardJavaFileManager getFileManager() {
if (fileManager == null) {
- fileManager = javaCompiler.getStandardFileManager(diagnosticListener, locale, charset);
+ fileManager = getJavaCompiler().getStandardFileManager(diagnosticListener, locale, charset);
try {
fileManager.setLocation(StandardLocation.CLASS_PATH, classPathLoader.getFiles());
- if (null != outputFolder) {
- fileManager.setLocation(StandardLocation.SOURCE_OUTPUT,outputFolder.getFolders());
+ Iterable<File> outputFolders = outputFolder.getFolders();
+ if (null != outputFolders) {
+ fileManager.setLocation(StandardLocation.SOURCE_OUTPUT, outputFolders);
}
-
- if (null != sourceFolders ) {
- fileManager.setLocation(StandardLocation.SOURCE_PATH, sourceFolders.getFolders());
- }
+ fileManager.setLocation(StandardLocation.SOURCE_PATH, sourceFolders.getFolders());
} catch (IOException e) {
throw new CdkException("Cannot configure JavaFileManager for compilator",e);
}
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -122,8 +122,7 @@
}
try {
- File sourceOutput = output.createFile(getOutputFile(c), lastModified);
- return new FileWriter(sourceOutput);
+ return output.createOutput(getOutputFile(c), lastModified);
} catch (IOException e) {
throw new CdkException(e);
}
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -26,6 +26,7 @@
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
+import java.io.Writer;
import com.google.inject.Inject;
@@ -99,15 +100,11 @@
JavaClass javaClass = visitor.getGeneratedClass();
String fullName = javaClass.getName();
try {
- File outFile = output.createFile(fullName.replace('.', '/') + ".java", library.lastModified());
+ Writer outFile = output.createOutput(fullName.replace('.', '/') + ".java", library.lastModified());
if (null != outFile) {
- PrintWriter outputWriter = null;
-
- outputWriter = new PrintWriter(outFile);
-
- this.renderer.writeSnippet("class", javaClass, outputWriter);
- outputWriter.close();
+ this.renderer.writeSnippet("class", javaClass, outFile);
+ outFile.close();
}
} catch (IOException e) {
throw new CdkException(e);
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/TemplateModule.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/TemplateModule.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/TemplateModule.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -27,6 +27,7 @@
import org.richfaces.cdk.ModelBuilder;
import com.google.inject.AbstractModule;
+import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.Multibinder;
/**
@@ -44,6 +45,8 @@
Multibinder<ModelBuilder> modelBinder = Multibinder.newSetBinder(binder(), ModelBuilder.class);
modelBinder.addBinding().to(RendererTemplateParser.class);
Multibinder.newSetBinder(binder(),CdkWriter.class).addBinding().to(RendererClassGenerator.class);
+ bind(new TypeLiteral<TemplateVisitorFactory<RendererClassVisitor>>(){}).to(VisitorFactoryImpl.class);
+ bind(FreeMarkerRenderer.class).to(JavaClassConfiguration.class);
}
}
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigGenerator.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigGenerator.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigGenerator.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -26,6 +26,7 @@
package org.richfaces.cdk.xmlconfig;
import java.io.File;
+import java.io.Writer;
import com.google.inject.Inject;
@@ -76,7 +77,7 @@
// TODO - check modification time.
try {
- File facesConfigXml = outputFileManager.createFile(FACES_CONFIG_XML, library.lastModified());
+ Writer facesConfigXml = outputFileManager.createOutput(FACES_CONFIG_XML, library.lastModified());
if (null != facesConfigXml) {
jaxbBinding.marshal(facesConfigXml, FACES_SCHEMA_LOCATION, libraryAdapter.marshal(library));
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigParser.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigParser.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigParser.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -28,6 +28,7 @@
import com.google.inject.Inject;
import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.FileManager;
import org.richfaces.cdk.ModelBuilder;
import org.richfaces.cdk.Source;
import org.richfaces.cdk.StandardSources;
@@ -51,7 +52,7 @@
@Inject
private ComponentLibrary library;
@Inject @Source(StandardSources.FACES_CONFIGS)
- private Iterable<File> configFiles;
+ private FileManager configFiles;
/*
@@ -62,8 +63,7 @@
@Override
public void build() throws CdkException {
- if (null != configFiles) {
- for (File file : configFiles) {
+ for (File file : configFiles.getFiles()) {
FacesConfigBean unmarshal = unmarshalFacesConfig(file);
if (null != unmarshal) {
ComponentLibrary facesConfig = ADAPTER.unmarshal(unmarshal);
@@ -78,8 +78,6 @@
// library.setExtensions(unmarshal.getExtensions());
}
}
-
- }
}
protected FacesConfigBean unmarshalFacesConfig(File file) throws CdkException {
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXB.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXB.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXB.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -3,6 +3,7 @@
import org.richfaces.cdk.CdkException;
import java.io.File;
+import java.io.Writer;
import javax.xml.transform.Result;
@@ -12,7 +13,7 @@
public abstract <T> T unmarshal(String url, String schemaLocation, Class<T> bindClass) throws CdkException;
- public abstract <T> void marshal(File output, String schemaLocation, T model) throws CdkException;
+ public abstract <T> void marshal(Writer output, String schemaLocation, T model) throws CdkException;
public abstract <T> void marshal(Result output, String schemaLocation, T model) throws CdkException;
Modified: root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -34,6 +34,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
+import java.io.Writer;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URISyntaxException;
@@ -89,6 +90,7 @@
/* (non-Javadoc)
* @see org.richfaces.cdk.xmlconfig.JAXB#unmarshal(java.io.File, java.lang.String, java.lang.Class)
*/
+ @Override
public <T> T unmarshal(File file, String schemaLocation, Class<T> bindClass) throws CdkException {
try {
InputSource input = new InputSource(new FileInputStream(file));
@@ -106,6 +108,7 @@
/* (non-Javadoc)
* @see org.richfaces.cdk.xmlconfig.JAXB#unmarshal(java.lang.String, java.lang.String, java.lang.Class)
*/
+ @Override
public <T> T unmarshal(String url, String schemaLocation, Class<T> bindClass) throws CdkException {
try {
InputSource inputSource;
@@ -186,14 +189,14 @@
/* (non-Javadoc)
* @see org.richfaces.cdk.xmlconfig.JAXB#marshal(java.io.File, java.lang.String, T)
*/
- public <T> void marshal(File output, String schemaLocation, T model) throws CdkException {
+ @Override
+ public <T> void marshal(Writer output, String schemaLocation, T model) throws CdkException {
try {
- FileOutputStream outputStream = new FileOutputStream(output);
- StreamResult result = new StreamResult(outputStream);
+ StreamResult result = new StreamResult(output);
marshal(result, schemaLocation, model);
- outputStream.flush();
- outputStream.close();
+ output.flush();
+ output.close();
} catch (FileNotFoundException e) {
throw new CdkException("File not found", e);
} catch (IOException e) {
@@ -204,6 +207,7 @@
/* (non-Javadoc)
* @see org.richfaces.cdk.xmlconfig.JAXB#marshal(javax.xml.transform.Result, java.lang.String, T)
*/
+ @Override
public <T> void marshal(Result output, String schemaLocation, T model) throws CdkException {
try {
JAXBContext jc = JAXBContext.newInstance(model.getClass());
Modified: root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestBase.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestBase.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestBase.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -32,8 +32,10 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
+import java.nio.charset.Charset;
import java.util.Collections;
+import java.util.Locale;
import java.util.logging.LogManager;
import org.junit.After;
@@ -41,20 +43,25 @@
import org.richfaces.cdk.annotations.Component;
import com.google.common.collect.ImmutableList;
+import com.google.inject.Binder;
+import com.google.inject.Module;
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
*
*/
-public abstract class CdkTestBase {
+public abstract class CdkTestBase implements Module {
protected Iterable<File> testSourceDirectory;
+ protected File tempDir;
@Before
public void setUpSourceDirectory() throws Exception {
testSourceDirectory = Collections.singleton(getJavaFile("test.source.properties").getParentFile());
+ this.tempDir = File.createTempFile("cdk", "test");
+
InputStream stream = this.getClass().getResourceAsStream("logging.properties");
if (null != stream) {
@@ -78,6 +85,12 @@
public void tearDownSourceDirectory() {
testSourceDirectory = null;
}
+
+ @Override
+ public void configure(Binder binder) {
+ binder.bind(Locale.class).toInstance(Locale.getDefault());
+ binder.bind(Charset.class).toInstance(Charset.defaultCharset());
+ }
protected File getJavaFile(String name) throws URISyntaxException {
ClassLoader classLoader = this.getClass().getClassLoader();
Modified: root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestRunner.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestRunner.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestRunner.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -32,7 +32,9 @@
import java.util.Set;
import org.easymock.EasyMock;
+import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
import com.google.common.collect.Sets;
@@ -79,6 +81,11 @@
}
@Override
+ protected void runChild(FrameworkMethod method, RunNotifier notifier) {
+ super.runChild(method, notifier);
+ }
+
+ @Override
protected Object createTest() throws Exception {
Class<?> c = getTestClass().getJavaClass();
Set<Field> testFields = getFields(c);
Modified: root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -28,14 +28,8 @@
* @author asmirnov
*
*/
-(a)RunWith(Parameterized.class)
-public class LibraryBuilderTest {
- private String param;
+public class LibraryBuilderTest extends CdkTestBase {
- public LibraryBuilderTest(String param) {
- this.param = param;
- }
-
/**
* @throws java.lang.Exception
*/
@@ -50,15 +44,15 @@
/**
* Test method for {@link org.richfaces.cdk.LibraryBuilder#createInstance()}.
+ * @throws Exception
*/
@Test
- public void createInstance() {
-
-// assertEquals("Parameter match","Two", param);
+ public void testInit() throws Exception {
+ Generator generator = new Generator();
+ // setup CDK configuration.
+ generator.setLoader(createClassLoader());
+ // Test dependencies tree.
+ generator.init();
}
- @Parameters
- public static Collection<String[]> values() {
- return Arrays.asList(new String[] {"One"}, new String[] {"Two"}, new String[] {"Tree"});
- }
}
Modified: root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/RunnerTest.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/RunnerTest.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/RunnerTest.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -25,4 +25,13 @@
replay(log,sources);
verify(log,sources);
}
+
+ @Test
+ public void easyMockInjections2() throws Exception {
+ assertNotNull(log);
+ assertNotNull(sources);
+ replay(log,sources);
+ verify(log,sources);
+ }
+
}
Modified: root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -21,63 +21,33 @@
package org.richfaces.cdk.apt;
-import org.richfaces.cdk.CdkTestBase;
-import org.richfaces.cdk.CdkContext;
-import org.richfaces.cdk.CdkContextBase;
-import org.richfaces.cdk.StandardSources;
-import org.richfaces.cdk.RichFacesConventions;
-import org.richfaces.cdk.NamingConventions;
-import org.richfaces.cdk.ModelValidator;
-import org.richfaces.cdk.CdkException;
-import org.richfaces.cdk.CdkProcessingException;
+import javax.el.ELContext;
+import javax.faces.component.UIComponent;
+
import org.richfaces.cdk.CdkClassLoader;
+import org.richfaces.cdk.CdkTestBase;
import org.richfaces.cdk.annotations.Family;
-import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
+
import com.google.common.collect.ImmutableList;
+import com.google.inject.Binder;
-import javax.el.ELContext;
-import javax.faces.component.UIComponent;
-
/**
* @author akolonitsky
* @since Jan 14, 2010
*/
public abstract class AnnotationProcessorTest extends CdkTestBase {
-
- protected ComponentLibrary prepareMockCompilationContext(String javaFilePath) throws Exception {
- CdkContext cdkContext = createMockContext();
- CdkProcessor processor = new CdkProcessor();
- AptBuilder compiler = new AptBuilder();
-
- compiler.init(cdkContext);
- processor.init(cdkContext);
- compiler.process(ImmutableList.of(getJavaFile(javaFilePath)), processor);
-
- return cdkContext.getLibrary();
+
+ @Override
+ public void configure(Binder binder) {
+ super.configure(binder);
+ try {
+ binder.bind(CdkClassLoader.class).toInstance(createClassLoader());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
- protected CdkContext createMockContext() throws Exception {
- CdkContextBase baseContext = new CdkContextBase(createClassLoader());
- baseContext.setSourceFolders(StandardSources.JAVA_SOURCES, testSourceDirectory);
- RichFacesConventions richFacesConventions = new RichFacesConventions();
- baseContext.setWorker(NamingConventions.class, richFacesConventions);
- baseContext.setWorker(ModelValidator.class, new ModelValidator() {
-
- @Override
- public void init(CdkContext context) {
-
- }
-
- @Override
- public void verify(ComponentLibrary library) throws CdkException {
- }
- });
- baseContext.sendError(new CdkProcessingException());
-
- return baseContext;
- }
-
@Override
protected CdkClassLoader createClassLoader() throws Exception {
return new CdkClassLoader(ImmutableList.of(getLibraryFile("test.source.properties"),
Modified: root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2010-02-01 23:54:20 UTC (rev 16389)
+++ root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -27,48 +27,15 @@
import static org.easymock.EasyMock.*;
-import static org.junit.Assert.*;
+import org.junit.runner.RunWith;
+import org.richfaces.cdk.CdkTestRunner;
-import static javax.lang.model.util.ElementFilter.*;
+import com.google.common.collect.ImmutableSet;
-import java.io.File;
+import static org.junit.Assert.*;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.util.Collections;
-import java.util.Set;
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.annotation.processing.Processor;
-import javax.annotation.processing.RoundEnvironment;
-import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.annotation.processing.SupportedSourceVersion;
-
-import javax.lang.model.SourceVersion;
-import javax.lang.model.element.TypeElement;
-
-import javax.tools.JavaFileObject;
-import javax.tools.SimpleJavaFileObject;
-
-import org.easymock.Capture;
-import org.easymock.CaptureType;
-
-import org.junit.Test;
-
-import org.richfaces.cdk.CdkContext;
-import org.richfaces.cdk.CdkTestBase;
-import org.richfaces.cdk.OutputType;
-import org.richfaces.cdk.StandardOutputs;
-import org.richfaces.cdk.StandardSources;
-import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.Component;
-import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-
/**
* <p class="changed_added_4_0">
* </p>
@@ -76,225 +43,12 @@
* @author asmirnov(a)exadel.com
*
*/
-public class CdkProcessorTest extends CdkTestBase {
+(a)RunWith(CdkTestRunner.class)
+public class CdkProcessorTest extends AnnotationProcessorTest {
private static final String ANNOTATION2 = TestAnnotation2.class.getName();
private static final String CLASS_JAVA = "org/richfaces/cdk/apt/TestClass.java";
private static final String COMPONENT_CLASS_JAVA = "org/richfaces/cdk/test/component/AbstractTestComponent.java";
private static final String INTERFACE_JAVA = "org/richfaces/cdk/apt/TestInterface.java";
private static final String SUB_CLASS_JAVA = "org/richfaces/cdk/apt/TestSubClass.java";
private static final ImmutableSet<String> PROCESS_ANNOTATIONS = ImmutableSet.of(TestAnnotation.class.getName());
- private ClassLoader testLoader;
-
- /**
- * Test method for
- * {@link org.richfaces.cdk.apt.CdkProcessor#process(java.util.Set, javax.annotation.processing.RoundEnvironment)}
- * .
- *
- * @throws Exception
- */
- @Test
- public void testProcess() throws Exception {
-
- // Prepare Mock compilation context.
- CdkContext cdkContext = createMock(CdkContext.class);
-
- expect(cdkContext.getSourceFolders(StandardSources.JAVA_SOURCES)).andStubReturn(testSourceDirectory);
- expect(cdkContext.getOutputFolder((OutputType) anyObject())).andStubReturn(null);
- expect(cdkContext.getLoader()).andStubReturn(createClassLoader());
- replay(cdkContext);
-
- Processor processor = createMock(Processor.class);
-
- processor.init((ProcessingEnvironment) anyObject());
- expect(processor.getSupportedOptions()).andReturn(ImmutableSet.<String>of());
-
- // processor.process(null,null);
- Capture<Set<? extends TypeElement>> capturedTypes = new Capture<Set<? extends TypeElement>>();
-
- expect(processor.process(capture(capturedTypes),
- capture(new Capture<RoundEnvironment>()))).andReturn(true).times(2);
- expect(processor.getSupportedAnnotationTypes()).andReturn(ImmutableSet.of("*"));
- expect(processor.getSupportedSourceVersion()).andReturn(SourceVersion.RELEASE_6);
- replay(processor);
-
- AptBuilder compiler = new AptBuilder();
-
- compiler.init(cdkContext);
- compiler.process(ImmutableList.of(getJavaFile(CLASS_JAVA)), processor);
- verify(cdkContext, processor);
- }
-
- /**
- * Test method for
- * {@link org.richfaces.cdk.apt.CdkProcessor#process(java.util.Set, javax.annotation.processing.RoundEnvironment)}
- * .
- *
- * @throws Exception
- */
- @Test
- public void testProcessSubClass() throws Exception {
-
- // Prepare Mock compilation context.
- CdkContext cdkContext = createMock(CdkContext.class);
-
- expect(cdkContext.getSourceFolders(StandardSources.JAVA_SOURCES)).andStubReturn(testSourceDirectory);
- expect(cdkContext.getOutputFolder((OutputType) anyObject())).andStubReturn(null);
- expect(cdkContext.getLoader()).andStubReturn(createClassLoader());
- replay(cdkContext);
-
- Processor processor = createMock(Processor.class);
-
- processor.init((ProcessingEnvironment) anyObject());
- expect(processor.getSupportedOptions()).andReturn(ImmutableSet.<String>of());
-
- // processor.process(null,null);
- Capture<Set<? extends TypeElement>> capturedTypes = new Capture<Set<? extends TypeElement>>(CaptureType.FIRST);
-
- expect(processor.process(capture(capturedTypes),
- capture(new Capture<RoundEnvironment>()))).andReturn(true).times(2);
- expect(processor.getSupportedAnnotationTypes()).andReturn(ImmutableSet.of(TestAnnotation2.class.getName()));
- expect(processor.getSupportedSourceVersion()).andReturn(SourceVersion.RELEASE_6);
- replay(processor);
-
- AptBuilder compiler = new AptBuilder();
-
- compiler.init(cdkContext);
- compiler.process(ImmutableList.of(getJavaFile(SUB_CLASS_JAVA), getJavaFile(CLASS_JAVA)), processor);
- verify(cdkContext, processor);
-
- Set<? extends TypeElement> elements = capturedTypes.getValue();
-
- assertFalse(elements.isEmpty());
- assertEquals("TestAnnotation2", elements.iterator().next().getSimpleName().toString());
- }
-
- /**
- * Test method for
- * {@link org.richfaces.cdk.apt.CdkProcessor#getClassesAnnotatedWith(RoundEnvironment, Class)}
- * .
- *
- * @throws Exception
- */
- @Test
- public void testGetClassesAnnotatedWith() throws Exception {
-
- // Prepare Mock compilation context.
- CdkContext cdkContext = createMock(CdkContext.class);
-
- expect(cdkContext.getSourceFolders(StandardSources.JAVA_SOURCES)).andStubReturn(testSourceDirectory);
- expect(cdkContext.getOutputFolder((OutputType) anyObject())).andStubReturn(null);
- expect(cdkContext.getLoader()).andStubReturn(createClassLoader());
- replay(cdkContext);
-
- TestProcessor processor = new TestProcessor() {
- @Override
- public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
- if (!roundEnv.processingOver()) {
- this.numOfComponents = roundEnv.getElementsAnnotatedWith(Component.class).size();
- }
-
- return true;
- }
- };
-
- processor.init(cdkContext);
- // ComponentLibrary library = new
- // ComponentLibrary("org.richfaces.cdk.test");
- // processor.library = library;
- AptBuilder compiler = new AptBuilder();
-
- compiler.init(cdkContext);
- compiler.process(ImmutableList.of(getJavaFile(COMPONENT_CLASS_JAVA)), processor);
- verify(cdkContext);
- assertTrue(processor.isInitialized());
- assertEquals(1, processor.numOfComponents);
- }
-
- /**
- * Test method for
- * {@link org.richfaces.cdk.apt.CdkProcessor#getClassesAnnotatedWith(RoundEnvironment, Class)}
- * .
- *
- * @throws Exception
- */
- @Test
- public void testGetPropertiesAnnotatedWith() throws Exception {
-
- // Prepare Mock compilation context.
- CdkContext cdkContext = createMock(CdkContext.class);
-
- expect(cdkContext.getSourceFolders(StandardSources.JAVA_SOURCES)).andStubReturn(testSourceDirectory);
- expect(cdkContext.getOutputFolder((OutputType) anyObject())).andStubReturn(null);
- expect(cdkContext.getLoader()).andStubReturn(createClassLoader());
- replay(cdkContext);
-
- TestProcessor processor = new TestProcessor() {
- @Override
- public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
- if (!roundEnv.processingOver()) {
- SourceUtils utils = new SourceUtils(processingEnv,roundEnv);
- utils.init(getContext());
- TypeElement typeElement = utils.getClassesAnnotatedWith(Component.class).iterator().next();
- Set<BeanProperty> beanProperties = utils.getBeanPropertiesAnnotatedWith(Attribute.class, typeElement);
-
- assertEquals(3, beanProperties.size());
-
- BeanProperty property = Iterables.get(beanProperties, 2);
-
- assertEquals("foo", property.getName());
- assertEquals("int", property.getType().toString());
- assertNull(property.getDocComment());
- property = Iterables.get(beanProperties, 1);
- assertEquals("testValue", property.getName());
- assertEquals("java.util.List<java.lang.String>", property.getType().toString());
- assertEquals(" Test Attribute\n", property.getDocComment());
- property = Iterables.get(beanProperties, 0);
- assertEquals("barValue", property.getName());
- assertEquals("java.util.List<M>", property.getType().toString());
- assertEquals(" Bar Attribute\n", property.getDocComment());
-
-// assertEquals("<M>" ,property.getTypeParameters());
- numOfComponents++;
- }
-
- return true;
- }
- };
- processor.init(cdkContext);
-
- // ComponentLibrary library = new
- // ComponentLibrary("org.richfaces.cdk.test");
- // processor.library = library;
- AptBuilder compiler = new AptBuilder();
-
- compiler.init(cdkContext);
- compiler.process(ImmutableList.of(getJavaFile(COMPONENT_CLASS_JAVA)), processor);
- verify(cdkContext);
- assertTrue(processor.isInitialized());
- assertEquals(1, processor.numOfComponents);
- }
-
- private abstract static class TestProcessor extends CdkProcessor {
- protected int numOfComponents;
-
- public TestProcessor() {
- }
-
- @Override
- public synchronized void init(ProcessingEnvironment processingEnv) {
- super.init(processingEnv);
- }
-
- @Override
- public synchronized boolean isInitialized() {
- return super.isInitialized();
- }
-
- @Override
- public Set<String> getSupportedAnnotationTypes() {
-
- // Process all annotations
- return ImmutableSet.of("*");
- }
- }
}
Added: root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java
===================================================================
--- root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java (rev 0)
+++ root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java 2010-02-02 01:17:30 UTC (rev 16390)
@@ -0,0 +1,127 @@
+/*
+ * $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.apt;
+
+import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
+
+import java.util.Collections;
+import java.util.Set;
+
+
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.Processor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.TypeElement;
+import javax.tools.JavaCompiler.CompilationTask;
+
+import org.easymock.Capture;
+import org.easymock.CaptureType;
+import org.easymock.EasyMock;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.richfaces.cdk.CdkTestRunner;
+import org.richfaces.cdk.FileManager;
+import org.richfaces.cdk.Logger;
+import org.richfaces.cdk.Mock;
+import org.richfaces.cdk.OutputFolder;
+import org.richfaces.cdk.Source;
+import org.richfaces.cdk.StandardOutputFolders;
+import org.richfaces.cdk.StandardSources;
+import org.richfaces.cdk.Stub;
+
+import com.google.common.collect.ImmutableList;
+import com.google.inject.Inject;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)RunWith(CdkTestRunner.class)
+public class TaskFactoryTest extends AnnotationProcessorTest {
+
+ private static final String CLASS_JAVA = "org/richfaces/cdk/apt/TestClass.java";
+ private static final String SUB_CLASS_JAVA = "org/richfaces/cdk/apt/TestSubClass.java";
+ private static final String INTERFACE_JAVA = "org/richfaces/cdk/apt/TestInterface.java";
+
+
+ @Inject
+ private TaskFactoryImpl factory;
+
+ @Mock
+ private Logger log;
+
+ @Mock
+ Processor processor;
+
+ @Stub
+ @OutputFolder(StandardOutputFolders.JAVA_CLASSES)
+ private FileManager output;
+
+ @Stub
+ @Source(StandardSources.JAVA_SOURCES)
+ private FileManager sources;
+ /**
+ * Test method for {@link org.richfaces.cdk.apt.TaskFactoryImpl#get()}.
+ * @throws Exception
+ * @throws AptException
+ */
+ @Test
+ public void testGetTask() throws AptException, Exception {
+ expect(sources.getFiles()).andStubReturn(Collections.singleton(getJavaFile(CLASS_JAVA)));
+ expect(sources.getFolders()).andStubReturn(this.testSourceDirectory);
+ expect(output.getFolders()).andReturn(null);
+ replay(log,processor,sources,output);
+ CompilationTask task = factory.get();
+ assertNotNull(task);
+ verify(log,processor,sources,output);
+ }
+
+ @Test
+ public void testTask() throws AptException, Exception {
+ expect(sources.getFiles()).andStubReturn(ImmutableList.of(getJavaFile(CLASS_JAVA),getJavaFile(SUB_CLASS_JAVA),getJavaFile(INTERFACE_JAVA)));
+ expect(sources.getFolders()).andStubReturn(this.testSourceDirectory);
+ expect(output.getFolders()).andReturn(null);
+ processor.init((ProcessingEnvironment) anyObject());expectLastCall();
+ expect(processor.getSupportedSourceVersion()).andReturn(SourceVersion.RELEASE_6);
+ expect(processor.getSupportedAnnotationTypes()).andReturn(Collections.singleton("*"));
+ expect(processor.getSupportedOptions()).andReturn(Collections.<String>emptySet());
+ // processor.process(null,null);
+ Capture<Set<? extends TypeElement>> capturedTypes = new Capture<Set<? extends TypeElement>>(CaptureType.FIRST);
+
+ expect(processor.process(capture(capturedTypes),
+ EasyMock.<RoundEnvironment>anyObject())).andReturn(true).times(2);
+ replay(log,processor,sources,output);
+ CompilationTask task = factory.get();
+ assertTrue(task.call());
+ Set<? extends TypeElement> elements = capturedTypes.getValue();
+
+ assertFalse(elements.isEmpty());
+ assertEquals("TestInterfaceAnnotation", elements.iterator().next().getSimpleName().toString());
+ verify(log,processor,sources,output);
+ }
+
+}
Property changes on: root/cdk/branches/guice/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 10 months
JBoss Rich Faces SVN: r16389 - root/docs/trunk/Developer_Guide/en-US.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-02-01 18:54:20 -0500 (Mon, 01 Feb 2010)
New Revision: 16389
Modified:
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml
Log:
Fixed building errors
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml 2010-02-01 19:16:08 UTC (rev 16388)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml 2010-02-01 23:54:20 UTC (rev 16389)
@@ -221,11 +221,15 @@
<procedure>
<step>
<title>Create a new project</title>
- <para>In <application>JBoss Tools</application>, select <menuchoice><guimenu>File</guimenu><guimenu>New</guimenu><guimenuitem>JSF Project</guimenuitem></menuchoice></para> from the menu. Name the project, select <guilabel>JSF 2</guilabel> from the <guilabel>JSF Environment</guilabel> drop-down box, and click the <guibutton>Finish</guibutton> button to create the project.
+ <para>
+ In <application>JBoss Tools</application>, select <menuchoice><guimenu>File</guimenu><guimenu>New</guimenu><guimenuitem>JSF Project</guimenuitem></menuchoice> from the menu. Name the project, select <guilabel>JSF 2</guilabel> from the <guilabel>JSF Environment</guilabel> drop-down box, and click the <guibutton>Finish</guibutton> button to create the project.
+ </para>
</step>
<step>
<title>Add the RichFaces libraries to the project</title>
- <para>Add <filename>core-ui.jar</filename>, <filename>richfaces-api.jar</filename>, and <filename>richfaces-impl.jar</filename> into your project by dragging them from the location where you unzipped the RichFaces archive to the <filename>WebContent/WEB-INF/lib/</filename> directory of your project in <application>JBoss Tools</application>.</para>
+ <para>
+ Add <filename>core-ui.jar</filename>, <filename>richfaces-api.jar</filename>, and <filename>richfaces-impl.jar</filename> into your project by dragging them from the location where you unzipped the RichFaces archive to the <filename>WebContent/WEB-INF/lib/</filename> directory of your project in <application>JBoss Tools</application>.
+ </para>
<note>
<title>Other required libraries</title>
<para>
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml 2010-02-01 19:16:08 UTC (rev 16388)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml 2010-02-01 23:54:20 UTC (rev 16389)
@@ -64,7 +64,7 @@
<section id="sect-Developer_Guide-RichFaces_overview-Ajax_Filter">
<title>Ajax Filter</title>
<para>
- To get all benefits of RichFaces, a filter should be registered in the <filename>web.xml</filename> file of your application. The filter recognizes multiple request types. Filter configuration is covered in detail in <xref linkend="sect-Developer_Guide-Advanced_features-Filters" />. <xref linkend="figu-Developer_Guide-RichFaces_overview-Request_processing_sequences" /> shows the difference between processing a regular JSF request and an Ajax request with a filter.
+ To get all benefits of RichFaces, a filter should be registered in the <filename>web.xml</filename> file of your application. The filter recognizes multiple request types. Filter configuration is covered in detail in <xref linkend="sect-Developer_Guide-Advanced_features-Filters" />. <xref linkend="figu-Developer_Guide-RichFaces_overview-Request_processing_sequences" /> shows the difference between processing a regular JSF request and an Ajax request with a filter. With the regular JSF request, the whole JSF tree is encoded. With the Ajax request, the filter parses the content of an Ajax response before sending it to the client side, and encoding depends on the size of the Ajax region.
</para>
<figure id="figu-Developer_Guide-RichFaces_overview-Request_processing_sequences">
<title>Request processing sequences</title>
@@ -78,12 +78,9 @@
</para>
</textobject>
</mediaobject>
- <para>
- With the regular JSF request, the whole JSF tree is encoded. With the Ajax request, the filter parses the content of an Ajax response before sending it to the client side, and encoding depends on the size of the Ajax region.
- </para>
</figure>
<para>
- Both with and without a filter, the required static or dynamic resources that your application requests are registered in the <classname>ResourseBuilder</classname> class. <xref linkend="figu-Developer_Guide-RichFaces_overview-Resource_request_sequence" /> shows the differences in resource requests for a regular JSF request and an Ajax request with a filter.
+ Both with and without a filter, the required static or dynamic resources that your application requests are registered in the <classname>ResourseBuilder</classname> class. <xref linkend="figu-Developer_Guide-RichFaces_overview-Resource_request_sequence" /> shows the differences in resource requests for a regular JSF request and an Ajax request with a filter. When a request for a resource occurs, the RichFaces filter checks the <classname>ResourceCache</classname> for the resource. If the resource is in the cache, it is sent to the client. Otherwise, the filter searches for the resource among those that are registered by the <classname>ResourceBuilder</classname>. If the resource is registered, the RichFaces filter will send a request to the <classname>ResourceBuilder</classname> to deliver the resource.
</para>
<figure id="figu-Developer_Guide-RichFaces_overview-Resource_request_sequence">
<title>Resource request sequence</title>
@@ -97,9 +94,6 @@
</para>
</textobject>
</mediaobject>
- <para>
- When a request for a resource occurs, the RichFaces filter checks the <classname>ResourceCache</classname> for the resource. If the resource is in the cache, it is sent to the client. Otherwise, the filter searches for the resource among those that are registered by the <classname>ResourceBuilder</classname>. If the resource is registered, the RichFaces filter will send a request to the <classname>ResourceBuilder</classname> to deliver the resource.
- </para>
</figure>
</section>
<section id="sect-Developer_Guide-RichFaces_overview-Ajax_Action_Components">
14 years, 10 months
JBoss Rich Faces SVN: r16388 - branches/community/3.3.X/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-02-01 14:16:08 -0500 (Mon, 01 Feb 2010)
New Revision: 16388
Modified:
branches/community/3.3.X/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
Log:
RF-8304
Modified: branches/community/3.3.X/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
--- branches/community/3.3.X/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2010-02-01 16:28:29 UTC (rev 16387)
+++ branches/community/3.3.X/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2010-02-01 19:16:08 UTC (rev 16388)
@@ -63,6 +63,7 @@
this.container = new ClientUI.common.box.Box(childs[i], null, true);
this.container.makeAbsolute();
this.container.setStyle({'z-index' : 20});
+ this.container.moveTo(0, 0);
if(!ClientUILib.isIE) this.container.setStyle({overflow: 'hidden'});
break;
}
@@ -103,6 +104,7 @@
if(ch.tagName && ch.tagName.toLowerCase()=="table") {
this.templFrozen = new ClientUI.common.box.Box($(ch), null, true);
this.templFrozen.makeAbsolute();
+ this.templFrozen.moveTo(0, 0);
break;
}
ch = ch.nextSibling;
14 years, 10 months
JBoss Rich Faces SVN: r16387 - root/framework/trunk/impl/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-02-01 11:28:29 -0500 (Mon, 01 Feb 2010)
New Revision: 16387
Modified:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js
Log:
RF-8337
comment unnecessary code.
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js 2010-02-01 15:17:28 UTC (rev 16386)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js 2010-02-01 16:28:29 UTC (rev 16387)
@@ -492,7 +492,10 @@
};
richfaces.ajax = function(source, event, options) {
- options = options || {};
+
+ jsf.ajax.request(source, event, options);
+
+ /*options = options || {};
var sourceId = (typeof source == 'object' && source.id) ? source.id : source;
parameters = options.parameters || {};
@@ -540,6 +543,7 @@
}
jsf.ajax.request(source, event, parameters);
+ */
};
var RICHFACES_AJAX_STATUS = "richfaces:ajaxStatus";
14 years, 10 months
JBoss Rich Faces SVN: r16386 - in root/cdk/trunk/plugins/generator/src: main/java/org/richfaces/cdk/templatecompiler/model and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-02-01 10:17:28 -0500 (Mon, 01 Feb 2010)
New Revision: 16386
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/model/CompositeInterface.java
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-composite.xsd
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-jstl-core.xsd
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd
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/model/TemplateTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml
Log:
https://jira.jboss.org/jira/browse/RF-7732
https://jira.jboss.org/jira/browse/RFPL-364
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-02-01 14:39:56 UTC (rev 16385)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-02-01 15:17:28 UTC (rev 16386)
@@ -153,6 +153,11 @@
renderer.setRendererClass(new ClassDescription(compositeInterface.getJavaClass()));
renderer.setTemplate(template);
+ Boolean rendersChildren = compositeInterface.getRendersChildren();
+ if (rendersChildren != null) {
+ renderer.setRendersChildren(rendersChildren.booleanValue());
+ }
+
Map<String, Property> rendererAttributes = renderer.getAttributes();
List<ImportAttributes> attributesImports = compositeInterface.getAttributesImports();
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java 2010-02-01 14:39:56 UTC (rev 16385)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java 2010-02-01 15:17:28 UTC (rev 16386)
@@ -57,7 +57,7 @@
private String rendererType;
- private boolean rendersChildren = true;
+ private Boolean rendersChildren = null;
/**
* <p class="changed_added_4_0"></p>
@@ -199,16 +199,15 @@
*
* @return the rendersChildren
*/
- //TODO: add handling
@XmlElement(name = "renders-children", namespace = Template.CDK_NAMESPACE)
- public boolean isRendersChildren() {
+ public Boolean getRendersChildren() {
return rendersChildren;
}
/**
* @param rendersChildren the rendersChildren to set
*/
- public void setRendersChildren(boolean rendersChildren) {
+ public void setRendersChildren(Boolean rendersChildren) {
this.rendersChildren = rendersChildren;
}
Modified: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-composite.xsd
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-composite.xsd 2010-02-01 14:39:56 UTC (rev 16385)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-composite.xsd 2010-02-01 15:17:28 UTC (rev 16386)
@@ -34,36 +34,48 @@
<xs:attribute name="displayName">
<xs:annotation>
<xs:documentation>
+ <p>
The name to display in a tool palette containing
this component. The
value of this attribute will be set as the value
for this property
on the composite component bean descriptor.
+ </p>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="preferred" type="xs:boolean" default="false">
<xs:annotation>
- <xs:documentation>Is this a "preferred" component. The value of this
+ <xs:documentation>
+ <p>
+ Is this a "preferred" component. The value of this
attribute will be set as the value for this property on the
- composite component bean descriptor.</xs:documentation>
+ composite component bean descriptor.
+ </p>
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="expert" type="xs:boolean" default="false">
<xs:annotation>
- <xs:documentation>Is this component only for expert users? The value
+ <xs:documentation>
+ <p>
+ Is this component only for expert users? The value
of this attribute will be set as the value for this property on the
- composite component bean descriptor.</xs:documentation>
+ composite component bean descriptor.
+ </p>
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="shortDescription">
<xs:annotation>
<xs:documentation>
+ <p>
A short description of the purpose of this
component. The value of
this attribute will be set as the value for
this property on the
composite component bean descriptor.
+ </p>
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -74,6 +86,7 @@
<xs:attribute name="name" use="required">
<xs:annotation>
<xs:documentation>
+ <p>
The name of the attribute as it must appear on the
composite component
tag in the using page. If the value of the name
@@ -89,12 +102,14 @@
present, must be ignored as its value is derived as
described in
retargetMethodExpressions().
+ </p>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="targets">
<xs:annotation>
<xs:documentation>
+ <p>
If this element has a method-signature attribute, the value of the
targets attribute must be interpreted as a space (not tab)
separated list of client ids (relative to the top level
@@ -112,25 +127,30 @@
of the special values listed in the description of the name
attribute, targets (or its derived value) need not correspond to
the id of an inner component.
- </xs:documentation>
+ </p>
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="default">
<xs:annotation>
<xs:documentation>
+ <p>
If this attribute is not required, and a value is
not supplied by the
page author, use this as the default value.
- </xs:documentation>
+ </p>
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="required" type="xs:boolean"
default="false">
<xs:annotation>
<xs:documentation>
+ <p>
True if the page author must supply a value for
this attribute.
- </xs:documentation>
+ </p>
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="method-signature">
@@ -195,18 +215,15 @@
<xs:attribute name="type">
<xs:annotation>
<xs:documentation>
- Declares that this attribute must be a ValueExpression whose
- expected type
- is given by the value of this attribute. If not
- specified, and no
- "method-signature" attribute is present,
- java.lang.Object is
- assumed. This attribute is mutually exclusive
- with the "type"
- attribute. If both attributes are present, the
- "method-signature"
- attribute is ignored.
- </xs:documentation>
+ <p>
+ Declares that this attribute must be a <code>ValueExpression</code> whose expected type
+ is given by the value of this attribute. If not specified, and no
+ "method-signature" attribute is present, <code>java.lang.Object</code> is
+ assumed. This attribute is mutually exclusive with the "type"
+ attribute. If both attributes are present, the "method-signature"
+ attribute is ignored.
+ </p>
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup ref="cc:beanDescriptorAttributes" />
@@ -216,7 +233,9 @@
<xs:attribute name="event">
<xs:annotation>
<xs:documentation>
+ <p>
Names of the logical event supported by the component
+ </p>
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -224,8 +243,10 @@
<xs:attribute name="default" type="xs:boolean">
<xs:annotation>
<xs:documentation>
- Boolean attribute defining whether the specified logical event is the
- default component event
+ <p>
+ Boolean attribute defining whether the specified logical event is the
+ default component event
+ </p>
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -261,26 +282,23 @@
<xs:attribute type="xs:string" name="name">
<xs:annotation>
<xs:documentation>
- The name of this composite component. Advisory
- only. The real name is
- taken from the filename. The value of this
- attribute will be set as
- the value for this property on the
- composite component bean
- descriptor.
+ <p>
+ The name of this composite component. Advisory only. The real name is
+ taken from the filename. The value of this attribute will be set as
+ the value for this property on the composite component bean descriptor.
+ </p>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute type="xs:string" name="componentType">
<xs:annotation>
<xs:documentation>
- The component-type of the UIComponent that will
- serve as the composite
- component root for this composite
- component.
- The declared
- component-family for this component must be
- javax.faces.NamingContainer.
+ <p>
+ The <code>component-type</code> of the <code>UIComponent</code> that will serve
+ as the composite component root for this composite component.
+ The declared <code>component-family</code> for this component must be
+ <code>javax.faces.NamingContainer</code>.
+ </p>
</xs:documentation>
</xs:annotation>
</xs:attribute>
Modified: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-jstl-core.xsd
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-jstl-core.xsd 2010-02-01 14:39:56 UTC (rev 16385)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-jstl-core.xsd 2010-02-01 15:17:28 UTC (rev 16386)
@@ -31,7 +31,7 @@
<xs:annotation>
<xs:documentation>
- Subset of JSTL core tags supported by RichFaces CDK.
+ Subset of JSTL 1.2 core library supported by RichFaces CDK.
</xs:documentation>
</xs:annotation>
@@ -39,7 +39,13 @@
<xs:attributeGroup name="testGroup">
<xs:attribute name="test" form="unqualified" use="required"
- type="cdk:elStrictExpression" />
+ type="cdk:elStrictExpression">
+ <xs:annotation>
+ <xs:documentation>
+ <p>The test condition that determines whether or not the body content should be processed.</p>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:attributeGroup>
<xs:complexType name="arbitraryContent" mixed="true">
@@ -56,22 +62,75 @@
</xs:complexContent>
</xs:complexType>
- <xs:element name="if" type="arbitraryConditionalContent" />
+ <xs:element name="if" type="arbitraryConditionalContent">
+ <xs:annotation>
+ <xs:documentation>
+ <p>Simple conditional tag, which evalutes its body if the supplied condition is true
+ and optionally exposes a Boolean scripting variable representing the evaluation of
+ this condition</p>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
<xs:element name="choose">
+ <xs:annotation>
+ <xs:documentation>
+ <p>Simple conditional tag that establishes a context for mutually exclusive conditional
+ operations, marked by <code><![CDATA[<c:when>]]></code> and <code><![CDATA[<c:otherwise>]]></code>
+ tags.</p>
+ </xs:documentation>
+ </xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="when"
- type="arbitraryConditionalContent" />
- <xs:element minOccurs="0" name="otherwise" type="arbitraryContent" />
+ type="arbitraryConditionalContent">
+ <xs:annotation>
+ <xs:documentation>
+ <p>Subtag of <code><![CDATA[<c:choose>]]></code> that includes its body if its condition
+ evaluates to 'true'.</p>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" name="otherwise" type="arbitraryContent">
+ <xs:annotation>
+ <xs:documentation>
+ <p>Subtag of <code><![CDATA[<c:choose>]]></code> that follows tags and runs only if
+ all of the prior conditions evaluated to 'false'.</p>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="forEach">
+ <xs:annotation>
+ <xs:documentation>
+ <p>The basic iteration tag, accepting many different collection types and supporting subsetting
+ and other functionality.</p>
+ <p>
+ <span class="warning">Support for this tag is not currently implemented.</span>
+ </p>
+ </xs:documentation>
+ </xs:annotation>
+
<xs:complexType>
<xs:complexContent>
<xs:extension base="arbitraryContent">
- <xs:attribute name="items" type="cdk:elStrictExpression" />
- <xs:attribute name="var" type="cdk:literalExpression" />
+ <xs:attribute name="items" type="cdk:elStrictExpression">
+ <xs:annotation>
+ <xs:documentation>
+ <p>Collection of items to iterate over.</p>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="var" type="cdk:literalExpression">
+ <xs:annotation>
+ <xs:documentation>
+ <p>Name of the exported scoped variable for the current item of the iteration.
+ This scoped variable has nested visibility. Its type depends on the object
+ of the underlying collection.</p>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
<!--
<xs:attribute name="begin" type="cdk:elFreeformExpression" default="0" />
Modified: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd 2010-02-01 14:39:56 UTC (rev 16385)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd 2010-02-01 15:17:28 UTC (rev 16386)
@@ -216,6 +216,8 @@
<xs:element name="renders-children" type="xs:boolean">
<xs:annotation>
<xs:documentation>
+ <p>Indicating whether generated renderer is responsible for rendering the children of the component
+ it is asked to render.</p>
<p><span class="usage">Should be used within cc:interface element.</span></p>
</xs:documentation>
</xs:annotation>
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-02-01 14:39:56 UTC (rev 16385)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-02-01 15:17:28 UTC (rev 16386)
@@ -270,6 +270,7 @@
assertEquals(new ClassDescription("org.richfaces.renderkit.html.BasicRendererImpl"), renderer
.getRendererClass());
+ assertFalse(renderer.isRendersChildren());
}
@Test
@@ -285,6 +286,7 @@
assertEquals(new ClassDescription("org.richfaces.renderkit.html.DummyRendererImpl"), renderer
.getRendererClass());
+ assertTrue(renderer.isRendersChildren());
assertEquals("org.richfaces.Dummy", renderer.getFamily());
assertSame(template, renderer.getTemplate());
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java 2010-02-01 14:39:56 UTC (rev 16385)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java 2010-02-01 15:17:28 UTC (rev 16386)
@@ -173,13 +173,14 @@
assertEquals("org.richfaces.TreeFamily", interfaceSection.getComponentFamily());
assertEquals("org.richfaces.TreeRenderer", interfaceSection.getRendererType());
assertEquals("RF4_XHTML", interfaceSection.getRenderKitId());
- assertFalse(interfaceSection.isRendersChildren());
+ assertEquals(Boolean.FALSE, interfaceSection.getRendersChildren());
}
@Test
public void testAttributes() throws Exception {
Template template = unmarshal(Template.class, TEMPLATE_PROLOG +
+ "<cdk:renders-children>true</cdk:renders-children>" +
"<cc:attribute name=\"onclick\" />" +
"<cc:attribute name=\"mode\" default=\"ajax\" />" +
"<cc:attribute name=\"action\" method-signature=\"void action()\" />" +
@@ -325,6 +326,8 @@
assertNotNull(clientBehavior);
assertEquals("valueChange", clientBehavior.getEvent());
assertTrue(clientBehavior.isDefaultEvent());
+
+ assertEquals(Boolean.TRUE, interfaceSection.getRendersChildren());
}
@Test
@@ -341,6 +344,8 @@
CompositeInterface interfaceSection = template.getInterface();
assertNotNull(interfaceSection);
+ assertNull(interfaceSection.getRendersChildren());
+
List<ResourceDependency> resourceDependencies = interfaceSection.getResourceDependencies();
assertNotNull(resourceDependencies);
assertEquals(3, resourceDependencies.size());
Modified: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml 2010-02-01 14:39:56 UTC (rev 16385)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml 2010-02-01 15:17:28 UTC (rev 16386)
@@ -8,6 +8,7 @@
<cdk:class>org.richfaces.renderkit.html.DummyRendererImpl</cdk:class>
<cdk:component-family>org.richfaces.Dummy</cdk:component-family>
<cdk:renderkit-id>org.richfaces.CUSTOM_RENDERKIT</cdk:renderkit-id>
+ <cdk:renders-children>true</cdk:renders-children>
<cc:attribute name="onclick">
<cc:clientBehavior event="click" />
14 years, 10 months
JBoss Rich Faces SVN: r16385 - root/examples/trunk/richfaces-demo/src/main/webapp/templates.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-02-01 09:39:56 -0500 (Mon, 01 Feb 2010)
New Revision: 16385
Modified:
root/examples/trunk/richfaces-demo/src/main/webapp/templates/main.xhtml
Log:
Modified: root/examples/trunk/richfaces-demo/src/main/webapp/templates/main.xhtml
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/webapp/templates/main.xhtml 2010-02-01 06:44:17 UTC (rev 16384)
+++ root/examples/trunk/richfaces-demo/src/main/webapp/templates/main.xhtml 2010-02-01 14:39:56 UTC (rev 16385)
@@ -7,20 +7,53 @@
</h:head>
<h:body>
<ui:composition>
- <rich:page id="page">
- <f:facet name="header">
- <h1>Welcome to RichFaces demo!</h1>
- </f:facet>
- <f:facet name="sidebar">
- <ui:include src="/templates/includes/navigation.xhtml" />
- </f:facet>
- <ui:insert name="body">
- Body content missed
- </ui:insert>
- <f:facet name="footer">
- footer
- </f:facet>
- </rich:page>
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <h:head>
+ <title>Components Gallery</title>
+ </h:head>
+ <h:body>
+ <h:outputStylesheet name="rich/css/page.css" />
+ <table border="0" cellpadding="0" cellspacing="0"
+ class="rich-page #{cc.attrs.pageClass}">
+ <tbody>
+ <tr>
+ <td class="header_bg">
+ <div
+ class="header_content rich-page-header #{cc.attrs.headerClass}">
+ <h1>Welcome to RichFaces demo!</h1>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td width="100%" height="100%" class="bg_tabbody">
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"
+ height="100%" class="rich-page-content #{cc.attrs.contentClass}">
+ <tbody>
+ <tr>
+ <td class="menu_col rich-page-sidebar #{cc.attrs.sidebarClass}">
+ <div class="menu_width spacer"
+ style="width:#{cc.attrs.sidebarWidth}px"></div>
+ <ui:include src="/templates/includes/navigation.xhtml" /></td>
+ <td class="content_col rich-page-body #{cc.attrs.bodyClass}">
+ <ui:insert name="body">
+ Body content missed
+ </ui:insert></td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td class="footer_bg">
+ <div
+ class="footer_bg_content rich-page-footer #{cc.attrs.footerClass}">
+ footer</div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </h:body>
+ </html>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
14 years, 10 months
JBoss Rich Faces SVN: r16384 - in root/docs/trunk/Developer_Guide/en-US: images and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-02-01 01:44:17 -0500 (Mon, 01 Feb 2010)
New Revision: 16384
Added:
root/docs/trunk/Developer_Guide/en-US/images/figu-Developer_Guide-RichFaces_overview-Request_processing_flow.png
root/docs/trunk/Developer_Guide/en-US/images/figu-Developer_Guide-RichFaces_overview-Request_processing_sequences.png
root/docs/trunk/Developer_Guide/en-US/images/figu-Developer_Guide-RichFaces_overview-Resource_request_sequence.png
Modified:
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml
Log:
Worked on RichFaces Overview and Getting Started
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml 2010-01-31 23:27:26 UTC (rev 16383)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml 2010-02-01 06:44:17 UTC (rev 16384)
@@ -7,34 +7,289 @@
<chapter id="chap-Developer_Guide-Getting_started_with_RichFaces">
<title>Getting started with RichFaces</title>
<para>
- Incomplete
+ Follow the instructions in this chapter to install and configure RichFaces for development. If you have existing projects that use an previous version of RichFaces, refer to the <citetitle>RichFaces 4.0 Migration Guide</citetitle>.
</para>
<section id="sect-Developer_Guide-Getting_started_with_RichFaces-Technical_Requirements">
<title>Technical Requirements</title>
<para>
- Incomplete
+ RichFaces has been developed with an open architecture to be compatible with a wide variety of environments. In addition to the RichFaces framework, you need the following frameworks, environments, and applications installed on your computer to start developing with RichFaces:
+ <variablelist>
+ <varlistentry>
+ <term>Java Development Kit (<acronym>JDK</acronym>)</term>
+ <listitem>
+ <para>
+ RichFaces supports the following JDK versions:
+ <itemizedlist>
+ <listitem>
+ <para>
+ JDK 1.5 and higher
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>JavaServer Faces (<acronym>JSF</acronym>)</term>
+ <listitem>
+ <para>
+ RichFaces supports the following JSF implementations and frameworks:
+ <itemizedlist>
+ <listitem>
+ <para>
+ Facelets 1.1.1 – 1.2
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ MyFaces 1.2.5
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Seam 1.2 – 2.1
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Sun JSF-RI 1.2_12
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>A Java application server or servlet container</term>
+ <listitem>
+ <para>
+ RichFaces supports the following servers:
+ <itemizedlist>
+ <listitem>
+ <para>
+ Apache Tomcat 5.5 – 6.0
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ BEA WebLogic 9.1 – 10.0
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ JBoss 4.2 – 5.0
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Jetty 6.1
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Geronimo 2.0 and higher
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Glassfish (J2EE 5)
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Resin 3.1
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Sun Application Server 9 (J2EE 1.5)
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Websphere 7.0 and higher
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>A web browser</term>
+ <listitem>
+ <para>
+ RichFaces supports the following web browsers:
+ <itemizedlist>
+ <title>Linux environments</title>
+ <listitem>
+ <para>
+ Firefox 3.0 and higher
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Google Chrome
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Opera 8.5 and higher
+ </para>
+ </listitem>
+ </itemizedlist>
+ <itemizedlist>
+ <title>Mac OS environments</title>
+ <listitem>
+ <para>
+ Firefox 3.5 and higher
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Google Chrome
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Safari 3.0 and higher
+ </para>
+ </listitem>
+ </itemizedlist>
+ <itemizedlist>
+ <title>Microsoft Windows environments</title>
+ <listitem>
+ <para>
+ Firefox 3.0 and higher
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Google Chrome
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Internet Explorer 6.0 and higher
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Opera 8.5 and higher
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Safari 3.0 and higher
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</para>
</section>
<section id="sect-Developer_Guide-Getting_started_with_RichFaces-Installing_RichFaces">
<title>Installing RichFaces</title>
<para>
- Incomplete
+ Follow the instructions in this section to install the RichFaces framework on your computer.
</para>
+ <section id="sect-Developer_Guide-Getting_started_with_RichFaces-Downloading_RichFaces">
+ <title>Downloading RichFaces</title>
+ <para>
+ Download RichFaces from the JBoss RichFaces Downloads area at <ulink url="http://www.jboss.org/richfaces/download.html">http://www.jboss.org/richfaces/download.html</ulink>. The binary files (available in <filename class="extension">.bin.zip</filename> or <filename class="extension">.bin.tar.gz</filename> archives) contain a compiled, ready-to-use version of RichFaces with a set of basic skins.
+ </para>
+ <para>
+ Create a new directory named <filename>RichFaces</filename>, then unzip the archive containing the binaries there.
+ </para>
+ <section id="sect-Developer_Guide-Getting_started_with_RichFaces-Compiling_the_source">
+ <title>Compiling the source</title>
+ <para>
+ Instead of downloading the pre-compiled binaries, you can download the source files and compile them yourself. Download the source files (also available in <filename class="extension">.bin.zip</filename> or <filename class="extension">.bin.tar.gz</filename> archives) from the JBoss RichFaces Downloads area at <ulink url="http://www.jboss.org/richfaces/download.html">http://www.jboss.org/richfaces/download.html</ulink>.
+ </para>
+ </section>
+ </section>
+
</section>
- <section id="sect-Developer_Guide-Getting_started_with_RichFaces-Configuration">
- <title>Configuration</title>
- <para>
- Incomplete
- </para>
- </section>
-
<section id="sect-Developer_Guide-Getting_started_with_RichFaces-Creating_a_project">
<title>Creating a project</title>
<para>
- Incomplete
+ Follow the procedure in this section to create a new RichFaces application with <application>JBoss Tools</application>.
</para>
+ <procedure>
+ <step>
+ <title>Create a new project</title>
+ <para>In <application>JBoss Tools</application>, select <menuchoice><guimenu>File</guimenu><guimenu>New</guimenu><guimenuitem>JSF Project</guimenuitem></menuchoice></para> from the menu. Name the project, select <guilabel>JSF 2</guilabel> from the <guilabel>JSF Environment</guilabel> drop-down box, and click the <guibutton>Finish</guibutton> button to create the project.
+ </step>
+ <step>
+ <title>Add the RichFaces libraries to the project</title>
+ <para>Add <filename>core-ui.jar</filename>, <filename>richfaces-api.jar</filename>, and <filename>richfaces-impl.jar</filename> into your project by dragging them from the location where you unzipped the RichFaces archive to the <filename>WebContent/WEB-INF/lib/</filename> directory of your project in <application>JBoss Tools</application>.</para>
+ <note>
+ <title>Other required libraries</title>
+ <para>
+ RichFaces also requires the following libraries to be referenced in your project. Typically they are already included when creating a JSF project in <application>JBoss Tools</application>.
+ <itemizedlist>
+ <listitem>
+ <para>
+ <filename>commons-beanutils.jar</filename>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <filename>commons-collections.jar</filename>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <filename>commons-digester.jar</filename>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <filename>commons-logging.jar</filename>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <filename>jhighlight.jar</filename>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </note>
+ </step>
+ <step>
+ <title>Reference the tag libraries</title>
+ <para>The RichFaces tag libraries need to be referenced on each JSP and XHTML page in your project.</para>
+ <variablelist>
+ <varlistentry>
+ <term>Referencing in JSP pages</term>
+ <listitem>
+<programlisting language="XML" role="XML"><%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+</programlisting>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Referencing in XHTML pages</term>
+ <listitem>
+<programlisting language="XML" role="XML"><ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+ ...
+</ui:composition>
+</programlisting>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </step>
+ </procedure>
+ <para>
+ You are now ready to begin building your RichFaces applications.
+ </para>
</section>
</chapter>
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml 2010-01-31 23:27:26 UTC (rev 16383)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml 2010-02-01 06:44:17 UTC (rev 16384)
@@ -7,13 +7,125 @@
<chapter id="chap-Developer_Guide-RichFaces_overview">
<title>RichFaces overview</title>
<para>
- Incomplete
+ The RichFaces framework is a component library which adds Ajax capability into existing pages, such that you don't need to write any extra JavaScript code or replace any existing components with new Ajax widgets. RichFaces also enables page-wide Ajax support instead of the traditional component-wide support. Events can be defined on pages that invoke Ajax requests. After an Ajax request, the areas of a page that are synchronized with the JSF Component Tree can themselves change data on the server according to events fired on the client.
</para>
+ <para>
+ <xref linkend="figu-Developer_Guide-RichFaces_overview-Request_processing_flow" /> illustrates how requests are processed in the RichFaces framework.
+ </para>
+ <figure id="figu-Developer_Guide-RichFaces_overview-Request_processing_flow">
+ <title>Request processing flow</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Developer_Guide-RichFaces_overview-Request_processing_flow.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ The RichFaces request processing flow.
+ </para>
+ </textobject>
+ </mediaobject>
+ </figure>
+ <para>
+ Using JSF tags, RichFaces allows different parts of a JSF page to be updated with an Ajax request. JSF pages using RichFaces do not change from "regular" JSF pages, and additional JavaScript or XMLHTTPRequest objects do not need to be written.
+ </para>
<section id="sect-Developer_Guide-RichFaces_overview-Architecture">
<title>Architecture</title>
<para>
- Incomplete
+ The important elements of the RichFaces framework are as follows:
+ <itemizedlist>
+ <listitem>
+ <para>
+ Ajax Filter
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Ajax Action Components
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Ajax Containers
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Skins and Theming
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ RichFaces JavaScript Engine
+ </para>
+ </listitem>
+ </itemizedlist>
+ Read this section for details on each element.
</para>
+ <section id="sect-Developer_Guide-RichFaces_overview-Ajax_Filter">
+ <title>Ajax Filter</title>
+ <para>
+ To get all benefits of RichFaces, a filter should be registered in the <filename>web.xml</filename> file of your application. The filter recognizes multiple request types. Filter configuration is covered in detail in <xref linkend="sect-Developer_Guide-Advanced_features-Filters" />. <xref linkend="figu-Developer_Guide-RichFaces_overview-Request_processing_sequences" /> shows the difference between processing a regular JSF request and an Ajax request with a filter.
+ </para>
+ <figure id="figu-Developer_Guide-RichFaces_overview-Request_processing_sequences">
+ <title>Request processing sequences</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Developer_Guide-RichFaces_overview-Request_processing_sequences.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ The difference between processing a regular JSF request and an Ajax request with a filter.
+ </para>
+ </textobject>
+ </mediaobject>
+ <para>
+ With the regular JSF request, the whole JSF tree is encoded. With the Ajax request, the filter parses the content of an Ajax response before sending it to the client side, and encoding depends on the size of the Ajax region.
+ </para>
+ </figure>
+ <para>
+ Both with and without a filter, the required static or dynamic resources that your application requests are registered in the <classname>ResourseBuilder</classname> class. <xref linkend="figu-Developer_Guide-RichFaces_overview-Resource_request_sequence" /> shows the differences in resource requests for a regular JSF request and an Ajax request with a filter.
+ </para>
+ <figure id="figu-Developer_Guide-RichFaces_overview-Resource_request_sequence">
+ <title>Resource request sequence</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Developer_Guide-RichFaces_overview-Resource_request_sequence.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ The difference between resource requests for a regular JSF request and an Ajax request with a filter.
+ </para>
+ </textobject>
+ </mediaobject>
+ <para>
+ When a request for a resource occurs, the RichFaces filter checks the <classname>ResourceCache</classname> for the resource. If the resource is in the cache, it is sent to the client. Otherwise, the filter searches for the resource among those that are registered by the <classname>ResourceBuilder</classname>. If the resource is registered, the RichFaces filter will send a request to the <classname>ResourceBuilder</classname> to deliver the resource.
+ </para>
+ </figure>
+ </section>
+ <section id="sect-Developer_Guide-RichFaces_overview-Ajax_Action_Components">
+ <title>Ajax Action Components</title>
+ <para>
+ The RichFaces framework includes several Ajax Action Components: <sgmltag><a4j:commandButton></sgmltag>, <sgmltag><a4j:commandLink></sgmltag>, <sgmltag><a4j:poll></sgmltag>, <sgmltag><a4j:ajax></sgmltag>, and more. Use Ajax Action Components to send Ajax requests from the client side.
+ </para>
+ </section>
+ <section id="sect-Developer_Guide-RichFaces_overview-Ajax_Containers">
+ <title>Ajax Containers</title>
+ <para>
+ <classname>AjaxContainer</classname> is an interface that describes an area on a JSF page that is decoded during an Ajax request. <classname>AjaxViewRoot</classname> and <classname>AjaxRegion</classname> are implementations of this interface.
+ </para>
+ </section>
+ <section id="sect-Developer_Guide-RichFaces_overview-Skins_and_Theming">
+ <title>Skins and Theming</title>
+ <para>
+
+ </para>
+ </section>
+ <section id="sect-Developer_Guide-RichFaces_overview-RichFaces_JavaScript_Engine">
+ <title>RichFaces JavaScript Engine</title>
+ <para>
+ The RichFaces JavaScript Engine runs on the client side. It can update different areas on a JSF page based on an Ajax response. It is not necessary to use the JavaScript code directly, as it is available automatically.
+ </para>
+ </section>
</section>
<section id="sect-Developer_Guide-RichFaces_overview-Technologies">
@@ -33,7 +145,34 @@
<section id="sect-Developer_Guide-RichFaces_overview-Restrictions">
<title>Restrictions</title>
<para>
- Incomplete
+ The following restrictions apply to applications implementing the RichFaces framework:
+ <itemizedlist>
+ <listitem>
+ <para>
+ Any Ajax framework should not append or delete elements on a page, but should instead replace them. For successful updates, an element with the same identifier as in the response must exist on the page. If it is necessary to append code to a page, include a placeholder for it (an empty element). For the same reason, it is recommended that messages be placed in the <sgmltag><a4j:outputPanel></sgmltag> component.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <sgmltag><f:verbatim></sgmltag> should not be used for self-rendered containers, since it is transient and not saved in the tree.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Ajax requests are made by XMLHTTPRequest functions in XML format, but this XML bypasses most validations and the corrections that might be made in a browser. As such, a strict standards-compliant code for HTML and XHTML should be used, without skipping any required elements or attributes. Any necessary XML corrections are automatically made by the XML filter on the server, but unexpected effects can be produced through incorrect HTML code.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The RichFaces <classname>ViewHandler</classname> puts itself in front of the Facelets <classname>ViewHandlers</classname> chain.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ RichFaces components uses their own renderers. In the <emphasis>Render Response Phase</emphasis>, the RichFaces framework makes a traversal of the component tree, calls its own renderer, and passes the result to the Faces Response.
+ </para>
+ </listitem>
+ </itemizedlist>
</para>
</section>
Added: root/docs/trunk/Developer_Guide/en-US/images/figu-Developer_Guide-RichFaces_overview-Request_processing_flow.png
===================================================================
(Binary files differ)
Property changes on: root/docs/trunk/Developer_Guide/en-US/images/figu-Developer_Guide-RichFaces_overview-Request_processing_flow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/docs/trunk/Developer_Guide/en-US/images/figu-Developer_Guide-RichFaces_overview-Request_processing_sequences.png
===================================================================
(Binary files differ)
Property changes on: root/docs/trunk/Developer_Guide/en-US/images/figu-Developer_Guide-RichFaces_overview-Request_processing_sequences.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/docs/trunk/Developer_Guide/en-US/images/figu-Developer_Guide-RichFaces_overview-Resource_request_sequence.png
===================================================================
(Binary files differ)
Property changes on: root/docs/trunk/Developer_Guide/en-US/images/figu-Developer_Guide-RichFaces_overview-Resource_request_sequence.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 10 months