[richfaces-svn-commits] JBoss Rich Faces SVN: r2186 - in trunk: framework/impl/src/main/javascript/ajaxjsf and 29 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Thu Aug 9 21:13:44 EDT 2007


Author: alexsmirnov
Date: 2007-08-09 21:13:44 -0400 (Thu, 09 Aug 2007)
New Revision: 2186

Added:
   trunk/ui/insert/
   trunk/ui/insert/pom.xml
   trunk/ui/insert/src/
   trunk/ui/insert/src/main/
   trunk/ui/insert/src/main/config/
   trunk/ui/insert/src/main/config/component/
   trunk/ui/insert/src/main/config/component/README
   trunk/ui/insert/src/main/config/component/insert.xml
   trunk/ui/insert/src/main/java/
   trunk/ui/insert/src/main/java/META-INF/
   trunk/ui/insert/src/main/java/META-INF/MANIFEST.MF
   trunk/ui/insert/src/main/java/org/
   trunk/ui/insert/src/main/java/org/richfaces/
   trunk/ui/insert/src/main/java/org/richfaces/ui/
   trunk/ui/insert/src/main/java/org/richfaces/ui/component/
   trunk/ui/insert/src/main/java/org/richfaces/ui/component/README
   trunk/ui/insert/src/main/java/org/richfaces/ui/component/UIInsert.java
   trunk/ui/insert/src/main/resources/
   trunk/ui/insert/src/main/resources/org/
   trunk/ui/insert/src/main/resources/org/richfaces/
   trunk/ui/insert/src/main/resources/org/richfaces/ui/
   trunk/ui/insert/src/main/resources/org/richfaces/ui/renderkit/
   trunk/ui/insert/src/main/resources/org/richfaces/ui/renderkit/html/
   trunk/ui/insert/src/main/resources/org/richfaces/ui/renderkit/html/css/
   trunk/ui/insert/src/main/resources/org/richfaces/ui/renderkit/html/css/highlight.css
   trunk/ui/insert/src/main/templates/
   trunk/ui/insert/src/main/templates/README
   trunk/ui/insert/src/main/templates/org/
   trunk/ui/insert/src/main/templates/org/richfaces/
   trunk/ui/insert/src/main/templates/org/richfaces/ui/
   trunk/ui/insert/src/main/templates/org/richfaces/ui/htmlInsert.jspx
   trunk/ui/insert/src/test/
   trunk/ui/insert/src/test/java/
   trunk/ui/insert/src/test/java/org/
   trunk/ui/insert/src/test/java/org/richfaces/
   trunk/ui/insert/src/test/java/org/richfaces/ui/
   trunk/ui/insert/src/test/java/org/richfaces/ui/component/
   trunk/ui/insert/src/test/java/org/richfaces/ui/component/JSFComponentTest.java
Modified:
   trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java
   trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
   trunk/ui/create.sh
   trunk/ui/pom.xml
