JBoss Rich Faces SVN: r16610 - root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-18 11:29:58 -0400 (Thu, 18 Mar 2010)
New Revision: 16610
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelMap.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/package-info.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelMap.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelMap.java 2010-03-18 15:28:56 UTC (rev 16609)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelMap.java 2010-03-18 15:29:58 UTC (rev 16610)
@@ -30,11 +30,11 @@
* @author asmirnov(a)exadel.com
*
*/
-public class ModelMap<K,E extends ModelElement<? super E>> extends LinkedHashMap<K, E> {
+public class ModelMap<K, E extends ModelElement<? super E>> extends LinkedHashMap<K, E> {
- public static <I,T extends ModelElement<? super T>> ModelMap<I,T> create(){
- return new ModelMap<I,T>();
+ public static <I, T extends ModelElement<? super T>> ModelMap<I, T> create() {
+ return new ModelMap<I, T>();
}
@@ -47,7 +47,7 @@
*/
public E put(K key, E value) {
E oldValue = get(key);
- if(null != oldValue){
+ if (null != oldValue) {
oldValue.merge(value);
} else {
super.put(key, value);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/package-info.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/package-info.java 2010-03-18 15:28:56 UTC (rev 16609)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/package-info.java 2010-03-18 15:29:58 UTC (rev 16610)
@@ -9,7 +9,7 @@
* <li>Encapsulates restrictions and references for model components, therefore it should be modified by model metods
* only.</li>
* <li>Encapsulates <a href="http://www.jboss.org/community/docs/DOC-13693">CDK naming conventions</a></li>
- * <li>Provides 'Visitor' pattern methods. see {@link LibraryVisitor} for reference.</li>
+ * <li>Provides 'Visitor' pattern methods. see {@link Visitor} for reference.</li>
* </ul>
*
*/
14 years, 7 months
JBoss Rich Faces SVN: r16609 - root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-18 11:28:56 -0400 (Thu, 18 Mar 2010)
New Revision: 16609
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ListenerModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelCollection.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ListenerModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ListenerModel.java 2010-03-18 15:27:30 UTC (rev 16608)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ListenerModel.java 2010-03-18 15:28:56 UTC (rev 16609)
@@ -25,8 +25,6 @@
package org.richfaces.cdk.model;
-import org.richfaces.cdk.CdkException;
-
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
@@ -47,11 +45,6 @@
public ListenerModel() {
}
- @Override
- public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
- return visitor.visit(this, param);
- }
-
public void accept(Visitor visitor) {
visitor.visitListener(this);
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelCollection.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelCollection.java 2010-03-18 15:27:30 UTC (rev 16608)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelCollection.java 2010-03-18 15:28:56 UTC (rev 16609)
@@ -23,17 +23,15 @@
package org.richfaces.cdk.model;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
-import org.richfaces.cdk.CdkException;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
/**
* <p class="changed_added_4_0">
* Base class for all model collections. This collection use {@link Mergeable#same(Object)} method instead of equals
@@ -165,19 +163,10 @@
return elements.toArray(a);
}
- public <R, P> R accept(org.richfaces.cdk.model.LibraryVisitor<R, P> visitor, P param) throws CdkException {
- R result = null;
- Iterator<E> iterator = iterator();
-
- while (null == result && iterator.hasNext()) {
- result = iterator.next().accept(visitor, param);
+ public void accept(Visitor visitor) {
+ for (ModelElement element : elements) {
+ element.accept(visitor);
}
-
- return result;
}
- public void accept(Visitor visitor) {
- // TODO
- }
-
}
14 years, 7 months
JBoss Rich Faces SVN: r16608 - root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-18 11:27:30 -0400 (Thu, 18 Mar 2010)
New Revision: 16608
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java 2010-03-18 15:26:51 UTC (rev 16607)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java 2010-03-18 15:27:30 UTC (rev 16608)
@@ -25,7 +25,6 @@
package org.richfaces.cdk.model;
-import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.util.ComparatorUtils;
/**
@@ -63,11 +62,6 @@
ComponentLibrary.merge(this, other);
}
- @Override
- public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
- return visitor.visit(this, param);
- }
-
public void accept(Visitor visitor) {
visitor.visitFacet(this);
}
14 years, 7 months
JBoss Rich Faces SVN: r16607 - root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-18 11:26:51 -0400 (Thu, 18 Mar 2010)
New Revision: 16607
Removed:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/LibraryVisitor.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Deleted: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/LibraryVisitor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/LibraryVisitor.java 2010-03-18 15:11:05 UTC (rev 16606)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/LibraryVisitor.java 2010-03-18 15:26:51 UTC (rev 16607)
@@ -1,46 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.model;
-
-import org.richfaces.cdk.CdkException;
-
-/**
- * <p class="changed_added_4_0"></p>
- *
- * @author asmirnov(a)exadel.com
- * @param <R> return type
- * @param <P> optional parameter type.
- */
-public interface LibraryVisitor<R, P> {
-
- /**
- * <p class="changed_added_4_0"></p>
- *
- * @param c
- * @param param
- * @return
- * @throws CdkException
- */
- public R visit(Visitable c, P param) throws CdkException;
-}
14 years, 7 months
JBoss Rich Faces SVN: r16606 - root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-18 11:11:05 -0400 (Thu, 18 Mar 2010)
New Revision: 16606
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EventModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EventName.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EventModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EventModel.java 2010-03-18 15:05:50 UTC (rev 16605)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EventModel.java 2010-03-18 15:11:05 UTC (rev 16606)
@@ -25,8 +25,6 @@
package org.richfaces.cdk.model;
-import org.richfaces.cdk.CdkException;
-
/**
* <p class="changed_added_4_0">That bean represent {@link javax.faces.event.FacesEvent} subclass that can be fired by
* component.</p>
@@ -132,11 +130,6 @@
ComponentLibrary.merge(this, other);
}
- @Override
- public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
- return visitor.visit(this, param);
- }
-
public void accept(Visitor visitor) {
visitor.visitEvent(this);
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EventName.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EventName.java 2010-03-18 15:05:50 UTC (rev 16605)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EventName.java 2010-03-18 15:11:05 UTC (rev 16606)
@@ -23,10 +23,9 @@
package org.richfaces.cdk.model;
-import java.io.Serializable;
-
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlValue;
+import java.io.Serializable;
/**
* <p class="changed_added_4_0"></p>
14 years, 7 months
JBoss Rich Faces SVN: r16605 - in root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model: validator and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-18 11:05:50 -0400 (Thu, 18 Mar 2010)
New Revision: 16605
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorRenderer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConfigExtension.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java 2010-03-18 15:04:03 UTC (rev 16604)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java 2010-03-18 15:05:50 UTC (rev 16605)
@@ -25,8 +25,6 @@
package org.richfaces.cdk.model;
-import org.richfaces.cdk.CdkException;
-
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
@@ -43,19 +41,13 @@
setId(behaviorId);
}
-
- @Override
- public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
- return visitor.visit(this, param);
- }
-
public void accept(Visitor visitor) {
visitor.visitBehavior(this);
}
@Override
public void merge(BehaviorModel other) {
- ComponentLibrary.merge(getAttributes(),other.getAttributes());
+ ComponentLibrary.merge(getAttributes(), other.getAttributes());
ComponentLibrary.merge(this, other);
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorRenderer.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorRenderer.java 2010-03-18 15:04:03 UTC (rev 16604)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorRenderer.java 2010-03-18 15:05:50 UTC (rev 16605)
@@ -25,8 +25,6 @@
package org.richfaces.cdk.model;
-import org.richfaces.cdk.CdkException;
-
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
@@ -83,10 +81,6 @@
}
@Override
- public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
- return visitor.visit(this, param);
- }
-
public void accept(Visitor visitor) {
visitor.visitBehaviorRenderer(this);
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2010-03-18 15:04:03 UTC (rev 16604)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2010-03-18 15:05:50 UTC (rev 16605)
@@ -26,7 +26,6 @@
package org.richfaces.cdk.model;
import com.google.inject.Singleton;
-import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.model.RenderKitModel.Id;
import java.beans.IntrospectionException;
@@ -76,8 +75,6 @@
private final ModelCollection<ListenerModel> listeners = ModelCollection.<ListenerModel>create();
- private final ModelCollection<RendererModel> renderers = ModelCollection.<RendererModel>create();
-
private long lastModified = Long.MIN_VALUE;
/**
@@ -108,34 +105,16 @@
this.tagLibrary = new TagLibrary();
}
- public ModelCollection<RendererModel> getRenderers() {
- return renderers;
- }
-
- @Override
- public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
- R result = accept(components, visitor, param, null);
-
- result = accept(renderKits.values(), visitor, param, result);
- result = accept(converters, visitor, param, result);
- result = accept(validators, visitor, param, result);
- result = accept(listeners, visitor, param, result);
- result = accept(events, visitor, param, result);
- result = accept(behaviors, visitor, param, result);
-
- return result;
- }
-
public void accept(Visitor visitor) {
visitor.visitComponentLibrary(this);
- visitCollection(visitor, components);
visitMap(visitor, renderKits);
- visitCollection(visitor, converters);
- visitCollection(visitor, validators);
- visitCollection(visitor, listeners);
- visitCollection(visitor, events);
- visitCollection(visitor, behaviors);
+ components.accept(visitor);
+ converters.accept(visitor);
+ validators.accept(visitor);
+ listeners.accept(visitor);
+ events.accept(visitor);
+ behaviors.accept(visitor);
}
private void visitMap(Visitor visitor, ModelMap<Id, RenderKitModel> modelMap) {
@@ -144,13 +123,6 @@
}
}
- @SuppressWarnings("unchecked")
- private void visitCollection(Visitor visitor, ModelCollection<?> models) {
- for (ModelElement component : models) {
- component.accept(visitor);
- }
- }
-
/**
* <p class="changed_added_4_0">
* </p>
@@ -356,21 +328,4 @@
// TODO Auto-generated catch block
}
}
-
- static <R, P, T extends ModelElement<T>> R accept(Iterable<T> components, LibraryVisitor<R, P> visitor, P param,
- R result) throws CdkException {
- if (null == result) {
- for (T t : components) {
- R accept = t.accept(visitor, param);
-
- if (null != accept) {
- result = accept;
-
- break;
- }
- }
- }
-
- return result;
- }
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-03-18 15:04:03 UTC (rev 16604)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-03-18 15:05:50 UTC (rev 16605)
@@ -1,7 +1,5 @@
package org.richfaces.cdk.model;
-import org.richfaces.cdk.CdkException;
-
import java.util.Collection;
/**
@@ -46,14 +44,10 @@
}
- @Override
- public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
- return visitor.visit(this, param);
- }
-
public void accept(Visitor visitor) {
visitor.visitComponent(this);
+ // TODO ??? see at render kit
for (RendererModel renderer : renderers) {
renderer.accept(visitor);
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConfigExtension.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConfigExtension.java 2010-03-18 15:04:03 UTC (rev 16604)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConfigExtension.java 2010-03-18 15:05:50 UTC (rev 16605)
@@ -24,12 +24,11 @@
package org.richfaces.cdk.model;
-import java.util.List;
+import org.w3c.dom.Element;
import javax.xml.bind.annotation.XmlAnyElement;
+import java.util.List;
-import org.w3c.dom.Element;
-
/**
* <p class="changed_added_4_0">That class represents all faces-config "extension" fields.</p>
*
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java 2010-03-18 15:04:03 UTC (rev 16604)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java 2010-03-18 15:05:50 UTC (rev 16605)
@@ -23,8 +23,6 @@
package org.richfaces.cdk.model;
-import org.richfaces.cdk.CdkException;
-
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
@@ -53,12 +51,6 @@
this.converterForClass = converterForClass;
}
-
- @Override
- public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
- return visitor.visit(this, param);
- }
-
public void accept(Visitor visitor) {
visitor.visitConverter(this);
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-03-18 15:04:03 UTC (rev 16604)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-03-18 15:05:50 UTC (rev 16605)
@@ -31,7 +31,13 @@
import org.richfaces.cdk.ModelValidator;
import org.richfaces.cdk.NamingConventions;
import org.richfaces.cdk.apt.SourceUtils;
-import org.richfaces.cdk.model.*;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.DescriptionGroup;
+import org.richfaces.cdk.model.FacetModel;
+import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.RenderKitModel;
+import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.util.Strings;
import java.util.Collection;
14 years, 7 months
JBoss Rich Faces SVN: r16604 - root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-18 11:04:03 -0400 (Thu, 18 Mar 2010)
New Revision: 16604
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibWriter.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibWriter.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibWriter.java 2010-03-18 14:50:38 UTC (rev 16603)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibWriter.java 2010-03-18 15:04:03 UTC (rev 16604)
@@ -25,7 +25,11 @@
import com.google.inject.Inject;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
-import org.richfaces.cdk.*;
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.CdkWriter;
+import org.richfaces.cdk.FileManager;
+import org.richfaces.cdk.Output;
+import org.richfaces.cdk.Outputs;
import org.richfaces.cdk.model.ComponentLibrary;
import java.io.IOException;
14 years, 7 months
JBoss Rich Faces SVN: r16603 - root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-18 10:50:38 -0400 (Thu, 18 Mar 2010)
New Revision: 16603
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java 2010-03-18 14:49:32 UTC (rev 16602)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ComponentClassGenerator.java 2010-03-18 14:50:38 UTC (rev 16603)
@@ -27,6 +27,7 @@
import com.google.inject.Inject;
import freemarker.template.Configuration;
+import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.CdkWriter;
import org.richfaces.cdk.FileManager;
import org.richfaces.cdk.Output;
@@ -34,31 +35,29 @@
import org.richfaces.cdk.freemarker.FreeMarkerRenderer;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
-import org.richfaces.cdk.model.Visitable;
+import java.util.Collection;
+
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
*
*/
-public class ComponentClassGenerator extends FreeMarkerRenderer<ComponentModel, ComponentLibrary> implements CdkWriter {
+public class ComponentClassGenerator extends FreeMarkerRenderer<ComponentModel> implements CdkWriter {
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.CdkWriter#init(org.richfaces.cdk.CdkContext)
- */
@Inject
public ComponentClassGenerator(Configuration configuration, ComponentLibrary library, @Output(Outputs.JAVA_CLASSES) FileManager output) {
super(configuration, library, output);
}
@Override
- protected boolean isMyComponent(Visitable c) {
- if (c instanceof ComponentModel) {
- return ((ComponentModel) c).isGenerate();
+ public void render() throws CdkException {
+ Collection<ComponentModel> models = library.getComponents();
+ for (ComponentModel model : models) {
+ if (model.isGenerate()) {
+ this.generate(model);
+ }
}
-
- return false;
}
@Override
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java 2010-03-18 14:49:32 UTC (rev 16602)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ConverterClassGenerator.java 2010-03-18 14:50:38 UTC (rev 16603)
@@ -24,6 +24,7 @@
import com.google.inject.Inject;
import freemarker.template.Configuration;
+import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.CdkWriter;
import org.richfaces.cdk.FileManager;
import org.richfaces.cdk.Output;
@@ -31,13 +32,14 @@
import org.richfaces.cdk.freemarker.FreeMarkerRenderer;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConverterModel;
-import org.richfaces.cdk.model.Visitable;
+import java.util.Collection;
+
/**
* @author akolonitsky
* @since Jan 20, 2010
*/
-public class ConverterClassGenerator extends FreeMarkerRenderer<ConverterModel, ComponentLibrary> implements CdkWriter {
+public class ConverterClassGenerator extends FreeMarkerRenderer<ConverterModel> implements CdkWriter {
@Inject
public ConverterClassGenerator(Configuration configuration, ComponentLibrary library,
@@ -46,12 +48,13 @@
}
@Override
- protected boolean isMyComponent(Visitable visitable) {
- if (visitable instanceof ConverterModel) {
- return ((ConverterModel) visitable).isGenerate();
+ public void render() throws CdkException {
+ Collection<ConverterModel> models = library.getConverters();
+ for (ConverterModel model : models) {
+ if (model.isGenerate()) {
+ this.generate(model);
+ }
}
-
- return false;
}
@Override
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java 2010-03-18 14:49:32 UTC (rev 16602)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ValidatorClassGenerator.java 2010-03-18 14:50:38 UTC (rev 16603)
@@ -24,6 +24,7 @@
import com.google.inject.Inject;
import freemarker.template.Configuration;
+import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.CdkWriter;
import org.richfaces.cdk.FileManager;
import org.richfaces.cdk.Output;
@@ -31,13 +32,14 @@
import org.richfaces.cdk.freemarker.FreeMarkerRenderer;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ValidatorModel;
-import org.richfaces.cdk.model.Visitable;
+import java.util.Collection;
+
/**
* @author akolonitsky
* @since Jan 15, 2010
*/
-public class ValidatorClassGenerator extends FreeMarkerRenderer<ValidatorModel, ComponentLibrary> implements CdkWriter {
+public class ValidatorClassGenerator extends FreeMarkerRenderer<ValidatorModel> implements CdkWriter {
@Inject
public ValidatorClassGenerator(Configuration configuration, ComponentLibrary library, @Output(Outputs.JAVA_CLASSES) FileManager output) {
@@ -45,12 +47,13 @@
}
@Override
- protected boolean isMyComponent(Visitable visitable) {
- if (visitable instanceof ValidatorModel) {
- return ((ValidatorModel) visitable).isGenerate();
+ public void render() throws CdkException {
+ Collection<ValidatorModel> models = library.getValidators();
+ for (ValidatorModel model : models) {
+ if (model.isGenerate()) {
+ this.generate(model);
+ }
}
-
- return false;
}
@Override
14 years, 7 months
JBoss Rich Faces SVN: r16602 - root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-18 10:49:32 -0400 (Thu, 18 Mar 2010)
New Revision: 16602
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java 2010-03-18 14:46:00 UTC (rev 16601)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/BehaviorClassGenerator.java 2010-03-18 14:49:32 UTC (rev 16602)
@@ -24,6 +24,7 @@
import com.google.inject.Inject;
import freemarker.template.Configuration;
+import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.CdkWriter;
import org.richfaces.cdk.FileManager;
import org.richfaces.cdk.Output;
@@ -31,18 +32,15 @@
import org.richfaces.cdk.freemarker.FreeMarkerRenderer;
import org.richfaces.cdk.model.BehaviorModel;
import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.model.Visitable;
+import java.util.Collection;
+
/**
* @author akolonitsky
* @since Jan 21, 2010
*/
-public class BehaviorClassGenerator extends FreeMarkerRenderer<BehaviorModel, ComponentLibrary> implements CdkWriter {
+public class BehaviorClassGenerator extends FreeMarkerRenderer<BehaviorModel> implements CdkWriter {
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.CdkWriter#init(org.richfaces.cdk.CdkContext)
- */
@Inject
public BehaviorClassGenerator(Configuration configuration, ComponentLibrary library,
@Output(Outputs.JAVA_CLASSES) FileManager output) {
@@ -50,17 +48,17 @@
}
@Override
- protected boolean isMyComponent(Visitable c) {
- if (c instanceof BehaviorModel) {
- return ((BehaviorModel) c).isGenerate();
+ public void render() throws CdkException {
+ Collection<BehaviorModel> models = library.getBehaviors();
+ for (BehaviorModel model : models) {
+ if (model.isGenerate()) {
+ this.generate(model);
+ }
}
-
- return false;
}
@Override
protected String getTemplateName() {
return "behavior.ftl";
}
-
}
14 years, 7 months
JBoss Rich Faces SVN: r16601 - root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-18 10:46:00 -0400 (Thu, 18 Mar 2010)
New Revision: 16601
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java 2010-03-18 14:40:34 UTC (rev 16600)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/FreeMarkerRenderer.java 2010-03-18 14:46:00 UTC (rev 16601)
@@ -25,36 +25,33 @@
package org.richfaces.cdk.freemarker;
-import java.io.File;
-import java.io.IOException;
-import java.io.Writer;
-
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.CdkWriter;
import org.richfaces.cdk.FileManager;
import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.model.LibraryVisitor;
import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.Trackable;
-import org.richfaces.cdk.model.Visitable;
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
/**
* <p class="changed_added_4_0">Base class for all output file buildes that use FreeMarker as template engine.</p>
* @author asmirnov(a)exadel.com
*
*/
-public abstract class FreeMarkerRenderer<C extends Visitable, P> implements CdkWriter, LibraryVisitor<Boolean, P> {
+public abstract class FreeMarkerRenderer<C> implements CdkWriter {
+ protected final ComponentLibrary library;
+
private final Configuration configuration;
private final Template template;
- private final ComponentLibrary library;
-
private final FileManager output;
public FreeMarkerRenderer(Configuration configuration, ComponentLibrary library, FileManager output) {
@@ -69,25 +66,7 @@
}
}
- @Override
- public void render() throws CdkException {
- library.accept(this, getVisitorParameter());
- }
-
- private P getVisitorParameter() {
- return null;
- }
-
- @Override
- public Boolean visit(Visitable c, P param) throws CdkException {
- if (isMyComponent(c)) {
- processComponent((C) c, param);
- }
-
- return null;
- }
-
- protected boolean processComponent(C c, P param) throws CdkException {
+ public void generate(C c) throws CdkException {
try {
Writer out = getOutput(c);
@@ -98,8 +77,6 @@
} catch (TemplateException e) {
throw new CdkException(e);
}
-
- return false;
}
protected Writer getOutput(C c) throws CdkException {
@@ -127,7 +104,6 @@
}
}
- protected abstract boolean isMyComponent(Visitable c);
-
protected abstract String getTemplateName();
+
}
14 years, 7 months