JBoss Rich Faces SVN: r18234 - in root/examples/richfaces-showcase/trunk/src/main: webapp/images/icons and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-07-26 08:17:39 -0400 (Mon, 26 Jul 2010)
New Revision: 18234
Added:
root/examples/richfaces-showcase/trunk/src/main/webapp/images/icons/common/
root/examples/richfaces-showcase/trunk/src/main/webapp/images/icons/common/rf.png
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/panel/
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/panel/lookCustomization.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/panel/simple.xhtml
Modified:
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml
Log:
https://jira.jboss.org/browse/RF-8967
Modified: root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml
===================================================================
--- root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-07-26 12:06:45 UTC (rev 18233)
+++ root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-07-26 12:17:39 UTC (rev 18234)
@@ -141,7 +141,7 @@
<sample>
<id>viewusage</id>
<name>Common status for view</name>
- </sample>
+ </sample>
<sample>
<id>simple</id>
<name>Status Simple</name>
@@ -273,7 +273,7 @@
<name>Data Lists Component</name>
</sample>
</samples>
- </demo>
+ </demo>
<demo new="true">
<id>dataGrid</id>
<name>rich:dataGrid</name>
@@ -283,24 +283,29 @@
<name>Data Grid Component</name>
</sample>
</samples>
- </demo>
+ </demo>
</demos>
</group>
- <!-- group>
- <name>Panels</name>
+ <group>
+ <name>Output/Panels</name>
<demos>
<demo>
- <id>divPanel</id>
- <name>rich:divPanel</name>
+ <id>panel</id>
+ <name>rich:panel</name>
<samples>
<sample>
<id>simple</id>
- <name>Simple divPanel component</name>
+ <name>Simple Panels</name>
</sample>
+ <sample>
+ <id>lookCustomization</id>
+ <name>Look and feel customization</name>
+ </sample>
</samples>
- </demo>
+ </demo>
</demos>
- </group-->
+ </group>
+
<group>
<name>Misc Components/Features</name>
<demos>
@@ -323,7 +328,7 @@
<name>RichFaces Functions</name>
</sample>
</samples>
- </demo>
+ </demo>
<demo>
<id>componentControl</id>
<name>rich:componentControl</name>
Added: root/examples/richfaces-showcase/trunk/src/main/webapp/images/icons/common/rf.png
===================================================================
(Binary files differ)
Property changes on: root/examples/richfaces-showcase/trunk/src/main/webapp/images/icons/common/rf.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/panel/lookCustomization.xhtml
===================================================================
--- root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/panel/lookCustomization.xhtml (rev 0)
+++ root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/panel/lookCustomization.xhtml 2010-07-26 12:17:39 UTC (rev 18234)
@@ -0,0 +1,95 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+
+<ui:composition>
+ <style>
+.rich-panel-header {
+ color: #0054BD;
+}
+
+.panel {
+ vertical-align: top;
+}
+
+.top {
+ width: 200px;
+ height: 100px;
+}
+
+.head2 {
+ background-image: url();
+ background-color: #4C9600;
+ height: 18px;
+ text-align: center;
+ vertical-align: middle;
+ color: #CFF;
+ padding: 4px 0;
+}
+
+.body3 {
+ height: 100px;
+ overflow: auto;
+}
+</style>
+ <h:panelGrid columnClasses="panel" border="0" columns="2">
+ <rich:panel>
+ <f:facet name="header">
+ Panel #1. Changing Style Synchronously
+ </f:facet>
+ Each component in the RichFaces has a pre-defined set of classes you can manipulate with. If defined, those
+ classes overwrite the ones come from the skin.
+ </rich:panel>
+
+ <rich:panel>
+ <f:facet name="header">
+ Panel #2. Changing Style Synchronously
+ </f:facet>
+ In this example, we define header color using the .rich-panel-header class and all panels located on the same page
+ inherit this color
+ </rich:panel>
+
+ </h:panelGrid>
+
+ <h:panelGrid columnClasses="panel" border="0" columns="3">
+ <rich:panel
+ onmouseover="document.getElementById(this.id+'_header').style.background='#60BA01';document.getElementById(this.id+'_body').style.background='#F4FFF8'"
+ onmouseout="document.getElementById(this.id+'_header').style.background='#4C9600';document.getElementById(this.id+'_body').style.background='#E4FFC8'"
+ style="width:200px;" headerClass="head2" bodyClass="body3">
+ <f:facet name="header">
+ Panel header
+ </f:facet>
+ Base on the previous layout, but some javascript behaviour added.
+ </rich:panel>
+
+ <rich:panel style="width:200px;" bodyClass="body3">
+ <f:facet name="header">
+ Scrolling Text Panel
+ </f:facet>
+ Long Text Long Text Long Text
+ Long Text Long Text Long Text
+ Long Text Long Text Long Text
+ Long Text Long Text Long Text
+ Long Text Long Text Long Text
+ Long Text Long Text Long Text
+ Long Text Long Text Long Text
+ Long Text Long Text Long Text
+ Long Text Long Text Long Text
+ Long Text Long Text Long Text
+ Long Text Long Text Long Text
+ Long Text Long Text Long Text
+ Long Text Long Text Long Text
+ </rich:panel>
+
+ <rich:panel styleClass="top">
+ This is a panel without the header
+ </rich:panel>
+
+ </h:panelGrid>
+
+</ui:composition>
+</html>
\ No newline at end of file
Added: root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/panel/simple.xhtml
===================================================================
--- root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/panel/simple.xhtml (rev 0)
+++ root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/panel/simple.xhtml 2010-07-26 12:17:39 UTC (rev 18234)
@@ -0,0 +1,54 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+
+<ui:composition>
+ <p>The panel is a rectangle area on a page that may contain any
+ content including other panels. Panel has a header (optionally) and a
+ body. The default look-n-feel is based on the current skin. Look-n-feel
+ of any parts of the panel, including color scheme, borders and paddings
+ can be customizable using with pre-defined number of CSS classes.</p>
+
+ <rich:panel header="Panel with default Look-n-feel">
+ <h:graphicImage value="/images/icons/common/rf.png"
+ style="float:right" />
+ RichFaces is a component library for JSF and an advanced framework for
+ easily integrating AJAX capabilities into business applications.
+ <ul>
+ <li>100+ AJAX enabled components in two libraries</li>
+ <li>a4j: page centric AJAX controls</li>
+ <li>rich: self contained, ready to use components</li>
+ <li>Whole set of JSF benefits while working with AJAX</li>
+ <li>Skinnability mechanism</li>
+ <li>Component Development Kit (CDK)</li>
+ <li>Dynamic resources handling</li>
+ <li>Testing facilities for components, actions, listeners, and
+ pages</li>
+ <li>Broad cross-browser support</li>
+ <li>Large and active community</li>
+ </ul>
+ </rich:panel>
+ <p><b>Panel without header:</b></p>
+ <rich:panel>
+ <p><b>JSF 2 and RichFaces 4:</b></p>
+ <p>We are working hard on RichFaces 4.0 which will have full JSF 2
+ integration. That is not all though, here is a summary of updates and
+ features:</p>
+ <ul>
+ <li>Redesigned modular repository and build system.</li>
+ <li>Simplified Component Development Kit with annotations,
+ faces-config extensions, advanced templates support and more..</li>
+ <li>Ajax framework improvements extending the JSF 2
+ specification.</li>
+ <li>Component review for consistency, usability, and redesign
+ following semantic HTML principles where possible.</li>
+ <li>Both server-side and client-side performance optimization.</li>
+ <li>Strict code clean-up and review.</li>
+ </ul>
+ </rich:panel>
+</ui:composition>
+</html>
\ No newline at end of file
14 years, 5 months
JBoss Rich Faces SVN: r18233 - in root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk: faces and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-07-26 08:06:45 -0400 (Mon, 26 Jul 2010)
New Revision: 18233
Added:
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceProducer.java
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceProducerFactory.java
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ClassResourceProducer.java
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ResourceProducerFactoryImpl.java
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/URLResource.java
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/URLResourceProducer.java
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/skin/
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/skin/SkinFactoryImpl.java
Removed:
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceFactory.java
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ResourceFactoryImpl.java
Modified:
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/Faces.java
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/Main.java
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceTaskFactory.java
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourcesScanner.java
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/faces/FacesImpl.java
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ReflectionsExt.java
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ResourcesScannerImpl.java
root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/task/ResourceTaskFactoryImpl.java
Log:
Latest changes for resources prerenderer module
Modified: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/Faces.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/Faces.java 2010-07-26 11:53:04 UTC (rev 18232)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/Faces.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -33,8 +33,6 @@
public void setSkin(String skinName);
- public String getSkin();
-
public void startRequest();
public void stopRequest();
Modified: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/Main.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/Main.java 2010-07-26 11:53:04 UTC (rev 18232)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/Main.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -22,20 +22,20 @@
package org.richfaces.cdk;
import static com.google.common.base.Predicates.notNull;
-import static com.google.common.collect.Iterables.concat;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.transform;
+import static com.google.common.collect.Collections2.filter;
+import static com.google.common.collect.Collections2.transform;
+import java.util.Collection;
+import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import javax.faces.application.Resource;
-
+import org.richfaces.cdk.faces.FacesImpl;
import org.richfaces.cdk.naming.FileNameMapperImpl;
-import org.richfaces.cdk.resource.ResourceFactoryImpl;
+import org.richfaces.cdk.resource.ResourceProducerFactoryImpl;
import org.richfaces.cdk.resource.ResourceWriterImpl;
import org.richfaces.cdk.resource.ResourcesScannerImpl;
import org.richfaces.cdk.task.ResourceTaskFactoryImpl;
@@ -49,25 +49,41 @@
public class Main {
private static ExecutorService createExecutorService() {
- return Executors.newSingleThreadExecutor();
+ return Executors.newFixedThreadPool(4);
}
+ private static <T> Collection<T> concatCollections(Collection<? extends T> firstCollection,
+ Collection<? extends T> secondCollection) {
+ List<T> result = Lists.newArrayList();
+
+ result.addAll(firstCollection);
+ result.addAll(secondCollection);
+
+ return result;
+ }
+
public static void main(String[] args) throws Exception {
+ // TODO set webroot
+ Faces faces = new FacesImpl(null);
+ faces.start();
+
String dstDir = args[0];
-
+
ResourcesScanner resourcesScanner = new ResourcesScannerImpl();
resourcesScanner.scan();
- ResourceFactory resourceFactory = new ResourceFactoryImpl();
+ ResourceProducerFactory resourceFactory = new ResourceProducerFactoryImpl();
- Iterable<Resource> resources = filter(concat(
- transform(resourcesScanner.getClassResources(), resourceFactory.getClassResourceFactory()),
- transform(resourcesScanner.getURLResources(), resourceFactory.getURLResourceFactory())), notNull());
+ Collection<ResourceProducer> classResources = filter(
+ transform(resourcesScanner.getClassResources(), resourceFactory.getClassResourceProducerFactory()), notNull());
+ Collection<ResourceProducer> urlResources = filter(
+ transform(resourcesScanner.getURLResources(), resourceFactory.getURLResourceProducerFactory()), notNull());
+ Collection<ResourceProducer> resources = concatCollections(classResources, urlResources);
+
ResourceWriterImpl resourceWriter = new ResourceWriterImpl(dstDir, new FileNameMapperImpl());
- //TODO set webroot
- ResourceTaskFactory taskFactory = new ResourceTaskFactoryImpl(resourceWriter, null);
-
+ ResourceTaskFactory taskFactory = new ResourceTaskFactoryImpl(faces, resourceWriter);
+
taskFactory.setResources(resources);
taskFactory.setSkins(Lists.newArrayList("blueSky", "ruby", "classic"));
@@ -81,18 +97,20 @@
tasksCounter++;
}
- while (tasksCounter > 0){
+ while (tasksCounter > 0) {
try {
completionService.take().get();
} catch (ExecutionException e) {
// TODO: handle exception
- e.getCause().printStackTrace();
+ //e.getCause().printStackTrace();
}
tasksCounter--;
}
} finally {
executorService.shutdown();
}
+
+ faces.stop();
}
}
Deleted: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceFactory.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceFactory.java 2010-07-26 11:53:04 UTC (rev 18232)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceFactory.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.cdk;
-
-import java.net.URL;
-
-import javax.faces.application.Resource;
-
-import com.google.common.base.Function;
-
-/**
- * @author Nick Belaevski
- *
- */
-public interface ResourceFactory {
-
- public Function<URL, Resource> getURLResourceFactory();
-
- public Function<Class<?>, Resource> getClassResourceFactory();
-
-}
Added: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceProducer.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceProducer.java (rev 0)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceProducer.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk;
+
+import javax.faces.application.Resource;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface ResourceProducer {
+
+ public Resource build();
+
+}
Copied: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceProducerFactory.java (from rev 18222, root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceFactory.java)
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceProducerFactory.java (rev 0)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceProducerFactory.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk;
+
+import com.google.common.base.Function;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface ResourceProducerFactory {
+
+ public Function<String, ResourceProducer> getURLResourceProducerFactory();
+
+ public Function<Class<?>, ResourceProducer> getClassResourceProducerFactory();
+
+}
Modified: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceTaskFactory.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceTaskFactory.java 2010-07-26 11:53:04 UTC (rev 18232)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourceTaskFactory.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -24,17 +24,15 @@
import java.util.Collection;
import java.util.concurrent.Callable;
-import javax.faces.application.Resource;
-
/**
* @author Nick Belaevski
*
*/
public interface ResourceTaskFactory {
- public void setSkins(Iterable<String> skins);
+ public void setSkins(Collection<String> skins);
- public void setResources(Iterable<Resource> resources);
+ public void setResources(Collection<ResourceProducer> resources);
public Collection<Callable<Object>> createTasks();
Modified: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourcesScanner.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourcesScanner.java 2010-07-26 11:53:04 UTC (rev 18232)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/ResourcesScanner.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -21,7 +21,6 @@
*/
package org.richfaces.cdk;
-import java.net.URL;
import java.util.Collection;
/**
@@ -36,5 +35,5 @@
public Collection<Class<?>> getClassResources();
- public Collection<URL> getURLResources();
+ public Collection<String> getURLResources();
}
Modified: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/faces/FacesImpl.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/faces/FacesImpl.java 2010-07-26 11:53:04 UTC (rev 18232)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/faces/FacesImpl.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -25,15 +25,14 @@
import javax.faces.context.FacesContext;
-import org.ajax4jsf.context.ContextInitParameters;
import org.ajax4jsf.context.InitParametersStorage;
import org.richfaces.application.Module;
import org.richfaces.application.ServiceTracker;
import org.richfaces.application.ServicesFactory;
import org.richfaces.application.ServicesFactoryImpl;
import org.richfaces.cdk.Faces;
+import org.richfaces.cdk.skin.SkinFactoryImpl;
import org.richfaces.skin.SkinFactory;
-import org.richfaces.skin.SkinFactoryImpl;
/**
* @author Nick Belaevski
@@ -68,15 +67,9 @@
}
public void setSkin(String skinName) {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- facesContext.getExternalContext().getInitParameterMap().put(ContextInitParameters.SKIN, skinName);
+ SkinFactoryImpl.setSkinName(skinName);
}
- public String getSkin() {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- return (String) facesContext.getExternalContext().getInitParameterMap().get(ContextInitParameters.SKIN);
- }
-
public void startRequest() {
FacesContextImpl facesContextImpl = new FacesContextImpl();
facesContextImpl.getExternalContext().setWebRoot(webroot);
Added: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ClassResourceProducer.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ClassResourceProducer.java (rev 0)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ClassResourceProducer.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.cdk.resource;
+
+import java.lang.reflect.Modifier;
+
+import javax.faces.FacesException;
+import javax.faces.application.Resource;
+
+import org.richfaces.cdk.ResourceProducer;
+import org.richfaces.resource.Java2DUserResource;
+import org.richfaces.resource.Java2DUserResourceWrapperImpl;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+final class ClassResourceProducer implements ResourceProducer {
+
+ /**
+ *
+ */
+ private final Class<?> from;
+
+ /**
+ * @param from
+ * @param resourceProducerFactoryImpl TODO
+ */
+ ClassResourceProducer(Class<?> from) {
+ this.from = from;
+ }
+
+ private static <T> T instantiate(Class<? extends T> clazz) {
+ try {
+ return clazz.newInstance();
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (LinkageError e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ throw new FacesException(clazz.getName());
+ }
+
+ private Resource createResource(Class<?> classResource) {
+ if (classResource.isInterface() || (classResource.getModifiers() & Modifier.ABSTRACT) != 0) {
+ return null;
+ }
+
+ if (Resource.class.isAssignableFrom(classResource)) {
+ return instantiate(classResource.asSubclass(Resource.class));
+ }
+
+ if (Java2DUserResource.class.isAssignableFrom(classResource)) {
+ Java2DUserResource java2dResource = instantiate(classResource.asSubclass(Java2DUserResource.class));
+ Resource wrapper = new Java2DUserResourceWrapperImpl(java2dResource);
+ wrapper.setResourceName(classResource.getName());
+ return wrapper;
+ }
+
+ return null;
+ }
+
+ @Override
+ public Resource build() {
+ return createResource(from);
+ }
+}
\ No newline at end of file
Modified: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ReflectionsExt.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ReflectionsExt.java 2010-07-26 11:53:04 UTC (rev 18232)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ReflectionsExt.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -21,32 +21,49 @@
*/
package org.richfaces.cdk.resource;
+import static com.google.common.collect.Collections2.filter;
+
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
import org.reflections.Configuration;
import org.reflections.Reflections;
import org.reflections.scanners.Scanner;
import org.reflections.util.Utils;
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
import com.google.common.collect.Multimap;
/**
* @author Nick Belaevski
*
*/
-public class ReflectionsExt extends Reflections {
+class ReflectionsExt extends Reflections {
- ReflectionsExt() {
+ private static final Predicate<String> ECSS_RESOURCE_PREDICATE = new Predicate<String>() {
+
+ private final Pattern PATH_PATTERN = Pattern.compile("^META-INF/resources/.+\\.ecss$");
+
+ @Override
+ public boolean apply(String input) {
+ return PATH_PATTERN.matcher(input).matches();
+ }
+
+ };
+
+ public ReflectionsExt() {
super();
}
- ReflectionsExt(Configuration configuration) {
+ public ReflectionsExt(Configuration configuration) {
super(configuration);
}
- ReflectionsExt(String prefix, Scanner... scanners) {
+ public ReflectionsExt(String prefix, Scanner... scanners) {
super(prefix, scanners);
}
@@ -58,4 +75,9 @@
}
return Utils.forNames(scannerMMap.get(MarkerResourcesScanner.STORE_KEY));
}
+
+ public Collection<String> getURLResources() {
+ Set<String> allResources = getResources(Predicates.<String> alwaysTrue());
+ return filter(allResources, ECSS_RESOURCE_PREDICATE);
+ }
}
Deleted: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ResourceFactoryImpl.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ResourceFactoryImpl.java 2010-07-26 11:53:04 UTC (rev 18232)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ResourceFactoryImpl.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -1,114 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.cdk.resource;
-
-import java.lang.reflect.Modifier;
-import java.net.URL;
-
-import javax.faces.FacesException;
-import javax.faces.application.Resource;
-
-import org.richfaces.cdk.ResourceFactory;
-import org.richfaces.resource.Java2DUserResource;
-import org.richfaces.resource.Java2DUserResourceWrapperImpl;
-
-import com.google.common.base.Function;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class ResourceFactoryImpl implements ResourceFactory {
-
- private <T> T instantiate(Class<? extends T> clazz) {
- try {
- return clazz.newInstance();
- } catch (InstantiationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (LinkageError e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- throw new FacesException(clazz.getName());
- }
-
- private Function<URL, Resource> urlFunction = new Function<URL, Resource>() {
- public Resource apply(URL from) {
- // TODO Auto-generated method stub
- return null;
- }
- };
-
- private Function<Class<?>, Resource> classFunction = new Function<Class<?>, Resource>() {
- private Resource createResource(Class<?> classResource) {
- if (classResource.isInterface() || (classResource.getModifiers() & Modifier.ABSTRACT) != 0) {
- return null;
- }
-
- if (Resource.class.isAssignableFrom(classResource)) {
- return instantiate(classResource.asSubclass(Resource.class));
- }
-
- if (Java2DUserResource.class.isAssignableFrom(classResource)) {
- Java2DUserResource java2dResource = instantiate(classResource.asSubclass(Java2DUserResource.class));
- Resource wrapper = new Java2DUserResourceWrapperImpl(java2dResource);
- wrapper.setResourceName(classResource.getName());
- return wrapper;
- }
-
- return null;
- }
-
- private boolean isImageResource(Resource resource) {
- String contentType = resource.getContentType();
-
- if (contentType == null) {
- return false;
- }
-
- return contentType.contains("image/");
- }
-
- public Resource apply(Class<?> from) {
- Resource resource = createResource(from);
- if (resource != null && isImageResource(resource)) {
- return resource;
- }
-
- return null;
- };
- };
-
- public Function<URL, Resource> getURLResourceFactory() {
- return urlFunction;
- }
-
- public Function<Class<?>, Resource> getClassResourceFactory() {
- return classFunction;
- }
-
-}
Copied: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ResourceProducerFactoryImpl.java (from rev 18222, root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ResourceFactoryImpl.java)
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ResourceProducerFactoryImpl.java (rev 0)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ResourceProducerFactoryImpl.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.resource;
+
+
+
+import org.richfaces.cdk.ResourceProducer;
+import org.richfaces.cdk.ResourceProducerFactory;
+
+import com.google.common.base.Function;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class ResourceProducerFactoryImpl implements ResourceProducerFactory {
+
+ private static Function<String, ResourceProducer> urlFunction = new Function<String, ResourceProducer>() {
+ public ResourceProducer apply(String from) {
+ return new URLResourceProducer(from);
+ }
+ };
+
+ private static Function<Class<?>, ResourceProducer> classFunction = new Function<Class<?>, ResourceProducer>() {
+
+ public ResourceProducer apply(final Class<?> from) {
+ return new ClassResourceProducer(from);
+ };
+ };
+
+ public Function<String, ResourceProducer> getURLResourceProducerFactory() {
+ return urlFunction;
+ }
+
+ public Function<Class<?>, ResourceProducer> getClassResourceProducerFactory() {
+ return classFunction;
+ }
+
+}
Modified: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ResourcesScannerImpl.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ResourcesScannerImpl.java 2010-07-26 11:53:04 UTC (rev 18232)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/ResourcesScannerImpl.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -73,13 +73,14 @@
private Collection<Class<?>> classResources = Sets.newHashSet();
- private Collection<URL> urlResources = Sets.newHashSet();
+ private Collection<String> urlResources = Sets.newHashSet();
public void scan() {
Collection<URL> urls = Collections2.filter(ClasspathHelper.getUrlsForCurrentClasspath(), FACES_URL);
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder().setUrls(urls);
- configurationBuilder.setScanners(new SubTypesScanner(), new TypeAnnotationsScanner(), new MarkerResourcesScanner());
+ configurationBuilder.setScanners(new SubTypesScanner(), new TypeAnnotationsScanner(),
+ new MarkerResourcesScanner(), new org.reflections.scanners.ResourcesScanner());
ReflectionsExt refl = new ReflectionsExt(configurationBuilder);
@@ -92,13 +93,14 @@
}
classResources.addAll(refl.getMarkedClasses());
+ urlResources.addAll(refl.getURLResources());
}
public Collection<Class<?>> getClassResources() {
return classResources;
}
- public Collection<URL> getURLResources() {
+ public Collection<String> getURLResources() {
return urlResources;
}
Added: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/URLResource.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/URLResource.java (rev 0)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/URLResource.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Map;
+
+import javax.faces.application.Resource;
+import javax.faces.context.FacesContext;
+
+import com.google.common.collect.Maps;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class URLResource extends Resource {
+
+ private URL resourceUrl;
+
+ public URLResource(URL resourceUrl) {
+ super();
+ this.resourceUrl = resourceUrl;
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return resourceUrl.openStream();
+ }
+
+ @Override
+ public Map<String, String> getResponseHeaders() {
+ return Maps.newHashMap();
+ }
+
+ @Override
+ public String getRequestPath() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public URL getURL() {
+ return resourceUrl;
+ }
+
+ @Override
+ public boolean userAgentNeedsUpdate(FacesContext context) {
+ throw new UnsupportedOperationException();
+ }
+}
Added: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/URLResourceProducer.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/URLResourceProducer.java (rev 0)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/resource/URLResourceProducer.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.cdk.resource;
+
+import java.net.URL;
+
+import javax.faces.application.Resource;
+
+import org.reflections.util.Utils;
+import org.richfaces.cdk.ResourceProducer;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+final class URLResourceProducer implements ResourceProducer {
+ /**
+ *
+ */
+ private final String libraryName;
+ /**
+ *
+ */
+ private final URL url;
+ /**
+ *
+ */
+ private final String resourceName;
+
+ /**
+ * @param libraryName
+ * @param url
+ * @param resourceName
+ */
+ URLResourceProducer(String resPath) {
+ String relPath = getResourceRelativePath(resPath);
+
+ url = Utils.getContextClassLoader().getResource(resPath);
+ libraryName = getLibraryName(relPath);
+ resourceName = getResourceName(relPath);
+ }
+
+ private String getResourceRelativePath(String path) {
+ return path.substring("META-INF/resources/".length());
+ }
+
+ private String getLibraryName(String relativePath) {
+ int idx = relativePath.lastIndexOf('/');
+ if (idx < 0) {
+ return null;
+ } else {
+ return relativePath.substring(0, idx);
+ }
+ }
+
+ private String getResourceName(String relativePath) {
+ int idx = relativePath.lastIndexOf('/');
+ if (idx < 0) {
+ return relativePath;
+ } else {
+ return relativePath.substring(idx + 1);
+ }
+ }
+
+ @Override
+ public Resource build() {
+ URLResource resource = new URLResource(url);
+
+ resource.setContentType("text/css");
+
+ resource.setLibraryName(libraryName);
+ resource.setResourceName(resourceName);
+
+ return resource;
+ }
+}
\ No newline at end of file
Added: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/skin/SkinFactoryImpl.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/skin/SkinFactoryImpl.java (rev 0)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/skin/SkinFactoryImpl.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.cdk.skin;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.skin.AbstractSkinFactory;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.Theme;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class SkinFactoryImpl extends AbstractSkinFactory {
+
+ private static ThreadLocal<String> skinNames = new ThreadLocal<String>();
+
+ public static void setSkinName(String skinName) {
+ skinNames.set(skinName);
+ }
+
+ @Override
+ public Skin getDefaultSkin(FacesContext context) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Skin getSkin(FacesContext context) {
+ return getSkin(context, skinNames.get());
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.skin.SkinFactory#getBaseSkin(javax.faces.context.FacesContext)
+ */
+ @Override
+ public Skin getBaseSkin(FacesContext facesContext) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.skin.SkinFactory#getTheme(javax.faces.context.FacesContext, java.lang.String)
+ */
+ @Override
+ public Theme getTheme(FacesContext facesContext, String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Modified: root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/task/ResourceTaskFactoryImpl.java
===================================================================
--- root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/task/ResourceTaskFactoryImpl.java 2010-07-26 11:53:04 UTC (rev 18232)
+++ root/cdk-sandbox/trunk/dynamic-resources-prerenderer/src/main/java/org/richfaces/cdk/task/ResourceTaskFactoryImpl.java 2010-07-26 12:06:45 UTC (rev 18233)
@@ -31,9 +31,9 @@
import javax.faces.context.FacesContext;
import org.richfaces.cdk.Faces;
+import org.richfaces.cdk.ResourceProducer;
import org.richfaces.cdk.ResourceTaskFactory;
import org.richfaces.cdk.ResourceWriter;
-import org.richfaces.cdk.faces.FacesImpl;
import org.richfaces.resource.StateHolderResource;
import com.google.common.collect.Lists;
@@ -48,27 +48,27 @@
private class ResourcesRendererCallable implements Callable<Object> {
- private Faces faces;
-
private String skinName;
- private Iterable<Resource> resources;
+ private ResourceProducer resourceBuilder;
- ResourcesRendererCallable(String skinName, Iterable<Resource> resources) {
+ ResourcesRendererCallable(String skinName, ResourceProducer resourceBuilder) {
this.skinName = skinName;
- this.resources = resources;
+ this.resourceBuilder = resourceBuilder;
}
- private void renderResource(Resource resource) throws Exception {
+ public Object call() throws Exception {
try {
- faces.startRequest();
faces.setSkin(skinName);
+ faces.startRequest();
+ Resource resource = resourceBuilder.build();
+
if (resource instanceof StateHolderResource) {
StateHolderResource stateHolderResource = (StateHolderResource) resource;
ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput();
stateHolderResource.writeState(FacesContext.getCurrentInstance(), dataOutput);
-
+ byte[] bs = dataOutput.toByteArray();
//TODO use collected data
} else if (resource instanceof StateHolder) {
StateHolder stateHolder = (StateHolder) resource;
@@ -78,25 +78,12 @@
}
}
- resourceWriter.writeResource(faces.getSkin(), resource);
+ //TODO check content type
+ resourceWriter.writeResource(skinName, resource);
} finally {
+ faces.setSkin(null);
faces.stopRequest();
}
- }
-
- public Object call() throws Exception {
- try {
- faces = new FacesImpl(webRoot);
- faces.start();
-
- for (Resource resource : resources) {
- renderResource(resource);
- }
-
- } finally {
- faces.stop();
- faces = null;
- }
// TODO Auto-generated method stub
return null;
@@ -104,25 +91,25 @@
}
- private String webRoot;
+ private Faces faces;
private ResourceWriter resourceWriter;
- private Iterable<Resource> resources = Collections.emptySet();
+ private Collection<ResourceProducer> resources = Collections.emptySet();
- private Iterable<String> skins = Collections.emptySet();
+ private Collection<String> skins = Collections.emptySet();
- public ResourceTaskFactoryImpl(ResourceWriter resourceWriter, String webRoot) {
+ public ResourceTaskFactoryImpl(Faces faces, ResourceWriter resourceWriter) {
super();
+ this.faces = faces;
this.resourceWriter = resourceWriter;
- this.webRoot = webRoot;
}
- public void setResources(Iterable<Resource> resources) {
+ public void setResources(Collection<ResourceProducer> resources) {
this.resources = resources;
}
-
- public void setSkins(Iterable<String> skins) {
+
+ public void setSkins(Collection<String> skins) {
this.skins = skins;
}
@@ -130,7 +117,9 @@
List<Callable<Object>> result = Lists.newArrayList();
for (String skin : skins) {
- result.add(new ResourcesRendererCallable(skin, resources));
+ for (ResourceProducer resource : resources) {
+ result.add(new ResourcesRendererCallable(skin, resource));
+ }
}
return result;
14 years, 5 months
JBoss Rich Faces SVN: r18232 - root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-07-26 07:53:04 -0400 (Mon, 26 Jul 2010)
New Revision: 18232
Modified:
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichExtendedDataTableBean.java
Log:
* refactored because of changes in class SortOrder
Modified: root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java
===================================================================
--- root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java 2010-07-26 11:36:55 UTC (rev 18231)
+++ root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java 2010-07-26 11:53:04 UTC (rev 18232)
@@ -60,8 +60,8 @@
private boolean state = true;
// sorting
- private SortOrder capitalsOrder = SortOrder.UNSORTED;
- private SortOrder statesOrder = SortOrder.UNSORTED;
+ private SortOrder capitalsOrder = SortOrder.unsorted;
+ private SortOrder statesOrder = SortOrder.unsorted;
// filtering
private String sexFilter;
@@ -180,20 +180,20 @@
}
public void sortByCapitals() {
- statesOrder = SortOrder.UNSORTED;
- if (capitalsOrder.equals(SortOrder.ASCENDING)) {
- setCapitalsOrder(SortOrder.DESCENDING);
+ statesOrder = SortOrder.unsorted;
+ if (capitalsOrder.equals(SortOrder.ascending)) {
+ setCapitalsOrder(SortOrder.descending);
} else {
- setCapitalsOrder(SortOrder.ASCENDING);
+ setCapitalsOrder(SortOrder.ascending);
}
}
public void sortByStates() {
- capitalsOrder = SortOrder.UNSORTED;
- if (statesOrder.equals(SortOrder.ASCENDING)) {
- setStatesOrder(SortOrder.DESCENDING);
+ capitalsOrder = SortOrder.unsorted;
+ if (statesOrder.equals(SortOrder.ascending)) {
+ setStatesOrder(SortOrder.descending);
} else {
- setStatesOrder(SortOrder.ASCENDING);
+ setStatesOrder(SortOrder.ascending);
}
}
Modified: root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichExtendedDataTableBean.java
===================================================================
--- root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichExtendedDataTableBean.java 2010-07-26 11:36:55 UTC (rev 18231)
+++ root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichExtendedDataTableBean.java 2010-07-26 11:53:04 UTC (rev 18232)
@@ -60,8 +60,8 @@
private boolean state = true;
// sorting
- private SortOrder capitalsOrder = SortOrder.UNSORTED;
- private SortOrder statesOrder = SortOrder.UNSORTED;
+ private SortOrder capitalsOrder = SortOrder.unsorted;
+ private SortOrder statesOrder = SortOrder.unsorted;
// filtering
private String sexFilter;
@@ -195,20 +195,20 @@
}
public void sortByCapitals() {
- statesOrder = SortOrder.UNSORTED;
- if (capitalsOrder.equals(SortOrder.ASCENDING)) {
- setCapitalsOrder(SortOrder.DESCENDING);
+ statesOrder = SortOrder.unsorted;
+ if (capitalsOrder.equals(SortOrder.ascending)) {
+ setCapitalsOrder(SortOrder.descending);
} else {
- setCapitalsOrder(SortOrder.ASCENDING);
+ setCapitalsOrder(SortOrder.ascending);
}
}
public void sortByStates() {
- capitalsOrder = SortOrder.UNSORTED;
- if (statesOrder.equals(SortOrder.ASCENDING)) {
- setStatesOrder(SortOrder.DESCENDING);
+ capitalsOrder = SortOrder.unsorted;
+ if (statesOrder.equals(SortOrder.ascending)) {
+ setStatesOrder(SortOrder.descending);
} else {
- setStatesOrder(SortOrder.ASCENDING);
+ setStatesOrder(SortOrder.ascending);
}
}
14 years, 5 months
JBoss Rich Faces SVN: r18231 - in root/examples/richfaces-showcase/trunk/src/main: webapp/richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-07-26 07:36:55 -0400 (Mon, 26 Jul 2010)
New Revision: 18231
Added:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataGrid/
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataGrid/grid.xhtml
Modified:
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml
Log:
https://jira.jboss.org/browse/RF-8967
Modified: root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml
===================================================================
--- root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-07-26 11:23:32 UTC (rev 18230)
+++ root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-07-26 11:36:55 UTC (rev 18231)
@@ -52,7 +52,7 @@
</sample>
</samples>
</demo>
- <demo new="true">
+ <demo>
<id>poll</id>
<name>a4j:poll</name>
<samples>
@@ -72,7 +72,7 @@
</sample>
</samples>
</demo>
- <demo new="true">
+ <demo>
<id>param</id>
<name>a4j:param</name>
<samples>
@@ -95,7 +95,7 @@
<group>
<name>Ajax Queue</name>
<demos>
- <demo new="true">
+ <demo>
<id>queue</id>
<name>a4j:queue</name>
<samples>
@@ -105,7 +105,7 @@
</sample>
</samples>
</demo>
- <demo new="true">
+ <demo>
<id>attachQueue</id>
<name>a4j:attachQueue</name>
<samples>
@@ -152,7 +152,7 @@
</sample>
</samples>
</demo>
- <demo new="true">
+ <demo>
<id>region</id>
<name>a4j:region</name>
<samples>
@@ -184,7 +184,7 @@
</demo>
</demos>
</group>
- <group new="true">
+ <group>
<name>Data Iteration</name>
<demos>
<demo>
@@ -264,7 +264,7 @@
</sample>
</samples>
</demo>
- <demo>
+ <demo new="true">
<id>list</id>
<name>rich:list</name>
<samples>
@@ -274,9 +274,34 @@
</sample>
</samples>
</demo>
+ <demo new="true">
+ <id>dataGrid</id>
+ <name>rich:dataGrid</name>
+ <samples>
+ <sample>
+ <id>grid</id>
+ <name>Data Grid Component</name>
+ </sample>
+ </samples>
+ </demo>
</demos>
</group>
- <group new="true">
+ <!-- group>
+ <name>Panels</name>
+ <demos>
+ <demo>
+ <id>divPanel</id>
+ <name>rich:divPanel</name>
+ <samples>
+ <sample>
+ <id>simple</id>
+ <name>Simple divPanel component</name>
+ </sample>
+ </samples>
+ </demo>
+ </demos>
+ </group-->
+ <group>
<name>Misc Components/Features</name>
<demos>
<demo>
Added: root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataGrid/grid.xhtml
===================================================================
--- root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataGrid/grid.xhtml (rev 0)
+++ root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataGrid/grid.xhtml 2010-07-26 11:36:55 UTC (rev 18231)
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+
+<ui:composition>
+ <p>The component takes iterates a model as any other iteration
+ component and outputs it the same way as <h:PanelGrid> does for
+ inline data. To define grid properties and styles, use the same
+ definitions as for <h:panelGrid>.</p>
+ <p>The following example shows the dataGrid component in use:</p>
+ <style>
+.label {
+ font-weight: bold;
+}
+
+.pbody {
+ width: 200px;
+}
+</style>
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Car Store"></h:outputText>
+ </f:facet>
+ <h:form>
+ <rich:dataGrid value="#{carsBean.allInventoryItems}" var="car"
+ columns="3" elements="9" width="600px">
+ <rich:panel bodyClass="pbody">
+ <f:facet name="header">
+ <h:outputText value="#{car.vendor} #{car.model}"></h:outputText>
+ </f:facet>
+ <h:panelGrid columns="2">
+ <h:outputText value="Price:" styleClass="label"></h:outputText>
+ <h:outputText value="#{car.price}" />
+ <h:outputText value="Mileage:" styleClass="label"></h:outputText>
+ <h:outputText value="#{car.mileage}" />
+ <h:outputText value="VIN:" styleClass="label"></h:outputText>
+ <h:outputText value="#{car.vin}" />
+ <h:outputText value="Stock:" styleClass="label"></h:outputText>
+ <h:outputText value="#{car.stock}" />
+ </h:panelGrid>
+ </rich:panel>
+ <f:facet name="footer">
+ <rich:dataScroller/>
+ </f:facet>
+ </rich:dataGrid>
+ </h:form>
+ </rich:panel>
+</ui:composition>
+</html>
\ No newline at end of file
14 years, 5 months
JBoss Rich Faces SVN: r18230 - root/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-26 07:23:32 -0400 (Mon, 26 Jul 2010)
New Revision: 18230
Modified:
root/tests/metamer/trunk/ftest/pom.xml
Log:
added SeleniumLogging- and FailureLogging-TestListeners to suite configuration
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-26 11:23:10 UTC (rev 18229)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-26 11:23:32 UTC (rev 18230)
@@ -275,7 +275,7 @@
<properties>
<property>
<name>listener</name>
- <value>org.jboss.test.selenium.listener.ConsoleStatusTestListener,org.jboss.test.selenium.listener.TestMethodSelector</value>
+ <value>org.jboss.test.selenium.listener.ConsoleStatusTestListener,org.jboss.test.selenium.listener.SeleniumLoggingTestListener,org.jboss.test.selenium.listener.FailureLoggingTestListener,org.jboss.test.selenium.listener.TestMethodSelector</value>
</property>
</properties>
</configuration>
14 years, 5 months
JBoss Rich Faces SVN: r18229 - root/tests/metamer/trunk/application/src/main/webapp/resources/css.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-26 07:23:10 -0400 (Mon, 26 Jul 2010)
New Revision: 18229
Modified:
root/tests/metamer/trunk/application/src/main/webapp/resources/css/common.css
Log:
added background: white to body style (requires to take entire page screenshots)
Modified: root/tests/metamer/trunk/application/src/main/webapp/resources/css/common.css
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/resources/css/common.css 2010-07-26 11:13:33 UTC (rev 18228)
+++ root/tests/metamer/trunk/application/src/main/webapp/resources/css/common.css 2010-07-26 11:23:10 UTC (rev 18229)
@@ -1,3 +1,7 @@
+body {
+ background: white;
+}
+
.button {
width: 100px;
height: 21px;
14 years, 5 months
JBoss Rich Faces SVN: r18228 - in root/ui/core/trunk/ui/src: main/java/org/richfaces/renderkit/html and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-07-26 07:13:33 -0400 (Mon, 26 Jul 2010)
New Revision: 18228
Modified:
root/ui/core/trunk/ui/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java
root/ui/core/trunk/ui/src/main/java/org/richfaces/renderkit/html/AjaxPollRenderer.java
root/ui/core/trunk/ui/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java
root/ui/core/trunk/ui/src/test/java/org/richfaces/component/QueueRendererTest.java
Log:
Fixed compilation errors in core-ui
Modified: root/ui/core/trunk/ui/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java
===================================================================
--- root/ui/core/trunk/ui/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java 2010-07-24 17:42:41 UTC (rev 18227)
+++ root/ui/core/trunk/ui/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java 2010-07-26 11:13:33 UTC (rev 18228)
@@ -83,7 +83,7 @@
StringBuffer onClick = new StringBuffer();
if (!getUtils().isBooleanAttribute(component, "disabled")) {
- HandlersChain handlersChain = new HandlersChain(facesContext, component);
+ HandlersChain handlersChain = new HandlersChain(context, component);
handlersChain.addInlineHandlerFromAttribute("onclick");
handlersChain.addBehaviors("click", "action");
Modified: root/ui/core/trunk/ui/src/main/java/org/richfaces/renderkit/html/AjaxPollRenderer.java
===================================================================
--- root/ui/core/trunk/ui/src/main/java/org/richfaces/renderkit/html/AjaxPollRenderer.java 2010-07-24 17:42:41 UTC (rev 18227)
+++ root/ui/core/trunk/ui/src/main/java/org/richfaces/renderkit/html/AjaxPollRenderer.java 2010-07-26 11:13:33 UTC (rev 18228)
@@ -80,7 +80,7 @@
Integer interval = new Integer(poll.getInterval());
options.put("pollinterval", interval);
options.put("pollId", component.getClientId(context));
- HandlersChain handlersChain = new HandlersChain(facesContext, poll);
+ HandlersChain handlersChain = new HandlersChain(context, poll);
handlersChain.addInlineHandlerFromAttribute(AbstractPoll.ON_TIMER);
handlersChain.addBehaviors(AbstractPoll.TIMER);
handlersChain.addAjaxSubmitFunction();
Modified: root/ui/core/trunk/ui/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java
===================================================================
--- root/ui/core/trunk/ui/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java 2010-07-24 17:42:41 UTC (rev 18227)
+++ root/ui/core/trunk/ui/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java 2010-07-26 11:13:33 UTC (rev 18228)
@@ -202,7 +202,7 @@
Map<String, Object> attributes = ajaxStatus.getAttributes();
for (String eventName : EVENT_NAMES) {
String eventAttribute = "on" + eventName;
- HandlersChain handlersChain = new HandlersChain(facesContext, component, true);
+ HandlersChain handlersChain = new HandlersChain(context, component, true);
handlersChain.addInlineHandlerFromAttribute(eventAttribute);
handlersChain.addBehaviors(eventName);
rendererUtils.addToScriptHash(options, eventAttribute,
Modified: root/ui/core/trunk/ui/src/test/java/org/richfaces/component/QueueRendererTest.java
===================================================================
--- root/ui/core/trunk/ui/src/test/java/org/richfaces/component/QueueRendererTest.java 2010-07-24 17:42:41 UTC (rev 18227)
+++ root/ui/core/trunk/ui/src/test/java/org/richfaces/component/QueueRendererTest.java 2010-07-26 11:13:33 UTC (rev 18228)
@@ -57,12 +57,12 @@
private @interface DisableQueue {}
private static final String EXPECTED_QUEUE_SCRIPT = "RichFaces.queue.setQueueOptions({" +
- "'first': {'requestDelay': 400, 'timeout': 100, 'ignoreDupResponses': true}," +
- "'form': {'requestDelay': 400}," +
- "'form:firstAttach': {'timeout': 300, 'requestGroupingId': 'request'}," +
- "'second': {'requestDelay': 400, 'timeout': 100, 'ignoreDupResponses': true}," +
- "'form:linkAttach': {'timeout': 500, 'queueId': 'second'}," +
- "'form:secondAttach': {}" +
+ "\"first\": {\"requestDelay\": 400, \"timeout\": 100, \"ignoreDupResponses\": true}," +
+ "\"form\": {\"requestDelay\": 400}," +
+ "\"form:firstAttach\": {\"timeout\": 300, \"requestGroupingId\": \"request\"}," +
+ "\"second\": {\"requestDelay\": 400, \"timeout\": 100, \"ignoreDupResponses\": true}," +
+ "\"form:linkAttach\": {\"timeout\": 500, \"queueId\": \"second\"}," +
+ "\"form:secondAttach\": {}" +
"});";
protected HtmlPage page;
14 years, 5 months
JBoss Rich Faces SVN: r18227 - root.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-07-24 13:42:41 -0400 (Sat, 24 Jul 2010)
New Revision: 18227
Added:
root/.hgignore
Log:
ignore working files in Mercurial
Added: root/.hgignore
===================================================================
--- root/.hgignore (rev 0)
+++ root/.hgignore 2010-07-24 17:42:41 UTC (rev 18227)
@@ -0,0 +1,7 @@
+\.classpath
+\.project
+\.settings
+/target$
+bin
+.*~
+
14 years, 5 months
JBoss Rich Faces SVN: r18226 - root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-07-23 20:37:17 -0400 (Fri, 23 Jul 2010)
New Revision: 18226
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
Log:
work in progress https://jira.jboss.org/browse/RF-8907
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2010-07-24 00:25:35 UTC (rev 18225)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2010-07-24 00:37:17 UTC (rev 18226)
@@ -168,6 +168,7 @@
if (!SIGNATURE_NONE_CLASS_NAME.equals(returnType)) {
MethodSignature methodSignature = new MethodSignature();
methodSignature.setParameters(getSignatureParams(signature));
+ methodSignature.setReturnType(returnType);
return methodSignature;
}
14 years, 5 months
JBoss Rich Faces SVN: r18225 - in root/cdk/trunk/plugins: generator/src/main/java/org/richfaces/cdk/model/validator and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-07-23 20:25:35 -0400 (Fri, 23 Jul 2010)
New Revision: 18225
Added:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/model/
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/model/TestModel.java
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ClassGeneratorModule.java
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/templatecompiler/RendererTemplateParser.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/CdkEntityResolver.java
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taghandler.ftl
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
Log:
work in progress https://jira.jboss.org/browse/RF-8907
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ClassGeneratorModule.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ClassGeneratorModule.java 2010-07-23 19:43:09 UTC (rev 18224)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ClassGeneratorModule.java 2010-07-24 00:25:35 UTC (rev 18225)
@@ -23,16 +23,21 @@
package org.richfaces.cdk.generate.java;
+import java.util.Map;
+
import org.richfaces.cdk.CdkWriter;
import org.richfaces.cdk.generate.freemarker.CdkConfiguration;
+import org.richfaces.cdk.generate.freemarker.DefaultImports;
import org.richfaces.cdk.generate.freemarker.FreeMakerUtils;
import org.richfaces.cdk.generate.freemarker.FreeMarkerRenderer;
import org.richfaces.cdk.generate.freemarker.LibraryModelWrapper;
import org.richfaces.cdk.generate.java.taghandler.ListenerTagHandlerGenerator;
import org.richfaces.cdk.generate.java.taghandler.TagHandlerWriter;
+import com.google.common.collect.ImmutableMap;
import com.google.inject.AbstractModule;
import com.google.inject.PrivateBinder;
+import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.Multibinder;
import freemarker.template.ObjectWrapper;
@@ -66,6 +71,8 @@
privateBinder.expose(FreeMarkerRenderer.class).annotatedWith(LibraryModel.class);
privateBinder.bind(ObjectWrapper.class).to(LibraryModelWrapper.class);
privateBinder.bind(FreeMakerUtils.class);
+ privateBinder.bind(new TypeLiteral<Map<String,String>>(){}).annotatedWith(DefaultImports.class).toInstance(ImmutableMap.of("util","util.ftl"));
+
}
}
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-07-23 19:43:09 UTC (rev 18224)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-07-24 00:25:35 UTC (rev 18225)
@@ -258,7 +258,6 @@
verifyComponentAttributes(library, parentComponent, verified);
for (PropertyBase parentAttribute : parentComponent.getAttributes()) {
PropertyBase attribute = component.getOrCreateAttribute(parentAttribute.getName());
- // TODO - do not owerride properties ?
attribute.merge(parentAttribute);
// TODO Check generate status. Attribute should not be generated if the parent component
// represents
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-07-23 19:43:09 UTC (rev 18224)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-07-24 00:25:35 UTC (rev 18225)
@@ -126,13 +126,14 @@
private MethodSignature parseSignature(String signatureString) {
List<ClassName> parameters = Lists.newArrayList();
- MethodSignature signature = new MethodSignature();
+ MethodSignature signature = null;
if (!Strings.isEmpty(signatureString)) {
Matcher parametersStringMatcher = PARAMETERS_STRING_PATTERN.matcher(signatureString);
if (!parametersStringMatcher.find()) {
throw new IllegalArgumentException(MessageFormat.format("Signature string {0} cannot be parsed!",
signatureString));
}
+ signature = new MethodSignature();
signature.setReturnType(ClassName.parseName(parametersStringMatcher.group(1)));
String parametersString = parametersStringMatcher.group(3);
if (parametersString.trim().length() != 0) {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/CdkEntityResolver.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/CdkEntityResolver.java 2010-07-23 19:43:09 UTC (rev 18224)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/CdkEntityResolver.java 2010-07-24 00:25:35 UTC (rev 18225)
@@ -44,10 +44,9 @@
/**
* <p class="changed_added_4_0">
- * That class resolves entities used by CDK ( standard JSF schemas, extensions,
- * configuration fragments.)
+ * That class resolves entities used by CDK ( standard JSF schemas, extensions, configuration fragments.)
* </p>
- *
+ *
* @author asmirnov(a)exadel.com
*/
public class CdkEntityResolver implements EntityResolver2 {
@@ -64,41 +63,37 @@
private static final String ATTRIBUTES_PREFIX = "META-INF/cdk/attributes/";
private static final String SYSTEM_PREFIX = "/META-INF/schema";
private static final String URN_SYSTEM = "urn:system:";
- private static final ImmutableMap<String, String> SYSTEM_ENTITIES = ImmutableMap
- .<String, String>builder()
- .put("http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd",
- URN_SYSTEM + "/web-facesconfig_2_0.xsd")
- .put("http://java.sun.com/xml/ns/javaee/web-facesuicomponent_2_0.xsd",
- URN_SYSTEM + "/web-facesuicomponent_2_0.xsd")
- .put("http://java.sun.com/xml/ns/javaee/web-partialresponse_2_0.xsd",
- URN_SYSTEM + "/web-partialresponse_2_0.xsd")
- .put("http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd",
- URN_SYSTEM + "/web-facesconfig_1_2.xsd")
- .put("http://java.sun.com/xml/ns/javaee/javaee_5.xsd",
- URN_SYSTEM + "/javaee_5.xsd")
- .put(
+ private static final ImmutableMap<String, String> SYSTEM_ENTITIES =
+ ImmutableMap.<String, String> builder().put("http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd",
+ URN_SYSTEM + "/web-facesconfig_2_0.xsd").put(
+ "http://java.sun.com/xml/ns/javaee/web-facesuicomponent_2_0.xsd",
+ URN_SYSTEM + "/web-facesuicomponent_2_0.xsd").put(
+ "http://java.sun.com/xml/ns/javaee/web-partialresponse_2_0.xsd",
+ URN_SYSTEM + "/web-partialresponse_2_0.xsd").put(
+ "http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd", URN_SYSTEM + "/web-facesconfig_1_2.xsd").put(
+ "http://java.sun.com/xml/ns/javaee/javaee_5.xsd", URN_SYSTEM + "/javaee_5.xsd").put(
"http://java.sun.com/xml/ns/javaee/javaee_web_services_1_2.xsd",
- URN_SYSTEM + "/javaee_web_services_1_2.xsd")
- .put("http://java.sun.com/xml/ns/javaee/javaee_web_services_client_1_2.xsd", URN_SYSTEM + "/javaee_web_services_client_1_2.xsd")
- .put("http://www.w3.org/2001/03/XMLSchema.dtd", URN_SYSTEM + "/XMLSchema.dtd")
- .put("http://www.w3.org/2001/03/xml.xsd", URN_SYSTEM + "/xml.xsd")
- .put("http://www.w3.org/2001/xml.xsd", URN_SYSTEM + "/xml.xsd")
- .put("http://richfaces.org/cdk/cdk-template.xsd", URN_SYSTEM + "/cdk-template.xsd")
- .put("http://richfaces.org/cdk/xhtml-el.xsd", URN_SYSTEM + "/xhtml-el.xsd").build();
+ URN_SYSTEM + "/javaee_web_services_1_2.xsd").put(
+ "http://java.sun.com/xml/ns/javaee/javaee_web_services_client_1_2.xsd",
+ URN_SYSTEM + "/javaee_web_services_client_1_2.xsd").put("http://www.w3.org/2001/03/XMLSchema.dtd",
+ URN_SYSTEM + "/XMLSchema.dtd").put("http://www.w3.org/2001/03/xml.xsd", URN_SYSTEM + "/xml.xsd").put(
+ "http://www.w3.org/2001/xml.xsd", URN_SYSTEM + "/xml.xsd").put("http://richfaces.org/cdk/cdk-template.xsd",
+ URN_SYSTEM + "/cdk-template.xsd")
+ .put("http://richfaces.org/cdk/xhtml-el.xsd", URN_SYSTEM + "/xhtml-el.xsd").build();
-
@Inject
private CdkClassLoader loader;
- @Inject @Source(Sources.FACES_CONFIGS)
+ @Inject
+ @Source(Sources.FACES_CONFIGS)
private FileManager facesConfigFolders;
- @Inject @Source(Sources.RENDERER_TEMPLATES)
+ @Inject
+ @Source(Sources.RENDERER_TEMPLATES)
private FileManager rendererTemplatesFolders;
/*
* (non-Javadoc)
- *
- * @see org.xml.sax.ext.EntityResolver2#getExternalSubset(java.lang.String,
- * java.lang.String)
+ *
+ * @see org.xml.sax.ext.EntityResolver2#getExternalSubset(java.lang.String, java.lang.String)
*/
@Override
public InputSource getExternalSubset(String name, String baseURI) throws SAXException, IOException {
@@ -109,9 +104,9 @@
/*
* (non-Javadoc)
- *
- * @see org.xml.sax.ext.EntityResolver2#resolveEntity(java.lang.String,
- * java.lang.String, java.lang.String, java.lang.String)
+ *
+ * @see org.xml.sax.ext.EntityResolver2#resolveEntity(java.lang.String, java.lang.String, java.lang.String,
+ * java.lang.String)
*/
@Override
public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId)
@@ -138,9 +133,8 @@
/*
* (non-Javadoc)
- *
- * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String,
- * java.lang.String)
+ *
+ * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
*/
@Override
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
@@ -153,7 +147,7 @@
return entity;
}
- protected InputSource resolveSystemId(String systemId) throws FileNotFoundException {
+ protected InputSource resolveSystemId(String systemId) throws IOException {
InputSource entity = null;
// first step - convert known system url's:
@@ -175,16 +169,11 @@
InputStream inputStream = null;
if (null != url) {
- try {
- inputStream = url.openStream();
- } catch (IOException e) {
- // Do nothnig.
- }
-
- if (inputStream != null) {
- entity = new InputSource(inputStream);
- entity.setSystemId(url.toString());
- }
+ inputStream = url.openStream();
+ entity = new InputSource(inputStream);
+ entity.setSystemId(url.toString());
+ } else {
+ throw new FileNotFoundException("Resource not found in generator class path: " + SYSTEM_PREFIX + path);
}
} else if (systemIdInternal.startsWith(URN_RESOURCE)) {
@@ -195,16 +184,11 @@
InputStream inputStream = null;
if (null != url) {
- try {
- inputStream = url.openStream();
- } catch (IOException e) {
- // Do nothnig.
- }
-
- if (inputStream != null) {
- entity = new InputSource(inputStream);
- entity.setSystemId(url.toString());
- }
+ inputStream = url.openStream();
+ entity = new InputSource(inputStream);
+ entity.setSystemId(url.toString());
+ } else {
+ throw new FileNotFoundException("Resource not found in project class path: " + path);
}
} else if (systemIdInternal.startsWith(URN_ATTRIBUTES)) {
@@ -218,18 +202,18 @@
}
if (null != inputStream) {
entity = new InputSource(inputStream);
+ } else {
+ throw new FileNotFoundException("Resource not found in class path: " + ATTRIBUTES_PREFIX + path);
}
} else if (systemIdInternal.startsWith(URN_CONFIG)) {
// Config folder.
String path = systemIdInternal.substring(URN_CONFIG.length());
-
entity = getProjectInputSource(facesConfigFolders, path);
} else if (systemIdInternal.startsWith(URN_TEMPLATES)) {
// Templates folder.
String path = systemIdInternal.substring(URN_TEMPLATES.length());
-
entity = getProjectInputSource(rendererTemplatesFolders, path);
}
@@ -248,9 +232,9 @@
if (null != configFile && configFile.exists()) {
InputStream inputStream = new FileInputStream(configFile);
-
entity = new InputSource(inputStream);
-
+ } else {
+ throw new FileNotFoundException("File not found in project : " + path);
}
return entity;
Modified: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taghandler.ftl
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taghandler.ftl 2010-07-23 19:43:09 UTC (rev 18224)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taghandler.ftl 2010-07-24 00:25:35 UTC (rev 18225)
@@ -2,17 +2,29 @@
package ${tag.targetClass.package};
-import javax.faces.view.facelets.*;
-import org.richfaces.MethodMetadata;
+import java.io.Serializable;
+import javax.el.MethodExpression;
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.MethodNotFoundException;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.${model}Config;
+import javax.faces.view.facelets.TagAttribute;
import ${model.targetClass};
-<#list model.generatedAttributes as prop><#if (!prop.signature.empty)><#list prop.signature as class>import ${class.name};
-</#list></#if></#list>
-
+import ${tag.baseClass};
+<#assign useMetaRule=false />
+<#list model.tagAttributes as prop><#if prop.signature?exists><#list prop.signature.parameters as class>import ${class.name};
+</#list></#if><#if (prop.binding || prop.bindingAttribute)><#assign useMetaRule=true /></#if></#list>
public class ${tag.targetClass.simpleName} extends ${tag.baseClass.simpleName} {
- private static final ${tag.targetClass.simpleName}MetaRule META_RULE = new ${tag.targetClass.simpleName}MetaRule();
-
public ${tag.targetClass.simpleName}(${model}Config config) {
super(config);
<#list model.requiredAttributes as prop>getRequiredAttribute("${prop.name}");
@@ -20,27 +32,80 @@
}
- protected MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset m = super.createMetaRuleset(type);
- m.addRule(META_RULE);
- return m;
- }
+<#if useMetaRule=true>
+<#assign useMethodBinding=false />
+ private static final MetaRule META_RULE = new MetaRule(){
- static class ${tag.targetClass.simpleName}MetaRule extends MetaRule{
-
- public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ public Metadata applyRule(String name, final TagAttribute attribute, MetadataTarget meta) {
if (meta.isTargetInstanceOf(${model.targetClass.simpleName}.class)) {
<#list model.tagAttributes as prop><#if (prop.binding || prop.bindingAttribute)>
if ("${prop.name}".equals(name)) {
- return new MethodMetadata(attribute<#if (!prop.signature.empty)><#list prop.signature as class>, ${class.simpleName}.class</#list></#if>) {
+ return new Metadata() {
+ private final Class<?>[] SIGNATURE={<#if prop.signature?exists><@util.concat seq=prop.signature.parameters; parameter>${parameter.simpleName}.class</(a)util.concat></#if>};
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((${model.targetClass.simpleName}) instance).${prop.setterName}(<#if (prop.isBinging)>getMethodBinding(ctx));<#else>getMethodExpression(ctx));</#if>
+ ((${model.targetClass.simpleName}) instance).${prop.setterName}(getValue(ctx));
}
+ <#if (prop.isBinging)>
+ <#assign useMethodBinding=true />
+ @SuppressWarnings("deprecation")
+ private MethodBinding getValue(FaceletContext ctx){
+ return new MethodBindingWrapper(attribute.getMethodExpression(ctx, <#if prop.signature?exists>${prop.signature.returnType.simpleName}.class<#else>null</#if>, SIGNATURE));
+ }
+ <#else>
+ private MethodExpression getValue(FaceletContext ctx){
+ return attribute.getMethodExpression(ctx, <#if prop.signature?exists>${prop.signature.returnType.simpleName}.class<#else>null</#if>, SIGNATURE);
+ }
+ </#if>
};
}
</#if></#list>
}
return null;
}
+ };
+
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset m = super.createMetaRuleset(type);
+ m.addRule(META_RULE);
+ return m;
}
+
+<#if useMethodBinding=true>
+ @SuppressWarnings({ "serial", "deprecation" })
+ public static final class MethodBindingWrapper extends
+ MethodBinding implements Serializable {
+
+ private final MethodExpression m;
+
+ public MethodBindingWrapper(MethodExpression m) {
+ this.m = m;
+ }
+
+ public Class getType(FacesContext context)
+ throws MethodNotFoundException {
+ try {
+ return m.getMethodInfo(context.getELContext()).getReturnType();
+ } catch (javax.el.MethodNotFoundException e) {
+ throw new MethodNotFoundException(e.getMessage(), e.getCause());
+ } catch (ELException e) {
+ throw new EvaluationException(e.getMessage(), e.getCause());
+ }
+ }
+
+ public Object invoke(FacesContext context, Object[] params)
+ throws EvaluationException, MethodNotFoundException {
+ try {
+ return m.invoke(context.getELContext(), params);
+ } catch (javax.el.MethodNotFoundException e) {
+ throw new MethodNotFoundException(e.getMessage(), e.getCause());
+ } catch (ELException e) {
+ throw new EvaluationException(e.getMessage(), e.getCause());
+ }
+ }
+
+ public String getExpressionString() {
+ return m.getExpressionString();
+ }
+ }
+</#if></#if>
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java 2010-07-23 19:43:09 UTC (rev 18224)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java 2010-07-24 00:25:35 UTC (rev 18225)
@@ -29,9 +29,9 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
+import java.util.Map;
import org.junit.Assert;
-import org.richfaces.cdk.As;
import org.richfaces.cdk.CdkTestBase;
import org.richfaces.cdk.FileManager;
import org.richfaces.cdk.Logger;
@@ -39,6 +39,8 @@
import org.richfaces.cdk.Output;
import org.richfaces.cdk.Outputs;
import org.richfaces.cdk.generate.freemarker.CdkConfiguration;
+import org.richfaces.cdk.generate.freemarker.DefaultImports;
+import org.richfaces.cdk.generate.freemarker.FreeMakerUtils;
import org.richfaces.cdk.generate.freemarker.FreeMarkerRenderer;
import org.richfaces.cdk.generate.freemarker.LibraryModelWrapper;
import org.richfaces.cdk.model.ClassName;
@@ -47,7 +49,10 @@
import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.PropertyBase;
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Binder;
import com.google.inject.Inject;
+import com.google.inject.TypeLiteral;
import freemarker.template.ObjectWrapper;
@@ -58,7 +63,6 @@
public abstract class AbstractClassGeneratorTest extends CdkTestBase {
@Inject
- @As(CdkConfiguration.class)
@LibraryModel
protected FreeMarkerRenderer configuration;
@@ -74,8 +78,16 @@
@Inject
- @As(LibraryModelWrapper.class)
protected ObjectWrapper wrapper;
+
+ @Override
+ public void configure(Binder binder) {
+ super.configure(binder);
+ binder.bind(FreeMarkerRenderer.class).annotatedWith(LibraryModel.class).to(CdkConfiguration.class);
+ binder.bind(ObjectWrapper.class).to(LibraryModelWrapper.class);
+ binder.bind(FreeMakerUtils.class);
+ binder.bind(new TypeLiteral<Map<String,String>>(){}).annotatedWith(DefaultImports.class).toInstance(ImmutableMap.of("util","util.ftl"));
+ }
protected static PropertyBase addAttribute(ModelElementBase model, String attributeName, Class<?> type,
boolean generate) {
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java 2010-07-23 19:43:09 UTC (rev 18224)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java 2010-07-24 00:25:35 UTC (rev 18225)
@@ -52,20 +52,12 @@
@Inject
private Logger log;
- public TagHandlerClassGenerator getGenerator() {
- return generator;
- }
- public void setGenerator(TagHandlerClassGenerator generator) {
- this.generator = generator;
- }
-
@Test
public void testGetOutputFileBehavior() throws Exception {
final StringWriter outputWriter = new StringWriter();
expect(output.createOutput((String) anyObject(), anyInt())).andReturn(outputWriter);
replay(output);
-
ComponentModel model = ComponentClassGeneratorTest.createComponent();
library.getComponents().add(model);
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-07-23 19:43:09 UTC (rev 18224)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-07-24 00:25:35 UTC (rev 18225)
@@ -128,7 +128,7 @@
assertNotNull(actionProperty.getSignature());
assertEquals(0, actionProperty.getSignature().getParameters().size());
- assertEquals(String.class.getName(), actionProperty.getSignature().getReturnType());
+ assertEquals(String.class.getName(), actionProperty.getSignature().getReturnType().toString());
}
/**
@@ -141,7 +141,7 @@
assertNotNull(actionListenerProperty);
assertNoEventNames(actionListenerProperty);
- assertEquals(Lists.newArrayList(new ClassName(ActionEvent.class)), actionListenerProperty.getSignature());
+ assertEquals(Lists.newArrayList(new ClassName(ActionEvent.class)), actionListenerProperty.getSignature().getParameters());
}
/**
@@ -157,7 +157,7 @@
ArrayList<ClassName> expectedSignature =
Lists.newArrayList(new ClassName(int.class), new ClassName(String.class), new ClassName(Validator.class));
- assertEquals(expectedSignature, coolMethodProperty.getSignature());
+ assertEquals(expectedSignature, coolMethodProperty.getSignature().getParameters());
}
private void checkDummyComponentImportedAttribute(PropertyBase importedAttribute, Class<?> type) {
Modified: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml 2010-07-23 19:43:09 UTC (rev 18224)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml 2010-07-24 00:25:35 UTC (rev 18225)
@@ -13,7 +13,6 @@
<cdk:pass-through>false</cdk:pass-through>
<cdk:read-only>false</cdk:read-only>
<cdk:required>false</cdk:required>
- <cdk:signature/>
</attribute-extension>
</attribute>
<property>
@@ -26,7 +25,6 @@
<cdk:pass-through>false</cdk:pass-through>
<cdk:read-only>false</cdk:read-only>
<cdk:required>false</cdk:required>
- <cdk:signature/>
</property-extension>
</property>
<behavior-extension>
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2010-07-23 19:43:09 UTC (rev 18224)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2010-07-24 00:25:35 UTC (rev 18225)
@@ -41,6 +41,7 @@
import org.richfaces.cdk.annotations.Signature;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.test.event.TestEvent;
+import org.richfaces.cdk.test.model.TestModel;
/**
* <p class="changed_added_4_0">
@@ -96,9 +97,9 @@
@Attribute(signature = @Signature(parameters = {String.class,Integer.class}, returnType = int.class))
public abstract MethodBinding getMethodBindingListener();
- @Attribute(required=true)
+ @Attribute(required=true,signature=(a)Signature(returnType=TestModel.class))
public abstract ValueExpression getValueExpressionProperty();
- @Attribute(required=true)
+ @Attribute(required=true,signature=(a)Signature(returnType=List.class,parameters={String.class,int.class}))
public abstract ValueBinding getValueBindingProperty();
}
Added: root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/model/TestModel.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/model/TestModel.java (rev 0)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/model/TestModel.java 2010-07-24 00:25:35 UTC (rev 18225)
@@ -0,0 +1,5 @@
+package org.richfaces.cdk.test.model;
+
+public class TestModel {
+
+}
Property changes on: root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/model/TestModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 5 months