You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ba...@apache.org on 2006/01/02 10:48:36 UTC

svn commit: r365324 - /myfaces/sandbox/trunk/src/main/java/org/apache/myfaces/custom/schedule/renderer/AbstractCompactScheduleRenderer.java

Author: baranda
Date: Mon Jan  2 01:48:33 2006
New Revision: 365324

URL: http://svn.apache.org/viewcvs?rev=365324&view=rev
Log:
Applied patch for MYFACES-984. Thanks to Peter Mahoney

Modified:
    myfaces/sandbox/trunk/src/main/java/org/apache/myfaces/custom/schedule/renderer/AbstractCompactScheduleRenderer.java

Modified: myfaces/sandbox/trunk/src/main/java/org/apache/myfaces/custom/schedule/renderer/AbstractCompactScheduleRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/main/java/org/apache/myfaces/custom/schedule/renderer/AbstractCompactScheduleRenderer.java?rev=365324&r1=365323&r2=365324&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/main/java/org/apache/myfaces/custom/schedule/renderer/AbstractCompactScheduleRenderer.java (original)
+++ myfaces/sandbox/trunk/src/main/java/org/apache/myfaces/custom/schedule/renderer/AbstractCompactScheduleRenderer.java Mon Jan  2 01:48:33 2006
@@ -97,7 +97,7 @@
             rowHeight = 0;
         }
 
-        if (rowHeight <= 0)
+        if (rowHeight == 0)
         {
             rowHeight = getDefaultRowHeight();
         }
@@ -138,24 +138,31 @@
 
         //determine the height of the day in pixels
         StringBuffer styleBuffer = new StringBuffer();
-        styleBuffer.append("height: ");
 
-        int myRowHeight = 0;
-        int myContentHeight = 0;
-
-        if (isWeekend)
-        {
-            myRowHeight = getRowHeight(attributes) / 2;
-            myContentHeight = myRowHeight - 19;
-        }
-        else
-        {
-            myRowHeight = getRowHeight(attributes) + 1; //need to add 1 to get the weekends right
-            myContentHeight = myRowHeight - 18; //18 instead of 19, to get the weekends right
+        int rowHeight = getRowHeight(attributes);
+        String myRowHeight = "height: ";
+        String myContentHeight = "height: ";
+
+    	if (rowHeight > 0) 
+    	{
+    		if (isWeekend)
+    		{
+        		myRowHeight += (rowHeight / 2) + "px;";
+        		myContentHeight += ((rowHeight / 2) - 19) + "px;";
+    		}
+    		else
+    		{
+        		myRowHeight += (rowHeight + 1) + "px;"; //need to add 1 to get the weekends right
+        		myContentHeight += ((rowHeight + 1) - 18) + "px;"; //18 instead of 19, to get the weekends right
+        	}
         }
+    	else
+    	{
+            myRowHeight += "100%;";
+            myContentHeight += "100%;";    		
+    	}
 
         styleBuffer.append(myRowHeight);
-        styleBuffer.append("px;");
 
         writer.writeAttribute(HTML.STYLE_ATTR, styleBuffer.toString()
                 + " width: " + cellWidth + "%;", null);
@@ -187,9 +194,8 @@
 
         //determine the height of the day content in pixels
         StringBuffer contentStyleBuffer = new StringBuffer();
-        contentStyleBuffer.append("height: ");
         contentStyleBuffer.append(myContentHeight);
-        contentStyleBuffer.append("px; width: 100%;");
+        contentStyleBuffer.append(" width: 100%;");
         writer.writeAttribute(HTML.STYLE_ATTR, contentStyleBuffer.toString(),
                 null);