JBoss Rich Faces SVN: r14034 - trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2009-05-06 09:59:46 -0400 (Wed, 06 May 2009)
New Revision: 14034
Modified:
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
Log:
https://jira.jboss.org/jira/browse/RF-7029
Modified: trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
--- trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2009-05-06 12:46:12 UTC (rev 14033)
+++ trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2009-05-06 13:59:46 UTC (rev 14034)
@@ -523,16 +523,15 @@
return this.fileEntryWidth;
}
var w;
- if (this.element.getWidth() != 0) {
- w = this.element.getWidth() - 122;
- } else {
- w = this.element.style.width - 122;
- }
+ w = this.element.offsetWidth - 122;
+ if (w<0) w = 0;
this.fileEntryWidth = w;
var progressW = this._progressBar.style.width;
if (progressW == "") { progressW = 200; }
if (progressW > this.fileEntryWidth) {
- w = (w - 2) + "px";
+ w = (w - 2);
+ if (w<0) w=0;
+ w += "px";
this._progressBar.style.width = w;
var r = $(this._progressBar.id + ":remain");
if (r) {
15 years, 8 months
JBoss Rich Faces SVN: r14033 - in trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html: scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2009-05-06 08:46:12 -0400 (Wed, 06 May 2009)
New Revision: 14033
Modified:
trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss
trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
Log:
https://jira.jboss.org/jira/browse/RF-6968
Modified: trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss
===================================================================
--- trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss 2009-05-06 12:40:11 UTC (rev 14032)
+++ trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss 2009-05-06 12:46:12 UTC (rev 14033)
@@ -132,7 +132,6 @@
position: absolute;
height: 100%;
width: 100%;
- border : 1px solid;
z-index: -1;
top: 4px;
left: 4px;
@@ -171,7 +170,6 @@
<u:selector name=".dr-mpnl-shadow">
<u:style name="background-color" skin="shadowBackgroundColor" />
- <u:style name="border-color" skin="shadowBackgroundColor" />
</u:selector>
</f:template>
Modified: trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
===================================================================
--- trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2009-05-06 12:40:11 UTC (rev 14032)
+++ trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2009-05-06 12:46:12 UTC (rev 14033)
@@ -648,7 +648,6 @@
}
element.style.visibility = "hidden";
-
Element.show(element);
this.correctShadowSize();
@@ -1060,7 +1059,7 @@
Richfaces.showModalPanel = function (id, opts, event) {
var invoke =
- (RichFaces.MSIE == RichFaces.navigatorType()) ?
+ (Richfaces.browser.isIE || Richfaces.browser.isSafari) ?
function(f) {
if (document.readyState != "complete") {
var args = arguments;
15 years, 8 months
JBoss Rich Faces SVN: r14032 - trunk/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-05-06 08:40:11 -0400 (Wed, 06 May 2009)
New Revision: 14032
Modified:
trunk/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/ResourceDependencyMojo.java
Log:
Modified: trunk/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/ResourceDependencyMojo.java
===================================================================
--- trunk/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/ResourceDependencyMojo.java 2009-05-06 12:31:28 UTC (rev 14031)
+++ trunk/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/ResourceDependencyMojo.java 2009-05-06 12:40:11 UTC (rev 14032)
@@ -121,22 +121,11 @@
private File webSourceDirectory;
/**
- * outputScriptDirectory
- * @parameter expression="${project.build.directory}/generated-resources/script"
- */
- private File outputScriptDirectory ;
-
- /**
* scriptFilePath
* @parameter expression="custom-dependencies"
*/
private String scriptFilePath;
- /**
- * outputStyleDirectory
- * @parameter expression="${project.build.directory}/generated-resources/styles"
- */
- private File outputStyleDirectory;
/**
* outputResourceDirectory
15 years, 8 months
JBoss Rich Faces SVN: r14031 - trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2009-05-06 08:31:28 -0400 (Wed, 06 May 2009)
New Revision: 14031
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/modifiableModel.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-7015
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/modifiableModel.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/modifiableModel.xhtml 2009-05-06 12:18:15 UTC (rev 14030)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/modifiableModel.xhtml 2009-05-06 12:31:28 UTC (rev 14031)
@@ -17,6 +17,9 @@
method is called with lists of sort and filter fields as parameters and should perform sorting and
filtering according to the fields.
</p>
+ <p><b>Note</b> that
+ filtering in this sample uses <i>contains</i> instead of <i>startsWith</i> conditions.
+ </p>
<div class="sample-container" >
<ui:include src="/richfaces/dataTable/examples/modifiableModel.xhtml"/>
@@ -30,7 +33,7 @@
<ui:param name="openlabel" value="View HibernateDataModel.java Source" />
<ui:param name="sourcetype" value="java" />
</ui:include>
- </div>
+ </div>
</ui:define>
</ui:composition>
</html>
\ No newline at end of file
15 years, 8 months
JBoss Rich Faces SVN: r14030 - in trunk/samples/richfaces-demo/src/main: webapp/images and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2009-05-06 08:18:15 -0400 (Wed, 06 May 2009)
New Revision: 14030
Added:
trunk/samples/richfaces-demo/src/main/webapp/images/cn_ColorPicker.gif
trunk/samples/richfaces-demo/src/main/webapp/images/cn_SemanticLayoutComponents.gif
trunk/samples/richfaces-demo/src/main/webapp/images/ico_ColorPicker.gif
trunk/samples/richfaces-demo/src/main/webapp/images/ico_SemanticLayoutComponents.gif
Modified:
trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
Log:
https://jira.jboss.org/jira/browse/RF-7001
Modified: trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
===================================================================
--- trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties 2009-05-06 11:43:54 UTC (rev 14029)
+++ trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties 2009-05-06 12:18:15 UTC (rev 14030)
@@ -92,4 +92,4 @@
editor=richInputs, Editor, /images/ico_Editor.gif, /images/cn_Editor.gif, editor.html, jbossrichfaces/freezone/docs/tlddoc/rich/editor.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIEditor.html, /richfaces/editor.jsf
queue=ajaxSupport, Queue, /images/ico_common.gif, /images/cn_Queue.gif, Queue.html, jbossrichfaces/freezone/docs/tlddoc/rich/queue.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIQueue.html, /richfaces/queue.jsf
colorPicker= richInputs, Color Picker, /images/ico_ColorPicker.gif, /images/cn_ColorPicker.gif, ColorPicker.html, jbossrichfaces/freezone/docs/tlddoc/rich/colorPicker.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIColorPicker.html, /richfaces/colorPicker.jsf, new
-layouts=richMisc, Semantic Layouts, /images/ico_Layouts.gif, /images/cn_Layouts.gif, Layouts.html, jbossrichfaces/freezone/docs/tlddoc/rich/Page.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIPage.html, /richfaces/layouts.jsf, new
\ No newline at end of file
+layouts=richMisc, Semantic Layouts, /images/ico_SemanticLayoutComponents.gif, /images/cn_SemanticLayoutComponents.gif, Layouts.html, jbossrichfaces/freezone/docs/tlddoc/rich/Page.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIPage.html, /richfaces/layouts.jsf, new
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/images/cn_ColorPicker.gif
===================================================================
(Binary files differ)
Property changes on: trunk/samples/richfaces-demo/src/main/webapp/images/cn_ColorPicker.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/richfaces-demo/src/main/webapp/images/cn_SemanticLayoutComponents.gif
===================================================================
(Binary files differ)
Property changes on: trunk/samples/richfaces-demo/src/main/webapp/images/cn_SemanticLayoutComponents.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/richfaces-demo/src/main/webapp/images/ico_ColorPicker.gif
===================================================================
(Binary files differ)
Property changes on: trunk/samples/richfaces-demo/src/main/webapp/images/ico_ColorPicker.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/richfaces-demo/src/main/webapp/images/ico_SemanticLayoutComponents.gif
===================================================================
(Binary files differ)
Property changes on: trunk/samples/richfaces-demo/src/main/webapp/images/ico_SemanticLayoutComponents.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 8 months
JBoss Rich Faces SVN: r14029 - trunk/sandbox/samples/maven-rd-plugin-sample.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-05-06 07:43:54 -0400 (Wed, 06 May 2009)
New Revision: 14029
Modified:
trunk/sandbox/samples/maven-rd-plugin-sample/pom.xml
Log:
Modified: trunk/sandbox/samples/maven-rd-plugin-sample/pom.xml
===================================================================
--- trunk/sandbox/samples/maven-rd-plugin-sample/pom.xml 2009-05-06 11:43:25 UTC (rev 14028)
+++ trunk/sandbox/samples/maven-rd-plugin-sample/pom.xml 2009-05-06 11:43:54 UTC (rev 14029)
@@ -10,6 +10,15 @@
<packaging>war</packaging>
<name>maven-rd-plugin-sample Maven Webapp</name>
<version>3.3.1-SNAPSHOT</version>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>jboss central</id>
+ <name>Maven Plugin Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
<build>
<finalName>maven-rd-plugin-sample</finalName>
<plugins>
@@ -20,45 +29,23 @@
<target>1.5</target>
</configuration>
</plugin>
+
<plugin>
<artifactId>maven-resource-dependency-plugin</artifactId>
<groupId>org.richfaces.cdk</groupId>
<version>3.3.1-SNAPSHOT</version>
<configuration>
- <webSourceDirectory>${basedir}/src/main/webapp</webSourceDirectory>
-
- <beforeScriptIncludes>
- <beforeScriptInclude>foo/scripts/before.js</beforeScriptInclude>
- <beforeScriptInclude>scripts/test/test.js</beforeScriptInclude>
- </beforeScriptIncludes>
-
- <afterScriptIncludes>
- <afterScriptInclude>foo/scripts/after.js</afterScriptInclude>
- </afterScriptIncludes>
-
- <beforeStyleIncludes>
- <beforeStyleInclude>foo/styles/before.xcss</beforeStyleInclude>
- <beforeStyleInclude>foo/styles/before.css</beforeStyleInclude>
- </beforeStyleIncludes>
-
- <afterStyleIncludes>
- <afterStyleInclude>foo/styles/after.xcss</afterStyleInclude>
- <afterStyleInclude>foo/styles/after.css</afterStyleInclude>
- </afterStyleIncludes>
-
- <namespaceExcludes>
- <namespaceExclude>http://richfaces.org/a4j</namespaceExclude>
- </namespaceExcludes>
-
- </configuration>
+ <scriptFilePath>styles/all.js</scriptFilePath>
+ <styleFilePath>scripts/all.xcss</styleFilePath>
+ </configuration>
<executions>
<execution>
- <phase>process-resources</phase>
+ <phase>generate-resources</phase>
<goals>
<goal>assembly-resources</goal>
</goals>
</execution>
- </executions>
+ </executions>
</plugin>
</plugins>
</build>
15 years, 8 months
JBoss Rich Faces SVN: r14028 - trunk/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-05-06 07:43:25 -0400 (Wed, 06 May 2009)
New Revision: 14028
Modified:
trunk/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/ResourceDependencyMojo.java
Log:
fix generated resource output
Modified: trunk/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/ResourceDependencyMojo.java
===================================================================
--- trunk/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/ResourceDependencyMojo.java 2009-05-06 08:43:34 UTC (rev 14027)
+++ trunk/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/ResourceDependencyMojo.java 2009-05-06 11:43:25 UTC (rev 14028)
@@ -22,7 +22,6 @@
import java.io.File;
import java.net.MalformedURLException;
-import java.net.URI;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
@@ -69,8 +68,8 @@
/**
* @author Anton Belevich
* @goal assembly-resources
- * @phase process-resources
-
+ * @phase generate-resources
+ *
*/
public class ResourceDependencyMojo extends AbstractMojo {
@@ -122,28 +121,34 @@
private File webSourceDirectory;
/**
- * outputScriptDirectory
- * @parameter expression = "${basedir}/src/main/webapp/WEB-INF/classes"
+ * outputScriptDirectory
+ * @parameter expression="${project.build.directory}/generated-resources/script"
*/
private File outputScriptDirectory ;
/**
- * scriptFileName
+ * scriptFilePath
* @parameter expression="custom-dependencies"
*/
- private String scriptFileName;
+ private String scriptFilePath;
/**
* outputStyleDirectory
- * @parameter expression = "${basedir}/src/main/webapp/WEB-INF/classes"
+ * @parameter expression="${project.build.directory}/generated-resources/styles"
*/
private File outputStyleDirectory;
/**
- * styleFileName
+ * outputResourceDirectory
+ * @parameter expression="${project.build.directory}/generated-resources
+ *
+ */
+ private File outputResourceDirectory;
+ /**
+ * styleFilePath
* @parameter expression="custom-dependencies"
*/
- private String styleFileName;
+ private String styleFilePath;
/**
* beforeScriptIncludes
@@ -269,43 +274,45 @@
Set <String> scripts = handler.getScripts();
- File scriptFile = new File(outputScriptDirectory, scriptFileName + ".js");
-
+ scriptFilePath = scriptFilePath.endsWith(".js") ? scriptFilePath : scriptFilePath + ".js";
+ File scriptFile = new File(outputResourceDirectory, scriptFilePath);
+ if(!scriptFile.exists()) {
+ scriptFile.mkdirs();
+ }
+
+ ScriptAssembler scriptAssembler = new ScriptAssembler();
+
+ getLog().info("Start merge scripts to the: " + scriptFile.getPath());
+
if(!scripts.isEmpty()) {
-
- if(!outputScriptDirectory.exists()) {
- outputScriptDirectory.mkdirs();
- }
-
- ScriptAssembler scriptAssembler = new ScriptAssembler();
- mergeResources(scriptFile, scriptAssembler, beforeScriptIncludes, afterScriptIncludes, scripts);
-
- } else if(scriptFile.exists()) {
- scriptFile.delete();
- }
-
+ mergeResources(scriptFile,scriptAssembler, beforeScriptIncludes, afterScriptIncludes, scripts);
+ }
+
Set <String> styles = handler.getStyles();
- File styleFile = new File(outputStyleDirectory, styleFileName + ".xcss");
+ styleFilePath = styleFilePath.endsWith(".xcss") ? styleFilePath : styleFilePath + ".xcss";
+ File styleFile = new File(outputResourceDirectory, styleFilePath);
+ if(!styleFile.exists()) {
+ styleFile.mkdirs();
+ }
+ StyleAssembler styleAssembler = new StyleAssembler();
+ styleAssembler.setVelocityComponent(velocity);
+ getLog().info("Start merge styles to the: " + styleFile.getPath());
+
if(!styles.isEmpty()) {
-
- if(!outputStyleDirectory.exists()) {
- outputStyleDirectory.mkdirs();
- }
-
- StyleAssembler styleAssembler = new StyleAssembler();
- styleAssembler.setVelocityComponent(velocity);
- mergeResources(styleFile, styleAssembler, beforeStyleIncludes, afterStyleIncludes, styles);
-
- } else if(styleFile.exists()) {
- styleFile.delete();
- }
+ mergeResources(styleFile,styleAssembler, beforeStyleIncludes, afterStyleIncludes, styles);
+ }
+
+ Resource resource = new Resource();
+ resource.setDirectory(outputResourceDirectory.getPath());
+ project.addResource(resource);
}
Thread.currentThread().setContextClassLoader(oldClassLoader);
} catch (Exception e) {
+ getLog().error("Error generate resource", e);
throw new MojoExecutionException(e.getMessage(),e);
}
@@ -406,7 +413,7 @@
try {
FileSystemManager manager = VFS.getManager();
- jarFileObjects = manager.resolveFile("jar:" + file.getAbsolutePath());
+ jarFileObjects = manager.resolveFile("jar:///" + file.getAbsolutePath());
} catch (FileSystemException e) {
getLog().error("Error during processing file: " + file.getAbsolutePath()+ "\n" + e.getMessage(), e);
}
15 years, 8 months
JBoss Rich Faces SVN: r14027 - trunk/examples/photoalbum/source/web/src/main/webapp/img/shell.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-05-06 04:43:34 -0400 (Wed, 06 May 2009)
New Revision: 14027
Added:
trunk/examples/photoalbum/source/web/src/main/webapp/img/shell/icon_add_album_disabled.jpg
trunk/examples/photoalbum/source/web/src/main/webapp/img/shell/icon_add_photo_disabled.jpg
Log:
Added: trunk/examples/photoalbum/source/web/src/main/webapp/img/shell/icon_add_album_disabled.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/examples/photoalbum/source/web/src/main/webapp/img/shell/icon_add_album_disabled.jpg
___________________________________________________________________
Name: svn:mime-type
+ image/jpeg
Added: trunk/examples/photoalbum/source/web/src/main/webapp/img/shell/icon_add_photo_disabled.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/examples/photoalbum/source/web/src/main/webapp/img/shell/icon_add_photo_disabled.jpg
___________________________________________________________________
Name: svn:mime-type
+ image/jpeg
15 years, 8 months
JBoss Rich Faces SVN: r14026 - trunk/framework/impl/src/main/java/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-05-06 04:19:57 -0400 (Wed, 06 May 2009)
New Revision: 14026
Modified:
trunk/framework/impl/src/main/java/org/richfaces/VersionBean.java
Log:
change SVN revision and date
Modified: trunk/framework/impl/src/main/java/org/richfaces/VersionBean.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/VersionBean.java 2009-05-05 22:28:33 UTC (rev 14025)
+++ trunk/framework/impl/src/main/java/org/richfaces/VersionBean.java 2009-05-06 08:19:57 UTC (rev 14026)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.richfaces;
+package org.richfaces;
/**
* Vendor and version information for A4J project
15 years, 8 months
JBoss Rich Faces SVN: r14025 - in trunk: samples/layout-sample/src/main/webapp/pages and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-05-05 18:28:33 -0400 (Tue, 05 May 2009)
New Revision: 14025
Added:
trunk/ui/layout/src/main/java/org/richfaces/component/LayoutStructure.java
trunk/ui/layout/src/main/java/org/richfaces/renderkit/html/LayoutPanelRenderer.java
trunk/ui/layout/src/main/java/org/richfaces/renderkit/html/LayoutRenderer.java
trunk/ui/layout/src/test/java/org/richfaces/component/
trunk/ui/layout/src/test/java/org/richfaces/component/LayoutStructureTest.java
Removed:
trunk/ui/layout/src/main/java/org/richfaces/renderkit/AbstractLayoutPanelRenderer.java
trunk/ui/layout/src/main/java/org/richfaces/renderkit/AbstractLayoutRenderer.java
trunk/ui/layout/src/main/templates/org/richfaces/htmlLayout.jspx
trunk/ui/layout/src/main/templates/org/richfaces/htmlLayoutPanel.jspx
Modified:
trunk/samples/layout-sample/src/main/java/org/richfaces/samples/LayoutBean.java
trunk/samples/layout-sample/src/main/webapp/pages/index.xhtml
trunk/samples/themes/src/main/templates/org/richfaces/oldschool.jspx
trunk/samples/themes/src/main/templates/org/richfaces/smooth.jspx
trunk/ui/layout/src/main/config/component/layout.xml
trunk/ui/layout/src/main/config/component/layoutPanel.xml
trunk/ui/layout/src/main/java/org/richfaces/component/UILayoutPanel.java
trunk/ui/layout/src/main/resources/org/richfaces/renderkit/html/css/simple.xcss
Log:
https://jira.jboss.org/jira/browse/RF-6602
https://jira.jboss.org/jira/browse/RF-6629
https://jira.jboss.org/jira/browse/RF-6713
https://jira.jboss.org/jira/browse/RF-6641
Modified: trunk/samples/layout-sample/src/main/java/org/richfaces/samples/LayoutBean.java
===================================================================
--- trunk/samples/layout-sample/src/main/java/org/richfaces/samples/LayoutBean.java 2009-05-05 17:33:02 UTC (rev 14024)
+++ trunk/samples/layout-sample/src/main/java/org/richfaces/samples/LayoutBean.java 2009-05-05 22:28:33 UTC (rev 14025)
@@ -22,7 +22,7 @@
private boolean rendered = true;
- private float width;
+ private String width;
/**
* @return the rendered
@@ -41,14 +41,14 @@
/**
* @return the width
*/
- public float getWidth() {
+ public String getWidth() {
return width;
}
/**
* @param width the width to set
*/
- public void setWidth(float width) {
+ public void setWidth(String width) {
this.width = width;
}
Modified: trunk/samples/layout-sample/src/main/webapp/pages/index.xhtml
===================================================================
(Binary files differ)
Modified: trunk/samples/themes/src/main/templates/org/richfaces/oldschool.jspx
===================================================================
--- trunk/samples/themes/src/main/templates/org/richfaces/oldschool.jspx 2009-05-05 17:33:02 UTC (rev 14024)
+++ trunk/samples/themes/src/main/templates/org/richfaces/oldschool.jspx 2009-05-05 22:28:33 UTC (rev 14025)
@@ -15,7 +15,6 @@
<c:set var="namespace" value="#{this:prolog(context,component)}"/>
<html x:xmlns="#{namespace}" x:lang="#{context.viewRoot.locale}">
<head>
-<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>#{component.attributes['pageTitle']}</title>
<f:call name="themeStyle"/>
<f:call name="themeScript"/>
@@ -36,10 +35,11 @@
</head>
<body x:passThruWithExclusions="value,name,type,id">
- <table border="0" cellpadding="0" cellspacing="0" class="rich-page">
+ <table border="0" cellpadding="0" cellspacing="0" class="rich-page #{component.attributes['pageClass']}">
+ <tbody>
<tr>
<td class="header_bg">
- <div class="header_content">
+ <div class="header_content rich-page-header #{component.attributes['headerClass']}">
<!-- begin header -->
<u:insertFacet name="header"/>
<!-- end header -->
@@ -48,15 +48,16 @@
</tr>
<tr>
<td width="100%" height="100%" class="bg_tabbody">
- <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%" class="rich-page-content #{component.attributes['contentClass']}">
+ <tbody>
<tr>
- <td class="menu_col">
+ <td class="menu_col rich-page-sidebar #{component.attributes['sidebarClass']}">
<div class="menu_width spacer" style="width:#{component.attributes['sidebarWidth']}px"></div>
<!-- begin menu -->
<u:insertFacet name="sidebar"/>
<!-- end meny -->
</td>
- <td class="content_col">
+ <td class="content_col rich-page-body #{component.attributes['bodyClass']}">
<!-- begin content -->
<vcp:body>
<f:call name="renderChildren" />
@@ -64,18 +65,20 @@
<!-- end content -->
</td>
</tr>
+ </tbody>
</table>
</td>
</tr>
<tr>
<td class="footer_bg">
- <div class="footer_bg_content">
+ <div class="footer_bg_content rich-page-footer #{component.attributes['footerClass']}">
<!-- begin footer -->
<u:insertFacet name="footer"/>
<!-- end footer -->
</div>
</td>
</tr>
+ </tbody>
</table>
</body>
</html>
Modified: trunk/samples/themes/src/main/templates/org/richfaces/smooth.jspx
===================================================================
--- trunk/samples/themes/src/main/templates/org/richfaces/smooth.jspx 2009-05-05 17:33:02 UTC (rev 14024)
+++ trunk/samples/themes/src/main/templates/org/richfaces/smooth.jspx 2009-05-05 22:28:33 UTC (rev 14025)
@@ -35,21 +35,24 @@
</head>
<body x:passThruWithExclusions="value,name,type,id">
-<table class="rich-page" border="0" cellpadding="0" cellspacing="0">
+<table class="rich-page #{component.attributes['pageClass']}" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" class="common_box">
<table height="100%" cellpadding="0" cellspacing="0" class="page_size">
+ <thead>
<tr>
- <td colspan="3" class="header_bg_left">
+ <th colspan="3" class="header_bg_left">
<div class="header_bg_right">
<!-- div class="spacer" style="height : 15px"></div -->
- <div class="header_content">
+ <div class="header_content rich-page-header #{component.attributes['headerClass']}">
<u:insertFacet name="header"/>
</div>
</div>
- </td>
+ </th>
</tr>
+ </thead>
+ <tbody>
<tr>
<td class="left_col">
<div class="left_strut">
@@ -57,18 +60,20 @@
</div>
</td>
<td width="100%" height="100%" class="bg_tabbody">
- <table class="content_body" cellpadding="0" cellspacing="0" width="100%" height="100%">
+ <table class="content_body rich-page-content #{component.attributes['contentClass']}" cellpadding="0" cellspacing="0" width="100%" height="100%">
+ <tbody>
<tr>
- <td class="menu_col">
+ <td class="menu_col rich-page-sidebar #{component.attributes['sidebarClass']}">
<div class="spacer" style="width:#{component.attributes['sidebarWidth']}px"></div>
<u:insertFacet name="sidebar"/>
</td>
- <td class="content_col">
+ <td class="content_col rich-page-body #{component.attributes['bodyClass']}">
<vcp:body>
<f:call name="renderChildren" />
</vcp:body>
</td>
</tr>
+ </tbody>
</table>
</td>
<td class="right_col">
@@ -80,13 +85,14 @@
<tr>
<td colspan="3" class="footer_bg_left">
<div class="footer_bg_right">
- <div class="footer_bg_content">
+ <div class="footer_bg_content rich-page-footer #{component.attributes['footerClass']}">
<u:insertFacet name="footer"/>
</div>
</div>
</td>
</tr>
+ </tbody>
</table>
</td>
Modified: trunk/ui/layout/src/main/config/component/layout.xml
===================================================================
--- trunk/ui/layout/src/main/config/component/layout.xml 2009-05-05 17:33:02 UTC (rev 14024)
+++ trunk/ui/layout/src/main/config/component/layout.xml 2009-05-05 22:28:33 UTC (rev 14025)
@@ -11,9 +11,9 @@
<![CDATA[
]]>
</description>
- <renderer generate="true" override="true">
+ <renderer generate="false" override="true">
<name>org.richfaces.LayoutRenderer</name>
- <template>org/richfaces/htmlLayout.jspx</template>
+ <classname>org.richfaces.renderkit.html.LayoutRenderer</classname>
</renderer>
<tag>
<name>layout</name>
Modified: trunk/ui/layout/src/main/config/component/layoutPanel.xml
===================================================================
--- trunk/ui/layout/src/main/config/component/layoutPanel.xml 2009-05-05 17:33:02 UTC (rev 14024)
+++ trunk/ui/layout/src/main/config/component/layoutPanel.xml 2009-05-05 22:28:33 UTC (rev 14025)
@@ -11,9 +11,9 @@
<![CDATA[
]]>
</description>
- <renderer generate="true" override="true">
+ <renderer generate="false" override="true">
<name>org.richfaces.LayoutPanelRenderer</name>
- <template>org/richfaces/htmlLayoutPanel.jspx</template>
+ <classname>org.richfaces.renderkit.html.LayoutPanelRenderer</classname>
</renderer>
<tag>
<name>layoutPanel</name>
@@ -38,7 +38,7 @@
<property>
<name>width</name>
- <classname>float</classname>
+ <classname>java.lang.String</classname>
<description>Sets the width of the layout area
</description>
</property>
Added: trunk/ui/layout/src/main/java/org/richfaces/component/LayoutStructure.java
===================================================================
--- trunk/ui/layout/src/main/java/org/richfaces/component/LayoutStructure.java (rev 0)
+++ trunk/ui/layout/src/main/java/org/richfaces/component/LayoutStructure.java 2009-05-05 22:28:33 UTC (rev 14025)
@@ -0,0 +1,291 @@
+/**
+ *
+ */
+package org.richfaces.component;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class LayoutStructure implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5700775901583881224L;
+
+ private UILayoutPanel top = null;
+ private UILayoutPanel bottom = null;
+ private UILayoutPanel left = null;
+ private UILayoutPanel right = null;
+ private UILayoutPanel center = null;
+ private int deep = 0;
+ private List<Column> columns;
+
+ public LayoutStructure(UILayout layout) {
+ sortPanels(layout);
+ }
+
+ public LayoutStructure(UILayoutPanel panel){
+ UIComponent parent = panel.getParent();
+ if (parent instanceof UILayout) {
+ UILayout layout = (UILayout) parent;
+ sortPanels(layout);
+ } else {
+ throw new FacesException("Layout panel should be children of UILayout pomponent");
+ }
+ }
+
+ /**
+ * @param layout
+ * @throws FacesException
+ */
+ public void sortPanels(UILayout layout) throws FacesException {
+ this.deep = layoutDeep(layout);
+ for (UIComponent child : layout.getChildren()) {
+ if (child instanceof UILayoutPanel && child.isRendered()) {
+ UILayoutPanel layoutPanel = (UILayoutPanel) child;
+ LayoutPosition position = layoutPanel.getPosition();
+ if (LayoutPosition.top.equals(position)) {
+ if (null != top) {
+ throw new FacesException(
+ "Duplicate layoutPanel's with same position"
+ + position);
+ }
+ top = layoutPanel;
+ } else if (LayoutPosition.bottom.equals(position)) {
+ if (null != bottom) {
+ throw new FacesException(
+ "Duplicate layoutPanel's with same position"
+ + position);
+ }
+ bottom = layoutPanel;
+ } else if (LayoutPosition.left.equals(position)) {
+ if (null != left) {
+ throw new FacesException(
+ "Duplicate layoutPanel's with same position"
+ + position);
+ }
+ left = layoutPanel;
+ } else if (LayoutPosition.right.equals(position)) {
+ if (null != right) {
+ throw new FacesException(
+ "Duplicate layoutPanel's with same position"
+ + position);
+ }
+ right = layoutPanel;
+ } else if (null == position
+ || LayoutPosition.center.equals(position)) {
+ if (null != center) {
+ throw new FacesException(
+ "Duplicate layoutPanel's with same position"
+ + position);
+ }
+ center = layoutPanel;
+ } else {
+
+ }
+ }
+
+ }
+ // Reorganise central row.
+ if(null == left && null != center){
+ left = center;
+ center = null;
+ }
+ if(null == left && null != right){
+ left = right;
+ right = null;
+ }
+ if(null == center && null != right){
+ center = right;
+ right = null;
+ }
+ this.columns = new ArrayList<Column>(3);
+ if(null != left){
+ columns.add(new Column(left));
+ }
+ if(null != center){
+ columns.add(new Column(center));
+ }
+ if(null != right){
+ columns.add(new Column(right));
+ }
+ }
+
+ /**
+ * @throws NumberFormatException
+ */
+ public void calculateWidth() throws NumberFormatException {
+ // calculate widths.
+ if(getColumns()>0){
+ float totalPercent = 0.0f;
+ int numOfPercentColumns = 0;
+ float totalPart = 0.0f;
+ int numOfPartColumns = 0;
+ // Collect width information.
+ for (Column column : columns) {
+ String width = column.panel.getWidth();
+ if(null == width || 0 ==width.length()){
+ column.partWidth = 1.0f;
+ totalPart += column.partWidth;
+ numOfPartColumns++;
+ } else if(width.startsWith("*")){
+ column.partWidth = Float.parseFloat(width.substring(1));
+ totalPart += column.partWidth;
+ numOfPartColumns++;
+ } else if(width.endsWith("%")) {
+ column.percentWidth = Float.parseFloat(width.substring(0,width.length()-1));
+ totalPercent += column.percentWidth;
+ numOfPercentColumns++;
+ }
+ }
+ float partToPercent=0.0f;
+ float percentCoefficient = 1.0f;
+ if(numOfPartColumns>0 && numOfPercentColumns >0){
+ float rest = 100.00f - totalPercent;
+ partToPercent = rest/totalPart;
+ } else if(numOfPartColumns>0){
+ partToPercent = 100.00f/totalPart;
+ } else if(numOfPercentColumns == columns.size()){
+ percentCoefficient = 100.00f/totalPercent;
+ }
+ // TODO - calculate precisious coefficient.
+ percentCoefficient*=0.98f;
+ // Recalculate width.
+ for (Column column : columns) {
+ if(column.partWidth>0.0f){
+ column.percentWidth = column.partWidth*partToPercent;
+ }
+ column.percentWidth = column.percentWidth*percentCoefficient;
+ }
+ }
+ }
+
+ /**
+ * @return the top
+ */
+ public UILayoutPanel getTop() {
+ return top;
+ }
+
+ /**
+ * @return the bottom
+ */
+ public UILayoutPanel getBottom() {
+ return bottom;
+ }
+
+ /**
+ * @return the left
+ */
+ public UILayoutPanel getLeft() {
+ return left;
+ }
+
+ /**
+ * @return the right
+ */
+ public UILayoutPanel getRight() {
+ return right;
+ }
+
+ /**
+ * @return the center
+ */
+ public UILayoutPanel getCenter() {
+ return center;
+ }
+
+ /**
+ * @return the columns
+ */
+ public int getColumns() {
+ return columns.size();
+ }
+
+ /**
+ */
+ public String getWidth(UILayoutPanel panel){
+ return getWidth(panel,1.0f);
+ }
+
+ /**
+ * @param panel
+ * @param coeeficient
+ * @return
+ */
+ public String getWidth(UILayoutPanel panel, float coeeficient){
+ if(this.top == panel || this.bottom == panel){
+ return panel.getWidth();
+ } else {
+ for (Column column : columns) {
+ if(column.panel == panel){
+ if(column.percentWidth>0){
+ return String.format((Locale)null, "%2.2f%%", column.percentWidth*coeeficient);
+ } else {
+ return panel.getWidth();
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Calculate deep of layout components.
+ * @param component
+ * @return
+ */
+ protected int layoutDeep(UIComponent component) {
+ int deep = 0;
+ if(null != component){
+ deep = layoutDeep(component.getParent());
+ if(component instanceof UILayout){
+ deep++;
+ }
+ }
+ return deep;
+ }
+
+
+ static class Column {
+ private final UILayoutPanel panel;
+ private float percentWidth = 0.0f;
+ private float partWidth = 0.0f;
+
+ public Column(UILayoutPanel panel) {
+ this.panel = panel;
+ }
+
+ public String getWidth(){
+ if(percentWidth>0.0f){
+ return String.format((Locale)null, "%2.2f%%", percentWidth);
+ } else {
+ return panel.getWidth();
+ }
+ }
+
+ /**
+ * @return the percentWidth
+ */
+ public float getPercentWidth() {
+ return percentWidth;
+ }
+ }
+
+
+ /**
+ * @return the deep
+ */
+ public int getDeep() {
+ return deep;
+ }
+}
Property changes on: trunk/ui/layout/src/main/java/org/richfaces/component/LayoutStructure.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/ui/layout/src/main/java/org/richfaces/component/UILayoutPanel.java
===================================================================
--- trunk/ui/layout/src/main/java/org/richfaces/component/UILayoutPanel.java 2009-05-05 17:33:02 UTC (rev 14024)
+++ trunk/ui/layout/src/main/java/org/richfaces/component/UILayoutPanel.java 2009-05-05 22:28:33 UTC (rev 14025)
@@ -33,13 +33,13 @@
* Get Panel width.
* @return
*/
- public abstract float getWidth();
+ public abstract String getWidth();
/**
* Set Panel width.
* @param newvalue
*/
- public abstract void setWidth(float newvalue);
+ public abstract void setWidth(String newvalue);
}
Deleted: trunk/ui/layout/src/main/java/org/richfaces/renderkit/AbstractLayoutPanelRenderer.java
===================================================================
--- trunk/ui/layout/src/main/java/org/richfaces/renderkit/AbstractLayoutPanelRenderer.java 2009-05-05 17:33:02 UTC (rev 14024)
+++ trunk/ui/layout/src/main/java/org/richfaces/renderkit/AbstractLayoutPanelRenderer.java 2009-05-05 22:28:33 UTC (rev 14025)
@@ -1,66 +0,0 @@
-/**
- *
- */
-package org.richfaces.renderkit;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.LayoutPosition;
-import org.richfaces.component.UILayout;
-import org.richfaces.component.UILayoutPanel;
-
-/**
- * @author asmirnov
- *
- */
-public abstract class AbstractLayoutPanelRenderer extends
- HeaderResourcesRendererBase {
-
- public String layoutStyle(FacesContext context, UILayoutPanel panel) {
- StringBuilder style = new StringBuilder();
- LayoutPosition position = panel.getPosition();
- Object componentStyle = panel.getAttributes().get(HTML.style_ATTRIBUTE);
- if(null != componentStyle){
- style.append(componentStyle).append(";");
- }
- if(!LayoutPosition.top.equals(position)&&!LayoutPosition.bottom.equals(position)){
- if(LayoutPosition.right.equals(position)){
- style.append("float:right;");
- } else {
- style.append("float:left;");
- }
- // find siblings.
- // get layout depth.
- int deep = layoutDeep(panel);
- // calculate real width.
- float width = panel.getWidth();
- if(width>=0.0f){
- style.append("width:").append(width).append("%;");
- width = width/(1.0f+(float)deep);
- style.append("*width:").append(width).append("%;");
- }
- } else {
- // top and buttom style.
- }
- return style.length()>0?style.toString():null;
- }
-
- /**
- * Calculate deep of layout components.
- * @param component
- * @return
- */
- private int layoutDeep(UIComponent component) {
- int deep = 0;
- if(null != component){
- deep = layoutDeep(component.getParent());
- if(component instanceof UILayout){
- deep++;
- }
- }
- return deep;
- }
-}
Deleted: trunk/ui/layout/src/main/java/org/richfaces/renderkit/AbstractLayoutRenderer.java
===================================================================
--- trunk/ui/layout/src/main/java/org/richfaces/renderkit/AbstractLayoutRenderer.java 2009-05-05 17:33:02 UTC (rev 14024)
+++ trunk/ui/layout/src/main/java/org/richfaces/renderkit/AbstractLayoutRenderer.java 2009-05-05 22:28:33 UTC (rev 14025)
@@ -1,109 +0,0 @@
-/**
- *
- */
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import java.util.Map;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.LayoutPosition;
-import org.richfaces.component.UILayout;
-import org.richfaces.component.UILayoutPanel;
-
-/**
- * @author asmirnov
- *
- */
-public abstract class AbstractLayoutRenderer extends
- HeaderResourcesRendererBase {
-
- public void renderLayout(FacesContext context, UILayout layout)
- throws IOException {
- // Detect layout content;
- UILayoutPanel top = null;
- UILayoutPanel bottom = null;
- UILayoutPanel left = null;
- UILayoutPanel right = null;
- UILayoutPanel center = null;
- int columns = 0;
- for (UIComponent child : layout.getChildren()) {
- if (child instanceof UILayoutPanel && child.isRendered()) {
- UILayoutPanel layoutPanel = (UILayoutPanel) child;
- LayoutPosition position = layoutPanel.getPosition();
- if (LayoutPosition.top.equals(position)) {
- if (null != top) {
- throw new FacesException(
- "Duplicate layoutPanel's with same position"
- + position);
- }
- top = layoutPanel;
- } else if (LayoutPosition.bottom.equals(position)) {
- if (null != bottom) {
- throw new FacesException(
- "Duplicate layoutPanel's with same position"
- + position);
- }
- bottom = layoutPanel;
- } else if (LayoutPosition.left.equals(position)) {
- if (null != left) {
- throw new FacesException(
- "Duplicate layoutPanel's with same position"
- + position);
- }
- left = layoutPanel;
- columns++;
- } else if (LayoutPosition.right.equals(position)) {
- if (null != right) {
- throw new FacesException(
- "Duplicate layoutPanel's with same position"
- + position);
- }
- right = layoutPanel;
- columns++;
- } else if (null == position
- || LayoutPosition.center.equals(position)) {
- if (null != center) {
- throw new FacesException(
- "Duplicate layoutPanel's with same position"
- + position);
- }
- center = layoutPanel;
- columns++;
- } else {
-
- }
- }
- }
- ResponseWriter writer = context.getResponseWriter();
- if (null != top) {
- top.encodeAll(context);
- }
- if (columns > 0) {
- // Reorder panels to fill ordeg left->center->right.
- if (null != left) {
- left.encodeAll(context);
- }
- if (null != center) {
- center.encodeAll(context);
- }
- if (null != right) {
- right.encodeAll(context);
- }
- }
- // line separator.
- writer.startElement(HTML.DIV_ELEM, layout);
- writer.writeAttribute(HTML.style_ATTRIBUTE, "display: block; height: 0; clear: both; visibility: hidden;", null);
- writer.writeText(".", null);
- writer.endElement(HTML.DIV_ELEM);
- if (null != bottom) {
- renderChild(context, bottom);
- }
- }
-}
Copied: trunk/ui/layout/src/main/java/org/richfaces/renderkit/html/LayoutPanelRenderer.java (from rev 14023, trunk/ui/layout/src/main/java/org/richfaces/renderkit/AbstractLayoutPanelRenderer.java)
===================================================================
--- trunk/ui/layout/src/main/java/org/richfaces/renderkit/html/LayoutPanelRenderer.java (rev 0)
+++ trunk/ui/layout/src/main/java/org/richfaces/renderkit/html/LayoutPanelRenderer.java 2009-05-05 22:28:33 UTC (rev 14025)
@@ -0,0 +1,91 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
+import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.component.LayoutPosition;
+import org.richfaces.component.LayoutStructure;
+import org.richfaces.component.UILayout;
+import org.richfaces.component.UILayoutPanel;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class LayoutPanelRenderer extends RendererBase {
+ private static final Object[] LAYOUT_EXCLUSIONS = { HTML.id_ATTRIBUTE,
+ HTML.style_ATTRIBUTE };
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context,
+ UIComponent component) throws IOException {
+ writer.startElement(HTML.DIV_ELEM, component);
+ getUtils().encodeCustomId(context, component);
+ getUtils().encodePassThruWithExclusionsArray(context, component,
+ LAYOUT_EXCLUSIONS);
+ String layoutStyle = layoutStyle(context, (UILayoutPanel) component);
+ if (null != layoutStyle) {
+ writer.writeAttribute(HTML.style_ATTRIBUTE, layoutStyle, "style");
+
+ }
+ }
+
+ public String layoutStyle(FacesContext context, UILayoutPanel panel) {
+ StringBuilder style = new StringBuilder();
+ LayoutPosition position = panel.getPosition();
+ Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
+ Object parentLayout = requestMap.get(LayoutRenderer.LAYOUT_STRUCTURE_ATTRIBUTE);
+ LayoutStructure structure;
+ if (null != parentLayout && parentLayout instanceof LayoutStructure) {
+ structure = (LayoutStructure) parentLayout;
+ } else {
+ structure = new LayoutStructure(panel);
+ structure.calculateWidth();
+ }
+ Object componentStyle = panel.getAttributes().get(HTML.style_ATTRIBUTE);
+ if (null != componentStyle) {
+ style.append(componentStyle).append(";");
+ }
+ if (!LayoutPosition.top.equals(position)
+ && !LayoutPosition.bottom.equals(position)) {
+ if (LayoutPosition.right.equals(position)) {
+ style.append("float:right;");
+ } else {
+ style.append("float:left;");
+ }
+ // calculate real width.
+ float coef = 1.0f-((float)structure.getDeep()/100.00f);
+ String width = structure.getWidth(panel,coef);
+ if(null != width){
+ style.append("width:").append(width).append(";");
+ coef = coef*0.95f;
+ width = structure.getWidth(panel,coef);;
+ style.append("*width:").append(width).append(";");
+ }
+ } else {
+ // top and buttom style.
+ }
+ return style.length() > 0 ? style.toString() : null;
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context,
+ UIComponent component) throws IOException {
+ writer.endElement(HTML.DIV_ELEM);
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UILayoutPanel.class;
+ }
+}
Property changes on: trunk/ui/layout/src/main/java/org/richfaces/renderkit/html/LayoutPanelRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/ui/layout/src/main/java/org/richfaces/renderkit/html/LayoutRenderer.java (from rev 14023, trunk/ui/layout/src/main/java/org/richfaces/renderkit/AbstractLayoutRenderer.java)
===================================================================
--- trunk/ui/layout/src/main/java/org/richfaces/renderkit/html/LayoutRenderer.java (rev 0)
+++ trunk/ui/layout/src/main/java/org/richfaces/renderkit/html/LayoutRenderer.java 2009-05-05 22:28:33 UTC (rev 14025)
@@ -0,0 +1,97 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
+import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.component.LayoutPosition;
+import org.richfaces.component.LayoutStructure;
+import org.richfaces.component.UILayout;
+import org.richfaces.component.UILayoutPanel;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class LayoutRenderer extends
+ RendererBase {
+
+ public static final String LAYOUT_STRUCTURE_ATTRIBUTE = UILayout.class.getName()+".structure";
+ private static final Object[] LAYOUT_EXCLUSIONS = {HTML.id_ATTRIBUTE,HTML.style_ATTRIBUTE};
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context,
+ UIComponent component) throws IOException {
+ writer.startElement(HTML.DIV_ELEM, component);
+ getUtils().encodeCustomId(context, component);
+ getUtils().encodePassThruWithExclusionsArray(context, component, LAYOUT_EXCLUSIONS);
+ Object style = component.getAttributes().get("style");
+ writer.writeAttribute(HTML.style_ATTRIBUTE,null==style?"":(style.toString()+";")+"zoom:1;","style");
+ }
+
+
+ @Override
+ protected void doEncodeChildren(ResponseWriter writer,
+ FacesContext context, UIComponent component) throws IOException {
+ renderLayout(writer,context, (UILayout) component);
+ }
+
+ public void renderLayout(ResponseWriter writer,FacesContext context, UILayout layout)
+ throws IOException {
+ LayoutStructure structure = new LayoutStructure(layout);
+ structure.calculateWidth();
+ Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
+ Object oldLayout = requestMap.get(LAYOUT_STRUCTURE_ATTRIBUTE);
+ requestMap.put(LAYOUT_STRUCTURE_ATTRIBUTE, structure);
+ // Detect layout content;
+ if (null != structure.getTop()) {
+ structure.getTop().encodeAll(context);
+ }
+ if (structure.getColumns() > 0) {
+ // Reorder panels to fill ordeg left->center->right.
+ if (null != structure.getLeft()) {
+ structure.getLeft().encodeAll(context);
+ }
+ if (null != structure.getCenter()) {
+ structure.getCenter().encodeAll(context);
+ }
+ if (null != structure.getRight()) {
+ structure.getRight().encodeAll(context);
+ }
+ }
+ // line separator.
+ writer.startElement(HTML.DIV_ELEM, layout);
+ writer.writeAttribute(HTML.style_ATTRIBUTE, "display: block; height: 0; clear: both; visibility: hidden;", null);
+ writer.writeText(".", null);
+ writer.endElement(HTML.DIV_ELEM);
+ if (null != structure.getBottom()) {
+ renderChild(context, structure.getBottom());
+ }
+ requestMap.put(LAYOUT_STRUCTURE_ATTRIBUTE, oldLayout);
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context,
+ UIComponent component) throws IOException {
+ writer.endElement(HTML.DIV_ELEM);
+ }
+
+ @Override
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UILayout.class;
+ }
+}
Property changes on: trunk/ui/layout/src/main/java/org/richfaces/renderkit/html/LayoutRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/ui/layout/src/main/resources/org/richfaces/renderkit/html/css/simple.xcss
===================================================================
--- trunk/ui/layout/src/main/resources/org/richfaces/renderkit/html/css/simple.xcss 2009-05-05 17:33:02 UTC (rev 14024)
+++ trunk/ui/layout/src/main/resources/org/richfaces/renderkit/html/css/simple.xcss 2009-05-05 22:28:33 UTC (rev 14025)
@@ -34,6 +34,13 @@
<u:style name="padding" value="0 20px" />
<u:style name="color" skin="trimColor" />
</u:selector>
+ <u:selector name=".rich-page-subheader">
+ <u:style name="border-bottom" value="1px solid" />
+ <u:style name="border-bottom-color" skin="generalBackgroundColor" />
+ <u:style name="background-color" skin="headerGradientColor"/>
+ <u:style name="padding" value="0 20px" />
+ <u:style name="color" skin="trimColor" />
+ </u:selector>
<u:selector name=".rich-page-content">
<!-- u:style name="background-image">
Deleted: trunk/ui/layout/src/main/templates/org/richfaces/htmlLayout.jspx
===================================================================
--- trunk/ui/layout/src/main/templates/org/richfaces/htmlLayout.jspx 2009-05-05 17:33:02 UTC (rev 14024)
+++ trunk/ui/layout/src/main/templates/org/richfaces/htmlLayout.jspx 2009-05-05 22:28:33 UTC (rev 14025)
@@ -1,24 +0,0 @@
-<?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="org.richfaces.renderkit.html.LayoutRenderer"
- baseclass="org.richfaces.renderkit.AbstractLayoutRenderer"
- component="org.richfaces.component.UILayout"
- >
- <!-- h:styles>css/layout.css</h:styles-->
- <f:clientid var="clientId"/>
- <div id="#{clientId}"
- style="#{component.attributes['style']};zoom:1;"
- x:passThruWithExclusions="value,name,type,id,style" >
- <vcp:body>
- <f:call name="renderLayout" />
- </vcp:body>
-
- </div>
-</f:root>
\ No newline at end of file
Deleted: trunk/ui/layout/src/main/templates/org/richfaces/htmlLayoutPanel.jspx
===================================================================
--- trunk/ui/layout/src/main/templates/org/richfaces/htmlLayoutPanel.jspx 2009-05-05 17:33:02 UTC (rev 14024)
+++ trunk/ui/layout/src/main/templates/org/richfaces/htmlLayoutPanel.jspx 2009-05-05 22:28:33 UTC (rev 14025)
@@ -1,22 +0,0 @@
-<?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:h="http://jsf.exadel.com/header"
- xmlns:vcp=" http://jsf.exadel.com/vcp"
- xmlns:x=" http://ajax4jsf.org/cdk/x"
- class="org.richfaces.renderkit.html.LayoutPanelRenderer"
- baseclass="org.richfaces.renderkit.AbstractLayoutPanelRenderer"
- component="org.richfaces.component.UILayoutPanel"
- >
- <f:clientid var="clientId"/>
- <div id="#{clientId}" x:style="#{this:layoutStyle(context,component)}"
- x:passThruWithExclusions="type,id,style"
- >
- <vcp:body>
- <f:call name="renderChildren" />
- </vcp:body>
- </div>
-</f:root>
\ No newline at end of file
Added: trunk/ui/layout/src/test/java/org/richfaces/component/LayoutStructureTest.java
===================================================================
--- trunk/ui/layout/src/test/java/org/richfaces/component/LayoutStructureTest.java (rev 0)
+++ trunk/ui/layout/src/test/java/org/richfaces/component/LayoutStructureTest.java 2009-05-05 22:28:33 UTC (rev 14025)
@@ -0,0 +1,86 @@
+package org.richfaces.component;
+
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+
+import org.richfaces.component.html.HtmlLayout;
+import org.richfaces.component.html.HtmlLayoutPanel;
+
+import junit.framework.TestCase;
+
+public class LayoutStructureTest extends TestCase {
+
+ protected UILayout createLayout(String leftWidth,String centerWidth,String rightWidth) {
+ UILayout layout = new HtmlLayout();
+ layout.setId("layout");
+ List<UIComponent> children = layout.getChildren();
+ UILayoutPanel panel = new HtmlLayoutPanel();
+ panel.setPosition(LayoutPosition.left);
+ panel.setId("left");
+ panel.setWidth(leftWidth);
+ children.add(panel);
+
+ panel = new HtmlLayoutPanel();
+ panel.setPosition(LayoutPosition.top);
+ panel.setId("top");
+ children.add(panel);
+
+ panel = new HtmlLayoutPanel();
+ panel.setPosition(LayoutPosition.right);
+ panel.setId("right");
+ panel.setWidth(rightWidth);
+ children.add(panel);
+
+ panel = new HtmlLayoutPanel();
+ panel.setPosition(LayoutPosition.center);
+ panel.setId("center");
+ panel.setWidth(centerWidth);
+ children.add(panel);
+
+ panel = new HtmlLayoutPanel();
+ panel.setPosition(LayoutPosition.bottom);
+ panel.setId("bottom");
+ children.add(panel);
+ return layout;
+ }
+
+ public void testSortPanels() throws Exception {
+ LayoutStructure struct = new LayoutStructure(createLayout(null, null, null));
+ assertEquals("top", struct.getTop().getId());
+ assertEquals("bottom", struct.getBottom().getId());
+ assertEquals("left", struct.getLeft().getId());
+ assertEquals("right", struct.getRight().getId());
+ assertEquals("center", struct.getCenter().getId());
+ }
+
+ public void testCalculateWidth() throws Exception {
+ LayoutStructure struct = new LayoutStructure(createLayout(null, null, null));
+ struct.calculateWidth();
+ assertEquals("32.67%", struct.getWidth(struct.getLeft()));
+ assertEquals("32.67%", struct.getWidth(struct.getCenter()));
+ assertEquals("32.67%", struct.getWidth(struct.getRight()));
+ }
+
+ public void testCalculateWidth1() throws Exception {
+ LayoutStructure struct = new LayoutStructure(createLayout("50%", null, null));
+ struct.calculateWidth();
+ assertEquals("49.00%", struct.getWidth(struct.getLeft()));
+ assertEquals("24.50%", struct.getWidth(struct.getCenter()));
+ assertEquals("24.50%", struct.getWidth(struct.getRight()));
+ }
+ public void testCalculateWidth2() throws Exception {
+ LayoutStructure struct = new LayoutStructure(createLayout("50%", "*2", "*1"));
+ struct.calculateWidth();
+ assertEquals("49.00%", struct.getWidth(struct.getLeft()));
+ assertEquals("32.67%", struct.getWidth(struct.getCenter()));
+ assertEquals("16.33%", struct.getWidth(struct.getRight()));
+ }
+ public void testCalculateWidth3() throws Exception {
+ LayoutStructure struct = new LayoutStructure(createLayout("50%", "20%", "10%"));
+ struct.calculateWidth();
+ assertEquals("61.25%", struct.getWidth(struct.getLeft()));
+ assertEquals("24.50%", struct.getWidth(struct.getCenter()));
+ assertEquals("12.25%", struct.getWidth(struct.getRight()));
+ }
+}
Property changes on: trunk/ui/layout/src/test/java/org/richfaces/component/LayoutStructureTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 8 months