Log:
new component - rich:insert
Display standart error page in case of the AJAX requests ( http://jira.jboss.com/jira/browse/RF-548 ).

Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java	2007-08-10 01:10:57 UTC (rev 2185)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java	2007-08-10 01:13:44 UTC (rev 2186)
@@ -155,7 +155,7 @@
 		ExternalContext externalContext = context.getExternalContext();
 		Map requestParameterMap = externalContext.getRequestParameterMap();
 		Map requestMap = externalContext.getRequestMap();
-		if (null == viewRoot) {
+/*		if (null == viewRoot) {
 			if (requestParameterMap
 					.containsKey(AjaxContainerRenderer.AJAX_PARAMETER_NAME)
 					&& !requestMap.containsKey(REDIRECTED)) {
@@ -189,7 +189,7 @@
 				}
 			}
 		}
-		return viewRoot;
+*/		return viewRoot;
 	}
 
 	/*

Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js	2007-08-10 01:10:57 UTC (rev 2185)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js	2007-08-10 01:13:44 UTC (rev 2186)
@@ -783,11 +783,16 @@
 		          					window.document.close();
 								}
 								// Firefox/Mozilla in XHTML case don't support document.write()
-//								window.location = "data:"+req.getContentType()+";charset=utf-8," + encodeURIComponent(req.getResponseText())
 								// Use dom manipulation instead.
-								var	oDomDoc = (new DOMParser()).parseFromString(req.getResponseText(), "application/xhtml+xml");
-						    	var node = window.document.importNode(oDomDoc.documentElement, true);
-								window.document.replaceChild(node,window.document.documentElement);
+								var	oDomDoc = (new DOMParser()).parseFromString(req.getResponseText(), req.getContentType());
+						    	Sarissa.clearChildNodes(window.document.documentElement);
+								var docNodes = oDomDoc.documentElement.childNodes;
+								for(var i = 0;i<docNodes.length;i++){
+									if(docNodes[i].nodeType == 1){
+							    		var node = window.document.importNode(docNodes[i], true);
+						    			window.document.documentElement.appendChild(node);
+									}
+								}
 								// TODO - scripts reloading ?
 							} finally {
 								window.document.open = oldDocOpen;								

Modified: trunk/ui/create.sh
===================================================================
--- trunk/ui/create.sh	2007-08-10 01:10:57 UTC (rev 2185)
+++ trunk/ui/create.sh	2007-08-10 01:13:44 UTC (rev 2186)
@@ -1,3 +1,3 @@
-#!/bin/sh
-mvn archetype:create -DarchetypeGroupId=org.ajax4jsf.cdk -DarchetypeArtifactId=maven-archetype-jsf-component \
-   -DarchetypeVersion=1.1.1-SNAPSHOT -DgroupId=org.richfaces -DartifactId=$1
\ No newline at end of file
+#!/bin/sh
+mvn archetype:create -DarchetypeGroupId=org.richfaces.cdk -DarchetypeArtifactId=maven-archetype-jsf-component \
+   -DarchetypeVersion=3.1.0-SNAPSHOT -DgroupId=org.richfaces.ui -DartifactId=$1

Added: trunk/ui/insert/pom.xml
===================================================================
--- trunk/ui/insert/pom.xml	                        (rev 0)
+++ trunk/ui/insert/pom.xml	2007-08-10 01:13:44 UTC (rev 2186)
@@ -0,0 +1,44 @@
+<?xml version="1.0"?><project>
+  <parent>
+    <artifactId>ui</artifactId>
+    <groupId>org.richfaces</groupId>
+    <version>3.1.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.richfaces.ui</groupId>
+  <artifactId>insert</artifactId>
+  <name>insert</name>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.richfaces.cdk</groupId>
+        <artifactId>maven-cdk-plugin</artifactId>
+        <version>3.1.0-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>generate</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <library>
+            <prefix>org.richfaces</prefix>
+            <taglib>
+              <shortName>insert</shortName>
+            </taglib>
+          </library>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+    <dependencies>
+	<dependency>
+	    <groupId>com.uwyn</groupId>
+	    <artifactId>jhighlight</artifactId>
+	    <version>1.0</version>
+	    <optional>true</optional>
+	</dependency>
+    </dependencies>
+</project>
\ No newline at end of file


Property changes on: trunk/ui/insert/pom.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Revision Author

Added: trunk/ui/insert/src/main/config/component/README
===================================================================

Added: trunk/ui/insert/src/main/config/component/insert.xml
===================================================================
--- trunk/ui/insert/src/main/config/component/insert.xml	                        (rev 0)
+++ trunk/ui/insert/src/main/config/component/insert.xml	2007-08-10 01:13:44 UTC (rev 2186)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN"  "https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd" >
+<components>
+	<component>
+		<name>org.richfaces.ui.Insert</name>
+		<family>org.richfaces.ui.Insert</family>
+		<classname>org.richfaces.ui.component.html.HtmlInsert</classname>
+		<superclass>org.richfaces.ui.component.UIInsert</superclass>
+		<description>
+			<![CDATA[
+    ]]>
+		</description>
+		<renderer generate="true" override="true">
+			<name>org.richfaces.ui.InsertRenderer</name>
+			<template>org/richfaces/ui/htmlInsert.jspx</template>
+		</renderer>
+		<tag>
+			<name>insert</name>
+			<classname>org.richfaces.ui.taglib.InsertTag</classname>
+			<superclass>
+				org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
+			</superclass>
+		</tag>
+		<!--
+		<taghandler>
+			<classname>org.ajax4jsf.tag.TestHandler</classname>
+		</taghandler>
+		-->
+		&ui_component_attributes;
+		<!--
+		<property>
+			<name>param</name>
+			<classname>java.lang.String</classname>
+			<description>
+			</description>
+			<defaultvalue>"default"</defaultvalue>
+		</property>
+        -->
+	</component>
+</components>


Property changes on: trunk/ui/insert/src/main/config/component/insert.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Revision Author

Added: trunk/ui/insert/src/main/java/META-INF/MANIFEST.MF
===================================================================
--- trunk/ui/insert/src/main/java/META-INF/MANIFEST.MF	                        (rev 0)
+++ trunk/ui/insert/src/main/java/META-INF/MANIFEST.MF	2007-08-10 01:13:44 UTC (rev 2186)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+


Property changes on: trunk/ui/insert/src/main/java/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/ui/insert/src/main/java/org/richfaces/ui/component/README
===================================================================

Added: trunk/ui/insert/src/main/java/org/richfaces/ui/component/UIInsert.java
===================================================================
--- trunk/ui/insert/src/main/java/org/richfaces/ui/component/UIInsert.java	                        (rev 0)
+++ trunk/ui/insert/src/main/java/org/richfaces/ui/component/UIInsert.java	2007-08-10 01:13:44 UTC (rev 2186)
@@ -0,0 +1,84 @@
+/**
+ *
+ */
+
+package org.richfaces.ui.component;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponentBase;
+
+import com.uwyn.jhighlight.renderer.Renderer;
+import com.uwyn.jhighlight.renderer.XhtmlRendererFactory;
+
+/**
+ * JSF component class
+ * 
+ */
+public abstract class UIInsert extends UIComponentBase {
+
+	private static final String COMPONENT_TYPE = "org.richfaces.ui.Insert";
+
+	private static final String COMPONENT_FAMILY = "org.richfaces.ui.Insert";
+
+	public String getContent() {
+		String content = null;
+		if (null != getSrc()) {
+			InputStream inputStream = getFacesContext().getExternalContext().getResourceAsStream(getSrc());
+			if(null != inputStream){
+				if(null == getHighlight()){
+					StringBuffer buff = new StringBuffer(1024);
+					InputStreamReader in = new InputStreamReader(inputStream);
+					char[] temp = new char[1024];
+					try {
+						int bytes;
+						while((bytes = in.read(temp))>0){
+							buff.append(temp,0,bytes);
+						};
+					} catch (IOException e) {
+						throw new FacesException(e);
+					} finally {
+						try {
+							in.close();
+						} catch (IOException e) {
+							throw new FacesException(e);
+						}
+					}
+					content = buff.toString();
+				} else {
+					Renderer renderer = XhtmlRendererFactory.getRenderer(getHighlight());
+					if(null != renderer){
+						ByteArrayOutputStream out = new ByteArrayOutputStream();
+						try {
+							renderer.highlight(getSrc(), inputStream, out, null, true);
+						} catch (IOException e) {
+							throw new FacesException(e);
+						} finally {
+							try {
+								inputStream.close();
+							} catch (IOException e) {
+								throw new FacesException(e);
+							}
+						}
+						content = out.toString();
+					}
+				}
+			}
+		}
+
+		return content;
+	}
+
+	public abstract String getSrc();
+
+	public abstract void setSrc(String src);
+
+	public abstract String getHighlight();
+
+	public abstract void setHighlight(String highlight);
+
+}


Property changes on: trunk/ui/insert/src/main/java/org/richfaces/ui/component/UIInsert.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Revision Author

Added: trunk/ui/insert/src/main/resources/org/richfaces/ui/renderkit/html/css/highlight.css
===================================================================
--- trunk/ui/insert/src/main/resources/org/richfaces/ui/renderkit/html/css/highlight.css	                        (rev 0)
+++ trunk/ui/insert/src/main/resources/org/richfaces/ui/renderkit/html/css/highlight.css	2007-08-10 01:13:44 UTC (rev 2186)
@@ -0,0 +1,135 @@
+.java_plain {
+	color: rgb(0,0,0);
+}
+.java_keyword {
+
+	color: rgb(0,0,0); 
+	font-weight: bold;
+}
+.java_type {
+
+	color: rgb(0,44,221);
+}
+.java_operator {
+
+	color: rgb(0,124,31);
+}
+.java_separator {
+
+	color: rgb(0,33,255);
+}
+.java_literal {
+
+	color: rgb(188,0,0);
+}
+.java_comment {
+
+	color: rgb(147,147,147); 
+	background-color: rgb(247,247,247);
+}
+.java_javadoc_comment {
+
+	color: rgb(147,147,147); 
+	background-color: rgb(247,247,247); 
+	font-style: italic;
+}
+.java_javadoc_tag {
+
+	color: rgb(147,147,147); 
+	background-color: rgb(247,247,247); 
+	font-style: italic; 
+	font-weight: bold;
+}
+.xml_plain {
+
+	color: rgb(0,0,0);
+}
+.xml_char_data {
+
+	color: rgb(0,0,0);
+}
+.xml_tag_symbols {
+
+	color: rgb(0,59,255);
+}
+.xml_comment {
+
+	color: rgb(147,147,147); 
+	background-color: rgb(247,247,247);
+}
+.xml_attribute_value {
+
+	color: rgb(193,0,0);
+}
+.xml_attribute_name {
+
+	color: rgb(0,0,0); 
+	font-weight: bold;
+}
+.xml_processing_instruction {
+
+	color: rgb(0,0,0); 
+	font-weight: bold; 
+	font-style: italic;
+}
+.xml_tag_name {
+
+	color: rgb(0,55,255);
+}
+.xml_rife_tag {
+
+	color: rgb(0,0,0); 
+	background-color: rgb(228,230,160);
+}
+.xml_rife_name {
+
+	color: rgb(0,0,196); 
+	background-color: rgb(228,230,160);
+}
+.cpp_plain {
+
+	color: rgb(0,0,0);
+}			
+.cpp_keyword { 
+
+	color: rgb(0,0,0); 
+	font-weight: bold;
+}			
+.cpp_type { 
+
+	color: rgb(0,44,221);
+}			
+.cpp_operator { 
+
+	color: rgb(0,124,31);
+}			
+.cpp_separator { 
+
+	color: rgb(0,33,255);
+}			
+.cpp_literal { 
+
+	color: rgb(188,0,0);
+}			
+.cpp_comment { 
+
+	color: rgb(147,147,147); 
+	background-color: rgb(247,247,247);
+}			
+.cpp_doxygen_comment { 
+
+	color: rgb(147,147,147); 
+	background-color: rgb(247,247,247); 
+	font-style: italic;
+}			
+.cpp_doxygen_tag { 
+
+	color: rgb(147,147,147); 
+	background-color: rgb(247,247,247); 
+	font-style: italic; 
+	font-weight: bold;
+}			
+.cpp_preproc { 
+
+	color: purple;
+}
\ No newline at end of file


Property changes on: trunk/ui/insert/src/main/resources/org/richfaces/ui/renderkit/html/css/highlight.css
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/ui/insert/src/main/templates/README
===================================================================

Added: trunk/ui/insert/src/main/templates/org/richfaces/ui/htmlInsert.jspx
===================================================================
--- trunk/ui/insert/src/main/templates/org/richfaces/ui/htmlInsert.jspx	                        (rev 0)
+++ trunk/ui/insert/src/main/templates/org/richfaces/ui/htmlInsert.jspx	2007-08-10 01:13:44 UTC (rev 2186)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root 
+	xmlns:f="http://ajax4jsf.org/cdk/template" 
+	xmlns:c=" http://java.sun.com/jsf/core" 
+	xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+	xmlns:u=" http://ajax4jsf.org/cdk/u"
+	xmlns:x=" http://ajax4jsf.org/cdk/x"
+	class="org.richfaces.ui.renderkit.html.InsertRenderer"
+	baseclass="org.ajax4jsf.renderkit.AjaxComponentRendererBase"
+	component="org.richfaces.ui.component.UIInsert" 
+	>
+	<h:styles>css/highlight.css</h:styles>  
+	<f:clientid var="clientId"/>
+	<div id="#{clientId}"
+		x:passThruWithExclusions="value,name,type,id"
+		>
+		<jsp:scriptlet>
+		  writer.write(component.getContent());
+		</jsp:scriptlet>
+	</div>
+</f:root>
\ No newline at end of file


Property changes on: trunk/ui/insert/src/main/templates/org/richfaces/ui/htmlInsert.jspx
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/ui/insert/src/test/java/org/richfaces/ui/component/JSFComponentTest.java
===================================================================
--- trunk/ui/insert/src/test/java/org/richfaces/ui/component/JSFComponentTest.java	                        (rev 0)
+++ trunk/ui/insert/src/test/java/org/richfaces/ui/component/JSFComponentTest.java	2007-08-10 01:13:44 UTC (rev 2186)
@@ -0,0 +1,53 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.ui.component;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import javax.faces.component.UIComponent;
+
+/**
+ * Unit test for simple Component.
+ */
+public class JSFComponentTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public JSFComponentTest( String testName )
+    {
+        super( testName );
+    }
+
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testComponent()
+    {
+        assertTrue( true );
+    }
+}


Property changes on: trunk/ui/insert/src/test/java/org/richfaces/ui/component/JSFComponentTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Revision Author

Modified: trunk/ui/pom.xml
===================================================================
--- trunk/ui/pom.xml	2007-08-10 01:10:57 UTC (rev 2185)
+++ trunk/ui/pom.xml	2007-08-10 01:13:44 UTC (rev 2186)
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<parent>
 		<artifactId>root</artifactId>
@@ -85,8 +86,9 @@
 		<module>calendar</module>
 		<module>treeModel</module>
 		<module>message</module>
-		<module>scrollable-grid</module>
-	</modules>
+		<module>scrollable-grid</module>
+    <module>insert</module>
+  </modules>
 	<dependencies>
 		<dependency>
 			<groupId>junit</groupId>




More information about the richfaces-svn-commits mailing list