Author: alexsmirnov
Date: 2009-07-24 15:41:59 -0400 (Fri, 24 Jul 2009)
New Revision: 15012
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkException.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/ParsingException.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/Attribute.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/DocumentDefinition.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/DocumentDefinitionFactory.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/Element.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/Node.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/wutka/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/xerces/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/xerces/XedrceDefinitionFactory.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/
Removed:
root/cdk/trunk/plugins/generator/src/main/java/org/ajax4jsf/builder/
root/cdk/trunk/plugins/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ActionSource2PropertyProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ComponentModelBuilder.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ComponentPropertyProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ELPropertyProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ExpressionPropertyProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/PrimitivePropertyProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/PropertyProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/methods/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/state/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/config/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/velocity/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/xml/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Attribute.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/DocumentDefinition.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/DocumentDefinitionFactory.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Element.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Node.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/wutka/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/ant/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/builder/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/el/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/A4JRendererElementsFactory.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/Attribute.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/BodyElement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/DeclarationElement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/ElementsArray.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/ElementsFactory.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/JSTLElementsFactory.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/RootElement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/TemplateElement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/TemplateElementBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/CDATAElement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/CommentElement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HTMLAttributes.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HTMLElement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HTMLTags.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HtmlAttributesFactory.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/PIElement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/TextElement.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/attribute/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/jsp/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/std/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/vcp/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/utils/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/velocity/
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/builder/xml/
Modified:
root/cdk/trunk/plugins/generator/pom.xml
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/NamesListComparator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/XMLBody.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/XMLBodyMerge.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/XMLBodySerializer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/XPathComparator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/wutka/WutkaDefinitionFactory.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodyMergeTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodySerializerTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodyTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XPathComparatorTest.java
Log:
All obsolette classes has been removed
Modified: root/cdk/trunk/plugins/generator/pom.xml
===================================================================
--- root/cdk/trunk/plugins/generator/pom.xml 2009-07-24 19:18:42 UTC (rev 15011)
+++ root/cdk/trunk/plugins/generator/pom.xml 2009-07-24 19:41:59 UTC (rev 15012)
@@ -95,5 +95,11 @@
<artifactId>sac</artifactId>
<version>1.3</version>
</dependency>
+
+ <dependency>
+ <groupId>wutka</groupId>
+ <artifactId>dtdparser</artifactId>
+ <version>1.21</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ActionSource2PropertyProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ActionSource2PropertyProcessor.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ActionSource2PropertyProcessor.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,111 +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.component;
-
-import java.util.Arrays;
-import java.util.List;
-
-import javax.faces.component.ActionSource2;
-import javax.faces.el.MethodBinding;
-
-import org.richfaces.builder.component.methods.VelocityMethodBody;
-import org.richfaces.builder.config.PropertyBean;
-import org.richfaces.builder.generator.GeneratorException;
-import org.richfaces.builder.generator.JSFGeneratorConfiguration;
-import org.richfaces.builder.model.JavaClass;
-import org.richfaces.builder.model.JavaField;
-import org.richfaces.builder.model.JavaLanguageElement;
-import org.richfaces.builder.model.JavaMethod;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-@SuppressWarnings("deprecation")
-public class ActionSource2PropertyProcessor extends ComponentPropertyProcessor {
-
- private static final List<String> ACCEPTED_NAMES =
Arrays.asList("action", "actionListener",
"actionExpression");
-
- @Override
- public boolean accept(PropertyBean propertyBean, JavaClass javaClass,
- JSFGeneratorConfiguration configuration) {
-
- boolean result = !propertyBean.isExist();
-
- if (result) {
- result = ActionSource2.class.isAssignableFrom(javaClass.getSuperClass());
- if (result) {
- result = ACCEPTED_NAMES.contains(propertyBean.getName());
- }
- }
-
- return result;
- }
-
- @Override
- public void process(PropertyBean propertyBean, JavaClass javaClass,
- JSFGeneratorConfiguration configuration) {
-
- JavaField field = getField(propertyBean, configuration);
- JavaMethod accessor = getAccessor(configuration, propertyBean, field);
- JavaMethod mutator = getMutator(configuration, propertyBean, field);
-
- if("action".equals(propertyBean.getName())) {
-
- try {
- accessor.setMethodBody(new VelocityMethodBody(configuration) {
- @Override
- public String getTemplate() {
- return "snippets/get-action.vm";
- }
- });
- mutator.setMethodBody(new VelocityMethodBody(configuration) {
- @Override
- public String getTemplate() {
- return "snippets/set-action.vm";
- }
- });
-
- } catch (GeneratorException e) {
- e.printStackTrace();
- }
-
- } else {
- javaClass.addField(field);
- }
-
- if (field.getType().getName().equals(MethodBinding.class.getName())) {
-
- for(JavaLanguageElement el : new JavaLanguageElement[] {field, accessor, mutator}) {
- el.addAnnotation(SuppressWarnings.class, "\"deprecation\"");
- }
-
- }
-
-
- //Do not add variable
- javaClass.addMethod(accessor);
- javaClass.addMethod(mutator);
-
- }
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ComponentModelBuilder.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ComponentModelBuilder.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ComponentModelBuilder.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,206 +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.component;
-
-import static org.richfaces.builder.model.Argument.*;
-
-import java.util.Collection;
-
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.builder.component.state.ComponentStateManager;
-import org.richfaces.builder.config.ComponentBean;
-import org.richfaces.builder.config.PropertyBean;
-import org.richfaces.builder.config.RendererBean;
-import org.richfaces.builder.generator.GeneratorException;
-import org.richfaces.builder.generator.JSFGeneratorConfiguration;
-import org.richfaces.builder.model.JavaClass;
-import org.richfaces.builder.model.JavaConstructor;
-import org.richfaces.builder.model.JavaField;
-import org.richfaces.builder.model.JavaMethod;
-import org.richfaces.builder.model.JavaModifier;
-import org.richfaces.builder.model.JavaPackage;
-import org.richfaces.builder.model.MethodBody;
-
-/**
- * Build component class model from configs
- * @author Maksim Kaszynski
- *
- */
-public class ComponentModelBuilder {
-
- private PropertyProcessor[] propertyProcessors = {
- new ActionSource2PropertyProcessor(),
- new ExpressionPropertyProcessor(),
- new PrimitivePropertyProcessor(),
- new ELPropertyProcessor(),
- new ComponentPropertyProcessor()};
-
- public JavaClass build(ComponentBean componentBean, JSFGeneratorConfiguration
configuration) {
-
- String superclassname =
- componentBean.getSuperclass();
-
- JavaClass javaClass =
- new JavaClass(componentBean.getSimpleClassName(),
- new JavaPackage(componentBean.getPackageName()));
-
- try {
- Class<?> superClass =
- Class.forName(superclassname, false, configuration.getClassLoader());
-
- javaClass.setSuperClass(superClass);
-
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- javaClass.setSuperClass(UIComponentBase.class);
- }
-
- javaClass.addModifier(JavaModifier.PUBLIC);
-
- javaClass.addField(getComponentFamily(componentBean));
- javaClass.addField(getComponentType(componentBean));
-
- javaClass.addMethod(getConstructor(componentBean, javaClass));
-
- Collection<PropertyBean> properties = componentBean.getProperties();
-
- for (PropertyBean propertyBean : properties) {
- PropertyProcessor proc = null;
-
- for (int i = 0; i < propertyProcessors.length && proc == null; i++) {
-
- PropertyProcessor processor =
- propertyProcessors[i];
-
- if (processor.accept(propertyBean, javaClass, configuration)) {
- proc = processor;
- }
- }
-
- if (proc != null) {
- proc.process(propertyBean, javaClass, configuration);
- }
- }
-
- javaClass.addMethod(getComponentFamilyMethod(componentBean));
-
- ComponentStateManager stateManager = new ComponentStateManager(javaClass);
-
- JavaMethod saveState = getSaveStateTemplate();
- try {
- saveState.setMethodBody(stateManager.getSaveStateMethodBody(configuration));
- } catch (GeneratorException e) {
- e.printStackTrace();
- }
- javaClass.addMethod(saveState);
-
- JavaMethod restoreState = getRestoreStateTemplate();
- try {
- restoreState.setMethodBody(stateManager.getRestoreStateMethodBody(configuration));
- } catch (GeneratorException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- javaClass.addMethod(restoreState);
-
-
-
- return javaClass;
-
- }
-
- private JavaMethod getComponentFamilyMethod(ComponentBean componentBean) {
- JavaMethod javaMethod = new JavaMethod("getFamily", String.class);
- javaMethod.addModifier(JavaModifier.PUBLIC);
- javaMethod.setMethodBody(new MethodBody() {
- @Override
- public String toCode() {
- return "return COMPONENT_FAMILY;";
- }
- });
- return javaMethod;
- }
-
- private JavaMethod getRestoreStateTemplate() {
- JavaMethod method =
- new JavaMethod("restoreState",
- Void.TYPE,
- arg("context", FacesContext.class),
- arg("state", Object.class));
- method.addModifier(JavaModifier.PUBLIC);
- method.addAnnotation(Override.class);
-
- return method;
- }
-
- private JavaMethod getSaveStateTemplate() {
- JavaMethod method =
- new JavaMethod("saveState",
- Object.class,
- arg("context", FacesContext.class));
- method.addModifier(JavaModifier.PUBLIC);
- method.addAnnotation(Override.class);
- method.setMethodBody(new MethodBody() {
- @Override
- public String toCode() {
- return "return super.saveState(context);";
- }
- });
- return method;
- }
-
- private JavaField getComponentType(ComponentBean componentBean) {
- JavaField field = new JavaField(String.class, "COMPONENT_TYPE");
- field.addModifier(JavaModifier.PUBLIC);
- field.addModifier(JavaModifier.STATIC);
- field.addModifier(JavaModifier.FINAL);
- field.setValue("\"" + componentBean.getName() + "\"");
- return field;
- }
- private JavaField getComponentFamily(ComponentBean componentBean) {
- JavaField field = new JavaField(String.class, "COMPONENT_FAMILY");
- field.addModifier(JavaModifier.PUBLIC);
- field.addModifier(JavaModifier.STATIC);
- field.addModifier(JavaModifier.FINAL);
- field.setValue("\"" + componentBean.getFamily() + "\"");
- return field;
- }
-
- private JavaMethod getConstructor(ComponentBean componentBean, JavaClass javaClass) {
- final RendererBean renderer = componentBean.getRenderer();
- JavaMethod method = new JavaConstructor(javaClass);
- method.addModifier(JavaModifier.PUBLIC);
- method.setMethodBody(new MethodBody(method) {
- @Override
- public String toCode() {
- if (renderer != null) {
- return "setRendererType(\"" + renderer.getName() +
"\");";
- }
- return super.toCode();
- }
- });
-
- return method;
- }
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ComponentPropertyProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ComponentPropertyProcessor.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ComponentPropertyProcessor.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,133 +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.component;
-
-import org.richfaces.builder.config.PropertyBean;
-import org.richfaces.builder.generator.JSFGeneratorConfiguration;
-import org.richfaces.builder.model.Argument;
-import org.richfaces.builder.model.JavaClass;
-import org.richfaces.builder.model.JavaComment;
-import org.richfaces.builder.model.JavaField;
-import org.richfaces.builder.model.JavaLanguageElement;
-import org.richfaces.builder.model.JavaMethod;
-import org.richfaces.builder.model.JavaModifier;
-import org.richfaces.builder.model.JavaPrimitive;
-import org.richfaces.builder.model.MethodBody;
-
-/**
- * Default property handler - a fallback one.
- * @author Maksim Kaszynski
- *
- */
-public class ComponentPropertyProcessor implements PropertyProcessor {
-
- public boolean accept(PropertyBean propertyBean, JavaClass javaClass,
JSFGeneratorConfiguration configuration) {
- return !propertyBean.isExist();
- }
-
- /* (non-Javadoc)
- * @see
org.richfaces.builder.render.PropertyProcessor#process(org.richfaces.builder.config.PropertyBean,
org.richfaces.builder.model.JavaClass)
- */
- public void process(PropertyBean propertyBean, JavaClass javaClass,
JSFGeneratorConfiguration configuration) {
- JavaField field = getField(propertyBean, configuration);
-
- javaClass.addField(field);
- javaClass.addMethod(getAccessor(configuration, propertyBean, field));
- javaClass.addMethod(getMutator(configuration, propertyBean, field));
- }
-
- protected JavaField getField(PropertyBean propertyBean, JSFGeneratorConfiguration
configuration) {
- String name = propertyBean.getName();
- String defaultvalue = propertyBean.getDefaultvalue();
- Class<?> propertyClass = getType(propertyBean, configuration.getClassLoader());
- JavaField field = new JavaField(propertyClass, "_" + name, defaultvalue);
- field.getComments().add(new JavaComment(propertyBean.getXmlEncodedDescription()));
- field.getModifiers().add(JavaModifier.PRIVATE);
-
- if (propertyBean.isTransient()) {
- field.addModifier(JavaModifier.TRANSIENT);
- }
-
- handleDeprecation(field.getType(), field);
- return field;
- }
-
- protected Class<?> getType(PropertyBean propertyBean, ClassLoader classLoader) {
- if (propertyBean.isSimpleType()) {
- try {
- Class<?> clazz = JavaPrimitive.forName(propertyBean.getClassname());
- return clazz;
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else {
- try {
- Class<?> clazz = Class.forName(propertyBean.getClassname(), false,
classLoader);
- return clazz;
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- return Object.class;
- }
-
- protected JavaMethod getAccessor(JSFGeneratorConfiguration configuration, PropertyBean
propertyBean, final JavaField field) {
- JavaMethod accessor =
- new JavaMethod(propertyBean.getGetterName(), field.getType());
-
- accessor.setMethodBody(new MethodBody() {
- @Override
- public String toCode() {
- return "return " + field.getName() + ";";
- }
- });
-
- accessor.addModifier(JavaModifier.PUBLIC);
- handleDeprecation(field.getType(), accessor);
-
- return accessor;
- }
-
- protected JavaMethod getMutator(JSFGeneratorConfiguration configuration, PropertyBean
propertyBean, final JavaField field) {
- JavaMethod mutator =
- new JavaMethod(propertyBean.getSetterName(),
- new Argument(field.getName(), field.getType()));
-
- mutator.setMethodBody(new MethodBody(mutator) {
- @Override
- public String toCode() {
- return "this." + field.getName() + " = " + field.getName() +
";";
- }
- });
-
- handleDeprecation(field.getType(), mutator);
- mutator.addModifier(JavaModifier.PUBLIC);
- return mutator;
- }
-
- protected void handleDeprecation(Class<?> type, JavaLanguageElement element) {
- if (type.isAnnotationPresent(Deprecated.class)) {
- element.addAnnotation(SuppressWarnings.class, "\"deprecation\"");
- }
- }
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ELPropertyProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ELPropertyProcessor.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ELPropertyProcessor.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,65 +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.component;
-
-import org.richfaces.builder.component.methods.ELPropertyAccessorMethodBody;
-import org.richfaces.builder.config.PropertyBean;
-import org.richfaces.builder.generator.GeneratorException;
-import org.richfaces.builder.generator.JSFGeneratorConfiguration;
-import org.richfaces.builder.model.JavaClass;
-import org.richfaces.builder.model.JavaField;
-import org.richfaces.builder.model.JavaMethod;
-import org.richfaces.builder.model.MethodBody;
-
-/**
- * Processing of EL-enabled properties
- * @author Maksim Kaszynski
- *
- */
-public class ELPropertyProcessor extends ComponentPropertyProcessor {
-
- @Override
- public boolean accept(PropertyBean propertyBean, JavaClass javaClass,
JSFGeneratorConfiguration configuration) {
- return !(propertyBean.isExist() || propertyBean.isSimpleType()) &&
propertyBean.isEl() ;
- }
-
- @Override
- protected JavaMethod getAccessor(JSFGeneratorConfiguration config, PropertyBean
propertyBean, JavaField field) {
- field.setValue("null");
-
- JavaMethod accessor = super.getAccessor(config, propertyBean, field);
-
- try {
- ELPropertyAccessorMethodBody propertyAccessorMethodBody =
- new ELPropertyAccessorMethodBody(config, propertyBean, field);
-
- accessor.setMethodBody(propertyAccessorMethodBody);
-
- } catch (GeneratorException e) {
- accessor.setMethodBody(new MethodBody());
- e.printStackTrace();
- }
-
- return accessor;
- }
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ExpressionPropertyProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ExpressionPropertyProcessor.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/ExpressionPropertyProcessor.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,73 +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.component;
-
-import javax.el.Expression;
-import javax.faces.el.MethodBinding;
-import javax.faces.el.ValueBinding;
-
-import org.richfaces.builder.config.PropertyBean;
-import org.richfaces.builder.generator.JSFGeneratorConfiguration;
-import org.richfaces.builder.model.JavaClass;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-@SuppressWarnings("deprecation")
-public class ExpressionPropertyProcessor extends ComponentPropertyProcessor {
-
- private static final Class<?>[] acceptedClasses = {
- MethodBinding.class,
- ValueBinding.class,
- Expression.class};
-
- @Override
- public boolean accept(PropertyBean propertyBean, JavaClass javaClass,
- JSFGeneratorConfiguration configuration) {
-
- boolean result =
- !propertyBean.isExist() &&
- propertyBean.isEl() &&
- propertyBean.isElonly();
-
- if (result) {
- Class<?> type =
- getType(propertyBean, configuration.getClassLoader());
-
- result = false;
-
- for (Class<?> clazz : acceptedClasses) {
- if (clazz.isAssignableFrom(type)) {
- result = true;
- break;
- }
- }
-
-
- }
-
-
-
- return result;
- }
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/PrimitivePropertyProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/PrimitivePropertyProcessor.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/PrimitivePropertyProcessor.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,141 +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.component;
-
-import javax.el.ELException;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-
-import org.richfaces.builder.component.methods.VelocityMethodBody;
-import org.richfaces.builder.config.PropertyBean;
-import org.richfaces.builder.generator.GeneratorException;
-import org.richfaces.builder.generator.JSFGeneratorConfiguration;
-import org.richfaces.builder.model.JavaClass;
-import org.richfaces.builder.model.JavaField;
-import org.richfaces.builder.model.JavaMethod;
-import org.richfaces.builder.model.JavaModifier;
-import org.richfaces.builder.model.JavaPrimitive;
-import org.richfaces.builder.model.MethodBody;
-
-/**
- * Handle primitive properties
- * @author Maksim Kaszynski
- *
- */
-public class PrimitivePropertyProcessor extends ComponentPropertyProcessor {
-
- class PrimitiveELPropertyAccessorMethodBody extends VelocityMethodBody {
-
- public PrimitiveELPropertyAccessorMethodBody(
- JSFGeneratorConfiguration configuration, JavaField field, JavaField field2,
PropertyBean property)
- throws GeneratorException {
- super(configuration);
- getContext().put("field1", field);
- getContext().put("field2", field2);
- getContext().put("wrapperClass",
JavaPrimitive.wrapperType(field.getType()));
- getContext().put("property", property);
- addType(ValueExpression.class);
- addType(ELException.class);
- addType(FacesException.class);
- }
-
- @Override
- public String getTemplate() {
- return "snippets/primitive-el-property-accessor.vm";
- }
- }
-
- class PrimitivePropertyAccessorMethodBody extends VelocityMethodBody {
-
- public PrimitivePropertyAccessorMethodBody(
- JSFGeneratorConfiguration configuration, JavaField field, JavaField field2)
- throws GeneratorException {
- super(configuration);
- getContext().put("field1", field);
- getContext().put("field2", field2);
- }
-
- @Override
- public String getTemplate() {
- return "snippets/primitive-property-accessor.vm";
- }
- }
-
- class PrimitivePropertyMutatorMethodBody extends VelocityMethodBody {
-
- public PrimitivePropertyMutatorMethodBody(
- JSFGeneratorConfiguration configuration, JavaField field, JavaField field2)
- throws GeneratorException {
- super(configuration);
- getContext().put("field1", field);
- getContext().put("field2", field2);
- }
-
- @Override
- public String getTemplate() {
- return "snippets/primitive-property-mutator.vm";
- }
- }
-
- @Override
- public boolean accept(PropertyBean propertyBean, JavaClass javaClass,
JSFGeneratorConfiguration configuration) {
- return propertyBean.isSimpleType() && super.accept(propertyBean, javaClass,
configuration);
- }
-
- @Override
- public void process(PropertyBean propertyBean, JavaClass javaClass,
JSFGeneratorConfiguration configuration) {
- JavaField field = getField(propertyBean, configuration);
- JavaField field2 = new JavaField(boolean.class, field.getName() + "Set",
"false");
- field2.addModifier(JavaModifier.PRIVATE);
- if (propertyBean.isTransient()) {
- field2.addModifier(JavaModifier.TRANSIENT);
- }
- JavaMethod accessor = getAccessor(configuration, propertyBean, field);
- MethodBody accessorMethodBody;
-
- try {
- if (propertyBean.isEl()) {
- accessorMethodBody = new PrimitiveELPropertyAccessorMethodBody(configuration, field,
field2, propertyBean);
- } else {
- accessorMethodBody = new PrimitivePropertyAccessorMethodBody(configuration, field,
field2);
- }
- accessor.setMethodBody(accessorMethodBody);
- } catch (GeneratorException e) {
- e.printStackTrace();
- }
-
- JavaMethod mutator = getMutator(configuration, propertyBean, field);
-
- try {
- PrimitivePropertyMutatorMethodBody mutatorBody = new
PrimitivePropertyMutatorMethodBody(configuration, field, field2);
- mutator.setMethodBody(mutatorBody);
- } catch (GeneratorException e) {
- e.printStackTrace();
- }
-
- javaClass.addField(field);
- javaClass.addField(field2);
- javaClass.addMethod(accessor);
- javaClass.addMethod(mutator);
- }
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/PropertyProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/PropertyProcessor.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/component/PropertyProcessor.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,36 +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.component;
-
-import org.richfaces.builder.config.PropertyBean;
-import org.richfaces.builder.generator.JSFGeneratorConfiguration;
-import org.richfaces.builder.model.JavaClass;
-
-/**
- * Process single property - add field to class, accessor, mutator, etc.
- * @author Maksim Kaszynski
- *
- */
-public interface PropertyProcessor {
- boolean accept(PropertyBean propertyBean, JavaClass javaClass, JSFGeneratorConfiguration
configuration);
- void process(PropertyBean propertyBean, JavaClass javaClass, JSFGeneratorConfiguration
configuration);
-}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkException.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkException.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkException.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -0,0 +1,68 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class CdkException extends Exception {
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ */
+ public CdkException() {
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param message
+ */
+ public CdkException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param cause
+ */
+ public CdkException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param message
+ * @param cause
+ */
+ public CdkException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils (from
rev 15003, root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/xml)
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/NamesListComparator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/xml/NamesListComparator.java 2009-07-24
13:21:35 UTC (rev 15003)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/NamesListComparator.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.richfaces.builder.xml;
+package org.richfaces.cdk.xmlutils;
import java.util.Comparator;
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/ParsingException.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/ParsingException.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/ParsingException.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -0,0 +1,43 @@
+package org.richfaces.cdk.xmlutils;
+
+import org.richfaces.cdk.CdkException;
+
+public class ParsingException extends CdkException {
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ */
+ public ParsingException() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param message
+ * @param cause
+ */
+ public ParsingException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param message
+ */
+ public ParsingException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param cause
+ */
+ public ParsingException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/ParsingException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/XMLBody.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/xml/XMLBody.java 2009-07-24
13:21:35 UTC (rev 15003)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/XMLBody.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.richfaces.builder.xml;
+package org.richfaces.cdk.xmlutils;
import java.io.IOException;
import java.io.InputStream;
@@ -35,7 +35,6 @@
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
-import org.richfaces.builder.config.ParsingException;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/XMLBodyMerge.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/xml/XMLBodyMerge.java 2009-07-24
13:21:35 UTC (rev 15003)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/XMLBodyMerge.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.richfaces.builder.xml;
+package org.richfaces.cdk.xmlutils;
import java.util.ArrayList;
import java.util.Collections;
@@ -34,7 +34,6 @@
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
-import org.richfaces.builder.config.ParsingException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/XMLBodySerializer.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/xml/XMLBodySerializer.java 2009-07-24
13:21:35 UTC (rev 15003)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/XMLBodySerializer.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.richfaces.builder.xml;
+package org.richfaces.cdk.xmlutils;
import java.io.StringWriter;
@@ -30,7 +30,6 @@
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import org.richfaces.builder.config.ParsingException;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.NodeList;
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/XPathComparator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/xml/XPathComparator.java 2009-07-24
13:21:35 UTC (rev 15003)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/XPathComparator.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.richfaces.builder.xml;
+package org.richfaces.cdk.xmlutils;
import java.util.Comparator;
Copied:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/Attribute.java
(from rev 15003,
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Attribute.java)
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/Attribute.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/Attribute.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -0,0 +1,35 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.xmlutils.dtd;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class Attribute extends Node{
+
+ public Attribute(String name) {
+ super(name);
+ }
+
+
+}
Copied:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/DocumentDefinition.java
(from rev 15003,
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/DocumentDefinition.java)
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/DocumentDefinition.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/DocumentDefinition.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -0,0 +1,62 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.xmlutils.dtd;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class DocumentDefinition {
+ private Map<String, Element> elements = new HashMap<String, Element>();
+
+ private URL url;
+
+ private Element rootElement;
+
+ public DocumentDefinition(URL url, Element rootElement) {
+ super();
+ this.url = url;
+ this.rootElement = rootElement;
+ }
+
+ public void addElement(Element e) {
+ elements.put(e.getName(), e);
+ }
+
+ public Element getElement(String name) {
+ return elements.get(name);
+ }
+
+ public URL getUrl() {
+ return url;
+ }
+
+ public Element getRootElement() {
+ return rootElement;
+ }
+
+
+}
Copied:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/DocumentDefinitionFactory.java
(from rev 15003,
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/DocumentDefinitionFactory.java)
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/DocumentDefinitionFactory.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/DocumentDefinitionFactory.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -0,0 +1,42 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.xmlutils.dtd;
+
+import java.net.URL;
+
+import org.richfaces.cdk.xmlutils.dtd.wutka.WutkaDefinitionFactory;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public abstract class DocumentDefinitionFactory {
+
+ private static DocumentDefinitionFactory instance =
+ new WutkaDefinitionFactory();
+
+ public static DocumentDefinitionFactory instance() {
+ return instance;
+ }
+
+ public abstract DocumentDefinition getDocumentDefinition(URL resource);
+}
Copied:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/Element.java
(from rev 15003,
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Element.java)
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/Element.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/Element.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -0,0 +1,48 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.xmlutils.dtd;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class Element extends Node{
+
+ private Map<String, Attribute> attributes = new HashMap<String,
Attribute>();
+
+ public Element(String name) {
+ super(name);
+ }
+
+ public void addAttribute(Attribute attribute) {
+ attributes.put(attribute.getName(), attribute);
+ }
+
+ public Map<String, Attribute> getAttributes() {
+ return attributes;
+ }
+
+
+}
Copied:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/Node.java
(from rev 15003,
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Node.java)
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/Node.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/Node.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -0,0 +1,42 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.xmlutils.dtd;
+
+/**
+ * Reduced DOM
+ * @author Maksim Kaszynski
+ *
+ */
+public class Node {
+
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public Node(String name) {
+ super();
+ this.name = name;
+ }
+
+}
Copied:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/wutka (from
rev 15003, root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/wutka)
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/wutka/WutkaDefinitionFactory.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/wutka/WutkaDefinitionFactory.java 2009-07-24
13:21:35 UTC (rev 15003)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/wutka/WutkaDefinitionFactory.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -19,19 +19,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.richfaces.dtd.wutka;
+package org.richfaces.cdk.xmlutils.dtd.wutka;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.richfaces.dtd.Attribute;
-import org.richfaces.dtd.DocumentDefinition;
-import org.richfaces.dtd.DocumentDefinitionFactory;
-import org.richfaces.dtd.Element;
+import org.richfaces.cdk.Logger;
+import org.richfaces.cdk.LoggerFactory;
+import org.richfaces.cdk.xmlutils.dtd.Attribute;
+import org.richfaces.cdk.xmlutils.dtd.DocumentDefinition;
+import org.richfaces.cdk.xmlutils.dtd.DocumentDefinitionFactory;
+import org.richfaces.cdk.xmlutils.dtd.Element;
import com.wutka.dtd.DTD;
import com.wutka.dtd.DTDAttribute;
@@ -44,7 +44,7 @@
*/
public class WutkaDefinitionFactory extends DocumentDefinitionFactory{
- private final Log log = LogFactory.getLog(this.getClass());
+ private final Logger log = LoggerFactory.getLogger();
private Map<URL, DocumentDefinition> definitions
= new HashMap<URL, DocumentDefinition>();
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/xerces/XedrceDefinitionFactory.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/xerces/XedrceDefinitionFactory.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/xerces/XedrceDefinitionFactory.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -0,0 +1,143 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.xmlutils.dtd.xerces;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.xerces.impl.Constants;
+import org.apache.xerces.parsers.XMLGrammarPreparser;
+import org.apache.xerces.xni.XNIException;
+import org.apache.xerces.xni.grammars.Grammar;
+import org.apache.xerces.xni.grammars.XMLGrammarDescription;
+import org.apache.xerces.xni.grammars.XSGrammar;
+import org.apache.xerces.xni.parser.XMLInputSource;
+import org.apache.xerces.xs.XSModel;
+import org.richfaces.cdk.Logger;
+import org.richfaces.cdk.LoggerFactory;
+import org.richfaces.cdk.xmlutils.dtd.DocumentDefinition;
+import org.richfaces.cdk.xmlutils.dtd.DocumentDefinitionFactory;
+
+/**
+ * <p class="changed_added_4_0">
+ * That class implements {@link DocumentDefinitionFactory} that parses XML
+ * schema using Xerces Xml Schema API
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class XedrceDefinitionFactory extends DocumentDefinitionFactory {
+
+ private final Logger log = LoggerFactory.getLogger();
+ /** Namespaces feature id (
http://xml.org/sax/features/namespaces). */
+ public static final String NAMESPACES_FEATURE_ID =
"http://xml.org/sax/features/namespaces";
+ /** Validation feature id (
http://xml.org/sax/features/validation). */
+ public static final String VALIDATION_FEATURE_ID =
"http://xml.org/sax/features/validation";
+ /**
+ * Schema validation feature id
+ * (
http://apache.org/xml/features/validation/schema).
+ */
+ public static final String SCHEMA_VALIDATION_FEATURE_ID =
"http://apache.org/xml/features/validation/schema";
+ /**
+ * Schema full checking feature id
+ * (
http://apache.org/xml/features/validation/schema-full-checking).
+ */
+ public static final String SCHEMA_FULL_CHECKING_FEATURE_ID =
"http://apache.org/xml/features/validation/schema-full-checking";
+
+ // feature: continue-after-fatal-error
+ public final static String CONTINUE_AFTER_FATAL_ERROR = Constants.XERCES_FEATURE_PREFIX
+ + Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE;
+ /** Property identifier: symbol table. */
+ public static final String SYMBOL_TABLE = Constants.XERCES_PROPERTY_PREFIX
+ + Constants.SYMBOL_TABLE_PROPERTY;
+ /** Property identifier: error reporter. */
+ public static final String ERROR_REPORTER = Constants.XERCES_PROPERTY_PREFIX
+ + Constants.ERROR_REPORTER_PROPERTY;
+ /** Property identifier: error handler. */
+ public static final String ERROR_HANDLER = Constants.XERCES_PROPERTY_PREFIX
+ + Constants.ERROR_HANDLER_PROPERTY;
+ /** Property identifier: entity resolver. */
+ public static final String ENTITY_RESOLVER = Constants.XERCES_PROPERTY_PREFIX
+ + Constants.ENTITY_RESOLVER_PROPERTY;
+ /** Property identifier: grammar pool . */
+ public static final String GRAMMAR_POOL = Constants.XERCES_PROPERTY_PREFIX
+ + Constants.XMLGRAMMAR_POOL_PROPERTY;
+
+ private Map<URL, DocumentDefinition> definitions = new HashMap<URL,
DocumentDefinition>();
+
+ @Override
+ public synchronized DocumentDefinition getDocumentDefinition(URL resource) {
+ DocumentDefinition def = null;
+ if (definitions.containsKey(resource)) {
+ def = definitions.get(resource);
+ } else {
+
+ try {
+ def = initDefinition(resource);
+ } catch (Exception e) {
+ log.error("An error has occured", e);
+ }
+
+ if (def != null) {
+ definitions.put(resource, def);
+ }
+ }
+ return def;
+ }
+
+ public DocumentDefinition initDefinition(URL resource) {
+ XMLGrammarPreparser preparser = new XMLGrammarPreparser();
+ // preparser.registerPreparser(XMLGrammarDescription.XML_DTD, null);
+ preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null);
+
+ // preparser.setProperty(GRAMMAR_POOL, grammarPool);
+ preparser.setFeature(NAMESPACES_FEATURE_ID, true);
+ preparser.setFeature(VALIDATION_FEATURE_ID, true);
+ // note we can set schema features just in case...
+ preparser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true);
+ preparser.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, true);
+
+ try {
+ Grammar g = preparser.preparseGrammar(
+ XMLGrammarDescription.XML_SCHEMA,
+ createInputSource(resource));
+ XSGrammar grammar = (XSGrammar) g;
+ XSModel model = grammar.toXSModel();
+ // TODO - make DocumentDefinition from XML schema.
+ } catch (XNIException e) {
+ log.error(e);
+ } catch (IOException e) {
+ log.error(e);
+ }
+ return null;
+ }
+
+ protected XMLInputSource createInputSource(URL resource) {
+ return new XMLInputSource(null, resource.toExternalForm(), null);
+ }
+
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/dtd/xerces/XedrceDefinitionFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Attribute.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Attribute.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Attribute.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,35 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * 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.dtd;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public class Attribute extends Node{
-
- public Attribute(String name) {
- super(name);
- }
-
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/DocumentDefinition.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/DocumentDefinition.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/DocumentDefinition.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,62 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * 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.dtd;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public class DocumentDefinition {
- private Map<String, Element> elements = new HashMap<String, Element>();
-
- private URL url;
-
- private Element rootElement;
-
- public DocumentDefinition(URL url, Element rootElement) {
- super();
- this.url = url;
- this.rootElement = rootElement;
- }
-
- public void addElement(Element e) {
- elements.put(e.getName(), e);
- }
-
- public Element getElement(String name) {
- return elements.get(name);
- }
-
- public URL getUrl() {
- return url;
- }
-
- public Element getRootElement() {
- return rootElement;
- }
-
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/DocumentDefinitionFactory.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/DocumentDefinitionFactory.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/DocumentDefinitionFactory.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,42 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * 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.dtd;
-
-import java.net.URL;
-
-import org.richfaces.dtd.wutka.WutkaDefinitionFactory;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public abstract class DocumentDefinitionFactory {
-
- private static DocumentDefinitionFactory instance =
- new WutkaDefinitionFactory();
-
- public static DocumentDefinitionFactory instance() {
- return instance;
- }
-
- public abstract DocumentDefinition getDocumentDefinition(URL resource);
-}
Deleted: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Element.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Element.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Element.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,48 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * 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.dtd;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public class Element extends Node{
-
- private Map<String, Attribute> attributes = new HashMap<String,
Attribute>();
-
- public Element(String name) {
- super(name);
- }
-
- public void addAttribute(Attribute attribute) {
- attributes.put(attribute.getName(), attribute);
- }
-
- public Map<String, Attribute> getAttributes() {
- return attributes;
- }
-
-
-}
Deleted: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Node.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Node.java 2009-07-24
19:18:42 UTC (rev 15011)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/dtd/Node.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,42 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * 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.dtd;
-
-/**
- * Reduced DOM
- * @author Maksim Kaszynski
- *
- */
-public class Node {
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public Node(String name) {
- super();
- this.name = name;
- }
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/A4JRendererElementsFactory.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/A4JRendererElementsFactory.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/A4JRendererElementsFactory.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,175 +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.templatecompiler.elements;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.richfaces.templatecompiler.builder.CompilationContext;
-import org.richfaces.templatecompiler.builder.CompilationException;
-import org.richfaces.templatecompiler.elements.html.CDATAElement;
-import org.richfaces.templatecompiler.elements.html.CommentElement;
-import org.richfaces.templatecompiler.elements.html.PIElement;
-import org.richfaces.templatecompiler.elements.html.TextElement;
-import org.richfaces.templatecompiler.elements.vcp.AjaxRenderedAreaElement;
-import org.richfaces.templatecompiler.elements.vcp.HeaderScriptsElement;
-import org.richfaces.templatecompiler.elements.vcp.HeaderStylesElement;
-import org.w3c.dom.Node;
-
-/**
- * Tag processors factory.
- *
- * @author ayukhovich(a)exadel.com (latest modification by $Author:
- * maksimkaszynski $)
- * @version $Revision: 1.1.2.2 $ $Date: 2007/02/26 20:48:44 $
- *
- */
-public class A4JRendererElementsFactory implements ElementsFactory {
-
- private static final Log log = LogFactory.getLog(A4JRendererElementsFactory.class);
-
- public static final String TEMPLATES_PATH = "META-INF/templates";
-
- public static final String TEMPLATES_TEMPLATECOMPILER_PATH =
TEMPLATES_PATH+"/templatecompiler";
-
- private final static String DEFAULT_CLASS_ELEMENT_PROCESSOR =
"org.richfaces.templatecompiler.elements.html.HTMLElement";
-
- private final static Class[] paramClasses = new Class[] { Node.class,
- CompilationContext.class };
-
- private final static HashMap<String, String> mapClasses = new HashMap<String,
String>();
-
- static {
- mapClasses
- .put("c:set",
- "org.richfaces.templatecompiler.elements.std.SetTemplateElement");
- mapClasses
- .put("c:object",
- "org.richfaces.templatecompiler.elements.std.ObjectTemplateElement");
- mapClasses.put("c:if",
- "org.richfaces.templatecompiler.elements.std.IFTemplateElement");
- mapClasses
- .put("c:forEach",
- "org.richfaces.templatecompiler.elements.std.ForEachTemplateElement");
- mapClasses
- .put("f:clientid",
- "org.richfaces.templatecompiler.elements.vcp.FClientIDTemplateElement");
- mapClasses
- .put("f:clientId",
- "org.richfaces.templatecompiler.elements.vcp.FClientIDTemplateElement");
- mapClasses.put("f:insertComponent",
- "org.richfaces.templatecompiler.elements.vcp.InsertComponent");
-
- mapClasses
- .put("f:call",
- "org.richfaces.templatecompiler.elements.vcp.FCallTemplateElement");
- mapClasses
- .put("f:resource",
- "org.richfaces.templatecompiler.elements.vcp.FResourceTemplateElement");
-
- mapClasses
- .put("u:insertFacet",
- "org.richfaces.templatecompiler.elements.vcp.UInsertFacetTemplateElement");
-
- mapClasses
- .put("vcp:body",
- "org.richfaces.templatecompiler.elements.vcp.VcpBodyTemplateElement");
- mapClasses.put("vcp:mock", "");
-
- mapClasses.put("jsp:scriptlet",
- "org.richfaces.templatecompiler.elements.jsp.Scriptlet");
- mapClasses.put("jsp:declaration",
- "org.richfaces.templatecompiler.elements.jsp.Declaration");
- mapClasses.put("jsp:directive.page",
- "org.richfaces.templatecompiler.elements.jsp.DirectivePage");
- mapClasses.put("jsp:expression",
- "org.richfaces.templatecompiler.elements.jsp.Expression");
- mapClasses.put("h:styles", HeaderStylesElement.class.getName());
- mapClasses.put("h:scripts", HeaderScriptsElement.class.getName());
- mapClasses.put("f:template", RootElement.class.getName());
- mapClasses.put("f:root", RootElement.class.getName());
- mapClasses.put("jsp:root", RootElement.class.getName());
- mapClasses.put("ajax:update", AjaxRenderedAreaElement.class.getName());
- }
-
- /* (non-Javadoc)
- * @see
org.richfaces.templatecompiler.elements.ElementsFactory#getProcessor(org.w3c.dom.Node,
org.richfaces.templatecompiler.builder.CompilationContext)
- */
- public TemplateElement getProcessor(final Node nodeElement,
- final CompilationContext componentBean) throws CompilationException {
- TemplateElement returnValue = null;
-
- short nodeType = nodeElement.getNodeType();
- if (Node.CDATA_SECTION_NODE == nodeType) {
- returnValue =new CDATAElement(nodeElement, componentBean);
- } else if (Node.TEXT_NODE == nodeType) {
- returnValue =new TextElement(nodeElement, componentBean);
- } else if (Node.COMMENT_NODE == nodeType) {
- returnValue =new CommentElement(nodeElement, componentBean);
- } else if (Node.PROCESSING_INSTRUCTION_NODE == nodeType) {
- returnValue =new PIElement(nodeElement, componentBean);
- } else if (Node.ELEMENT_NODE == nodeType) {
- String className = (String) mapClasses.get(nodeElement.getNodeName());
-
- if (className == null) {
- className = DEFAULT_CLASS_ELEMENT_PROCESSOR;
- }
-
- if (!className.equals("")) {
- Class class1;
- try {
- log.debug("loading class: " + className);
-
- class1 = Class.forName(className);
- Object[] objects = new Object[2];
- objects[0] = nodeElement;
- objects[1] = componentBean;
-
- returnValue = (TemplateElement) class1.getConstructor(
- paramClasses).newInstance(objects);
- } catch (InstantiationException e) {
- throw new CompilationException("InstantiationException: "
- + e.getLocalizedMessage(), e);
- } catch (IllegalAccessException e) {
- throw new CompilationException("IllegalAccessException: "
- + e.getLocalizedMessage(), e);
- } catch (IllegalArgumentException e) {
- e.printStackTrace();
- } catch (SecurityException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- throw new CompilationException("InvocationTargetException: "
- + e.getMessage(), e);
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- throw new CompilationException(" error loading class: "
- + e.getLocalizedMessage());
- }
- }
- }
- return returnValue;
- }
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/Attribute.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/Attribute.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/Attribute.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,40 +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.templatecompiler.elements;
-
-/**
- * Interface for HTLM-attributes.
- *
- * @author ayukhovich(a)exadel.com (latest modification by $Author:
- * alexeyyukhovich $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/26 20:48:44 $
- *
- */
-public interface Attribute {
- public void copyValues(final Attribute src);
-
- public String getName();
-
- public String getValue();
-
- public String getCode();
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/BodyElement.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/BodyElement.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/BodyElement.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,31 +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.templatecompiler.elements;
-
-/**
- * Marker interface for central body element ( for renderer, contain encodeChildren
method content )
- * @author shura
- *
- */
-public interface BodyElement {
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/DeclarationElement.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/DeclarationElement.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/DeclarationElement.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -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.templatecompiler.elements;
-
-/**
- * Marker interdace for {@link TemplateElement} processed as declaration, outside
- * of encode... methods
- * @author shura
- *
- */
-public interface DeclarationElement {
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/ElementsArray.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/ElementsArray.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/ElementsArray.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,55 +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.templatecompiler.elements;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.richfaces.templatecompiler.builder.CompilationException;
-
-/**
- * @author ayukhovich(a)exadel.com (latest modification by $Author:
- * alexeyyukhovich $)
- * @version $Revision: 1.1.2.3 $ $Date: 2007/02/26 20:48:45 $
- *
- */
-class ElementsArray extends ArrayList<TemplateElement> {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public String toCode() throws CompilationException {
- StringBuffer buf = new StringBuffer();
-
- Iterator<TemplateElement> i = iterator();
- boolean hasNext = i.hasNext();
- while (hasNext) {
- TemplateElement o = i.next();
- if (o != null) {
- buf.append(o.toCode());
- }
- hasNext = i.hasNext();
- } // while
- return buf.toString();
- }
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/ElementsFactory.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/ElementsFactory.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/ElementsFactory.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -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.templatecompiler.elements;
-
-import org.richfaces.templatecompiler.builder.CompilationContext;
-import org.richfaces.templatecompiler.builder.CompilationException;
-import org.w3c.dom.Node;
-
-/**
- * @author shura
- *
- */
-public interface ElementsFactory {
-
- public abstract TemplateElement getProcessor(final Node nodeElement,
- final CompilationContext componentBean) throws CompilationException;
-
-}
\ No newline at end of file
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/JSTLElementsFactory.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/JSTLElementsFactory.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/JSTLElementsFactory.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,43 +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.templatecompiler.elements;
-
-import org.richfaces.templatecompiler.builder.CompilationContext;
-import org.richfaces.templatecompiler.builder.CompilationException;
-import org.w3c.dom.Node;
-
-/**
- * @author shura
- *
- */
-public class JSTLElementsFactory implements ElementsFactory {
-
- /* (non-Javadoc)
- * @see
org.richfaces.templatecompiler.elements.ElementsFactory#getProcessor(org.w3c.dom.Node,
org.richfaces.templatecompiler.builder.CompilationContext)
- */
- public TemplateElement getProcessor(Node nodeElement,
- CompilationContext componentBean) throws CompilationException {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/RootElement.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/RootElement.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/RootElement.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,196 +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.templatecompiler.elements;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.velocity.VelocityContext;
-import org.richfaces.templatecompiler.builder.CompilationContext;
-import org.richfaces.templatecompiler.builder.CompilationException;
-import org.richfaces.templatecompiler.elements.vcp.VcpBodyTemplateElement;
-import org.w3c.dom.Node;
-
-/**
- * @author shura
- *
- */
-public class RootElement extends TemplateElementBase {
-
- private static final String TEMPLATE =
A4JRendererElementsFactory.TEMPLATES_TEMPLATECOMPILER_PATH+"/ComponentTemplate.vm";
- private static final String ENCODE_BEGIN_TEMPLATE =
A4JRendererElementsFactory.TEMPLATES_TEMPLATECOMPILER_PATH+"/EncodeBegin.vm";
- private static final String ENCODE_END_TEMPLATE =
A4JRendererElementsFactory.TEMPLATES_TEMPLATECOMPILER_PATH+"/EncodeEnd.vm";
- private static final String ENCODE_CHILDREN_TEMPLATE =
A4JRendererElementsFactory.TEMPLATES_TEMPLATECOMPILER_PATH+"/EncodeChildren.vm";
-
- final private static String regexComponent = "(.*)" +
VcpBodyTemplateElement.STR_VCB_BODY + "(.*)"
- + VcpBodyTemplateElement.STR_VCB_BODY + "(.*)";
-
- final private static Pattern patternComponent = Pattern.compile(
- regexComponent, Pattern.UNIX_LINES + Pattern.DOTALL);
-
- /**
- * @param element
- * @param componentBean
- */
- public RootElement(Node element, CompilationContext componentBean) {
- super(element, componentBean);
- // TODO apply global attributes
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.templatecompiler.elements.TemplateElement#getBeginElement()
- */
- public String getBeginElement() throws CompilationException {
- VelocityContext context = new VelocityContext();
- context.put("component", this.getComponentBean());
- return this.getComponentBean().processTemplate(getTemplateName(), context);
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.templatecompiler.elements.TemplateElementBase#toCode()
- */
- public String toCode() throws CompilationException {
- VelocityContext context = new VelocityContext();
- context.put("component", this.getComponentBean());
- StringBuffer code = new StringBuffer();
- String beginElement = this.getBeginElement();
- if (null != beginElement) {
- code.append(beginElement);
- code.append("\n");
- }
- StringBuffer declarationsCode = new StringBuffer();
- StringBuffer methodCode = new StringBuffer();
- for (ListIterator<TemplateElement> iter = getSubElements().listIterator();
iter.hasNext();) {
- TemplateElement element = iter.next();
- String toCode = element.toCode();
- if(element instanceof DeclarationElement){
- declarationsCode.append(toCode);
- } /*else if(element instanceof BodyElement){
- // All collected code put to encodeBegin method.
- if (methodCode.length()>0) {
- context.put("body", methodCode.toString());
- code.append(this.getComponentBean().processTemplate(
- getEncodeBeginTemplateName(), context));
- }
- // If body contain any code, create encodeChildren method.
- if (toCode.length()>0) {
- context.put("body", toCode);
- code.append(this.getComponentBean().processTemplate(
- getEncodeChildrenTemplateName(), context));
- }
- methodCode = new StringBuffer();
- } */
- else {
- methodCode.append(toCode);
- }
- }
-
- if (methodCode.length()>0) {
-
- Matcher matcher = patternComponent.matcher(methodCode);
-
- String strEncodeBegin;
- String strEncodeChildren;
- String strEncodeEnd;
-
- if (matcher.find()) {
- strEncodeBegin = matcher.group(1);
- // put content before body element to encodeBegin
- if (strEncodeBegin.trim().length()>0) {
- context.put("body", strEncodeBegin);
- code.append(this.getComponentBean().processTemplate(
- getEncodeBeginTemplateName(), context));
- }
- strEncodeChildren = matcher.group(2);
- if (strEncodeChildren.trim().length()>0 ) {
- // put content of body element
- context.put("body", strEncodeChildren);
- code.append(this.getComponentBean().processTemplate(
- getEncodeChildrenTemplateName(), context));
- }
-
- strEncodeEnd = matcher.group(3);
- if(strEncodeEnd.trim().length()>0){
- // All code after body put to encodeEnd method.
- context.put("body", strEncodeEnd);
- code.append(this.getComponentBean().processTemplate(
- getEncodeEndTemplateName(), context));
- }
- } else {
- // All collected code put to encodeEnd method.
- context.put("body", methodCode.toString());
- code.append(this.getComponentBean().processTemplate(
- getEncodeEndTemplateName(), context));
- }
- }
- if(declarationsCode.length()>0){
- code.append(declarationsCode);
- }
- String endElement = this.getEndElement();
- if (endElement != null) {
- code.append(endElement);
- code.append("\n");
- }
- return code.toString();
- }
-
- /**
- * @return
- */
- protected String getEncodeBeginTemplateName() {
- return ENCODE_BEGIN_TEMPLATE;
- }
-
- /**
- * @return
- */
- protected String getEncodeEndTemplateName() {
- return ENCODE_END_TEMPLATE;
- }
- /**
- * @return
- */
- protected String getEncodeChildrenTemplateName() {
- return ENCODE_CHILDREN_TEMPLATE;
- }
- /**
- * @return
- */
- protected String getTemplateName() {
- return TEMPLATE;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.templatecompiler.elements.TemplateElement#getEndElement()
- */
- public String getEndElement() throws CompilationException {
- // TODO Auto-generated method stub
- return "\n}";
- }
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/TemplateElement.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/TemplateElement.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/TemplateElement.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,51 +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.templatecompiler.elements;
-
-import java.util.ArrayList;
-
-import org.richfaces.templatecompiler.builder.CompilationException;
-
-/**
- * Intarace for tag processors.
- *
- * @author ayukhovich(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.2 $ $Date: 2007/02/26 20:48:43 $
- *
- */
-public interface TemplateElement {
- public String getBeginElement() throws CompilationException;
-
- public String getEndElement() throws CompilationException;
-
- public boolean isSkipBody();
-
- public void addSubElement(TemplateElement e);
-
- public String toCode() throws CompilationException;
-
- /**
- * @return the subElements
- */
- public ArrayList<TemplateElement> getSubElements();
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/TemplateElementBase.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/TemplateElementBase.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/TemplateElementBase.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,93 +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.templatecompiler.elements;
-
-import org.richfaces.templatecompiler.builder.CompilationContext;
-import org.richfaces.templatecompiler.builder.CompilationException;
-import org.w3c.dom.Node;
-
-/**
- * Abstract base class for tag processors.
- *
- * @author ayukhovich(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.3 $ $Date: 2007/02/26 20:48:44 $
- */
-public abstract class TemplateElementBase implements TemplateElement {
-
-
- private CompilationContext componentBean;
-
- private ElementsArray subElements = new ElementsArray();
-
-
- public TemplateElementBase(final Node element,
- final CompilationContext componentBean) {
- this.componentBean = componentBean;
- };
-
- public boolean isSkipBody() {
- // by default, children process by compiler.
- return false;
- }
-
- public void addSubElement(TemplateElement e) {
- this.subElements.add(e);
- }
-
- public String toCode() throws CompilationException {
- StringBuffer buf = new StringBuffer();
-
- String beginElement = this.getBeginElement();
- if (null != beginElement) {
- buf.append(beginElement);
- buf.append("\n");
- }
-
- if (this.subElements.size() != 0) {
- buf.append(this.subElements.toCode());
- }
-
- String endElement = this.getEndElement();
- if (endElement != null) {
- buf.append(endElement);
- buf.append("\n");
- }
-
- return buf.toString();
- }
-
- /**
- * @return the componentBean
- */
- public CompilationContext getComponentBean() {
- return componentBean;
- }
-
- /**
- * @return the subElements
- */
- public ElementsArray getSubElements() {
- return this.subElements;
- }
-
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/CDATAElement.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/CDATAElement.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/CDATAElement.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,69 +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.templatecompiler.elements.html;
-
-import org.richfaces.templatecompiler.builder.CompilationContext;
-import org.richfaces.templatecompiler.el.ELParser;
-import org.richfaces.templatecompiler.elements.TemplateElementBase;
-import org.w3c.dom.Node;
-
-/**
- * @author shura
- *
- */
-public class CDATAElement extends TemplateElementBase {
-
- private String htmlText;
-
- public CDATAElement(Node element, CompilationContext componentBean) {
- super(element, componentBean);
- this.htmlText = element.getNodeValue();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.templatecompiler.elements.TemplateElement#getBeginElement()
- */
- public String getBeginElement() {
- StringBuffer retValue = new StringBuffer();
- if ((null != this.htmlText) && (this.htmlText.length() > 0)) {
- retValue.append(" writer.write(\"<![CDATA[\");\n");
- retValue.append(" writer.write(convertToString(").append(
- ELParser.compileEL(this.htmlText, this.getComponentBean()))
- .append("));\n");
- retValue.append(" writer.write(\"]]>\");\n");
- }
- return retValue.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.templatecompiler.elements.TemplateElement#getEndElement()
- */
- public String getEndElement() {
- // Do nothitg - text not have childs
- return null;
- }
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/CommentElement.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/CommentElement.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/CommentElement.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,70 +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.templatecompiler.elements.html;
-
-import java.util.Formatter;
-
-import org.richfaces.templatecompiler.builder.CompilationContext;
-import org.richfaces.templatecompiler.el.ELParser;
-import org.richfaces.templatecompiler.elements.TemplateElementBase;
-import org.w3c.dom.Node;
-
-/**
- * @author shura
- *
- */
-public class CommentElement extends TemplateElementBase {
-
- private String htmlText;
-
- public CommentElement(Node element, CompilationContext componentBean) {
- super(element, componentBean);
- this.htmlText = element.getNodeValue();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.templatecompiler.elements.TemplateElement#getBeginElement()
- */
- public String getBeginElement() {
- String retValue = null;
- if ((null != this.htmlText) && (this.htmlText.length() > 0)) {
- Object[] params = { ELParser.compileEL(this.htmlText, this.getComponentBean()) };
- retValue = new Formatter().format(
- "writer.writeComment(convertToString(%s));\n", params)
- .toString();
- }
- return retValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.templatecompiler.elements.TemplateElement#getEndElement()
- */
- public String getEndElement() {
- // Do nothitg - text not have childs
- return null;
- }
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HTMLAttributes.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HTMLAttributes.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HTMLAttributes.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,63 +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.templatecompiler.elements.html;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.richfaces.templatecompiler.elements.Attribute;
-
-/**
- * Processing HTLM-attributes.
- *
- * @author ayukhovich(a)exadel.com (latest modification by $Author:
- * alexeyyukhovich $)
- * @version $Revision: 1.1.2.2 $ $Date: 2007/02/26 20:48:41 $
- *
- */
-public class HTMLAttributes {
- private LinkedHashMap attributesMap = new LinkedHashMap();
-
-
- public void addAttribute(String nameAttribute, String valueAttribute) {
-
- Attribute attribute = HtmlAttributesFactory.getProcessor(
- nameAttribute, valueAttribute);
-
- if (attribute != null) {
- Attribute oldElemet = (Attribute) this.attributesMap.get(attribute
- .getName());
-
- if (oldElemet != null) {
- oldElemet.copyValues(attribute);
- } else {
- this.attributesMap.put(attribute.getName(), attribute);
- }
- } else {
- System.out.println("attribute is null");
- }
- }
-
- public Map getAttributes() {
- return this.attributesMap;
- }
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HTMLElement.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HTMLElement.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HTMLElement.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,187 +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.templatecompiler.elements.html;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Formatter;
-import java.util.List;
-import java.util.TreeSet;
-
-import org.apache.velocity.VelocityContext;
-import org.richfaces.templatecompiler.builder.CompilationContext;
-import org.richfaces.templatecompiler.builder.CompilationException;
-import org.richfaces.templatecompiler.el.ELParser;
-import org.richfaces.templatecompiler.elements.A4JRendererElementsFactory;
-import org.richfaces.templatecompiler.elements.TemplateElementBase;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * Processing template HTLM-attributes.
- *
- * @author ayukhovich(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.3 $ $Date: 2007/02/26 20:48:42 $
- *
- */
-public class HTMLElement extends TemplateElementBase {
- final static private String PRE_TAG_NAME = "pre";
-
- private static final String PASS_THRU_ATTR = "x:passThruWithExclusions";
-
- private static final List<String> DEFAULT_EXCLUSIONS =
Arrays.asList("class", "id");
-
- private static final String TEMPLATE =
A4JRendererElementsFactory.TEMPLATES_TEMPLATECOMPILER_PATH
- + "/HTMLElement.vm";
-
- private String htmlTag;
-
- private String htmlText;
-
- private HTMLAttributes htmlAttributes = new HTMLAttributes();
-
- private Collection<String> passThruAttributes = null;
-
- private CompilationContext componentBean;
-
- /**
- *
- * @param element
- * @param variables
- */
- public HTMLElement(final Node element,
- final CompilationContext componentBean) {
- super(element, componentBean);
-
- this.passThruAttributes = null;
- this.htmlTag = element.getNodeName();
- this.componentBean = componentBean;
- processingAttributes(element.getAttributes());
- }
-
- /**
- * @return string contain
- * @throws CompilationException
- */
- public String getBeginElement() throws CompilationException {
- VelocityContext context = new VelocityContext();
- context.put("htmlTag", this.htmlTag);
- context.put("htmlAttributes", this.htmlAttributes.getAttributes());
- context.put("passThruAttributes", this.passThruAttributes);
- if (this.htmlText != null) {
- context.put("htmlText", this.htmlText);
- }
- return this.componentBean.processTemplate(getTemplateName(), context);
-
- }
-
- /**
- * @return
- */
- protected String getTemplateName() {
- // TODO Auto-generated method stub
- return TEMPLATE;
- }
-
- /**
- * @return
- */
- public String getEndElement() {
- String sReturnValue;
-
- Object[] objects = new Object[1];
- objects[0] = this.htmlTag;
-
- sReturnValue = new
Formatter().format("writer.endElement(\"%s\");",
- objects).toString();
- return sReturnValue;
- }
-
- /**
- *
- * @param attributes
- */
- public void processingAttributes(NamedNodeMap attributes) {
- if (attributes == null) {
- return;
- }
-
- for (int iElement = 0; iElement != attributes.getLength(); iElement++) {
- Node attribute = attributes.item(iElement);
- String attributeName = attribute.getNodeName();
- String attributeValue = attribute.getNodeValue();
-
- if (attributeName.equals(PASS_THRU_ATTR)) {
- processingPassThruAtrribute(attributeValue);
- } else {
- this.htmlAttributes.addAttribute(attributeName, ELParser
- .compileEL(attributeValue, this.componentBean));
- }
-
- } // for
- }
-
- /**
- *
- * @param listPassThruAttributes
- */
- private void processingPassThruAtrribute(String listPassThruAttributes) {
-
- passThruAttributes =
- new TreeSet<String>(HTMLTags.getAttributes(this.htmlTag));
-
- String[] excludeAttributes = listPassThruAttributes.split(",");
-
- passThruAttributes.removeAll(DEFAULT_EXCLUSIONS);
-
- for (String attribute : excludeAttributes) {
- passThruAttributes.remove(attribute);
- }
-
- }
-
- /**
- * Set a body text for HTML-tag
- *
- * @param nodeText
- */
- public void setText(final String nodeText) {
- String tempStr = null;
- // if TAG is not PRE test do not trim
- if (nodeText.trim().length() != 0) {
- if (this.htmlTag.compareToIgnoreCase(PRE_TAG_NAME) == 0) {
- tempStr = nodeText;
- } else {
- tempStr = nodeText.trim();
- }
- }
-
- if (null != tempStr) {
- if (null == this.htmlText) {
- this.htmlText = ELParser.compileEL(tempStr, this.componentBean);
- } else {
- this.htmlText = this.htmlText
- + ELParser.compileEL(tempStr, this.componentBean);
- }
- }
- }
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HTMLTags.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HTMLTags.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HTMLTags.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,107 +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.templatecompiler.elements.html;
-
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.net.URL;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.Map.Entry;
-
-import org.richfaces.dtd.DocumentDefinition;
-import org.richfaces.dtd.DocumentDefinitionFactory;
-import org.richfaces.dtd.Element;
-
-
-/**
- * @author yukhovich
- * @author Maksim Kaszynski
- */
-public class HTMLTags {
- /**
- *
- */
-
- private static final String HTML_SCHEMA =
"META-INF/schema/html/xhtml1-transitional.dtd";
-
- private static final URL HTML_DTD =
HTMLTags.class.getClassLoader().getResource(HTML_SCHEMA);
-
- @SuppressWarnings("unchecked")
- public static Set<String> getAttributes(String tagName) {
- Set<String> atrs = Collections.emptySet();
-
- DocumentDefinition dtd =
- DocumentDefinitionFactory.instance().getDocumentDefinition(HTML_DTD);
-
- if (dtd != null) {
- Element element = dtd.getElement(tagName);
-
- if (element != null) {
- atrs = element.getAttributes().keySet();
- }
- }
-
- return atrs;
-
- }
-
- /**
- * Look for tags.bin, and compare with it
- * @param args
- * @throws Exception
- */
- public static void main(String [] args) throws Exception{
- InputStream stream =
HTMLTags.class.getClassLoader().getResourceAsStream("META-INF/templates/templatecompiler/tags.bin");
-
- ObjectInputStream stream2 = new ObjectInputStream(stream);
-
- @SuppressWarnings("unchecked")
- Map<String, List<String>> m =
- (Map<String, List<String>>) stream2.readObject();
-
- Set<String> newAttrs = new TreeSet<String>();
-
- Set<Entry<String,List<String>>> entrySet = m.entrySet();
- for (Entry<String, List<String>> entry : entrySet) {
- String element = entry.getKey();
-
- Set<String> attributes = HTMLTags.getAttributes(element);
- List<String> attributeList = entry.getValue();
-
- if (attributeList != null && attributes != null) {
- attributes.removeAll(attributeList);
- }
- newAttrs.addAll(attributes);
-
- System.out.println(element + attributes);
-
- }
-
- System.out.println(newAttrs);
- }
-
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HtmlAttributesFactory.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HtmlAttributesFactory.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/HtmlAttributesFactory.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,93 +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.templatecompiler.elements.html;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-
-import org.richfaces.templatecompiler.elements.Attribute;
-
-/**
- * Factory for processing HTLM-attributes.
- *
- * @author ayukhovich(a)exadel.com (latest modification by $Author:
- * alexeyyukhovich $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/02/26 20:48:42 $
- *
- */
-public class HtmlAttributesFactory {
- private final static String DEFAULT_CLASS_ATTRIBUTE_PROCESSOR =
"org.richfaces.templatecompiler.elements.html.attribute.HtmlAttribute";
-
- private final static Class[] paramClasses = new Class[] { String.class,
- String.class };
-
- private final static HashMap mapClasses = new HashMap();
-
- static {
- // mapClasses.put("x:passThruWithExclusions",
- //
"org.richfaces.templatecompiler.elements.html.attribute.PassThruWithExclusions");
- mapClasses.put("x:otherParameters", "");
- }
-
- public static Attribute getProcessor(String attributeName,
- String attributeValue) {
- Attribute returnValue = null;
-
- String className = (String) mapClasses.get(attributeName);
-
- if (className == null) {
- className = DEFAULT_CLASS_ATTRIBUTE_PROCESSOR;
- }
-
- if (!className.equals("")) {
- Class class1;
- try {
- class1 = Class.forName(className);
- try {
- try {
- Object[] objects = new Object[2];
- objects[0] = attributeName;
- objects[1] = attributeValue;
- returnValue = (Attribute) class1.getConstructor(
- paramClasses).newInstance(objects);
- } catch (InstantiationException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- }
- } catch (IllegalArgumentException e) {
- e.printStackTrace();
- } catch (SecurityException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- }
- } catch (ClassNotFoundException e1) {
- e1.printStackTrace();
- }
- }
-
- return returnValue;
- }
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/PIElement.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/PIElement.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/PIElement.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,68 +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.templatecompiler.elements.html;
-
-import org.richfaces.templatecompiler.builder.CompilationContext;
-import org.richfaces.templatecompiler.el.ELParser;
-import org.richfaces.templatecompiler.elements.TemplateElementBase;
-import org.w3c.dom.Node;
-
-/**
- * @author shura
- *
- */
-public class PIElement extends TemplateElementBase {
-
- private String htmlText;
-
- public PIElement(Node element, CompilationContext componentBean) {
- super(element, componentBean);
- this.htmlText = element.getNodeValue();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.templatecompiler.elements.TemplateElement#getBeginElement()
- */
- public String getBeginElement() {
- StringBuffer retValue = new StringBuffer();
- if ((null != this.htmlText) && (this.htmlText.length() > 0)) {
- retValue.append(" writer.write(\"<![CDATA[\");\n");
- retValue.append(" writer.write(").append(
- ELParser.compileEL(this.htmlText,
this.getComponentBean())).append(");\n");
- retValue.append(" writer.write(\"]]>\");\n");
- }
- return null; // retValue.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.templatecompiler.elements.TemplateElement#getEndElement()
- */
- public String getEndElement() {
- // Do nothitg - text not have childs
- return null;
- }
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/TextElement.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/TextElement.java 2009-07-24
19:18:42 UTC (rev 15011)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/templatecompiler/elements/html/TextElement.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -1,70 +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.templatecompiler.elements.html;
-
-import java.util.Formatter;
-
-import org.richfaces.templatecompiler.builder.CompilationContext;
-import org.richfaces.templatecompiler.el.ELParser;
-import org.richfaces.templatecompiler.elements.TemplateElementBase;
-import org.w3c.dom.Node;
-
-/**
- * @author shura
- *
- */
-public class TextElement extends TemplateElementBase {
-
- private String htmlText;
-
- public TextElement(Node element, CompilationContext componentBean) {
- super(element, componentBean);
- this.htmlText = element.getNodeValue().trim();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.templatecompiler.elements.TemplateElement#getBeginElement()
- */
- public String getBeginElement() {
- String retValue = null;
- if ((null != this.htmlText) && (this.htmlText.length() > 0)) {
- Object[] params = { ELParser.compileEL(this.htmlText, this.getComponentBean()) };
- retValue = new Formatter().format(
- "writer.writeText(convertToString(%s),null);\n", params)
- .toString();
- }
- return retValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.templatecompiler.elements.TemplateElement#getEndElement()
- */
- public String getEndElement() {
- // Do nothitg - text not have childs
- return null;
- }
-
-}
Copied: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils (from
rev 15003, root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/builder/xml)
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodyMergeTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/builder/xml/XMLBodyMergeTest.java 2009-07-24
13:21:35 UTC (rev 15003)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodyMergeTest.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -19,9 +19,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.richfaces.builder.xml;
+package org.richfaces.cdk.xmlutils;
-import org.richfaces.builder.xml.XMLBodyMerge;
+import org.richfaces.cdk.xmlutils.XMLBodyMerge;
import junit.framework.TestCase;
@@ -46,7 +46,7 @@
}
/**
- * Test method for {@link
org.richfaces.builder.xml.XMLBodyMerge#add(org.w3c.dom.Node)}.
+ * Test method for {@link
org.richfaces.cdk.xmlutils.XMLBodyMerge#add(org.w3c.dom.Node)}.
*/
public void testAddNode() {
XMLBodyMerge merge = new XMLBodyMerge("//node()");
@@ -54,28 +54,28 @@
}
/**
- * Test method for {@link
org.richfaces.builder.xml.XMLBodyMerge#add(org.richfaces.builder.xml.XMLBody)}.
+ * Test method for {@link
org.richfaces.cdk.xmlutils.XMLBodyMerge#add(org.richfaces.cdk.xmlutils.XMLBody)}.
*/
public void testAddXMLBody() {
//fail("Not yet implemented");
}
/**
- * Test method for {@link org.richfaces.builder.xml.XMLBodyMerge#getLength()}.
+ * Test method for {@link org.richfaces.cdk.xmlutils.XMLBodyMerge#getLength()}.
*/
public void testGetLength() {
//fail("Not yet implemented");
}
/**
- * Test method for {@link org.richfaces.builder.xml.XMLBodyMerge#item(int)}.
+ * Test method for {@link org.richfaces.cdk.xmlutils.XMLBodyMerge#item(int)}.
*/
public void testItem() {
//fail("Not yet implemented");
}
/**
- * Test method for {@link org.richfaces.builder.xml.XMLBodyMerge#getContent()}.
+ * Test method for {@link org.richfaces.cdk.xmlutils.XMLBodyMerge#getContent()}.
*/
public void testGetContent() {
//fail("Not yet implemented");
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodySerializerTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/builder/xml/XMLBodySerializerTest.java 2009-07-24
13:21:35 UTC (rev 15003)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodySerializerTest.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.richfaces.builder.xml;
+package org.richfaces.cdk.xmlutils;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@@ -28,8 +28,8 @@
import javax.xml.parsers.DocumentBuilderFactory;
import org.richfaces.builder.config.ParsingException;
-import org.richfaces.builder.xml.XMLBody;
-import org.richfaces.builder.xml.XMLBodySerializer;
+import org.richfaces.cdk.xmlutils.XMLBody;
+import org.richfaces.cdk.xmlutils.XMLBodySerializer;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -61,7 +61,7 @@
}
/**
- * Test method for {@link
org.richfaces.builder.xml.XMLBodySerializer#serialize(org.w3c.dom.NodeList,
org.w3c.dom.Document)}.
+ * Test method for {@link
org.richfaces.cdk.xmlutils.XMLBodySerializer#serialize(org.w3c.dom.NodeList,
org.w3c.dom.Document)}.
*/
public void testSerialize() throws ParsingException{
String xml = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?>\n"
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodyTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/builder/xml/XMLBodyTest.java 2009-07-24
13:21:35 UTC (rev 15003)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XMLBodyTest.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.richfaces.builder.xml;
+package org.richfaces.cdk.xmlutils;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@@ -28,7 +28,7 @@
import junit.framework.TestCase;
import org.richfaces.builder.config.ParsingException;
-import org.richfaces.builder.xml.XMLBody;
+import org.richfaces.cdk.xmlutils.XMLBody;
/**
* @author shura
@@ -56,7 +56,7 @@
/**
* Test method for
- * {@link org.richfaces.builder.xml.XMLBody#loadXML(java.io.InputStream)}.
+ * {@link org.richfaces.cdk.xmlutils.XMLBody#loadXML(java.io.InputStream)}.
*
* @throws ParsingException
*/
@@ -80,7 +80,7 @@
/**
* Test method for
- * {@link org.richfaces.builder.xml.XMLBody#isRootName(java.lang.String)}.
+ * {@link org.richfaces.cdk.xmlutils.XMLBody#isRootName(java.lang.String)}.
*
* @throws ParsingException
*/
@@ -98,7 +98,7 @@
}
/**
- * Test method for {@link org.richfaces.builder.xml.XMLBody#getDoctype()}.
+ * Test method for {@link org.richfaces.cdk.xmlutils.XMLBody#getDoctype()}.
*
* @throws ParsingException
*/
@@ -118,7 +118,7 @@
/**
* Test method for
- * {@link org.richfaces.builder.xml.XMLBody#getRootNameSpace()}.
+ * {@link org.richfaces.cdk.xmlutils.XMLBody#getRootNameSpace()}.
*
* @throws ParsingException
*/
@@ -133,7 +133,7 @@
}
/**
- * Test method for {@link org.richfaces.builder.xml.XMLBody#getContent()}.
+ * Test method for {@link org.richfaces.cdk.xmlutils.XMLBody#getContent()}.
*
* @throws ParsingException
*/
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XPathComparatorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/builder/xml/XPathComparatorTest.java 2009-07-24
13:21:35 UTC (rev 15003)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlutils/XPathComparatorTest.java 2009-07-24
19:41:59 UTC (rev 15012)
@@ -19,13 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.richfaces.builder.xml;
+package org.richfaces.cdk.xmlutils;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import org.richfaces.builder.xml.XMLBody;
-import org.richfaces.builder.xml.XPathComparator;
+import org.richfaces.cdk.xmlutils.XMLBody;
+import org.richfaces.cdk.xmlutils.XPathComparator;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;