[richfaces-svn-commits] JBoss Rich Faces SVN: r13382 - in trunk: samples/layout-sample/src/main/webapp/pages and 3 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Apr 3 18:20:44 EDT 2009


Author: alexsmirnov
Date: 2009-04-03 18:20:44 -0400 (Fri, 03 Apr 2009)
New Revision: 13382

Added:
   trunk/samples/layout-sample/src/main/java/org/richfaces/samples/LayoutBean.java
   trunk/samples/themes/src/main/resources/META-INF/themes/theme1.theme.properties
   trunk/samples/themes/src/main/resources/META-INF/themes/theme2.theme.properties
   trunk/samples/themes/src/main/resources/org/richfaces/renderkit/html/css/theme1.xcss
   trunk/samples/themes/src/main/resources/org/richfaces/renderkit/html/css/theme2.xcss
Modified:
   trunk/samples/layout-sample/src/main/java/org/richfaces/samples/Bean.java
   trunk/samples/layout-sample/src/main/webapp/pages/index.xhtml
   trunk/samples/layout-sample/src/main/webapp/pages/layout.xhtml
   trunk/ui/layout/src/main/java/org/richfaces/renderkit/AbstractLayoutRenderer.java
Log:
fix layout renderdr. Lex'x themes start working

Modified: trunk/samples/layout-sample/src/main/java/org/richfaces/samples/Bean.java
===================================================================
--- trunk/samples/layout-sample/src/main/java/org/richfaces/samples/Bean.java	2009-04-03 17:05:33 UTC (rev 13381)
+++ trunk/samples/layout-sample/src/main/java/org/richfaces/samples/Bean.java	2009-04-03 22:20:44 UTC (rev 13382)
@@ -3,6 +3,15 @@
  */
 package org.richfaces.samples;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.richfaces.component.LayoutPosition;
+
 /**
  * @author asmirnov
  *
@@ -16,6 +25,18 @@
 	private int width=960;
 	
 	private int sidebarWidth=260;
+	
+	private final Map<String, LayoutBean> layouts;
+	private final  List<LayoutBean> layoutValues;
+	
+	public Bean() {
+		Map<String, LayoutBean> layouts = new HashMap<String, LayoutBean>(5);
+		for(LayoutPosition lp:LayoutPosition.values()){
+			layouts.put(lp.toString(), new LayoutBean(lp));
+		}
+		this.layouts = Collections.unmodifiableMap(layouts);
+		layoutValues = Collections.unmodifiableList(new ArrayList<LayoutBean>(layouts.values()));
+	}
 
 	/**
 	 * @return the position
@@ -76,4 +97,14 @@
 		this.theme = theme;
 	}
 
+	/**
+	 * @return the layouts
+	 */
+	public Map<String, LayoutBean> getLayouts() {
+		return layouts;
+	}
+
+	public List<LayoutBean> getLayoutValues(){
+		return layoutValues;
+	}
 }

Added: trunk/samples/layout-sample/src/main/java/org/richfaces/samples/LayoutBean.java
===================================================================
--- trunk/samples/layout-sample/src/main/java/org/richfaces/samples/LayoutBean.java	                        (rev 0)
+++ trunk/samples/layout-sample/src/main/java/org/richfaces/samples/LayoutBean.java	2009-04-03 22:20:44 UTC (rev 13382)
@@ -0,0 +1,69 @@
+/**
+ * 
+ */
+package org.richfaces.samples;
+
+import org.richfaces.component.LayoutPosition;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class LayoutBean {
+	
+	private LayoutPosition position;
+	
+	/**
+	 * @param position
+	 */
+	public LayoutBean(LayoutPosition position) {
+		this.position = position;
+	}
+
+	private boolean rendered = true;
+	
+	private String width;
+
+	/**
+	 * @return the rendered
+	 */
+	public boolean isRendered() {
+		return rendered;
+	}
+
+	/**
+	 * @param rendered the rendered to set
+	 */
+	public void setRendered(boolean rendered) {
+		this.rendered = rendered;
+	}
+
+	/**
+	 * @return the width
+	 */
+	public String getWidth() {
+		return width;
+	}
+
+	/**
+	 * @param width the width to set
+	 */
+	public void setWidth(String width) {
+		this.width = width;
+	}
+
+	/**
+	 * @return the position
+	 */
+	public LayoutPosition getPosition() {
+		return position;
+	}
+
+	/**
+	 * @param position the position to set
+	 */
+	public void setPosition(LayoutPosition position) {
+		this.position = position;
+	}
+
+}


Property changes on: trunk/samples/layout-sample/src/main/java/org/richfaces/samples/LayoutBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/samples/layout-sample/src/main/webapp/pages/index.xhtml
===================================================================
(Binary files differ)

