You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by pm...@apache.org on 2007/12/12 17:28:35 UTC

svn commit: r603665 - in /myfaces/tomahawk/trunk/core/src/main: java/org/apache/myfaces/custom/schedule/ resources/org/apache/myfaces/custom/schedule/resource/css/ tld/tomahawk-entities/

Author: pmahoney
Date: Wed Dec 12 08:28:34 2007
New Revision: 603665

URL: http://svn.apache.org/viewvc?rev=603665&view=rev
Log:
TOMAHAWK-1066: Add compactMonthDayOfWeekDateFormat attribute to allow headers in the month view

Modified:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/ScheduleCompactMonthRenderer.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/ScheduleTag.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/UIScheduleBase.java
    myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/css/schedule.css
    myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_ui_schedule_attributes.xml

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/ScheduleCompactMonthRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/ScheduleCompactMonthRenderer.java?rev=603665&r1=603664&r2=603665&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/ScheduleCompactMonthRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/ScheduleCompactMonthRenderer.java Wed Dec 12 08:28:34 2007
@@ -22,6 +22,7 @@
 
 import java.io.IOException;
 import java.io.Serializable;
+import java.text.DateFormat;
 import java.util.Calendar;
 import java.util.Iterator;
 
@@ -80,16 +81,48 @@
         writer.startElement(HTML.TABLE_ELEM, schedule);
         writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "month"), null);
         writer.writeAttribute(
-            HTML.STYLE_ATTR, "position: relative; left: 0px; top: 0px; width: 100%;",
+            HTML.STYLE_ATTR, "width: 100%;",
             null
         );
         writer.writeAttribute(HTML.CELLPADDING_ATTR, "0", null);
         writer.writeAttribute(HTML.CELLSPACING_ATTR, "1", null);
-        writer.writeAttribute("border", "0", null);
-        writer.writeAttribute(HTML.WIDTH_ATTR, "100%", null);
-        writer.startElement(HTML.TBODY_ELEM, schedule);
 
         Calendar cal = getCalendarInstance(schedule, schedule.getModel().getSelectedDate());
+
+        String dayOfWeekDateFormat = schedule.getCompactMonthDayOfWeekDateFormat();
+
+        if (dayOfWeekDateFormat != null && dayOfWeekDateFormat.length() > 0) {
+        	DateFormat dayOfWeekFormater = getDateFormat(context, schedule, dayOfWeekDateFormat);
+        	writer.startElement(HTML.THEAD_ELEM, schedule);
+        	writer.startElement(HTML.TR_ELEM, schedule);
+
+        	for (Iterator dayIterator = schedule.getModel().iterator(); dayIterator.hasNext();) {
+        		ScheduleDay day = (ScheduleDay) dayIterator.next();
+        		cal.setTime(day.getDate());
+
+        		int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
+
+        		writer.startElement(HTML.TH_ELEM, schedule);
+        		writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "header"), null);
+
+        		if (schedule.isSplitWeekend() && dayOfWeek == Calendar.SATURDAY) {
+            		// Don't label the weekend
+        			writer.endElement(HTML.TH_ELEM);
+        			break;
+        		} else {
+            		writer.writeText(dayOfWeekFormater.format(day.getDate()), null);
+            		writer.endElement(HTML.TH_ELEM);        			
+        		}
+        		if (dayOfWeek == Calendar.SUNDAY) {
+        			break;
+        		}
+        	}
+        	writer.endElement(HTML.TR_ELEM);
+        	writer.endElement(HTML.THEAD_ELEM);
+        }
+
+        writer.startElement(HTML.TBODY_ELEM, schedule);
+
         int selectedMonth = cal.get(Calendar.MONTH);
 
         for (

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/ScheduleTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/ScheduleTag.java?rev=603665&r1=603664&r2=603665&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/ScheduleTag.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/ScheduleTag.java Wed Dec 12 08:28:34 2007
@@ -48,6 +48,7 @@
     private String _workingStartHour;
     private String _submitOnClick;
     private String _hourNotation;
+    private String _compactMonthDayOfWeekDateFormat;
     //UISchedule properties
     private String _action;
     private String _actionListener;
@@ -259,11 +260,21 @@
     /**
      * @return the hourNotation
      */
-    public String getHourNotation() {
+    public String getHourNotation()
+    {
 		return _hourNotation;
 	}
     
-    public void release() {
+    /**
+     * @return the compactMonthDayOfWeekDateFormat
+     */
+    public String getcompactMonthDayOfWeekDateFormat()
+    {
+		return _compactMonthDayOfWeekDateFormat;
+	}
+    
+    public void release()
+    {
         super.release();
         //UIScheduleBase properties
         _compactMonthRowHeight = null;
@@ -282,6 +293,7 @@
         _workingStartHour = null;
         _submitOnClick = null;
         _hourNotation = null;
+        _compactMonthDayOfWeekDateFormat = null;
         //UISchedule properties
         _action = null;
         _actionListener = null;
@@ -428,6 +440,7 @@
           setIntegerProperty(component, "workingStartHour", _workingStartHour);
           setBooleanProperty(component, "submitOnClick", _submitOnClick);
           setStringProperty(component, "hourNotation", _hourNotation);
+          setStringProperty(component, "compactMonthDayOfWeekDateFormat", _compactMonthDayOfWeekDateFormat);
           //UISchedule properties
           setActionProperty(component, _action);
           setActionListenerProperty(component, _actionListener);
@@ -562,13 +575,21 @@
     }
 
     /**
-     * @param hourNotation the workingStartHour to set
+     * @param hourNotation the hourNotation to set
      */
     public void setHourNotation(String hourNotation)
     {
         this._hourNotation = hourNotation;
     }
 
+    /**
+     * @param hourNotation the monthDayOfWeekDateFormat to set
+     */
+    public void setCompactMonthDayOfWeekDateFormat(String monthDayOfWeekDateFormat)
+    {
+		_compactMonthDayOfWeekDateFormat = monthDayOfWeekDateFormat;
+	}
+    
     /**
      * @return the backgroundClass
      */

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/UIScheduleBase.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/UIScheduleBase.java?rev=603665&r1=603664&r2=603665&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/UIScheduleBase.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/UIScheduleBase.java Wed Dec 12 08:28:34 2007
@@ -87,6 +87,7 @@
     private Integer _workingStartHour;
     private Boolean _submitOnClick = null;
     private String _hourNotation;
+    private String _compactMonthDayOfWeekDateFormat;
 	private Boolean _splitWeekend;
 
 	public boolean isSplitWeekend()
@@ -319,6 +320,15 @@
     {
     	return ScheduleUtil.getStringProperty(this, _hourNotation, "hourNotation", null);
     }
+
+    /**
+     * @return the headerDateFormat
+     */
+    public String getCompactMonthDayOfWeekDateFormat()
+    {
+        return ScheduleUtil.getStringProperty(this, _compactMonthDayOfWeekDateFormat,
+                "compactMonthDayOfWeekDateFormat", null);
+    }
     
     /**
      * @see javax.faces.component.UIComponentBase#restoreState(javax.faces.context.FacesContext, java.lang.Object)
@@ -345,6 +355,7 @@
         _submitOnClick = (Boolean)values[16];
         _hourNotation = (String) values[17];
 		_splitWeekend = (Boolean)values[18];
+		_compactMonthDayOfWeekDateFormat = (String)values[19];
     }
 
     /**
@@ -352,7 +363,7 @@
      */
     public Object saveState(FacesContext context)
     {
-        Object[] values = new Object[19];
+        Object[] values = new Object[20];
         values[0] = super.saveState(context);
         values[1] = _compactMonthRowHeight;
         values[2] = _compactWeekRowHeight;
@@ -372,6 +383,7 @@
         values[16] = _submitOnClick;
         values[17] = _hourNotation;
 		values[18] = _splitWeekend;
+		values[19] = _compactMonthDayOfWeekDateFormat;
         
         return values;
     }
@@ -526,4 +538,15 @@
     	this._hourNotation = hourNotation;
     }
     
+    /**
+     * <p>
+     * Date format to use for days of the week headers in the month view.
+     * e.g. EEEE = Monday, Tuesday,  etc.
+     * </p>
+     * 
+     * @param compactMonthDayOfWeekDateFormat Date format for day of the week header, or null for no header
+     */
+    public void setCompactMonthDayOfWeekDateFormat(String compactMonthDayOfWeekDateFormat) {
+		_compactMonthDayOfWeekDateFormat = compactMonthDayOfWeekDateFormat;
+	}
 }

Modified: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/css/schedule.css
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/css/schedule.css?rev=603665&r1=603664&r2=603665&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/css/schedule.css (original)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/css/schedule.css Wed Dec 12 08:28:34 2007
@@ -118,13 +118,17 @@
 	background-color: rgb(153,153,153);
 }
 
