JBoss Rich Faces SVN: r15904 - in branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf: webapp and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-11-17 14:56:37 -0500 (Tue, 17 Nov 2009)
New Revision: 15904
Modified:
branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/resource/UserResource.java
branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java
Log:
https://jira.jboss.org/jira/browse/RF-8064
Modified: branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/resource/UserResource.java
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/resource/UserResource.java 2009-11-17 18:22:36 UTC (rev 15903)
+++ branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/resource/UserResource.java 2009-11-17 19:56:37 UTC (rev 15904)
@@ -108,6 +108,13 @@
OutputStream out = context.getOutputStream();
MethodExpression send = (MethodExpression) UIComponentBase.restoreAttachedState(facesContext,data.createContent);
send.invoke(elContext,new Object[]{out,data.value});
+ try{
+ // https://jira.jboss.org/jira/browse/RF-8064
+ out.flush();
+ out.close();
+ } catch (IOException e) {
+ // Ignore it, stream would be already closed by user bean.
+ }
}
}
Modified: branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java 2009-11-17 18:22:36 UTC (rev 15903)
+++ branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java 2009-11-17 19:56:37 UTC (rev 15904)
@@ -251,6 +251,8 @@
};
}
+// filledOutputStream = true;
+// content = null;
return servletStream;
}
@@ -276,6 +278,8 @@
};
servletWriter = new PrintWriter(out);
}
+// filledOutputWriter = true;
+// writerContent = null;
return servletWriter;
}
15 years, 1 month
JBoss Rich Faces SVN: r15903 - in root/cdk/trunk/plugins/generator/src: main/java/org/richfaces/builder/model and 11 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-11-17 13:22:36 -0500 (Tue, 17 Nov 2009)
New Revision: 15903
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBodyStatementImpl.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/AbstractTemplateMethodBodyStatement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/AbstractTemplateMethodBodyStatementsContainer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/EncodeMethodPrefaceStatement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/EndElementStatement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/ForEachStatement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/IfElseStatement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/IfStatement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RenderingContext.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/StartElementStatement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/WriteAttributeStatement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/WriteTextStatement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkForEachElement.java
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/class.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/encode-method-preface.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/end-element.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/for-each.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/if-else.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/start-element.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/write-attribute.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/write-text.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/method.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/object.ftl
Removed:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/builder/render/
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/TemplateReaderTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/template-simple.xml
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/template.xml
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/JavaLanguageElement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/JavaMethod.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBody.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBodyStatement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBodyStatementsContainer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/render/JavaLanguageElementRenderer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/render/JavaMethodRenderer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkBodyElement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkChooseElement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeImplementation.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ElementsHandler.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ModelFragment.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/TemplateVisitor.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/main/resources/META-INF/schema/xhtml-el.xsd
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
Log:
https://jira.jboss.org/jira/browse/RF-7732
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/JavaLanguageElement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/JavaLanguageElement.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/JavaLanguageElement.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -27,6 +27,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.TreeSet;
/**
*
@@ -34,7 +35,7 @@
*
*/
public class JavaLanguageElement {
- private Set<JavaModifier> modifiers = new HashSet<JavaModifier>();
+ private Set<JavaModifier> modifiers = new TreeSet<JavaModifier>();
private List<JavaComment> comments = new ArrayList<JavaComment>();
private List<JavaAnnotation> annotations = new ArrayList<JavaAnnotation>();
private String name;
@@ -83,4 +84,8 @@
public void addAnnotation(Class<?> annotation) {
annotations.add(new JavaAnnotation(annotation));
}
+
+ public void addComment(JavaComment comment) {
+ comments.add(comment);
+ }
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/JavaMethod.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/JavaMethod.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/JavaMethod.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -39,6 +39,7 @@
public JavaMethod(String name) {
super(name);
+
this.returnType = Void.TYPE;
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBody.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBody.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBody.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -23,18 +23,15 @@
package org.richfaces.builder.model;
-import java.util.ArrayList;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
/**
* @author Maksim Kaszynski
- *
+ * @author Nick Belaevski
*/
-public class MethodBody implements MethodBodyStatementsContainer {
+public class MethodBody extends MethodBodyStatementsContainer {
private Set<Class<?>> usedClasses = new HashSet<Class<?>>();
- private List<MethodBodyStatement> body = new ArrayList<MethodBodyStatement>();
private JavaMethod method;
public MethodBody() {}
@@ -52,22 +49,6 @@
this.method = method;
}
- public String toCode() {
- StringBuilder builder = new StringBuilder();
-
- for (MethodBodyStatement statement : body) {
- statement.appendTo(builder);
- }
-
- return builder.toString();
- }
-
- public void addToBody(MethodBodyStatement... argStatements) {
- for (MethodBodyStatement methodBodyStatement : argStatements) {
- body.add(methodBodyStatement);
- }
- }
-
public void addType(Class<?> clazz) {
usedClasses.add(clazz);
}
@@ -75,4 +56,5 @@
public Set<Class<?>> getUsedClasses() {
return usedClasses;
}
+
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBodyStatement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBodyStatement.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBodyStatement.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -1,77 +1,32 @@
-/**
- * License Agreement.
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * 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,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * 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
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-
-
-
package org.richfaces.builder.model;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* @author Nick Belaevski
- *
+ *
*/
-public class MethodBodyStatement implements MethodBodyStatementsContainer {
- private String end = null;
- private String start = null;
- private List<MethodBodyStatement> statements = new ArrayList<MethodBodyStatement>();
+public interface MethodBodyStatement {
- public MethodBodyStatement() {
- this(null);
- }
-
- public MethodBodyStatement(String expression) {
- this(expression, null);
- }
-
- public MethodBodyStatement(String start, String end) {
- super();
- this.start = start;
- this.end = end;
- }
-
- /**
- * @param builder
- */
- public void appendTo(StringBuilder builder) {
- if (start != null) {
- builder.append(start);
- builder.append('\n');
- }
-
- for (MethodBodyStatement statement : statements) {
- statement.appendTo(builder);
- builder.append('\n');
- }
-
- if (end != null) {
- builder.append(end);
- builder.append('\n');
- }
- }
-
- public void addToBody(MethodBodyStatement... argStatements) {
- for (MethodBodyStatement methodBodyStatement : argStatements) {
- statements.add(methodBodyStatement);
- }
- }
+ public String getCode();
+
}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBodyStatementImpl.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBodyStatementImpl.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBodyStatementImpl.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.builder.model;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class MethodBodyStatementImpl implements MethodBodyStatement {
+
+ private String code;
+
+ public MethodBodyStatementImpl(String code) {
+ super();
+ this.code = code;
+ }
+
+ @Override
+ public String getCode() {
+ return code;
+ }
+
+}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBodyStatementsContainer.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBodyStatementsContainer.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBodyStatementsContainer.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -23,10 +23,53 @@
package org.richfaces.builder.model;
+import java.util.ArrayList;
+import java.util.List;
+
+
/**
* @author Nick Belaevski
- *
+ * @since 4.0
*/
-public interface MethodBodyStatementsContainer {
- public void addToBody(MethodBodyStatement... s);
+public class MethodBodyStatementsContainer implements MethodBodyStatement {
+
+ private List<MethodBodyStatement> statements = new ArrayList<MethodBodyStatement>();
+
+ public List<MethodBodyStatement> getStatements() {
+ return statements;
+ }
+
+ public void addStatement(MethodBodyStatement statement) {
+ statements.add(statement);
+ }
+
+ public void addStatement(int index, MethodBodyStatement statement) {
+ statements.add(index, statement);
+ }
+
+ public void addStatement(String statementCode) {
+ addStatement(new MethodBodyStatementImpl(statementCode));
+ }
+
+ public void addStatement(int index, String statementCode) {
+ addStatement(index, new MethodBodyStatementImpl(statementCode));
+ }
+
+ public boolean isEmpty() {
+ return statements.isEmpty();
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.builder.model.MethodBodyStatement#getCode()
+ */
+ @Override
+ public String getCode() {
+ StringBuilder sb = new StringBuilder();
+ for (MethodBodyStatement statement: statements) {
+ sb.append(statement.getCode());
+ sb.append('\n');
+ }
+
+ return sb.toString();
+ }
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/render/JavaLanguageElementRenderer.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/render/JavaLanguageElementRenderer.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/render/JavaLanguageElementRenderer.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -25,6 +25,7 @@
import java.io.PrintWriter;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -46,7 +47,7 @@
}
public void renderModifiers(T element, PrintWriter out) {
- Set<JavaModifier> modifiers = element.getModifiers();
+ Collection<JavaModifier> modifiers = element.getModifiers();
for (JavaModifier javaModifier : modifiers) {
out.print(javaModifier);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/render/JavaMethodRenderer.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/render/JavaMethodRenderer.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/render/JavaMethodRenderer.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -24,13 +24,13 @@
package org.richfaces.builder.render;
import java.io.PrintWriter;
-
import java.util.Iterator;
import java.util.List;
import org.richfaces.builder.model.Argument;
import org.richfaces.builder.model.JavaMethod;
import org.richfaces.builder.model.MethodBody;
+import org.richfaces.builder.model.MethodBodyStatement;
/**
* @author Maksim Kaszynski
@@ -91,7 +91,10 @@
MethodBody methodBody = javaMethod.getMethodBody();
if (methodBody != null) {
- out.println(methodBody.toCode());
+ List<MethodBodyStatement> statements = methodBody.getStatements();
+ for (MethodBodyStatement methodBodyStatement : statements) {
+ out.println(methodBodyStatement.toString());
+ }
}
out.println("}");
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -327,7 +327,13 @@
static <K extends Key, T extends ModelElement<T, K>> void merge(Collection<T> target, Collection<T> source) {
for (T element : source) {
- T targetElement = find(target, element.getKey());
+ T targetElement = null;
+
+ try {
+ find(target, element.getKey());
+ } catch (NoSuchElementException e) {
+ // TODO: handle exception
+ }
if (null == targetElement) {
target.add(element);
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/AbstractTemplateMethodBodyStatement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/AbstractTemplateMethodBodyStatement.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/AbstractTemplateMethodBodyStatement.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler;
+
+import org.richfaces.builder.model.MethodBodyStatement;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class AbstractTemplateMethodBodyStatement implements MethodBodyStatement {
+
+ private String templateName;
+
+ protected AbstractTemplateMethodBodyStatement(String templateName) {
+ super();
+ this.templateName = templateName;
+ }
+
+ @Override
+ public String getCode() {
+ return RenderingContext.renderSnippet(templateName, this);
+ }
+
+}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/AbstractTemplateMethodBodyStatementsContainer.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/AbstractTemplateMethodBodyStatementsContainer.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/AbstractTemplateMethodBodyStatementsContainer.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler;
+
+import org.richfaces.builder.model.MethodBodyStatementsContainer;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class AbstractTemplateMethodBodyStatementsContainer extends MethodBodyStatementsContainer {
+
+ private String templateName;
+
+ protected AbstractTemplateMethodBodyStatementsContainer(String templateName) {
+ super();
+ this.templateName = templateName;
+ }
+
+ @Override
+ public String getCode() {
+ return RenderingContext.renderSnippet(templateName, this);
+ }
+
+}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/EncodeMethodPrefaceStatement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/EncodeMethodPrefaceStatement.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/EncodeMethodPrefaceStatement.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class EncodeMethodPrefaceStatement extends AbstractTemplateMethodBodyStatement {
+
+ /**
+ * @param templateName
+ */
+ public EncodeMethodPrefaceStatement() {
+ super("encode-method-preface");
+ }
+
+}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/EndElementStatement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/EndElementStatement.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/EndElementStatement.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class EndElementStatement extends StartElementStatement {
+
+ public EndElementStatement(String elementName) {
+ super("end-element", elementName);
+ }
+
+}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/ForEachStatement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/ForEachStatement.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/ForEachStatement.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class ForEachStatement extends AbstractTemplateMethodBodyStatementsContainer {
+
+ private String itemsExpression;
+
+ private String var;
+
+ private String varType;
+
+ public ForEachStatement(String itemsExpression,
+ String var, String varType) {
+ super("for-each");
+ this.itemsExpression = itemsExpression;
+ this.var = var;
+ this.varType = varType;
+ }
+
+ /**
+ * @return the itemsExpression
+ */
+ public String getItemsExpression() {
+ return itemsExpression;
+ }
+
+ /**
+ * @return the var
+ */
+ public String getVar() {
+ return var;
+ }
+
+ /**
+ * @return the varType
+ */
+ public String getVarType() {
+ return varType;
+ }
+
+}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/IfElseStatement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/IfElseStatement.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/IfElseStatement.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler;
+
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class IfElseStatement extends AbstractTemplateMethodBodyStatementsContainer {
+
+ public IfElseStatement() {
+ super("if-else");
+ }
+
+}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/IfStatement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/IfStatement.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/IfStatement.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler;
+
+import org.richfaces.builder.model.MethodBodyStatementsContainer;
+
+public final class IfStatement extends MethodBodyStatementsContainer {
+
+ private String test;
+
+ public IfStatement(String test) {
+ super();
+ this.test = test;
+ }
+
+ public String getTest() {
+ return test;
+ }
+}
\ No newline at end of file
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -24,20 +24,22 @@
package org.richfaces.cdk.templatecompiler;
import java.io.File;
-import java.io.FileNotFoundException;
+import java.io.IOException;
import java.io.PrintWriter;
import org.richfaces.builder.model.JavaClass;
-import org.richfaces.builder.render.JavaClassRenderer;
import org.richfaces.cdk.CdkContext;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.CdkWriter;
import org.richfaces.cdk.StandardOutputs;
+import org.richfaces.cdk.freemarker.CdkConfiguration;
import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.RenderKit;
import org.richfaces.cdk.model.Renderer;
-import org.richfaces.cdk.model.RenderKit;
import org.richfaces.cdk.templatecompiler.model.Template;
+import freemarker.template.TemplateException;
+
/**
* <p class="changed_added_4_0">
* </p>
@@ -74,7 +76,9 @@
// TODO - put real parameters.
RendererClassVisitor visitor = new RendererClassVisitor(
template.getInterface());
+ visitor.preProcess();
template.getImplementation().visit(visitor);
+ visitor.postProcess();
JavaClass javaClass = visitor.getRendererClass();
String fullName = javaClass.getFullName();
File outFile = context.createOutputFile(
@@ -83,11 +87,22 @@
+ ".java", library.lastModified());
if (null != outFile) {
+ PrintWriter outputWriter = null;;
try {
- new JavaClassRenderer().render(javaClass,
- new PrintWriter(outFile));
- } catch (FileNotFoundException e) {
+ outputWriter = new PrintWriter(outFile);
+
+ CdkConfiguration cdkConfiguration = new CdkConfiguration(context);
+ RenderingContext.setCdkConfiguration(cdkConfiguration);
+ RenderingContext.writeSnippet("class", javaClass, outputWriter);
+ } catch (IOException e) {
throw new CdkException(e);
+ } catch (TemplateException e) {
+ throw new CdkException(e);
+ } finally {
+ RenderingContext.setCdkConfiguration(null);
+ if (outputWriter != null) {
+ outputWriter.close();
+ }
}
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -26,18 +26,32 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
+import java.util.HashSet;
import java.util.LinkedList;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
+import javax.xml.namespace.QName;
+
+import org.richfaces.builder.model.Argument;
import org.richfaces.builder.model.JavaClass;
-import org.richfaces.builder.model.MethodBodyStatement;
+import org.richfaces.builder.model.JavaMethod;
+import org.richfaces.builder.model.JavaModifier;
+import org.richfaces.builder.model.JavaPackage;
+import org.richfaces.builder.model.MethodBody;
+import org.richfaces.builder.model.MethodBodyStatementsContainer;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.templatecompiler.model.AnyElement;
import org.richfaces.cdk.templatecompiler.model.CdkBodyElement;
import org.richfaces.cdk.templatecompiler.model.CdkCallElement;
import org.richfaces.cdk.templatecompiler.model.CdkChooseElement;
+import org.richfaces.cdk.templatecompiler.model.CdkForEachElement;
import org.richfaces.cdk.templatecompiler.model.CdkIfElement;
import org.richfaces.cdk.templatecompiler.model.CdkObjectElement;
import org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement;
@@ -54,15 +68,34 @@
*/
public class RendererClassVisitor implements TemplateVisitor {
+ /**
+ *
+ */
+ static final String RESPONSE_WRITER_VARIABLE = "responseWriter";
+ /**
+ *
+ */
+ static final String COMPONENT_VARIABLE = "cc";
+ /**
+ *
+ */
+ static final String FACES_CONTEXT_VARIABLE = "facesContext";
+ private static final Set<String> DEFAULT_NAMESPACES = new HashSet<String>();
+
+ static {
+ DEFAULT_NAMESPACES.add("http://richfaces.org/xhtml-el");
+ DEFAULT_NAMESPACES.add("http://www.w3.org/1999/xhtml");
+ }
+
private static final Pattern EL_EXPRESSION = Pattern.compile("#\\{([^\\}]+)\\}");
private static final Pattern COMPONENT_ATTRIBUTES_EXPRESSION =
Pattern.compile("^component\\.attributes\\[(?:'|\")?([^'\"]+)(?:'|\")?\\]$");
private static final Map<String, Set<String>> ELEMENTS_ATTRIBUTES;
- private final LinkedList<MethodBodyStatement> statements = Lists.newLinkedList();
- private final JavaClass rendererClass;
- private final CompositeInterface compositeInterface;
+ private JavaClass rendererClass;
+ private CompositeInterface compositeInterface;
- protected MethodBodyStatement currentStatement;
+ protected MethodBodyStatementsContainer currentStatement;
+ private final LinkedList<MethodBodyStatementsContainer> statements = Lists.newLinkedList();
static {
InputStream serializedAttributesStream = RendererClassVisitor.class.getResourceAsStream("/META-INF/schema/attributes.ser");
@@ -73,7 +106,9 @@
// TODO detect URI attributes
ObjectInputStream ois = new ObjectInputStream(serializedAttributesStream);
- ELEMENTS_ATTRIBUTES = (Map<String, Set<String>>) ois.readObject();
+ @SuppressWarnings("unchecked")
+ Map<String, Set<String>> attributes = (Map<String, Set<String>>) ois.readObject();
+ ELEMENTS_ATTRIBUTES = attributes;
} catch (Exception e) {
throw new IllegalStateException(e.getMessage(), e);
} finally {
@@ -84,11 +119,148 @@
}
}
}
+
+ private String compileEl(String expression, Class<?> type) {
+ if (Boolean.class.isAssignableFrom(type)) {
+ //TODO just a stub!
+ return "false /* " + expression.trim() + " */";
+ }
+
+ return quote(expression) + " /* " + expression.trim() + " */";
+ }
+ private String getElExpressionContainerType(String value) {
+ // TODO Auto-generated method stub
+ return Object.class.getName();
+ }
+
+ private String getElExpressionType(String value) {
+ // TODO Auto-generated method stub
+ return String.class.getName();
+ }
+
+ private String toCharExpression(char c) {
+ String prependingZeroesString;
+ String hexString = Integer.toHexString(c);
+
+ switch (hexString.length()) {
+ case 1:
+ prependingZeroesString = "000";
+ break;
+ case 2:
+ prependingZeroesString = "00";
+ break;
+ case 3:
+ prependingZeroesString = "0";
+ break;
+ case 4:
+ prependingZeroesString = "";
+ break;
+ default:
+ throw new IllegalArgumentException();
+ }
+
+ return "\\u" + prependingZeroesString + hexString.toUpperCase(Locale.US);
+ }
+
+ private String quote(String s) {
+ StringBuilder result = new StringBuilder();
+
+ result.append('\"');
+
+ char[] chars = s.toCharArray();
+
+ for (char c : chars) {
+ if (c == '\n') {
+ result.append("\\n");
+ } else if (c == '\r') {
+ result.append("\\r");
+ } else if (c == '\t') {
+ result.append("\\t");
+ } else if (c == '\f') {
+ result.append("\\f");
+ } else if (c == '\b') {
+ result.append("\\b");
+ } else if (c == '\\') {
+ result.append("\\\\");
+ } else if (c == '"') {
+ result.append("\\\"");
+ } else {
+ if (c < 0x20 || c > 0x7F) {
+ result.append(toCharExpression(c));
+ } else {
+ result.append(c);
+ }
+ }
+ }
+
+ result.append('\"');
+
+ return result.toString();
+ }
+
+ private boolean isDefaultNamespace(String namespaceURI) {
+ //TODO - another namespaces
+ if (namespaceURI == null || namespaceURI.length() == 0) {
+ return true;
+ }
+
+ if (DEFAULT_NAMESPACES.contains(namespaceURI)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ private void flushToEncodeMethod(String encodeMethodName) {
+ if (!this.currentStatement.isEmpty()) {
+ Argument facesContextArgument = new Argument(FACES_CONTEXT_VARIABLE, FacesContext.class);
+ Argument componentArgument = new Argument(COMPONENT_VARIABLE, UIComponent.class);
+
+ JavaMethod javaMethod = new JavaMethod(encodeMethodName, facesContextArgument, componentArgument);
+ javaMethod.addModifier(JavaModifier.PUBLIC);
+ javaMethod.addAnnotation(Override.class);
+ javaMethod.getExceptions().add(IOException.class);
+
+ MethodBody methodBody = (MethodBody) currentStatement;
+ javaMethod.setMethodBody(methodBody);
+
+ methodBody.addStatement(0, new EncodeMethodPrefaceStatement());
+ rendererClass.addMethod(javaMethod);
+ }
+
+ this.currentStatement = new MethodBody();
+ }
+
+ private JavaClass createJavaClassByName(String fullName) {
+ String simpleName = null;
+ String packageName = "";
+ int lastDotIdx = fullName.lastIndexOf('.');
+
+ if (lastDotIdx != -1) {
+ simpleName = fullName.substring(lastDotIdx + 1);
+ packageName = fullName.substring(0, lastDotIdx);
+ } else {
+ simpleName = fullName;
+ }
+
+ return new JavaClass(simpleName, new JavaPackage(packageName));
+ }
+
+ private void pushStatement(MethodBodyStatementsContainer container) {
+ currentStatement.addStatement(container);
+ statements.push(currentStatement);
+ currentStatement = container;
+ }
+
+ private void popStatement() {
+ currentStatement = statements.pop();
+ }
+
public RendererClassVisitor(CompositeInterface compositeInterface) {
this.compositeInterface = compositeInterface;
- rendererClass = new JavaClass();
- }
+ }
+
/**
* <p class="changed_added_4_0"></p>
* @return the rendererClass
@@ -96,13 +268,13 @@
public JavaClass getRendererClass() {
return this.rendererClass;
}
+
/* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#endElement(org.richfaces.cdk.templatecompiler.model.AnyElement)
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkBodyElement)
*/
@Override
- public void endElement(AnyElement anyElement) throws CdkException {
- // TODO Auto-generated method stub
-
+ public void startElement(CdkBodyElement cdkBodyElement) throws CdkException {
+ flushToEncodeMethod("encodeBegin");
}
/* (non-Javadoc)
@@ -110,8 +282,7 @@
*/
@Override
public void endElement(CdkBodyElement cdkBodyElement) throws CdkException {
- // TODO Auto-generated method stub
-
+ flushToEncodeMethod("encodeChildren");
}
/* (non-Javadoc)
@@ -119,17 +290,51 @@
*/
@Override
public void startElement(AnyElement anyElement) throws CdkException {
- // TODO Auto-generated method stub
+ QName elementName = anyElement.getName();
+ Map<QName, Object> elementAttributes = anyElement.getAttributes();
+
+ if (!isDefaultNamespace(elementName.getNamespaceURI())) {
+ //TODO: add support
+ }
+
+ currentStatement.addStatement(new StartElementStatement(elementName.getLocalPart()));
+
+ if (elementAttributes != null) {
+ for (Map.Entry<QName, Object> attribute : elementAttributes.entrySet()) {
+ QName attributeName = attribute.getKey();
+ Object attributeValue = attribute.getValue();
+
+ if (!isDefaultNamespace(attributeName.getNamespaceURI())) {
+ //TODO: add support
+ //TODO: cdk:passThrough
+ }
+
+ currentStatement.addStatement(new WriteAttributeStatement(attributeName.getLocalPart(),
+ compileEl(attributeValue.toString(), String.class)));
+ }
+ }
+
+ // TODO Auto-generated method stub
}
/* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkBodyElement)
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#endElement(org.richfaces.cdk.templatecompiler.model.AnyElement)
*/
@Override
- public void startElement(CdkBodyElement cdkBodyElement) throws CdkException {
- // TODO Auto-generated method stub
+ public void endElement(AnyElement anyElement) throws CdkException {
+ QName elementName = anyElement.getName();
+ currentStatement.addStatement(new EndElementStatement(elementName.getLocalPart()));
+ }
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#visitElement(java.lang.String)
+ */
+ @Override
+ public void visitElement(String child) throws CdkException {
+ if (child != null && child.length() != 0) {
+ currentStatement.addStatement(new WriteTextStatement(compileEl(child, String.class)));
+ }
}
/* (non-Javadoc)
@@ -137,89 +342,145 @@
*/
@Override
public void visitElement(CdkCallElement cdkCallElement) throws CdkException {
- // TODO Auto-generated method stub
-
+ currentStatement.addStatement(cdkCallElement.getExpression() + ";");
}
/* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#visitElement(java.lang.String)
- */
- @Override
- public void visitElement(String child) throws CdkException {
- // TODO Auto-generated method stub
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkIfElement)
+ */
+ @Override
+ public void startElement(CdkIfElement cdkIfElement) {
+ String compiledTestExpression = compileEl(cdkIfElement.getTest(), Boolean.class);
+
+ pushStatement(new IfElseStatement());
+ pushStatement(new IfStatement(compiledTestExpression));
+ }
- }
/* (non-Javadoc)
* @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#endElement(org.richfaces.cdk.templatecompiler.model.CdkIfElement)
*/
@Override
public void endElement(CdkIfElement cdkIfElement) {
- // TODO Auto-generated method stub
-
+ popStatement();
+ popStatement();
}
+
/* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkIfElement)
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkChooseElement)
*/
@Override
- public void startElement(CdkIfElement cdkIfElement) {
- // TODO Auto-generated method stub
+ public void startElement(CdkChooseElement cdkChooseElement) {
+ pushStatement(new IfElseStatement());
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#endElement(org.richfaces.cdk.templatecompiler.model.CdkChooseElement)
+ */
+ @Override
+ public void endElement(CdkChooseElement cdkChooseElement) {
+ popStatement();
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkWhenElement)
+ */
+ @Override
+ public void startElement(CdkWhenElement cdkWhenElement) {
+ String compiledTestExpression = compileEl(cdkWhenElement.getTest(), Boolean.class);
+ pushStatement(new IfStatement(compiledTestExpression));
}
+
/* (non-Javadoc)
* @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#endElement(org.richfaces.cdk.templatecompiler.model.CdkWhenElement)
*/
@Override
public void endElement(CdkWhenElement cdkWhenElement) {
- // TODO Auto-generated method stub
-
+ popStatement();
}
+
/* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#endElement(org.richfaces.cdk.templatecompiler.model.CdkChooseElement)
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement)
*/
@Override
- public void endElement(CdkChooseElement cdkChooseElement) {
- // TODO Auto-generated method stub
-
+ public void startElement(CdkOtherwiseElement cdkOtherwiseElement) {
+ pushStatement(new IfStatement(""));
}
+
/* (non-Javadoc)
* @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#endElement(org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement)
*/
@Override
public void endElement(CdkOtherwiseElement cdkOtherwiseElement) {
- // TODO Auto-generated method stub
-
+ popStatement();
}
+
/* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkWhenElement)
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#visitElement(org.richfaces.cdk.templatecompiler.model.CdkObjectElement)
*/
@Override
- public void startElement(CdkWhenElement cdkWhenElement) {
- // TODO Auto-generated method stub
+ public void visitElement(CdkObjectElement cdkObjectElement) {
+ String name = cdkObjectElement.getName();
+ String value = cdkObjectElement.getValue();
+ if (value == null || value.length() == 0) {
+ value = cdkObjectElement.getBodyValue();
+ }
+
+ String type = cdkObjectElement.getType();
+
+ if (value != null && value.length() != 0) {
+ if (type == null || type.length() == 0) {
+ type = getElExpressionType(value);
+ }
+
+ value = compileEl(value, Object.class);
+ currentStatement.addStatement(type + " " + name + " = " + value + ";");
+ } else {
+ currentStatement.addStatement(type + " " + name + ";");
+ }
}
+
/* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkChooseElement)
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkForEachElement)
*/
@Override
- public void startElement(CdkChooseElement cdkChooseElement) {
- // TODO Auto-generated method stub
-
+ public void startElement(CdkForEachElement cdkForEachElement) {
+ String items = cdkForEachElement.getItems();
+ String itemsExpression = compileEl(items, Iterable.class);
+ pushStatement(new ForEachStatement(itemsExpression, cdkForEachElement.getVar(),
+ getElExpressionContainerType(items)));
}
+
/* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#startElement(org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement)
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#endElement(org.richfaces.cdk.templatecompiler.model.CdkForEachElement)
*/
@Override
- public void startElement(CdkOtherwiseElement cdkOtherwiseElement) {
- // TODO Auto-generated method stub
-
+ public void endElement(CdkForEachElement cdkForEachElement) {
+ popStatement();
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#visitElement(org.richfaces.cdk.templatecompiler.model.CdkObjectElement)
+
+ /**
+ *
*/
- @Override
- public void visitElement(CdkObjectElement cdkObjectElement) {
- // TODO Auto-generated method stub
-
+ public void preProcess() {
+ this.rendererClass = createJavaClassByName(compositeInterface.getJavaClass());
+ this.rendererClass.addModifier(JavaModifier.PUBLIC);
+ this.rendererClass.setSuperClass(createJavaClassByName(compositeInterface.getBaseClass()));
+
+ this.rendererClass.addImport(FacesContext.class);
+ this.rendererClass.addImport(Renderer.class);
+ this.rendererClass.addImport(ResponseWriter.class);
+ this.rendererClass.addImport(UIComponent.class);
+
+ this.currentStatement = new MethodBody();
}
+ /**
+ *
+ */
+ public void postProcess() {
+ flushToEncodeMethod("encodeEnd");
+ }
+
}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RenderingContext.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RenderingContext.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RenderingContext.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.richfaces.cdk.freemarker.CdkConfiguration;
+
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+class RenderingContext {
+
+ private static ThreadLocal<CdkConfiguration> cdkConfigurationHolder = new ThreadLocal<CdkConfiguration>();
+
+ static void setCdkConfiguration(CdkConfiguration cdkConfiguration) {
+ cdkConfigurationHolder.set(cdkConfiguration);
+ }
+
+ static void writeSnippet(String templateName, Object object, Writer writer) throws IOException, TemplateException {
+ Template t = cdkConfigurationHolder.get().getTemplate("java/" + templateName + ".ftl");
+ Map<String, Object> rootMap = new HashMap<String, Object>();
+ rootMap.put("modelItem", object);
+
+ rootMap.put("facesContextVariable", RendererClassVisitor.FACES_CONTEXT_VARIABLE);
+ rootMap.put("componentVariable", RendererClassVisitor.COMPONENT_VARIABLE);
+ rootMap.put("responseWriterVariable", RendererClassVisitor.RESPONSE_WRITER_VARIABLE);
+
+ t.process(rootMap, writer);
+ }
+
+ static String renderSnippet(String templateName, Object object) {
+ StringWriter writer = new StringWriter();
+ try {
+ writeSnippet(templateName, object, writer);
+
+ return writer.toString();
+ } catch (IOException e) {
+ // TODO: handle exception
+ return e.getMessage();
+ } catch (TemplateException e) {
+ // TODO: handle exception
+ return e.getMessage();
+ } finally {
+ try {
+ writer.close();
+ } catch (IOException e) {
+ //do nothing
+ }
+ }
+ }
+
+}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/StartElementStatement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/StartElementStatement.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/StartElementStatement.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler;
+
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class StartElementStatement extends AbstractTemplateMethodBodyStatement {
+
+ private String elementName;
+
+ public StartElementStatement(String elementName) {
+ this("start-element", elementName);
+ }
+
+ protected StartElementStatement(String templateName, String elementName) {
+ super(templateName);
+ this.elementName = elementName;
+ }
+
+ /**
+ * @return the elementName
+ */
+ public String getElementName() {
+ return elementName;
+ }
+
+}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/WriteAttributeStatement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/WriteAttributeStatement.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/WriteAttributeStatement.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class WriteAttributeStatement extends AbstractTemplateMethodBodyStatement {
+
+ private String attributeName;
+
+ private String valueExpression;
+
+ public WriteAttributeStatement(String attributeName, String valueExpression) {
+ super("write-attribute");
+ this.attributeName = attributeName;
+ this.valueExpression = valueExpression;
+ }
+
+ public String getAttributeName() {
+ return attributeName;
+ }
+
+ public String getValueExpression() {
+ return valueExpression;
+ }
+
+}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/WriteTextStatement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/WriteTextStatement.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/WriteTextStatement.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class WriteTextStatement extends AbstractTemplateMethodBodyStatement {
+
+ private String textExpression;
+
+ public WriteTextStatement(String textExpression) {
+ super("write-text");
+ this.textExpression = textExpression;
+ }
+
+ public String getTextExpression() {
+ return textExpression;
+ }
+
+}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkBodyElement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkBodyElement.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkBodyElement.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -23,6 +23,8 @@
package org.richfaces.cdk.templatecompiler.model;
+import javax.xml.bind.annotation.XmlRootElement;
+
import org.richfaces.cdk.CdkException;
/**
@@ -30,8 +32,10 @@
* @author asmirnov(a)exadel.com
*
*/
+@XmlRootElement(name = "body", namespace = Template.CDK_NAMESPACE)
public class CdkBodyElement extends ModelFragment {
- @Override
+
+ @Override
public void beforeVisit(TemplateVisitor visitor) throws CdkException {
visitor.startElement(this);
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkChooseElement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkChooseElement.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkChooseElement.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -21,6 +21,7 @@
*/
package org.richfaces.cdk.templatecompiler.model;
+import java.util.Iterator;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
@@ -50,6 +51,9 @@
super.setChildren(body);
}
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.templatecompiler.model.ModelFragment#visit(org.richfaces.cdk.templatecompiler.model.TemplateVisitor)
+ */
@Override
public void beforeVisit(TemplateVisitor visitor) throws CdkException {
visitor.startElement(this);
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkForEachElement.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkForEachElement.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkForEachElement.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler.model;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.richfaces.cdk.CdkException;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+@XmlRootElement(name = "forEach", namespace = Template.JSTL_CORE_NAMESPACE)
+public class CdkForEachElement extends ModelFragment {
+
+ private String items;
+
+ private String var;
+
+ /**
+ * @return the items
+ */
+ @XmlAttribute
+ public String getItems() {
+ return items;
+ }
+
+ /**
+ * @param items the items to set
+ */
+ public void setItems(String items) {
+ this.items = items;
+ }
+
+ /**
+ * @return the var
+ */
+ @XmlAttribute
+ public String getVar() {
+ return var;
+ }
+
+ /**
+ * @param var the var to set
+ */
+ public void setVar(String var) {
+ this.var = var;
+ }
+
+ @Override
+ public void beforeVisit(TemplateVisitor visitor) throws CdkException {
+ visitor.startElement(this);
+ }
+
+ @Override
+ public void afterVisit(TemplateVisitor visitor) throws CdkException {
+ visitor.endElement(this);
+ }
+}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeImplementation.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeImplementation.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeImplementation.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -34,5 +34,4 @@
@XmlType(name="ImplementationType",namespace=Template.COMPOSITE_NAMESPACE)
public class CompositeImplementation extends ModelFragment {
-
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ElementsHandler.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ElementsHandler.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ElementsHandler.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -115,11 +115,15 @@
if( n instanceof Document ) {
return ((Document)n).getDocumentElement();
}
- if( n instanceof Element )
- return (Element)n;
- if( n instanceof DocumentFragment )
+
+ if( n instanceof Element ) {
+ return (Element) n;
+ }
+
+ if( n instanceof DocumentFragment ) {
return (Element)n.getChildNodes().item(0);
-
+ }
+
// if the result object contains something strange,
// it is not a user problem, but it is a JAXB provider's problem.
// That's why we throw a runtime exception.
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ModelFragment.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ModelFragment.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ModelFragment.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -18,48 +18,52 @@
CdkCallElement.class,
CdkBodyElement.class,
CdkIfElement.class,
+ CdkObjectElement.class,
CdkChooseElement.class,
- CdkObjectElement.class
+ CdkForEachElement.class
})
public class ModelFragment implements LeafModelElement {
- private List<Object> children;
+ private List<Object> children;
- //TODO filter unhandled elements from known namespaces
- @XmlAnyElement(lax=true, value=ElementsHandler.class)
- @XmlMixed
- public List<Object> getChildren() {
- return this.children;
- }
+ //TODO filter unhandled elements from known namespaces
+ @XmlAnyElement(lax=true, value=ElementsHandler.class)
+ @XmlMixed
+ public List<Object> getChildren() {
+ return this.children;
+ }
- /**
- * <p class="changed_added_4_0"></p>
- * @param body the body to set
- */
- public void setChildren(List<Object> body) {
- this.children = body;
- }
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param body the body to set
+ */
+ public void setChildren(List<Object> body) {
+ this.children = body;
+ }
- @Override
- public void visit(TemplateVisitor visitor) throws CdkException {
- beforeVisit(visitor);
- for (Object child : getChildren()) {
- if (child instanceof String) {
- visitor.visitElement((String) child);
- } else if (child instanceof ModelElement) {
- ((ModelElement) child).visit(visitor);
- } else {
- throw new CdkException("Unknown type of element in renderer template "+child.getClass());
- }
- }
- afterVisit(visitor);
- }
+ @Override
+ public void visit(TemplateVisitor visitor) throws CdkException {
+ beforeVisit(visitor);
+ List<Object> childrenList = getChildren();
+ if (childrenList != null) {
+ for (Object child : childrenList) {
+ if (child instanceof String) {
+ visitor.visitElement((String) child);
+ } else if (child instanceof ModelElement) {
+ ((ModelElement) child).visit(visitor);
+ } else {
+ throw new CdkException("Unknown type of element in renderer template "+child.getClass());
+ }
+ }
+ }
+ afterVisit(visitor);
+ }
- public void afterVisit(TemplateVisitor visitor) throws CdkException {
- }
+ public void afterVisit(TemplateVisitor visitor) throws CdkException {
+ }
- public void beforeVisit(TemplateVisitor visitor) throws CdkException {
- }
+ public void beforeVisit(TemplateVisitor visitor) throws CdkException {
+ }
}
\ No newline at end of file
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/TemplateVisitor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/TemplateVisitor.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/TemplateVisitor.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -62,4 +62,8 @@
void visitElement(CdkObjectElement cdkObjectElement);
+ void startElement(CdkForEachElement cdkForEachElement);
+
+ void endElement(CdkForEachElement cdkForEachElement);
+
}
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 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-composite.xsd 2009-11-17 18:22:36 UTC (rev 15903)
@@ -1,10 +1,42 @@
<?xml version = "1.0" encoding = "UTF-8"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+
<xs:schema targetNamespace="http://java.sun.com/jsf/composite"
xmlns:cc="http://java.sun.com/jsf/composite" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xml="http://www.w3.org/XML/1998/namespace" elementFormDefault="qualified"
attributeFormDefault="unqualified">
+ <xs:annotation>
+ <xs:documentation>
+ NB: this schema covers only subset of elements supported by RichFaces CDK and therefore it
+ shouldn't be used as a reference document for development of composite components.
+ </xs:documentation>
+ </xs:annotation>
+
<xs:attributeGroup name="beanDescriptorAttributes">
<xs:attribute name="displayName">
<xs:annotation>
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 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-jstl-core.xsd 2009-11-17 18:22:36 UTC (rev 15903)
@@ -1,9 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://java.sun.com/jsp/jstl/core" xmlns="http://java.sun.com/jsp/jstl/core"
xmlns:cdk="http://richfaces.org/cdk"
elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xs:annotation>
+ <xs:documentation>
+ NB: this schema covers only subset of elements supported by RichFaces CDK and therefore it
+ shouldn't be used as a reference document for development of application pages.
+ </xs:documentation>
+ </xs:annotation>
+
<xs:import schemaLocation="cdk-template.xsd" namespace="http://richfaces.org/cdk" />
<xs:attributeGroup name="testGroup">
@@ -35,4 +67,21 @@
</xs:sequence>
</xs:complexType>
</xs:element>
+ <xs:element name="forEach">
+ <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="begin" type="cdk:elFreeformExpression" default="0" />
+ <xs:attribute name="end" type="cdk:elFreeformExpression" />
+ <xs:attribute name="step" type="cdk:elFreeformExpression" default="1" />
+ <xs:attribute name="varStatus" type="cdk:literalExpression" />
+ -->
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
</xs:schema>
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 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd 2009-11-17 18:22:36 UTC (rev 15903)
@@ -1,4 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://richfaces.org/cdk" xmlns="http://richfaces.org/cdk"
elementFormDefault="qualified" attributeFormDefault="unqualified"
@@ -16,6 +41,13 @@
</xs:restriction>
</xs:simpleType>
+ <xs:simpleType name="literalExpression">
+ <xs:restriction base="xs:string">
+ <!-- TODO -->
+ <xs:pattern value=".*" />
+ </xs:restriction>
+ </xs:simpleType>
+
<xs:simpleType name="elMixedExpression">
<xs:restriction base="xs:string">
<xs:pattern value=".*#\{[^\}]+\}.*" />
@@ -104,7 +136,7 @@
<xs:complexType mixed="true">
<xs:simpleContent>
<xs:extension base="xs:string">
- <xs:attribute name="name" form="unqualified" use="required" />
+ <xs:attribute name="name" form="unqualified" type="literalExpression" use="required" />
<xs:attribute name="value" form="unqualified" />
<xs:attribute name="type" form="unqualified" />
</xs:extension>
Modified: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd 2009-11-17 18:22:36 UTC (rev 15903)
@@ -1,4 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+
<xs:schema version="1.0" xml:lang="en"
xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://richfaces.org/xhtml-el"
xmlns="http://richfaces.org/xhtml-el" xmlns:xml="http://www.w3.org/XML/1998/namespace"
Modified: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl 2009-11-17 18:22:36 UTC (rev 15903)
@@ -44,7 +44,7 @@
/**
* ${description?if_exists}
**/
-@Generated({"RicFaces CDK","4.0.0-SNAPSHOT"})
+@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
public class ${componentClass.simpleName} extends ${baseClass} <#if (eventNames?size > 0)>implements ClientBehaviorHolder</#if> {
Added: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/class.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/class.ftl (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/class.ftl 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,38 @@
+package ${modelItem.package.name};
+
+<#list modelItem.imports as import>
+import ${import.name};
+</#list>
+
+<@renderCommonJavaElementStuff element=modelItem />class ${modelItem.name} <#if modelItem.superClass.name != 'java.lang.Object'>extends ${modelItem.superClass.name} </#if>{
+ <#list modelItem.fields as field>
+ <@renderCommonJavaElementStuff element=field />${field.type.simpleName} ${field.name}<#if field.value??> = ${field.value}</#if>;
+ </#list>
+
+ <#list modelItem.methods as method>
+ <@renderCommonJavaElementStuff element=method />${method.returnType.simpleName} ${method.name}(<#list method.arguments as argument>${argument.type.simpleName} ${argument.name}<#if argument_has_next>, </#if></#list>)
+ <#if !method.exceptions.empty>
+ throws <#list method.exceptions as exception>${exception.simpleName}<#if exception_has_next>, </#if></#list>
+ </#if> {
+ <#if method.methodBody??>
+ <#list method.methodBody.statements as methodStatement>
+ ${methodStatement.code}
+ </#list>
+ </#if>
+ }
+ </#list>
+}
+
+<#macro renderCommonJavaElementStuff element>
+
+<#if !element.comments.empty>
+/*
+<#list element.comments as comment>
+ * ${comment.value}
+</#list>
+ */
+</#if>
+<#list element.annotations as annotation>
+(a)${annotation.type.simpleName}<#if !annotation.arguments.empty>(<#list annotation.arguments as argument>${argument}<#if argument_has_next>, </#if></#list>)</#if>
+</#list>
+<#list element.modifiers as modifier>${modifier} </#list></#macro>
\ No newline at end of file
Added: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/encode-method-preface.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/encode-method-preface.ftl (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/encode-method-preface.ftl 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1 @@
+ResponseWriter ${responseWriterVariable} = ${facesContextVariable}.getResponseWriter();
\ No newline at end of file
Added: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/end-element.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/end-element.ftl (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/end-element.ftl 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1 @@
+${responseWriterVariable}.endElement("${modelItem.elementName}");
\ No newline at end of file
Added: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/for-each.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/for-each.ftl (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/for-each.ftl 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,5 @@
+for (${modelItem.varType} ${modelItem.var}: ${modelItem.itemsExpression}) {
+ <#list modelItem.statements as subStatement>
+ ${subStatement.code}
+ </#list>
+}
\ No newline at end of file
Added: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/if-else.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/if-else.ftl (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/if-else.ftl 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,10 @@
+<#list modelItem.statements as statement>
+ <#if statement_index == 0>
+ if (${statement.test}) {
+ <#else>
+ } else <#if statement.test.length() != 0>if (${statement.test}) </#if> {
+ </#if>
+ <#list statement.statements as subStatement>
+ ${subStatement.code}
+ </#list>
+</#list>}
\ No newline at end of file
Added: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/start-element.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/start-element.ftl (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/start-element.ftl 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1 @@
+${responseWriterVariable}.startElement("${modelItem.elementName}", ${componentVariable});
\ No newline at end of file
Added: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/write-attribute.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/write-attribute.ftl (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/write-attribute.ftl 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1 @@
+${responseWriterVariable}.writeAttribute("${modelItem.attributeName}", ${modelItem.valueExpression}, null);
\ No newline at end of file
Added: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/write-text.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/write-text.ftl (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/java/write-text.ftl 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1 @@
+${responseWriterVariable}.writeText(${modelItem.textExpression}, null);
\ No newline at end of file
Added: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/method.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/method.ftl (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/method.ftl 2009-11-17 18:22:36 UTC (rev 15903)
@@ -0,0 +1,6 @@
+<#list method.comments as comment>
+//${comment}
+</#list>
+<#list method.modifiers as modifier>${modifier} </#list> ${method.returnType} ${method.name}(<#list method.arguments as argument>${argument.type} ${argument.name}<#if argument_has_next>, </#if></#list>) {
+ ${method.methodBody.toCode()}
+}
Added: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/object.ftl
===================================================================
Deleted: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/TemplateReaderTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/TemplateReaderTest.java 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/TemplateReaderTest.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -1,121 +0,0 @@
-package org.richfaces.cdk;
-
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.richfaces.builder.model.JavaClass;
-import org.richfaces.builder.model.JavaMethod;
-import org.richfaces.builder.templates.TemplateReader;
-
-public class TemplateReaderTest {
- private static final String ENCODE_BEGIN_METHOD = "encodeBegin";
- private static final String ENCODE_CHILDREN_METHOD = "encodeChildren";
- private static final String ENCODE_END_METHOD = "encodeEnd";
- private static final String END_DIV_FRAGMENT = "responseWriter.endElement(\"div\");";
- private static final String END_TABLE_FRAGMENT = "responseWriter.endElement(\"table\");";
- private static final String FULL_NAME = "org.richfaces.renderkit.html.TabPanelRenderer";
- private static final String IF_FRAGMENT = "if (";
- private static final String PACKAGE = "org.richfaces.renderkit.html";
- private static final String START_DIV_FRAGMENT = "responseWriter.startElement(\"div\", component);";
- private static final String START_TABLE_FRAGMENT = "responseWriter.startElement(\"table\", component);";
- private static final String SUPERCLASS = "javax.faces.render.Renderer";
- private static final String TAB_PANEL_RENDERER = "TabPanelRenderer";
- private static final String TEMPLATE_SIMPLE_XML = "template-simple.xml";
- private static final String TEMPLATE_XML = "template.xml";
- private static final String WRITE_ATTRIBBUTE_FRAGMENT =
- "responseWriter.writeAttribute(\"id\", component.getClientId(context), \"id\");";
- InputStream stream = null;
-
- @Before
- public void create() {}
-
- @After
- public void destroy() {
- try {
- stream.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testSimpleTemplate() throws Exception {
- stream = this.getClass().getResourceAsStream(TEMPLATE_SIMPLE_XML);
-
- JavaClass claz = TemplateReader.parse(stream);
-
- /*
- * JavaClassRenderer renderer = new JavaClassRenderer();
- * renderer.render(claz, new PrintWriter(System.out));
- */
- assertEquals(claz.getFullName(), FULL_NAME);
- assertEquals(claz.getName(), TAB_PANEL_RENDERER);
- assertEquals(claz.getPakg().getName(), PACKAGE);
- assertEquals(claz.getSuperClass().getFullName(), SUPERCLASS);
- assertTrue(containMethod(claz, ENCODE_BEGIN_METHOD));
- assertTrue(containMethod(claz, ENCODE_END_METHOD));
- assertTrue(containMethod(claz, ENCODE_CHILDREN_METHOD));
- }
-
- @Test
- public void testFullTemplate() throws Exception {
- stream = this.getClass().getResourceAsStream(TEMPLATE_XML);
-
- JavaClass claz = TemplateReader.parse(stream);
-
- /*
- * JavaClassRenderer renderer = new JavaClassRenderer();
- * renderer.render(claz, new PrintWriter(System.err));
- */
- assertEquals(claz.getFullName(), FULL_NAME);
- assertEquals(claz.getName(), TAB_PANEL_RENDERER);
- assertEquals(claz.getPakg().getName(), PACKAGE);
- assertEquals(claz.getSuperClass().getFullName(), SUPERCLASS);
- assertTrue(containMethod(claz, ENCODE_BEGIN_METHOD));
- assertTrue(containMethod(claz, ENCODE_CHILDREN_METHOD));
- assertTrue(containMethod(claz, ENCODE_END_METHOD));
-
- JavaMethod method = getMethodByName(claz, ENCODE_CHILDREN_METHOD);
-
- assertNotNull(method);
-
- String code = method.getMethodBody().toCode();
-
- assertTrue(code.lastIndexOf(IF_FRAGMENT) != -1);
- assertTrue(code.lastIndexOf(START_TABLE_FRAGMENT) != -1);
- assertTrue(code.lastIndexOf(WRITE_ATTRIBBUTE_FRAGMENT) != -1);
- assertTrue(code.lastIndexOf(START_DIV_FRAGMENT) != -1);
- assertTrue(code.lastIndexOf(END_TABLE_FRAGMENT) != -1);
- assertTrue(code.lastIndexOf(END_DIV_FRAGMENT) != -1);
- assertTrue(code.lastIndexOf(START_TABLE_FRAGMENT) < code.lastIndexOf(START_DIV_FRAGMENT));
- assertTrue(code.lastIndexOf(WRITE_ATTRIBBUTE_FRAGMENT) < code.lastIndexOf(START_DIV_FRAGMENT));
- assertTrue(code.lastIndexOf(WRITE_ATTRIBBUTE_FRAGMENT) < code.lastIndexOf(END_TABLE_FRAGMENT));
- assertTrue(code.lastIndexOf(END_TABLE_FRAGMENT) > code.lastIndexOf(END_DIV_FRAGMENT));
- }
-
- private JavaMethod getMethodByName(JavaClass clazz, String name) {
- for (JavaMethod method : clazz.getMethods()) {
- if (method.getName().equals(name)) {
- return method;
- }
- }
-
- return null;
- }
-
- private boolean containMethod(JavaClass clazz, String name) {
- for (JavaMethod method : clazz.getMethods()) {
- if (method.getName().equals(name)) {
- return true;
- }
- }
-
- return false;
- }
-}
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 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java 2009-11-17 18:22:36 UTC (rev 15903)
@@ -83,6 +83,9 @@
"</c:when>" +
"<c:otherwise>otherwise content</c:otherwise>" +
"</c:choose>" +
+ "<c:forEach items=\"#{someCollection}\" var=\"iterationVar\">" +
+ "forEach content" +
+ "</c:forEach>" +
"finish" +
TEMPLATE_EPILOG);
@@ -91,7 +94,7 @@
List<Object> children = implementation.getChildren();
assertNotNull(children);
- assertEquals(4, children.size());
+ assertEquals(5, children.size());
assertEquals("start", children.get(0));
assertEquals(CdkIfElement.class, children.get(1).getClass());
CdkIfElement ifElement = (CdkIfElement) children.get(1);
@@ -138,7 +141,17 @@
assertEquals(1, childrenOfOtherwiseElement.size());
assertEquals("otherwise content", childrenOfOtherwiseElement.get(0));
- assertEquals("finish", children.get(3));
+ assertEquals(CdkForEachElement.class, children.get(3).getClass());
+ CdkForEachElement forEachElement = (CdkForEachElement) children.get(3);
+ assertEquals("#{someCollection}", forEachElement.getItems());
+ assertEquals("iterationVar", forEachElement.getVar());
+
+ List<Object> forEachChildren = forEachElement.getChildren();
+ assertNotNull(forEachChildren);
+ assertEquals(1, forEachChildren.size());
+ assertEquals("forEach content", forEachChildren.get(0));
+
+ assertEquals("finish", children.get(4));
}
@Test
Deleted: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/template-simple.xml
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/template-simple.xml 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/template-simple.xml 2009-11-17 18:22:36 UTC (rev 15903)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<cdk:root xmlns:cdk="http://richfaces.org/cdk"
- class="org.richfaces.renderkit.html.TabPanelRenderer" componentclass="org.richfaces.component.UITabPanel">
- <cdk:body>
- <table border="0" cellpadding="0" cellspacing="0" id="#{clientId}"
- class="rich-tabpanel #{component.attributes['styleClass']}"/>
-</cdk:body>
-</cdk:root>
\ No newline at end of file
Deleted: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/template.xml
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/template.xml 2009-11-17 18:10:31 UTC (rev 15902)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/template.xml 2009-11-17 18:22:36 UTC (rev 15903)
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<cdk:root xmlns:cdk="http://richfaces.org/cdk"
- class="org.richfaces.renderkit.html.TabPanelRenderer"
- componentclass="org.richfaces.component.UITabPanel">
-<cdk:body>
-<cdk:clientid var="clientId" />
-<table border="0" cellpadding="0" cellspacing="0" id="#{clientId}"
- class="rich-tabpanel #{component.attributes['styleClass']}">
- <tbody>
- <tr>
- <td align="#{component.attributes['headerAlignment']}" class="rich-tab-bottom-line #{component.attributes['headerClass']}">
- <div style="display: none;">
- <cdk:if test="#{clientSide}">
- <input autocomplete="off" type="hidden"
- id="#{clientId}_input"
- name="#{clientId}"
- value=" " />
- </cdk:if>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </cdk:body>
-</cdk:root>
\ No newline at end of file
15 years, 1 month
JBoss Rich Faces SVN: r15902 - in root/cdk/trunk/plugins/maven-cdk-plugin/src/main: mdo and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-11-17 13:10:31 -0500 (Tue, 17 Nov 2009)
New Revision: 15902
Removed:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CompileTemplatesMojo.java
Modified:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/SkinInfo.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/mdo/resource-config.mdo
Log:
https://jira.jboss.org/jira/browse/RF-7732
Deleted: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CompileTemplatesMojo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CompileTemplatesMojo.java 2009-11-17 17:41:37 UTC (rev 15901)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CompileTemplatesMojo.java 2009-11-17 18:10:31 UTC (rev 15902)
@@ -1,122 +0,0 @@
-/**
- * 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.builder.mojo;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.PrintWriter;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-
-import org.richfaces.builder.model.JavaClass;
-import org.richfaces.builder.render.JavaClassRenderer;
-import org.richfaces.builder.templates.TemplateReader;
-
-/**
- * @author Nick Belaevski
- * @goal compile-templates
- */
-public class CompileTemplatesMojo extends AbstractCDKMojo {
-
- /**
- * sourceFileIncludes
- * @parameter
- */
- protected String[] templateFileIncludes = {"**/*.template.xml"};
-
- /**
- * sourceFileExcludes
- * @parameter
- */
- protected String[] templatesFileExcludes = null;
-
- /**
- * @param templatesDirectory the templatesDirectory to set
- */
- protected void setTemplatesDirectory(File templatesDirectory) {
- this.templatesDirectory = templatesDirectory;
- }
-
- /**
- * @param templateFileIncludes the templateFileIncludes to set
- */
- public void setTemplateFileIncludes(String[] templateFileIncludes) {
- this.templateFileIncludes = templateFileIncludes;
- }
-
- /**
- * @param templatesFileExcludes the templatesFileExcludes to set
- */
- public void setTemplatesFileExcludes(String[] templatesFileExcludes) {
- this.templatesFileExcludes = templatesFileExcludes;
- }
-
- protected Iterable<File> findTemplateFiles() throws MojoExecutionException {
- Set<File> sourceFiles = new HashSet<File>();
-
- if (templatesDirectory.exists() && templatesDirectory.isDirectory()) {
- for (String fileName : doScan(templateFileIncludes, templatesFileExcludes, templatesDirectory)) {
- sourceFiles.add(new File(templatesDirectory, fileName));
- }
- }
-
- return sourceFiles;
- }
-
- protected void compileTemplates() throws MojoExecutionException, MojoFailureException {
- try {
- Iterable<File> templates = findTemplateFiles();
-
- for (File file : templates) {
- JavaClass javaClass = TemplateReader.parse(new FileInputStream(file));
- String fullName = javaClass.getFullName();
- File outFile = new File(outputJavaDirectory, fullName.replace('.', '/') + ".java");
-
- if (outFile.exists()) {
- outFile.delete();
- }
-
- outFile.getParentFile().mkdirs();
- new JavaClassRenderer().render(javaClass, new PrintWriter(outFile));
- }
- } catch (Exception e) {
- throw new MojoExecutionException(e.getMessage(), e);
- }
- }
-
- @Override
- public void execute() throws MojoExecutionException, MojoFailureException {
- outputJavaDirectory.mkdirs();
- outputResourcesDirectory.mkdirs();
- outputTestsDirectory.mkdirs();
- project.addCompileSourceRoot(outputJavaDirectory.getAbsolutePath());
- project.addCompileSourceRoot(outputResourcesDirectory.getAbsolutePath());
- project.addTestCompileSourceRoot(outputTestsDirectory.getAbsolutePath());
- compileTemplates();
- }
-}
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2009-11-17 17:41:37 UTC (rev 15901)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2009-11-17 18:10:31 UTC (rev 15902)
@@ -31,7 +31,6 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
-
import org.codehaus.plexus.util.DirectoryScanner;
import org.richfaces.builder.maven.MavenLogger;
@@ -174,7 +173,7 @@
*/
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
-
+
// Setup logger.
LoggerFactory.setLogger(new MavenLogger(getLog()));
@@ -424,10 +423,16 @@
for (FileSet fileSet : filesets) {
String[] includes = (String[]) fileSet.getIncludes().toArray(STRINGS_ARRAY);
String[] excludes = (String[]) fileSet.getExcludes().toArray(STRINGS_ARRAY);
- String[] scan = doScan(includes, excludes, new File(fileSet.getDirectory()));
+ File fileSetDirectory = new File(fileSet.getDirectory());
+ String[] scan = doScan(includes, excludes, fileSetDirectory);
for (String filename : scan) {
- files.add(new File(filename));
+ File file = new File(fileSetDirectory, filename);
+ if (!file.exists()) {
+ file = new File(project.getBasedir(), file.getPath());
+ }
+
+ files.add(file);
}
}
}
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/SkinInfo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/SkinInfo.java 2009-11-17 17:41:37 UTC (rev 15901)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/SkinInfo.java 2009-11-17 18:10:31 UTC (rev 15902)
@@ -26,7 +26,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.richfaces.cdk.model.Resource;
+import org.richfaces.cdk.model.legacy.Resource;
/**
* @author Maksim Kaszynski
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/mdo/resource-config.mdo
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/mdo/resource-config.mdo 2009-11-17 17:41:37 UTC (rev 15901)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/mdo/resource-config.mdo 2009-11-17 18:10:31 UTC (rev 15902)
@@ -5,7 +5,7 @@
<defaults>
<default>
<key>package</key>
- <value>org.richfaces.cdk.model</value>
+ <value>org.richfaces.cdk.model.legacy</value>
</default>
</defaults>
<classes>
15 years, 1 month
JBoss Rich Faces SVN: r15901 - root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-11-17 12:41:37 -0500 (Tue, 17 Nov 2009)
New Revision: 15901
Added:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlToggleControl.java
Log:
Html ToggleControl class
Added: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlToggleControl.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlToggleControl.java (rev 0)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlToggleControl.java 2009-11-17 17:41:37 UTC (rev 15901)
@@ -0,0 +1,6 @@
+package org.richfaces.component.html;
+
+import org.richfaces.component.UIToggleControl;
+
+public class HtmlToggleControl extends UIToggleControl {
+}
15 years, 1 month
JBoss Rich Faces SVN: r15900 - root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-11-17 12:40:56 -0500 (Tue, 17 Nov 2009)
New Revision: 15900
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/DataIterator.java
Log:
remove check for suTable instance
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/DataIterator.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/DataIterator.java 2009-11-17 17:39:54 UTC (rev 15899)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/DataIterator.java 2009-11-17 17:40:56 UTC (rev 15900)
@@ -44,7 +44,7 @@
UIComponent child = childrenIterator.next();
//TODO nick - why non-rendered children are filtered?
//TODO nick - should be (child instanceof UIColumn || child instanceof Column)?
- if ((child instanceof UIColumn) || (child instanceof Column) || child instanceof UISubTable) {
+ if ((child instanceof UIColumn) || (child instanceof Column)) {
nextColumn = child;
} else if(checkAjaxComponent(child)) {
nextColumn = child;
15 years, 1 month
JBoss Rich Faces SVN: r15899 - root/examples-sandbox/trunk/components/tables/src/main/webapp.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-11-17 12:39:54 -0500 (Tue, 17 Nov 2009)
New Revision: 15899
Modified:
root/examples-sandbox/trunk/components/tables/src/main/webapp/home.xhtml
Log:
add expand subTable
Modified: root/examples-sandbox/trunk/components/tables/src/main/webapp/home.xhtml
===================================================================
--- root/examples-sandbox/trunk/components/tables/src/main/webapp/home.xhtml 2009-11-17 17:38:57 UTC (rev 15898)
+++ root/examples-sandbox/trunk/components/tables/src/main/webapp/home.xhtml 2009-11-17 17:39:54 UTC (rev 15899)
@@ -12,6 +12,7 @@
<h:body>
<h:form id="form1">
+
<rich:dataTable var="record" value="#{dataBean.employeeList}" rows="20">
<f:facet name="caption">
<h:outputText id="captioFacet1" value="Caption Facet" />
@@ -27,6 +28,8 @@
<f:facet name="header">
<h:outputText id="columnHeader1" value="Column Header Facet"/>
</f:facet>
+
+ <rich:toggleControl forId="expandedSubTable" expandControl="resources/images/+.gif" collapseControl="resources/images/-.gif"/>
<h:outputText value="#{record.name}" />
<f:facet name="footer">
<h:outputText id="columnFooter1" value="Column Footer Facet"/>
@@ -41,7 +44,9 @@
<h:outputText value="#{record.EMail}" />
</rich:column>
- <rich:subTable var="company" value="#{record.company}" rows="20">
+
+
+ <rich:subTable id="expandedSubTable" var="company" value="#{record.company}" rows="20" expanded="true" switchType="client">
<f:facet name="header">
<rich:colGroup id="headerFacet1" >
<rich:column><h:outputText id="headerFacet12" value="company"> </h:outputText></rich:column>
15 years, 1 month
JBoss Rich Faces SVN: r15898 - in root/examples-sandbox/trunk/components/tables/src/main/webapp/resources: images and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-11-17 12:38:57 -0500 (Tue, 17 Nov 2009)
New Revision: 15898
Added:
root/examples-sandbox/trunk/components/tables/src/main/webapp/resources/images/
root/examples-sandbox/trunk/components/tables/src/main/webapp/resources/images/+.gif
root/examples-sandbox/trunk/components/tables/src/main/webapp/resources/images/-.gif
Log:
Added: root/examples-sandbox/trunk/components/tables/src/main/webapp/resources/images/+.gif
===================================================================
(Binary files differ)
Property changes on: root/examples-sandbox/trunk/components/tables/src/main/webapp/resources/images/+.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/examples-sandbox/trunk/components/tables/src/main/webapp/resources/images/-.gif
===================================================================
(Binary files differ)
Property changes on: root/examples-sandbox/trunk/components/tables/src/main/webapp/resources/images/-.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 1 month
JBoss Rich Faces SVN: r15897 - root/ui-sandbox/trunk/components/tables/ui/src/main/templates/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-11-17 12:30:12 -0500 (Tue, 17 Nov 2009)
New Revision: 15897
Removed:
root/ui-sandbox/trunk/components/tables/ui/src/main/templates/org/richfaces/renderkit/html/extendedtable.template.xml
Log:
remove extended dataTable Template
Deleted: root/ui-sandbox/trunk/components/tables/ui/src/main/templates/org/richfaces/renderkit/html/extendedtable.template.xml
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/templates/org/richfaces/renderkit/html/extendedtable.template.xml 2009-11-17 17:28:37 UTC (rev 15896)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/templates/org/richfaces/renderkit/html/extendedtable.template.xml 2009-11-17 17:30:12 UTC (rev 15897)
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<cdk:root xmlns="http://richfaces.org/xhtml-el" xmlns:cdk="http://richfaces.org/cdk"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- class="org.richfaces.renderkit.html.ExtendedDataTableRenderer"
- superclass="org.richfaces.renderkit.ExtendedDataTableRendererBase"
- componentclass="org.richfaces.component.UIExtendedDataTable">
-
- ExtendedDataTable encoding ...
-
-
-</cdk:root>
15 years, 1 month
JBoss Rich Faces SVN: r15896 - in root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces: model and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-11-17 12:28:37 -0500 (Tue, 17 Nov 2009)
New Revision: 15896
Added:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/Ordering.java
Log:
add Ordering enum
Added: root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/Ordering.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/Ordering.java (rev 0)
+++ root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/Ordering.java 2009-11-17 17:28:37 UTC (rev 15896)
@@ -0,0 +1,31 @@
+/**
+ * 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.model;
+/**
+ *
+ * @author Maksim Kaszynski
+ *
+ */
+public enum Ordering {
+ ASCENDING,
+ DESCENDING,
+ UNSORTED
+}
15 years, 1 month
JBoss Rich Faces SVN: r15895 - in root/ui-sandbox/trunk/components/tables/api/src: main/java/org/richfaces/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-11-17 12:24:43 -0500 (Tue, 17 Nov 2009)
New Revision: 15895
Removed:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Filterable.java
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/ScriptExportable.java
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Selectable.java
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Sortable.java
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Sortable2.java
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/event/
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/
root/ui-sandbox/trunk/components/tables/api/src/test/java/org/
Log:
remove unnecessary
Deleted: root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Filterable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Filterable.java 2009-11-17 17:23:33 UTC (rev 15894)
+++ root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Filterable.java 2009-11-17 17:24:43 UTC (rev 15895)
@@ -1,37 +0,0 @@
-/**
- * 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.component;
-
-import java.util.List;
-
-import org.richfaces.model.FilterField;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public interface Filterable {
-
- public List<FilterField> getFilterFields();
-
- public void setFilterFields(List<FilterField> filterFields);
-
-}
Deleted: root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/ScriptExportable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/ScriptExportable.java 2009-11-17 17:23:33 UTC (rev 15894)
+++ root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/ScriptExportable.java 2009-11-17 17:24:43 UTC (rev 15895)
@@ -1,30 +0,0 @@
-/**
- * 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.component;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public interface ScriptExportable {
- public String getScriptVar();
- public void setScriptVar(String s);
-}
Deleted: root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Selectable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Selectable.java 2009-11-17 17:23:33 UTC (rev 15894)
+++ root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Selectable.java 2009-11-17 17:24:43 UTC (rev 15895)
@@ -1,32 +0,0 @@
-/**
- * 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.component;
-
-import org.richfaces.model.selection.Selection;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public interface Selectable {
- public Selection getSelection();
- public void setSelection (Selection selection);
-}
Deleted: root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Sortable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Sortable.java 2009-11-17 17:23:33 UTC (rev 15894)
+++ root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Sortable.java 2009-11-17 17:24:43 UTC (rev 15895)
@@ -1,23 +0,0 @@
-/*
- * Copyright
- * Copyright (c) Exadel,Inc. 2006
- * All rights reserved.
- *
- * History
- * $Source: /cvs-master/intralinks-jsf-comps/components/data-view-grid/src/component/com/exadel/jsf/component/Sortable.java,v $
- * $Revision: 1.1 $
- */
-
-package org.richfaces.component;
-
-import org.richfaces.model.SortOrder;
-
-
-/**
- * @author Maksim Kaszynski
- * Base interface for sort capable components
- */
-public interface Sortable {
- public SortOrder getSortOrder();
- public void setSortOrder(SortOrder sortOrder);
-}
Deleted: root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Sortable2.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Sortable2.java 2009-11-17 17:23:33 UTC (rev 15894)
+++ root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Sortable2.java 2009-11-17 17:24:43 UTC (rev 15895)
@@ -1,37 +0,0 @@
-/**
- * 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.component;
-
-import java.util.List;
-
-import org.richfaces.model.SortField2;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public interface Sortable2 {
-
- public List<SortField2> getSortFields();
-
- public void setSortFields(List<SortField2> sortFields);
-
-}
15 years, 1 month