Modified: trunk/samples/layout-sample/src/main/webapp/pages/layout.xhtml
===================================================================
--- trunk/samples/layout-sample/src/main/webapp/pages/layout.xhtml	2009-04-03 17:05:33 UTC (rev 13381)
+++ trunk/samples/layout-sample/src/main/webapp/pages/layout.xhtml	2009-04-03 22:20:44 UTC (rev 13382)
@@ -59,7 +59,6 @@
 	   <layout:layoutPanel position="right">Right</layout:layoutPanel>
 	   <layout:layoutPanel position="top">Top</layout:layoutPanel>
 	   <layout:layoutPanel position="bottom">Bottom</layout:layoutPanel>
-	   
 	</layout:layout>
 
 </layout:page>
\ No newline at end of file

Added: trunk/samples/themes/src/main/resources/META-INF/themes/theme1.theme.properties
===================================================================
--- trunk/samples/themes/src/main/resources/META-INF/themes/theme1.theme.properties	                        (rev 0)
+++ trunk/samples/themes/src/main/resources/META-INF/themes/theme1.theme.properties	2009-04-03 22:20:44 UTC (rev 13382)
@@ -0,0 +1,2 @@
+rendererType=org.richfaces.Theme1Renderer
+styleSheet=resource:///org/richfaces/renderkit/html/css/theme1.xcss


Property changes on: trunk/samples/themes/src/main/resources/META-INF/themes/theme1.theme.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/samples/themes/src/main/resources/META-INF/themes/theme2.theme.properties
===================================================================
--- trunk/samples/themes/src/main/resources/META-INF/themes/theme2.theme.properties	                        (rev 0)
+++ trunk/samples/themes/src/main/resources/META-INF/themes/theme2.theme.properties	2009-04-03 22:20:44 UTC (rev 13382)
@@ -0,0 +1,2 @@
+rendererType=org.richfaces.Theme2Renderer
+styleSheet=resource:///org/richfaces/renderkit/html/css/theme2.xcss


