Author: Alex.Kolonitsky
Date: 2010-03-18 10:46:00 -0400 (Thu, 18 Mar 2010)
New Revision: 16601
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java 2010-03-18
14:40:34 UTC (rev 16600)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java 2010-03-18
14:46:00 UTC (rev 16601)
@@ -25,36 +25,33 @@
package org.richfaces.cdk.freemarker;
-import java.io.File;
-import java.io.IOException;
-import java.io.Writer;
-
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.CdkWriter;
import org.richfaces.cdk.FileManager;
import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.model.LibraryVisitor;
import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.Trackable;
-import org.richfaces.cdk.model.Visitable;
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
/**
* <p class="changed_added_4_0">Base class for all output file buildes
that use FreeMarker as template engine.</p>
* @author asmirnov(a)exadel.com
*
*/
-public abstract class FreeMarkerRenderer<C extends Visitable, P> implements
CdkWriter, LibraryVisitor<Boolean, P> {
+public abstract class FreeMarkerRenderer<C> implements CdkWriter {
+ protected final ComponentLibrary library;
+
private final Configuration configuration;
private final Template template;
- private final ComponentLibrary library;
-
private final FileManager output;
public FreeMarkerRenderer(Configuration configuration, ComponentLibrary library,
FileManager output) {
@@ -69,25 +66,7 @@
}
}
- @Override
- public void render() throws CdkException {
- library.accept(this, getVisitorParameter());
- }
-
- private P getVisitorParameter() {
- return null;
- }
-
- @Override
- public Boolean visit(Visitable c, P param) throws CdkException {
- if (isMyComponent(c)) {
- processComponent((C) c, param);
- }
-
- return null;
- }
-
- protected boolean processComponent(C c, P param) throws CdkException {
+ public void generate(C c) throws CdkException {
try {
Writer out = getOutput(c);
@@ -98,8 +77,6 @@
} catch (TemplateException e) {
throw new CdkException(e);
}
-
- return false;
}
protected Writer getOutput(C c) throws CdkException {
@@ -127,7 +104,6 @@
}
}
- protected abstract boolean isMyComponent(Visitable c);
-
protected abstract String getTemplateName();
+
}
Show replies by date