[richfaces-svn-commits] JBoss Rich Faces SVN: r13670 - in trunk/cdk/maven-cdk-plugin/src/main: resources and 5 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Sat Apr 18 09:08:29 EDT 2009


Author: nbelaevski
Date: 2009-04-18 09:08:29 -0400 (Sat, 18 Apr 2009)
New Revision: 13670

Added:
   trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AbstractCreateMojo.java
   trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CreateThemeMojo.java
   trunk/cdk/maven-cdk-plugin/src/main/resources/theme/
   trunk/cdk/maven-cdk-plugin/src/main/resources/theme/component/
   trunk/cdk/maven-cdk-plugin/src/main/resources/theme/component/theme.xml
   trunk/cdk/maven-cdk-plugin/src/main/resources/theme/css/
   trunk/cdk/maven-cdk-plugin/src/main/resources/theme/css/theme.xcss
   trunk/cdk/maven-cdk-plugin/src/main/resources/theme/template/
   trunk/cdk/maven-cdk-plugin/src/main/resources/theme/template/theme.jspx
   trunk/cdk/maven-cdk-plugin/src/main/resources/theme/themes/
   trunk/cdk/maven-cdk-plugin/src/main/resources/theme/themes/theme.properties
Modified:
   trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CreateSkinMojo.java
Log:
- add-theme goal added
- slight refactoring done