Property changes on: trunk/samples/themes/src/main/resources/META-INF/themes/theme2.theme.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/samples/themes/src/main/resources/org/richfaces/renderkit/html/css/theme1.xcss
===================================================================
--- trunk/samples/themes/src/main/resources/org/richfaces/renderkit/html/css/theme1.xcss	                        (rev 0)
+++ trunk/samples/themes/src/main/resources/org/richfaces/renderkit/html/css/theme1.xcss	2009-04-03 22:20:44 UTC (rev 13382)
@@ -0,0 +1,32 @@
+<?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">
+
+	<f:verbatim>
+		<![CDATA[
+.page_size{width : 90%;}
+.menu_width{width : 300px;}
+
+body {margin : 0px; background : url(images/bg_page.png) top left #93C4E5;}
+.common_box {margin : 0px; background : url(images/bg_grad_page.png) top left repeat-x;}
+.header_bg_left {background : url(images/bg_header_left.png) top left no-repeat;}
+.header_bg_right {background : url(images/bg_header_right.png) top right no-repeat; height : 105px;}
+.header_content {margin : 0px 10px 0px 10px; height : 80px; position : relative;}
+.spacer{font-size : 1px;}
+.left_col {background : url(images/bg_left.png) top left no-repeat; vertical-align : top}
+.left_strut {background : url(images/bg_left_strut.png) top left no-repeat; height : 389px; width : 14px}
+.bg_tabbody {background : #c0c0c0}
+
+.menu_col {border-right : 2px solid #C0C0C0; vertical-align : top; background : #FFFFFF;}
+.content_col {vertical-align : top; width : 100%; background : #FFFFFF;}
+
+.right_col {background : url(images/bg_right.png) top right no-repeat; vertical-align : top}
+.right_strut {background : url(images/bg_right_strut.png) top right no-repeat; height : 389px; width : 14px}
+.footer_bg_left {background : url(images/bg_footer_left.png) top left no-repeat;}
+.footer_bg_right {background : url(images/bg_footer_right.png) top right no-repeat; height : 72px;}
+.footer_bg_content {margin : 0px 10px 0px 10px; height : 53px; position : relative;}
+		]]>
+	</f:verbatim>
+</f:template>
\ No newline at end of file

Added: trunk/samples/themes/src/main/resources/org/richfaces/renderkit/html/css/theme2.xcss
===================================================================
--- trunk/samples/themes/src/main/resources/org/richfaces/renderkit/html/css/theme2.xcss	                        (rev 0)
+++ trunk/samples/themes/src/main/resources/org/richfaces/renderkit/html/css/theme2.xcss	2009-04-03 22:20:44 UTC (rev 13382)
@@ -0,0 +1,75 @@
+<?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">
+
+	<f:verbatim>
+		<![CDATA[
+.menu_width{width : 300px;}
+
+body {
+	margin : 0px; 
+	background : #f1f1f1;  /*generalBackgroundColor*/
+}
+
+.page_size {
+	width : 100%; 
+	height : 100%;
+}
+
+.header_bg {
+	background : url(images/bg_header.png) top left repeat-x #005000; /*headerBackgroundColor*/
+	border-bottom : 1px solid #f1f1f1;  /*generalBackgroundColor*/
+}
+
+.header_content {
+	margin : 0px 0px 0px 0px; 
+	height : 95px; position : relative;
+}
+
+.spacer{font-size : 1px;}
+
+.menu_col {
+	border-right : 2px solid #C0C0C0;  /*panelBorderColor*/
+	border-top : 2px solid #C0C0C0;  /*panelBorderColor*/
+	border-bottom : 2px solid #C0C0C0;  /*panelBorderColor*/
+	vertical-align : top; 
+	background : #f1f1f1;  /*generalBackgroundColor*/
+}
+
+.content_col {
+	border-top : 2px solid #C0C0C0;  /*panelBorderColor*/
+	border-bottom : 2px solid #C0C0C0;  /*panelBorderColor*/
+	vertical-align : top; 
+	width : 100%; 
+	background : #f1f1f1;  /*generalBackgroundColor*/
+}
+
+*.menu_col, *.content_col, *.footer_bg {
+	color : #000000; /*generalTextColor*/
+	font-size : 11px; /*generalSizeFont*/
+	font-family : Arial, Verdana, sans-serif ; /*generalFamilyFont*/
+	
+}
+
+*.header_content {
+	color : #FFFFFF; /*headerTextColor*/
+	font-size : 12px; /*headerSizeFont*/
+	font-family : Arial, Verdana, sans-serif ; /*headerFamilyFont*/
+	
+}
+
+.footer_bg {
+	border-top : 1px solid #f1f1f1;  /*generalBackgroundColor*/
+	background : url(images/bg_footer.png) top left  repeat-x #c0c0c0;  /*panelBorderColor*/
+}
+
+.footer_bg_content {
+	margin : 0px 0px 0px 0px; 
+	height : 45px; 
+	position : relative;
+}
+		]]>
+	</f:verbatim>
+</f:template>
\ No newline at end of file

Modified: trunk/ui/layout/src/main/java/org/richfaces/renderkit/AbstractLayoutRenderer.java
===================================================================
--- trunk/ui/layout/src/main/java/org/richfaces/renderkit/AbstractLayoutRenderer.java	2009-04-03 17:05:33 UTC (rev 13381)
+++ trunk/ui/layout/src/main/java/org/richfaces/renderkit/AbstractLayoutRenderer.java	2009-04-03 22:20:44 UTC (rev 13382)
@@ -33,7 +33,7 @@
 		UILayoutPanel center = null;
 		int columns = 0;
 		for (UIComponent child : layout.getChildren()) {
-			if (child instanceof UILayoutPanel) {
+			if (child instanceof UILayoutPanel && child.isRendered()) {
 				UILayoutPanel layoutPanel = (UILayoutPanel) child;
 				LayoutPosition position = layoutPanel.getPosition();
 				if (LayoutPosition.top.equals(position)) {
@@ -82,7 +82,7 @@
 		}
 		ResponseWriter writer = context.getResponseWriter();
 		if (null != top) {
-			renderChild(context, top);
+			top.encodeAll(context);
 		}
 		if (columns > 0) {
 			// Reorder panels to fill ordeg left->center->right.
@@ -107,15 +107,15 @@
 				writer.writeAttribute(HTML.class_ATTRIBUTE, yahooClass, null);
 				left.getAttributes().put("first", "first");
 				center.getAttributes().remove("first");
-				renderChild(context, left);
-				renderChild(context, center);
+				left.encodeAll(context);
+				center.encodeAll(context);
 				if (null != right) {
 					right.getAttributes().remove("first");
-					renderChild(context, right);
+					right.encodeAll(context);
 				}
 				writer.endElement(HTML.DIV_ELEM);
 			} else {
-				renderChild(context, left);
+				left.encodeAll(context);
 			}
 		}
 		if (null != bottom) {
@@ -138,12 +138,12 @@
 		} else if(null != left && null != center){
 			int leftPart = 0;
 			String leftWidth = left.getWidth();
-			if(null != leftWidth){
+			if(!isEmpty(leftWidth)){
 				leftPart = Integer.parseInt(leftWidth);
 			}
 			int rightPart = 0;
 			String centerWidth = center.getWidth();
-			if(null != centerWidth){
+			if(!isEmpty(centerWidth)){
 				rightPart = Integer.parseInt(centerWidth);
 				if(0 ==leftPart && 0>rightPart && centerWidth.endsWith("%")){
 					leftPart = 100 - rightPart;
@@ -168,4 +168,8 @@
 		}
 		return yahooClass;
 	}
+
+	private boolean isEmpty(String leftWidth) {
+		return null == leftWidth || leftWidth.length() >0;
+	}
 }




More information about the richfaces-svn-commits mailing list