+div.schedule-compact-default table.month th.header {
+    background-color: rgb(181,200,207);	
+	font-family: Verdana, Arial, Helvetica, Sans-Serif;
+}
+
 div.schedule-compact-default table.day {
   background-color: rgb(255,255,255);
 }
 
 div.schedule-compact-default table.day th.header {
   background-color: rgb(181,200,207);
-  font-family: Verdana, Arial, Helvetica, Sans-Serif;
   font-size: 10px;
   color: rgb(0,0,0);
   text-align: left;
@@ -301,13 +305,17 @@
     background-color: rgb(172,172,172);
 }
 
+div.schedule-compact-evolution table.month th.header {
+    background-color: rgb(246,246,246);
+	font-family: Verdana, Arial, Helvetica, Sans-Serif;
+}
+
 div.schedule-compact-evolution table.day {
   background-color: rgb(255,255,255);
 }
 
 div.schedule-compact-evolution table.day th.header {
   background-color: rgb(255,255,255);
-  font-family: Verdana, Arial, Helvetica, Sans-Serif;
   font-size: 10px;
   color: rgb(0,0,0);
   text-align: left;
@@ -483,6 +491,11 @@
     width: 100%;
     left: 0px;
     background-color: rgb(128,128,128);
+}
+
+div.schedule-compact-outlookxp table.month th.header {
+    background-color: rgb(219,216,209);
+	font-family: Verdana, Arial, Helvetica, Sans-Serif;
 }
 
 div.schedule-compact-outlookxp table.day {

Modified: myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_ui_schedule_attributes.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_ui_schedule_attributes.xml?rev=603665&r1=603664&r2=603665&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_ui_schedule_attributes.xml (original)
+++ myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_ui_schedule_attributes.xml Wed Dec 12 08:28:34 2007
@@ -89,6 +89,12 @@
 	<type>java.lang.String</type>
 </attribute>
 <attribute>
+	<name>compactMonthDayOfWeekDateFormat</name>
+	<required>false</required>
+	<rtexprvalue>false</rtexprvalue>
+	<type>java.lang.String</type>
+</attribute>
+<attribute>
 	<name>splitWeekend</name>
 	<required>false</required>
 	<rtexprvalue>false</rtexprvalue>