Added: trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AbstractCreateMojo.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AbstractCreateMojo.java	                        (rev 0)
+++ trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AbstractCreateMojo.java	2009-04-18 13:08:29 UTC (rev 13670)
@@ -0,0 +1,141 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.ajax4jsf.builder.mojo;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.aja4jsf.builder.model.Resource;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.velocity.VelocityContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public abstract class AbstractCreateMojo extends AbstractCDKMojo {
+
+	protected static final String SRC_MAIN_RESOURCES = "src/main/resources";
+
+	protected static final Set<String> JAVA_RESERVED_WORDS;
+
+	static{
+		JAVA_RESERVED_WORDS = new HashSet<String>();
+		JAVA_RESERVED_WORDS.add("abstract");
+		JAVA_RESERVED_WORDS.add("assert");
+		JAVA_RESERVED_WORDS.add("boolean");
+		JAVA_RESERVED_WORDS.add("break");
+		JAVA_RESERVED_WORDS.add("byte");
+		JAVA_RESERVED_WORDS.add("case");
+		JAVA_RESERVED_WORDS.add("catch");
+		JAVA_RESERVED_WORDS.add("char");
+		JAVA_RESERVED_WORDS.add("class");
+		JAVA_RESERVED_WORDS.add("const");
+		JAVA_RESERVED_WORDS.add("continue");
+		JAVA_RESERVED_WORDS.add("default");
+		JAVA_RESERVED_WORDS.add("do");
+		JAVA_RESERVED_WORDS.add("double");
+		JAVA_RESERVED_WORDS.add("else");
+		JAVA_RESERVED_WORDS.add("extends");
+		JAVA_RESERVED_WORDS.add("false");
+		JAVA_RESERVED_WORDS.add("final");
+		JAVA_RESERVED_WORDS.add("finally");
+		JAVA_RESERVED_WORDS.add("float");
+		JAVA_RESERVED_WORDS.add("for");
+		JAVA_RESERVED_WORDS.add("goto");		
+		JAVA_RESERVED_WORDS.add("if");
+		JAVA_RESERVED_WORDS.add("implements");
+		JAVA_RESERVED_WORDS.add("import");
+		JAVA_RESERVED_WORDS.add("instanceof");
+		JAVA_RESERVED_WORDS.add("int");
+		JAVA_RESERVED_WORDS.add("interface");
+		JAVA_RESERVED_WORDS.add("long");
+		JAVA_RESERVED_WORDS.add("native");
+		JAVA_RESERVED_WORDS.add("new");
+		JAVA_RESERVED_WORDS.add("null");
+		JAVA_RESERVED_WORDS.add("package");
+		JAVA_RESERVED_WORDS.add("private");
+		JAVA_RESERVED_WORDS.add("protected");
+		JAVA_RESERVED_WORDS.add("public");
+		JAVA_RESERVED_WORDS.add("return");
+		JAVA_RESERVED_WORDS.add("short");
+		JAVA_RESERVED_WORDS.add("static");
+		JAVA_RESERVED_WORDS.add("strictfp");
+		JAVA_RESERVED_WORDS.add("super");
+		JAVA_RESERVED_WORDS.add("switch");
+		JAVA_RESERVED_WORDS.add("synchronized");
+		JAVA_RESERVED_WORDS.add("this");
+		JAVA_RESERVED_WORDS.add("throw");
+		JAVA_RESERVED_WORDS.add("throws");
+		JAVA_RESERVED_WORDS.add("transient");
+		JAVA_RESERVED_WORDS.add("true");
+		JAVA_RESERVED_WORDS.add("try");
+		JAVA_RESERVED_WORDS.add("void");
+		JAVA_RESERVED_WORDS.add("volatile");
+		JAVA_RESERVED_WORDS.add("while");
+	}
+
+	protected void checkAndCreateDirectory(File directory)
+	throws MojoExecutionException {
+		getLog().debug("Checking directory " + directory + " for existence");
+		if (!directory.exists()) {
+			directory.mkdirs();
+			getLog().debug("Directory " + directory + " created");
+		}
+		if (!directory.isDirectory()) {
+			throw new MojoExecutionException("Directory " + directory.getAbsolutePath() + " is not a Directory");
+		}
+	}
+
+	protected void filterJarResource(Resource template, Resource skinResource, File baseDir,
+			VelocityContext context) throws Exception {
+		File newFile = new File(baseDir, skinResource.getPath());
+		if (newFile.exists()) {
+			getLog().debug("File " + newFile + " already exists. Skipping.");
+		} else {
+			try {
+				writeParsedTemplate(template.getPath(), context, newFile);
+			} catch (Exception e) {
+				throw new MojoExecutionException("Unable to write file " + newFile, e);
+			}
+		}
+	}
+	
+	protected boolean isValidJavaName(String name) {
+		return !JAVA_RESERVED_WORDS.contains(name);
+	}
+	
+	protected boolean isValidPackageName(String packageName) {
+		if (packageName != null) {
+			String[] packageNameSegments = packageName.split("\\.");
+			for (String packageNameSegment : packageNameSegments) {
+				if (!isValidJavaName(packageNameSegment)) {
+					return false;
+				}
+			}
+		}
+
+		return true;
+	}
+
+}

Modified: trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CreateSkinMojo.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CreateSkinMojo.java	2009-04-17 23:04:12 UTC (rev 13669)
+++ trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CreateSkinMojo.java	2009-04-18 13:08:29 UTC (rev 13670)
@@ -29,9 +29,7 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Enumeration;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
@@ -69,10 +67,8 @@
  * @author Maksim Kaszynski
  *
  */
-public class CreateSkinMojo extends AbstractCDKMojo {
+public class CreateSkinMojo extends AbstractCreateMojo {
 
-	private static final String SRC_MAIN_RESOURCES = "src/main/resources";
-
 	private static final String PROPERTIES = ".skin.properties";
 
 	private static final String XCSS = ".xcss";
@@ -83,64 +79,6 @@
 
 	private static final String META_INF_SKINS = "META-INF/skins/";
 	
-	private static final Set<String> JAVA_RESERVED_WORDS;
-	
-	static{
-		JAVA_RESERVED_WORDS = new HashSet<String>();
-		JAVA_RESERVED_WORDS.add("abstract");
-		JAVA_RESERVED_WORDS.add("assert");
-		JAVA_RESERVED_WORDS.add("boolean");
-		JAVA_RESERVED_WORDS.add("break");
-		JAVA_RESERVED_WORDS.add("byte");
-		JAVA_RESERVED_WORDS.add("case");
-		JAVA_RESERVED_WORDS.add("catch");
-		JAVA_RESERVED_WORDS.add("char");
-		JAVA_RESERVED_WORDS.add("class");
-		JAVA_RESERVED_WORDS.add("const");
-		JAVA_RESERVED_WORDS.add("continue");
-		JAVA_RESERVED_WORDS.add("default");
-		JAVA_RESERVED_WORDS.add("do");
-		JAVA_RESERVED_WORDS.add("double");
-		JAVA_RESERVED_WORDS.add("else");
-		JAVA_RESERVED_WORDS.add("extends");
-		JAVA_RESERVED_WORDS.add("false");
-		JAVA_RESERVED_WORDS.add("final");
-		JAVA_RESERVED_WORDS.add("finally");
-		JAVA_RESERVED_WORDS.add("float");
-		JAVA_RESERVED_WORDS.add("for");
-		JAVA_RESERVED_WORDS.add("goto");		
-		JAVA_RESERVED_WORDS.add("if");
-		JAVA_RESERVED_WORDS.add("implements");
-		JAVA_RESERVED_WORDS.add("import");
-		JAVA_RESERVED_WORDS.add("instanceof");
-		JAVA_RESERVED_WORDS.add("int");
-		JAVA_RESERVED_WORDS.add("interface");
-		JAVA_RESERVED_WORDS.add("long");
-		JAVA_RESERVED_WORDS.add("native");
-		JAVA_RESERVED_WORDS.add("new");
-		JAVA_RESERVED_WORDS.add("null");
-		JAVA_RESERVED_WORDS.add("package");
-		JAVA_RESERVED_WORDS.add("private");
-		JAVA_RESERVED_WORDS.add("protected");
-		JAVA_RESERVED_WORDS.add("public");
-		JAVA_RESERVED_WORDS.add("return");
-		JAVA_RESERVED_WORDS.add("short");
-		JAVA_RESERVED_WORDS.add("static");
-		JAVA_RESERVED_WORDS.add("strictfp");
-		JAVA_RESERVED_WORDS.add("super");
-		JAVA_RESERVED_WORDS.add("switch");
-		JAVA_RESERVED_WORDS.add("synchronized");
-		JAVA_RESERVED_WORDS.add("this");
-		JAVA_RESERVED_WORDS.add("throw");
-		JAVA_RESERVED_WORDS.add("throws");
-		JAVA_RESERVED_WORDS.add("transient");
-		JAVA_RESERVED_WORDS.add("true");
-		JAVA_RESERVED_WORDS.add("try");
-		JAVA_RESERVED_WORDS.add("void");
-		JAVA_RESERVED_WORDS.add("volatile");
-		JAVA_RESERVED_WORDS.add("while");
-	}
-
 	/**
 	 * Name of base package of skin.
 	 * If it is not set, GroupId is used.
@@ -221,13 +159,14 @@
 		getLog().debug("Skin package is " + fullSkinName);
 		
 		//RF-4023
-		if(JAVA_RESERVED_WORDS.contains(skinName)){
+		if (!isValidJavaName(skinName)){
 			throw new MojoExecutionException("Invalid skin name '" + skinName + "'. Please type another name.");
 		}
-		if(JAVA_RESERVED_WORDS.contains(packageName)){
+		
+		if (!isValidPackageName(packageName)) {
 			throw new MojoExecutionException("Invalid skin package '" + packageName + "'. Please type another package.");
 		}
-
+		
 		SkinInfo skinInfoTemplate = new SkinInfo();
 		skinInfoTemplate.setShortName(shortName);
 		skinInfoTemplate.setPackageName(fullSkinName.toLowerCase());
@@ -272,19 +211,6 @@
 		}
 	}
 	
-	private void filterJarResource(Resource template, Resource skinResource, File baseDir, VelocityContext context) throws Exception{
-		File newFile = new File(baseDir, skinResource.getPath());
-		if (newFile.exists()) {
-			getLog().debug("File " + newFile + " already exists. Skipping.");
-		} else {
-			try {
-				writeParsedTemplate(template.getPath(), context, newFile);
-			} catch (Exception e) {
-				throw new MojoExecutionException("Unable to write file " + newFile, e);
-			}
-		}
-	}
-	
 	private List<Resource> filterComponentSkinTemplates(List<Resource> jarTemplates, SkinInfo skinInfo, File resourceDir) throws MojoExecutionException {
 		List<Resource> newResources = new ArrayList<Resource>(jarTemplates.size());
 		for (Resource jarTemplate : jarTemplates) {
@@ -484,17 +410,6 @@
 		return pluginArtifact.getFile();
 	}
 
-	private void checkAndCreateDirectory(File directory) throws MojoExecutionException {
-		getLog().debug("Checking directory " + directory + " for existence");
-		if (!directory.exists()) {
-			directory.mkdirs();
-			getLog().debug("Directory " + directory + " created");
-		}
-		if (!directory.isDirectory()) {
-			throw new MojoExecutionException("Directory " + directory.getAbsolutePath() + " is not a Directory");
-		}
-	}
-
 	private void addToResourceConfig(List<Resource> resources, File resourceConfigFile) throws Exception{
 		ResourceConfig resourceConfig = null;
 		

Added: trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CreateThemeMojo.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CreateThemeMojo.java	                        (rev 0)
+++ trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CreateThemeMojo.java	2009-04-18 13:08:29 UTC (rev 13670)
@@ -0,0 +1,158 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.ajax4jsf.builder.mojo;
+
+import java.io.File;
+import java.util.Locale;
+
+import org.aja4jsf.builder.model.Resource;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.velocity.VelocityContext;
+
+/**
+ * This mojo is intended to create new theme within existing project.
+ * <p><b>Usage</b> <tt>mvn cdk:add-theme -Dname=&lt;themeName&gt; [ -Dpackage=&lt;themePackage&gt; ]</tt></p>
+ * This adds new theme named &lt;themeName&gt; to project resources/META-INF/themes folder.<br/>
+ * If <em>package</em> is not specified, it is set same as groupId.<br/>
+ * 
+ * Following parameters can be used
+ * <li><strong>name</strong> - name of the theme. <strong>Required.</strong></li>
+ * <li><strong>package</strong> - base package of the theme. If not specified, <em>groupId</em> is used</li>
+ * 
+ * @goal add-theme
+ * @requiresProject true
+ * 
+ * @author Nick Belaevski
+ */
+public class CreateThemeMojo extends AbstractCreateMojo {
+
+	private static final String XCSS = ".xcss";
+
+	private static final String META_INF_THEMES = "META-INF/themes/";
+
+	private static final String XCSS_THEMES_PACKAGE = "/renderkit/html/css";
+
+	private static final String THEME_PROPERTIES = ".theme.properties";
+
+	private static final String RENDERKIT_THEMES = "renderkit.html";
+
+	/**
+	 * Name of base package of theme.
+	 * If it is not set, GroupId is used.
+	 * @parameter expression="${package}" default-value="${project.groupId}"
+	 */
+	private String packageName;
+	
+	
+	/**
+	 * Name of theme. Required parameter.
+	 * @parameter expression="${name}"
+	 * @required
+	 */
+	private String themeName;
+	
+	private String generateRendererName(String themeName) {
+		StringBuilder rendererTypeBuilder = new StringBuilder();
+		rendererTypeBuilder.append(Character.toUpperCase(themeName.charAt(0)));
+		rendererTypeBuilder.append(themeName.subSequence(1, themeName.length()));
+		rendererTypeBuilder.append("Renderer");
+		return rendererTypeBuilder.toString();
+	}
+	
+	private void generateTheme(String packageName, String themeName) throws MojoExecutionException, MojoFailureException {
+		Resource themeProperties = new Resource("theme/themes/theme.properties");
+		Resource themeXCSS = new Resource("theme/css/theme.xcss");
+		Resource themeConfig = new Resource("theme/component/theme.xml");
+		Resource themeTemplate = new Resource("theme/template/theme.jspx");
+		
+		File resourceDir = new File(project.getBasedir(), SRC_MAIN_RESOURCES);
+		
+		String packagePath = packageName.replace('.', '/');
+		String xcssPackagePath = packagePath + XCSS_THEMES_PACKAGE;
+		String rendererName = generateRendererName(themeName);
+		String rendererType = packageName + '.' + rendererName;
+		String rendererClassName = packageName + '.' + RENDERKIT_THEMES + '.' + rendererName;
+
+		getLog().debug("Relative path to package is " + packagePath);
+
+		VelocityContext velocityMasterContext = new VelocityContext();
+		velocityMasterContext.put("packagePath", packagePath);
+		velocityMasterContext.put("xcssPackagePath", xcssPackagePath);
+		velocityMasterContext.put("name", themeName);
+		velocityMasterContext.put("rendererType", rendererType);
+		velocityMasterContext.put("rendererClassName", rendererClassName);
+		
+		Resource properties = new Resource(META_INF_THEMES + themeName + THEME_PROPERTIES);
+		try {
+			filterJarResource(themeProperties, properties, resourceDir, velocityMasterContext);
+		} catch (Exception e) {
+			throw new MojoExecutionException("An exception occured while filtering resource " + themeProperties + " into " + properties, e);
+		}
+		
+		Resource xcss = new Resource(xcssPackagePath + '/' + themeName + XCSS);
+		try {
+			filterJarResource(themeXCSS, xcss, resourceDir, velocityMasterContext);
+		} catch (Exception e) {
+			throw new MojoExecutionException("An exception occured while filtering resource " + themeXCSS + " into " + xcss, e);
+		}
+		
+		File configDir = new File(project.getBasedir(), "src/main/config/component");
+		Resource config = new Resource(themeName + ".xml");
+		try {
+			filterJarResource(themeConfig, config, configDir, velocityMasterContext);
+		} catch (Exception e) {
+			throw new MojoExecutionException("An exception occured while filtering resource " + themeConfig + " into " + config, e);
+		}
+
+		File templateDir = new File(project.getBasedir(), "src/main/templates");
+		Resource template = new Resource(packagePath + '/' + themeName + ".jspx");
+		try {
+			filterJarResource(themeTemplate, template, templateDir, velocityMasterContext);
+		} catch (Exception e) {
+			throw new MojoExecutionException("An exception occured while filtering resource " + themeTemplate + " into " + template, e);
+		}
+	}
+
+	public void execute() throws MojoExecutionException, MojoFailureException {
+		getLog().info("Executing " + project);
+		getLog().info("Generating Theme " + themeName);
+
+		String themePackageName = packageName.replace('/', '.').toLowerCase(Locale.US);
+		String shortName = themeName;
+		getLog().debug("Root package " + packageName);
+		getLog().debug("Theme package is " + themePackageName);
+
+		if (!isValidJavaName(themeName)){
+			throw new MojoExecutionException("Invalid theme name '" + themeName + "'. Please type another name.");
+		}
+
+		if (!isValidPackageName(packageName)) {
+			throw new MojoExecutionException("Invalid theme package '" + packageName + "'. Please type another package.");
+		}
+		
+		generateTheme(themePackageName, shortName);
+		
+		getLog().info("Generating Theme successful");
+	}
+
+}

Added: trunk/cdk/maven-cdk-plugin/src/main/resources/theme/component/theme.xml
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/resources/theme/component/theme.xml	                        (rev 0)
+++ trunk/cdk/maven-cdk-plugin/src/main/resources/theme/component/theme.xml	2009-04-18 13:08:29 UTC (rev 13670)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN"  "http://labs.jboss.com/jbossrichfaces/component-config.dtd">
+
+<components>
+	<renderer generate="true" override="true">
+		<name>${rendererType}</name>
+		<family>org.richfaces.Page</family>
+		<template>${packagePath}/${name}.jspx</template>
+	</renderer>
+</components>
\ No newline at end of file

Added: trunk/cdk/maven-cdk-plugin/src/main/resources/theme/css/theme.xcss
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/resources/theme/css/theme.xcss	                        (rev 0)
+++ trunk/cdk/maven-cdk-plugin/src/main/resources/theme/css/theme.xcss	2009-04-18 13:08:29 UTC (rev 13670)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:template xmlns:f='http:/jsf.exadel.com/template'
+   xmlns:u='http:/jsf.exadel.com/template/util'
+   xmlns="http://www.w3.org/1999/xhtml">
+
+	<u:selector name=".rich-page">
+	</u:selector>
+
+	<u:selector name=".rich-page-header">
+	</u:selector>
+
+	<u:selector name=".rich-page-footer">
+	</u:selector>
+
+	<u:selector name=".rich-page-sidebar">
+	</u:selector>
+
+	<u:selector name=".rich-page-body">
+	</u:selector>
+
+	<f:verbatim>
+		<![CDATA[
+		.rich-page-sidebar {
+			float: left; 
+			margin-bottom: 15px; 
+			margin-right: 15px;
+		}	
+		]]>
+	</f:verbatim>
+</f:template>
\ No newline at end of file

Added: trunk/cdk/maven-cdk-plugin/src/main/resources/theme/template/theme.jspx
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/resources/theme/template/theme.jspx	                        (rev 0)
+++ trunk/cdk/maven-cdk-plugin/src/main/resources/theme/template/theme.jspx	2009-04-18 13:08:29 UTC (rev 13670)
@@ -0,0 +1,55 @@
+<?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"
+	xmlns:h="http://jsf.exadel.com/header"
+	xmlns:vcp="http://ajax4jsf.org/cdk/vcp" class="${rendererClassName}"
+	baseclass="org.richfaces.renderkit.AbstractPageRenderer"
+	component="org.richfaces.component.UIPage">
+
+	<c:set var="namespace" value="#{this:prolog(context,component)}" />
+	<html x:xmlns="#{namespace}" x:lang="#{context.viewRoot.locale}">
+		<head>
+			<title>#{component.attributes['pageTitle']}</title>
+			<f:call name="themeStyle" />
+			<f:call name="themeScript" />
+			<style type="text/css">
+				<jsp:scriptlet><![CDATA[
+				Integer width = (Integer) component.getAttributes().get("width");
+	
+				if (null != width && width.intValue() > 0) {
+					StringBuilder format = new StringBuilder(".rich-page{margin:auto;text-align:left;");
+					format.append("width:").append(width).append("px;");
+					writer.write(format.toString());
+				} else {
+					writer.write(".rich-page{width: 100%;}\n");
+				}]]></jsp:scriptlet>
+			</style>
+			
+			<u:insertFacet name="pageHeader" />
+	</head>
+	<body x:passThruWithExclusions="value,name,type,id" class="rich-page">
+	
+		<div class="rich-page-header">
+			<u:insertFacet name="header" />
+		</div>
+		
+		<div class="rich-page-sidebar">
+			<u:insertFacet name="sidebar" />
+		</div>
+		
+		<div>
+			<vcp:body>
+				<f:call name="renderChildren" />
+			</vcp:body>
+		</div>
+		
+		<div class="rich-page-footer">
+			<u:insertFacet name="footer" />
+		</div>
+
+	</body>
+	</html>
+</f:root>
\ No newline at end of file

Added: trunk/cdk/maven-cdk-plugin/src/main/resources/theme/themes/theme.properties
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/resources/theme/themes/theme.properties	                        (rev 0)
+++ trunk/cdk/maven-cdk-plugin/src/main/resources/theme/themes/theme.properties	2009-04-18 13:08:29 UTC (rev 13670)
@@ -0,0 +1,2 @@
+rendererType=${rendererType}
+styleSheet=resource\:///${xcssPackagePath}/${name}.xcss




More information about the richfaces-svn-commits mailing list