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

svn commit: r368941 [1/2] - in /myfaces/sandbox/trunk: sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/ sandbox-examples/src/main/webapp/ sandbox-examples/src/main/webapp/WEB-INF/ sandbox-examples/src/main/webapp/schedule/ sandbox/s...

Author: schof
Date: Fri Jan 13 17:03:22 2006
New Revision: 368941

URL: http://svn.apache.org/viewcvs?rev=368941&view=rev
Log:
Fixes MYFACES-1012 (Patch by Jurgen Lust)

Added:
    myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/AddEntryHandler.java
    myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/RandomColorScheduleEntryRenderer.java
    myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleExampleHandler.java
    myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleSettings.java
    myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/addentry.jsp
    myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/editsettings.jsp
    myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example1.jsp
    myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example2.jsp
    myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example3.jsp
    myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example4.jsp
    myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/renderer/DefaultScheduleEntryRenderer.java
    myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/renderer/ScheduleEntryRenderer.java
Modified:
    myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/WEB-INF/examples-config.xml
    myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule.jsp
    myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/ScheduleTag.java
    myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/AbstractScheduleModel.java
    myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/ScheduleModel.java
    myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/SimpleScheduleModel.java
    myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/renderer/AbstractCompactScheduleRenderer.java
    myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/renderer/AbstractScheduleRenderer.java
    myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/renderer/ScheduleCompactMonthRenderer.java
    myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/renderer/ScheduleCompactWeekRenderer.java
    myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/renderer/ScheduleDetailedDayRenderer.java
    myfaces/sandbox/trunk/sandbox/src/main/resources/org/apache/myfaces/custom/schedule/resource/css/schedule.css
    myfaces/sandbox/trunk/sandbox/src/main/tld/entities/html_schedule_attributes.xml
    myfaces/sandbox/trunk/sandbox/src/site/xdoc/schedule.xml

Added: myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/AddEntryHandler.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/AddEntryHandler.java?rev=368941&view=auto
==============================================================================
--- myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/AddEntryHandler.java (added)
+++ myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/AddEntryHandler.java Fri Jan 13 17:03:22 2006
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.examples.schedule;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+
+import org.apache.commons.lang.RandomStringUtils;
+import org.apache.myfaces.custom.schedule.model.DefaultScheduleEntry;
+import org.apache.myfaces.custom.schedule.model.ScheduleModel;
+
+public class AddEntryHandler implements Serializable
+{
+    private static final long serialVersionUID = -4253400845605088699L;
+
+    private Date from;
+
+    private Date until;
+
+    private String title;
+
+    private String location;
+
+    private String comments;
+
+    private ScheduleModel model;
+
+    public String getComments()
+    {
+        return comments;
+    }
+
+    public void setComments(String comments)
+    {
+        this.comments = comments;
+    }
+
+    public Date getFrom()
+    {
+        return from;
+    }
+
+    public void setFrom(Date from)
+    {
+        this.from = from;
+    }
+
+    public String getLocation()
+    {
+        return location;
+    }
+
+    public void setLocation(String location)
+    {
+        this.location = location;
+    }
+
+    public ScheduleModel getModel()
+    {
+        return model;
+    }
+
+    public void setModel(ScheduleModel model)
+    {
+        this.model = model;
+    }
+
+    public String getTitle()
+    {
+        return title;
+    }
+
+    public void setTitle(String title)
+    {
+        this.title = title;
+    }
+
+    public Date getUntil()
+    {
+        return until;
+    }
+
+    public void setUntil(Date until)
+    {
+        this.until = until;
+    }
+
+    public String add()
+    {
+        if (!from.before(until))
+        {
+            FacesContext.getCurrentInstance().addMessage(
+                    null,
+                    new FacesMessage(FacesMessage.SEVERITY_ERROR,
+                            "start time must be before end time", null));
+            return "failure";
+        }
+        DefaultScheduleEntry entry = new DefaultScheduleEntry();
+        entry.setId(RandomStringUtils.randomNumeric(32));
+        entry.setStartTime(from);
+        entry.setEndTime(until);
+        entry.setTitle(title);
+        entry.setSubtitle(location);
+        entry.setDescription(comments);
+        model.addEntry(entry);
+        model.refresh();
+        return "success";
+    }
+
+}

Added: myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/RandomColorScheduleEntryRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/RandomColorScheduleEntryRenderer.java?rev=368941&view=auto
==============================================================================
--- myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/RandomColorScheduleEntryRenderer.java (added)
+++ myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/RandomColorScheduleEntryRenderer.java Fri Jan 13 17:03:22 2006
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.myfaces.examples.schedule;
+
+import java.util.HashMap;
+import java.util.Random;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.custom.schedule.HtmlSchedule;
+import org.apache.myfaces.custom.schedule.model.ScheduleEntry;
+import org.apache.myfaces.custom.schedule.renderer.DefaultScheduleEntryRenderer;
+
+/**
+ * An example ScheduleEntryRenderer that assigns a random color to each
+ * entry.
+ * 
+ * @author Jurgen Lust (latest modification by $Author$)
+ * @version $Revision$
+ */
+public class RandomColorScheduleEntryRenderer extends
+        DefaultScheduleEntryRenderer
+{
+    private HashMap colors = new HashMap();
+
+    public String getColor(FacesContext context, HtmlSchedule schedule, ScheduleEntry entry, boolean selected)
+    {
+        if (colors.containsKey(entry.getId())) return (String)colors.get(entry.getId());
+        StringBuffer color = new StringBuffer();
+        Random random = new Random();
+        color.append("rgb(");
+        color.append(random.nextInt(255));
+        color.append(",");
+        color.append(random.nextInt(255));
+        color.append(",");
+        color.append(random.nextInt(255));
+        color.append(")");
+        String colorString = color.toString();
+        colors.put(entry.getId(), colorString);
+        return colorString;
+    }
+
+}

Added: myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleExampleHandler.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleExampleHandler.java?rev=368941&view=auto
==============================================================================
--- myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleExampleHandler.java (added)
+++ myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleExampleHandler.java Fri Jan 13 17:03:22 2006
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.myfaces.examples.schedule;
+
+import java.io.Serializable;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import javax.faces.event.ActionEvent;
+
+import org.apache.commons.lang.RandomStringUtils;
+import org.apache.myfaces.custom.schedule.model.DefaultScheduleEntry;
+import org.apache.myfaces.custom.schedule.model.ScheduleModel;
+import org.apache.myfaces.custom.schedule.model.SimpleScheduleModel;
+
+public class ScheduleExampleHandler implements Serializable
+{
+    private static final long serialVersionUID = -8815771399735333108L;
+
+    private ScheduleModel model;
+
+    public ScheduleModel getModel()
+    {
+        return model;
+    }
+
+    public void setModel(ScheduleModel model)
+    {
+        this.model = model;
+    }
+
+    public void deleteSelectedEntry(ActionEvent event)
+    {
+        if (model == null)
+            return;
+        model.removeSelectedEntry();
+    }
+
+    public void addSampleHoliday(ActionEvent event)
+    {
+        if (model instanceof SimpleScheduleModel)
+        {
+            SimpleScheduleModel ssm = (SimpleScheduleModel) model;
+            Calendar calendar = GregorianCalendar.getInstance();
+            calendar.setTime(ssm.getSelectedDate());
+            calendar.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY);
+            ssm.setHoliday(calendar.getTime(), "Poeperkesdag");
+            ssm.refresh();
+        }
+    }
+
+    public void addSampleEntries(ActionEvent event)
+    {
+        if (model == null)
+            return;
+        Calendar calendar = GregorianCalendar.getInstance();
+        calendar.setTime(model.getSelectedDate());
+        calendar.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
+        DefaultScheduleEntry entry1 = new DefaultScheduleEntry();
+        // every entry in a schedule must have a unique id
+        entry1.setId(RandomStringUtils.randomNumeric(32));
+        calendar.add(Calendar.MINUTE, -5);
+        entry1.setStartTime(calendar.getTime());
+        calendar.add(Calendar.MINUTE, 45);
+        entry1.setEndTime(calendar.getTime());
+        entry1.setTitle("Test MyFaces schedule component");
+        entry1.setSubtitle("my office");
+        entry1
+                .setDescription("We need to get this thing out of the sandbox ASAP");
+        model.addEntry(entry1);
+        DefaultScheduleEntry entry2 = new DefaultScheduleEntry();
+        entry2.setId(RandomStringUtils.randomNumeric(32));
+        // entry2 overlaps entry1
+        calendar.add(Calendar.MINUTE, -20);
+        entry2.setStartTime(calendar.getTime());
+        calendar.add(Calendar.HOUR, 2);
+        entry2.setEndTime(calendar.getTime());
+        entry2.setTitle("Show schedule component to boss");
+        entry2.setSubtitle("my office");
+        entry2.setDescription("Convince him to get time to thoroughly test it");
+        model.addEntry(entry2);
+        DefaultScheduleEntry entry3 = new DefaultScheduleEntry();
+        entry3.setId(RandomStringUtils.randomNumeric(32));
+        calendar.add(Calendar.DATE, 1);
+        calendar.set(Calendar.HOUR_OF_DAY, 9);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        entry3.setStartTime(calendar.getTime());
+        calendar.set(Calendar.HOUR_OF_DAY, 17);
+        entry3.setEndTime(calendar.getTime());
+        entry3.setTitle("Thoroughly test schedule component");
+        model.addEntry(entry3);
+        model.refresh();
+    }
+}

Added: myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleSettings.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleSettings.java?rev=368941&view=auto
==============================================================================
--- myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleSettings.java (added)
+++ myfaces/sandbox/trunk/sandbox-examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleSettings.java Fri Jan 13 17:03:22 2006
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.examples.schedule;
+
+import java.io.Serializable;
+
+import org.apache.myfaces.custom.schedule.model.ScheduleModel;
+
+public class ScheduleSettings implements Serializable
+{
+    private ScheduleModel model;
+    
+    private static final long serialVersionUID = -8547428935814382762L;
+
+    private int compactMonthRowHeight;
+
+    private int compactWeekRowHeight;
+
+    private String headerDateFormat;
+
+    private boolean readonly;
+
+    private String theme;
+
+    private boolean tooltip;
+
+    private int visibleEndHour;
+
+    private int visibleStartHour;
+
+    private int workingEndHour;
+
+    private int workingStartHour;
+
+    public int getCompactMonthRowHeight()
+    {
+        return compactMonthRowHeight;
+    }
+
+    public int getCompactWeekRowHeight()
+    {
+        return compactWeekRowHeight;
+    }
+
+    public String getHeaderDateFormat()
+    {
+        return headerDateFormat;
+    }
+
+    public String getTheme()
+    {
+        return theme;
+    }
+
+    public int getVisibleEndHour()
+    {
+        return visibleEndHour;
+    }
+
+    public int getVisibleStartHour()
+    {
+        return visibleStartHour;
+    }
+
+    public int getWorkingEndHour()
+    {
+        return workingEndHour;
+    }
+
+    public int getWorkingStartHour()
+    {
+        return workingStartHour;
+    }
+
+    public boolean isReadonly()
+    {
+        return readonly;
+    }
+
+    public boolean isTooltip()
+    {
+        return tooltip;
+    }
+
+    public String save()
+    {
+        model.refresh();
+        return "success";
+    }
+
+    public void setCompactMonthRowHeight(int compactMonthRowHeight)
+    {
+        this.compactMonthRowHeight = compactMonthRowHeight;
+    }
+
+    public void setCompactWeekRowHeight(int compactWeekRowHeight)
+    {
+        this.compactWeekRowHeight = compactWeekRowHeight;
+    }
+
+    public void setHeaderDateFormat(String headerDateFormat)
+    {
+        this.headerDateFormat = headerDateFormat;
+    }
+
+    public void setReadonly(boolean readonly)
+    {
+        this.readonly = readonly;
+    }
+
+    public void setTheme(String theme)
+    {
+        this.theme = theme;
+    }
+
+    public void setTooltip(boolean tooltip)
+    {
+        this.tooltip = tooltip;
+    }
+
+    public void setVisibleEndHour(int visibleEndHour)
+    {
+        this.visibleEndHour = visibleEndHour;
+    }
+
+    public void setVisibleStartHour(int visibleStartHour)
+    {
+        this.visibleStartHour = visibleStartHour;
+    }
+
+    public void setWorkingEndHour(int workingEndHour)
+    {
+        this.workingEndHour = workingEndHour;
+    }
+
+    public void setWorkingStartHour(int workingStartHour)
+    {
+        this.workingStartHour = workingStartHour;
+    }
+
+    public ScheduleModel getModel()
+    {
+        return model;
+    }
+
+    public void setModel(ScheduleModel model)
+    {
+        this.model = model;
+    }
+}

Modified: myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/WEB-INF/examples-config.xml
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/WEB-INF/examples-config.xml?rev=368941&r1=368940&r2=368941&view=diff
==============================================================================
--- myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/WEB-INF/examples-config.xml (original)
+++ myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/WEB-INF/examples-config.xml Fri Jan 13 17:03:22 2006
@@ -264,41 +264,143 @@
   </managed-bean>
 
 
-  <!-- Managed Beans for schedule.jsp -->
+  <!--  managed beans for schedule examples -->
+  <managed-bean>
+  	<managed-bean-name>today</managed-bean-name>
+  	<managed-bean-class>java.util.Date</managed-bean-class>
+  	<managed-bean-scope>application</managed-bean-scope>
+  </managed-bean>
+  
+  <managed-bean>
+  	<managed-bean-name>scheduleModel1</managed-bean-name>
+  	<managed-bean-class>org.apache.myfaces.custom.schedule.model.SimpleScheduleModel</managed-bean-class>
+  	<managed-bean-scope>session</managed-bean-scope>
+  		<managed-property>
+  			<property-name>mode</property-name>
+  			<value>1</value>
+  		</managed-property>
+  		<managed-property>
+  			<property-name>selectedDate</property-name>
+  			<value>#{today}</value>
+  		</managed-property>
+  </managed-bean>
+  
+  <managed-bean>
+    <managed-bean-name>scheduleHandler1</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.examples.schedule.ScheduleExampleHandler</managed-bean-class>
+    <managed-bean-scope>session</managed-bean-scope>
+    	<managed-property>
+    		<property-name>model</property-name>
+    		<value>#{scheduleModel1}</value>
+    	</managed-property>
+  </managed-bean>
+  
+  <managed-bean>
+  	<managed-bean-name>addEntryHandler</managed-bean-name>
+  	<managed-bean-class>org.apache.myfaces.examples.schedule.AddEntryHandler</managed-bean-class>
+  	<managed-bean-scope>request</managed-bean-scope>
+    	<managed-property>
+    		<property-name>model</property-name>
+    		<value>#{scheduleModel1}</value>
+    	</managed-property>
+  </managed-bean>
+  
+  <managed-bean>
+  	<managed-bean-name>scheduleModel2</managed-bean-name>
+  	<managed-bean-class>org.apache.myfaces.custom.schedule.model.SimpleScheduleModel</managed-bean-class>
+  	<managed-bean-scope>session</managed-bean-scope>
+  		<managed-property>
+  			<property-name>mode</property-name>
+  			<value>1</value>
+  		</managed-property>
+  		<managed-property>
+  			<property-name>selectedDate</property-name>
+  			<value>#{today}</value>
+  		</managed-property>
+  </managed-bean>
 
   <managed-bean>
-    <managed-bean-name>scheduleBean</managed-bean-name>
-    <managed-bean-class>org.apache.myfaces.examples.schedule.ScheduleBean</managed-bean-class>
+    <managed-bean-name>scheduleHandler2</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.examples.schedule.ScheduleExampleHandler</managed-bean-class>
     <managed-bean-scope>session</managed-bean-scope>
-        <managed-property>
-            <property-name>mode</property-name>
-            <value>1</value>
-        </managed-property>
-        <managed-property>
-            <property-name>theme</property-name>
-            <value>default</value>
-        </managed-property>
-        <managed-property>
-            <property-name>readonly</property-name>
-            <value>false</value>
-        </managed-property>
-        <managed-property>
-            <property-name>tooltip</property-name>
-            <value>true</value>
-        </managed-property>
+    	<managed-property>
+    		<property-name>model</property-name>
+    		<value>#{scheduleModel2}</value>
+    	</managed-property>
+  </managed-bean>
+  
+  <managed-bean>
+  	<managed-bean-name>scheduleSettings2</managed-bean-name>
+  	<managed-bean-class>org.apache.myfaces.examples.schedule.ScheduleSettings</managed-bean-class>
+  	<managed-bean-scope>session</managed-bean-scope>
+    	<managed-property>
+    		<property-name>model</property-name>
+    		<value>#{scheduleModel2}</value>
+    	</managed-property>
+  		<managed-property>
+  			<property-name>visibleStartHour</property-name>
+  			<value>8</value>
+  		</managed-property>
+  		<managed-property>
+  			<property-name>visibleEndHour</property-name>
+  			<value>18</value>
+  		</managed-property>
+  		<managed-property>
+  			<property-name>workingStartHour</property-name>
+  			<value>9</value>
+  		</managed-property>
+  		<managed-property>
+  			<property-name>workingEndHour</property-name>
+  			<value>17</value>
+  		</managed-property>
+  		<managed-property>
+  			<property-name>tooltip</property-name>
+  			<value>true</value>
+  		</managed-property>
+  		<managed-property>
+  			<property-name>readonly</property-name>
+  			<value>false</value>
+  		</managed-property>
+  		<managed-property>
+  			<property-name>theme</property-name>
+  			<value>default</value>
+  		</managed-property>
+  		<managed-property>
+  			<property-name>headerDateFormat</property-name>
+  			<value>yyyy-MM-dd</value>
+  		</managed-property>
+  		<managed-property>
+  			<property-name>compactWeekRowHeight</property-name>
+  			<value>200</value>
+  		</managed-property>
+  		<managed-property>
+  			<property-name>compactMonthRowHeight</property-name>
+  			<value>100</value>
+  		</managed-property>
   </managed-bean>
 
   <managed-bean>
-    <managed-bean-name>appointmentBean</managed-bean-name>
-    <managed-bean-class>org.apache.myfaces.examples.schedule.AppointmentBean</managed-bean-class>
-    <managed-bean-scope>request</managed-bean-scope>
-        <managed-property>
-            <property-name>scheduleBean</property-name>
-            <value>#{scheduleBean}</value>
-        </managed-property>
+  	<managed-bean-name>scheduleThemeChoices</managed-bean-name>
+  	<managed-bean-class>java.util.TreeMap</managed-bean-class>
+  	<managed-bean-scope>application</managed-bean-scope>
+  	<map-entries>
+  		<map-entry>
+  			<key>default</key>
+  			<value>default</value>
+  		</map-entry>
+  		<map-entry>
+  			<key>evolution</key>
+  			<value>evolution</value>
+  		</map-entry>
+  		<map-entry>
+  			<key>outlookxp</key>
+  			<value>outlookxp</value>
+  		</map-entry>
+  	</map-entries>
   </managed-bean>
 
-	<!-- managed bean for graphicImageAjax-->
+
+<!-- managed bean for graphicImageAjax-->
 
 	<managed-bean>
 		<managed-bean-name>graphicImageDynamicBean</managed-bean-name>
@@ -401,6 +503,77 @@
 		<managed-bean-class>org.apache.myfaces.examples.dateTimeConverter.DateTimeConverterBean</managed-bean-class>
 		<managed-bean-scope>session</managed-bean-scope>
 	</managed-bean>
+
+
+	<!-- navigational rules for the schedule examples -->
+	<navigation-rule>
+		<from-view-id>/schedule.jsp</from-view-id>
+		<navigation-case>
+			<from-outcome>schedule1</from-outcome>
+			<to-view-id>/schedule/example1.jsp</to-view-id>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>schedule2</from-outcome>
+			<to-view-id>/schedule/example2.jsp</to-view-id>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>schedule3</from-outcome>
+			<to-view-id>/schedule/example3.jsp</to-view-id>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>schedule4</from-outcome>
+			<to-view-id>/schedule/example4.jsp</to-view-id>
+		</navigation-case>
+	</navigation-rule>
+	
+	<navigation-rule>
+		<from-view-id>/schedule/example2.jsp</from-view-id>
+		<navigation-case>
+			<from-outcome>add_entry</from-outcome>
+			<to-view-id>/schedule/addentry.jsp</to-view-id>
+		</navigation-case>
+	</navigation-rule>
+	
+	<navigation-rule>
+		<from-view-id>/schedule/addentry.jsp</from-view-id>
+		<navigation-case>
+			<from-outcome>success</from-outcome>
+			<to-view-id>/schedule/example2.jsp</to-view-id>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>cancel</from-outcome>
+			<to-view-id>/schedule/example2.jsp</to-view-id>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>failure</from-outcome>
+			<to-view-id>/schedule/addentry.jsp</to-view-id>
+		</navigation-case>
+	</navigation-rule>
+	
+	<navigation-rule>
+		<from-view-id>/schedule/example3.jsp</from-view-id>
+		<navigation-case>
+			<from-outcome>edit_settings</from-outcome>
+			<to-view-id>/schedule/editsettings.jsp</to-view-id>
+		</navigation-case>
+	</navigation-rule>
+
+	<navigation-rule>
+		<from-view-id>/schedule/editsettings.jsp</from-view-id>
+		<navigation-case>
+			<from-outcome>success</from-outcome>
+			<to-view-id>/schedule/example3.jsp</to-view-id>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>cancel</from-outcome>
+			<to-view-id>/schedule/example3.jsp</to-view-id>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>failure</from-outcome>
+			<to-view-id>/schedule/editsettings.jsp</to-view-id>
+		</navigation-case>
+	</navigation-rule>
+	
 
 
     <!-- navigational rules for the wizard -->

Modified: myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule.jsp
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule.jsp?rev=368941&r1=368940&r2=368941&view=diff
==============================================================================
--- myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule.jsp (original)
+++ myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule.jsp Fri Jan 13 17:03:22 2006
@@ -26,185 +26,26 @@
 
     <body>
         <f:view>
-         <h:form>
-            <h:messages
-                tooltip="true"
-                id="scheduleMessages"
-                layout="table"
-                globalOnly="false"/>
-                
-            <table cellpadding="5" border="0">
-                <tr>
-                    <td valign="top">
-                        <h:panelGrid cellpadding="0" cellspacing="5" columns="1">
-                            <x:inputCalendar
-                                id="scheduleNavigator"
-                                monthYearRowClass="yearMonthHeader"
-                                weekRowClass="weekHeader"
-                                currentDayCellClass="currentDayCell"
-                                value="#{scheduleBean.date}"
-                                valueChangeListener="#{scheduleBean.calendarValueChanged}"
-                                binding="#{scheduleBean.dateInput}"/>
-                            <h:outputLabel
-                                for="modeInput"
-                                id="modeLabel"
-                                value="mode:"/>
-                            <h:selectOneMenu
-                                id="modeInput"
-                                binding="#{scheduleBean.modeInput}"
-                                immediate="true"
-                                valueChangeListener="#{scheduleBean.modeValueChanged}"
-                                onchange="this.form.submit();"
-                                value="#{scheduleBean.mode}">
-                                <f:selectItems
-                                    id="modeItems"
-                                    value="#{scheduleBean.modeItems}"/>
-                            </h:selectOneMenu>
-                            <h:outputLabel
-                                for="themeInput"
-                                id="themeLabel"
-                                value="theme:" />
-                            <h:selectOneMenu
-                                id="themeInput"
-                                immediate="true"
-                                onchange="this.form.submit();"
-                                value="#{scheduleBean.theme}">
-                                <f:selectItem
-                                    itemValue="default"
-                                    itemLabel="default"/>
-                                <f:selectItem
-                                    itemValue="outlookxp"
-                                    itemLabel="Outlook XP"/>
-                                <f:selectItem
-                                    itemValue="evolution"
-                                    itemLabel="Evolution"/>
-                            </h:selectOneMenu>
-                            <h:outputLabel
-                                for="readonlyInput"
-                                id="readonlyLabel"
-                                value="read-only:" />
-                            <h:selectBooleanCheckbox
-                                id="readonlyInput"
-                                value="#{scheduleBean.readonly}"
-                                valueChangeListener="#{scheduleBean.readonlyValueChanged}"
-                                immediate="true"
-                                onchange="this.form.submit();"
-                                title="read-only?"/>
-                            <h:outputLabel
-                                for="tooltipInput"
-                                id="tooltipLabel"
-                                value="show tooltips:" />
-                            <h:selectBooleanCheckbox
-                                id="tooltipInput"
-                                value="#{scheduleBean.tooltip}"
-                                immediate="true"
-                                onchange="this.form.submit();"
-                                title="show tooltips?"/>
-                        </h:panelGrid>
-                    </td>
-                    <td width="100%">
-                        <s:schedule
-                            value="#{scheduleBean.model}"
-                            id="schedule1"
-                            rendered="true"
-                            visibleEndHour="18"
-                            visibleStartHour="8"
-                            workingEndHour="17"
-                            workingStartHour="9"
-                            readonly="#{scheduleBean.readonly}"
-                            actionListener="#{scheduleBean.scheduleActionPerformed}"
-                            tooltip="#{scheduleBean.tooltip}"
-                            theme="#{scheduleBean.theme}"/>
-                    </td>
-                </tr>
-                <tr>
-                    <td valign="top">
-                        <h3><h:outputText value="add appointment"/></h3>
-                    </td>
-                    <td>
-                        <h:panelGrid cellpadding="0" cellspacing="0" columns="2">
-                            <h:outputLabel
-                                for="appStart"
-                                value="start:"/>
-                            <x:inputDate
-                                id="appStart"
-                                value="#{appointmentBean.appointmentStart}"
-                                type="both"/>
-                            <h:outputLabel
-                                for="appEnd"
-                                value="end:"/>
-                            <x:inputDate
-                                id="appEnd"
-                                value="#{appointmentBean.appointmentEnd}"
-                                type="both"/>
-                            <h:outputLabel
-                                for="appTitle"
-                                value="title:"/>
-                            <h:inputText
-                                size="60"
-                                id="appTitle"
-                                value="#{appointmentBean.appointmentTitle}"/>
-                            <h:outputLabel
-                                for="appLocation"
-                                value="location:"/>
-                            <h:inputText
-                                size="60"
-                                id="appLocation"
-                                value="#{appointmentBean.appointmentLocation}"/>
-                            <h:outputLabel
-                                for="appComments"
-                                value="comments:"/>
-                            <h:inputTextarea
-                                cols="60"
-                                rows="5"
-                                id="appComments"
-                                value="#{appointmentBean.appointmentComments}"/>
-                            <h:commandButton
-                                value="Add appointment"
-                                actionListener="#{appointmentBean.addAppointment}"/>
-                        </h:panelGrid>
-                    </td>
-                </tr>
-                <tr>
-                    <td valign="top">
-                        <h3><h:outputText value="remove appointment"/></h3>
-                    </td>
-                    <td>
-                        <h:commandButton
-                            value="Remove selected appointment"
-                            actionListener="#{appointmentBean.removeAppointment}"
-                            disabled="#{!scheduleBean.entrySelected}"/>
-                    </td>
-                </tr>
-                <tr>
-                    <td valign="top">
-                        <h3><h:outputText value="add holiday"/></h3>
-                    </td>
-                    <td>
-                        <h:panelGrid cellpadding="0" cellspacing="0" columns="2">
-                            <h:outputLabel
-                                for="holidayDate"
-                                value="date:"/>
-                            <x:inputDate
-                                id="holidayDate"
-                                value="#{appointmentBean.holidayDate}"
-                                type="date"/>
-                            <h:outputLabel
-                                for="holidayName"
-                                value="name:"/>
-                            <h:inputText
-                                size="60"
-                                id="holidayName"
-                                value="#{appointmentBean.holidayName}"/>
-                            <h:commandButton
-                                value="Add holiday"
-                                actionListener="#{appointmentBean.addHoliday}"/>
-                        </h:panelGrid>
-                    </td>
-                </tr>
-            </table>
-
-         </h:form>
+        	<t:htmlTag value="h1">Schedule examples</t:htmlTag>
+        	<h:panelGrid columns="2">
+        		<h:commandLink value="Example 1" action="schedule1" />
+        		<h:outputText value="A very simple example, containing a
+        		schedule component in workweek mode, and a calendar
+        		component that is used to navigate through the schedule. The
+        		schedule is backed by a SimpleScheduleModel, storing
+        		appointments in session scope. " />
+        		<h:commandLink value="Example 2" action="schedule2" />
+        		<h:outputText value="The same example, but now with the
+        		possibility to add and delete appointments." />
+        		<h:commandLink value="Example 3" action="schedule3" />
+        		<h:outputText value="This example shows how you can customize
+        		the look and feel of the schedule component" />
+        		<h:commandLink value="Example 4" action="schedule4" />
+        		<h:outputText value="A rather ugly example showing how you
+        		can override the theme for some parts of the schedule. Also
+        		a custom EntryRenderer, which assigns a random color to each
+        		entry, is used."/>
+        	</h:panelGrid>
         </f:view>
     </body>
 

Added: myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/addentry.jsp
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/addentry.jsp?rev=368941&view=auto
==============================================================================
--- myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/addentry.jsp (added)
+++ myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/addentry.jsp Fri Jan 13 17:03:22 2006
@@ -0,0 +1,58 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
+<%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s"%>
+
+<!--
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//-->
+
+<html>
+<%@include file="../inc/head.inc"%>
+<body>
+<f:view>
+	<h:form>
+		<t:htmlTag value="h3">Add entry</t:htmlTag>
+		<h:messages tooltip="true" layout="table" globalOnly="true" />
+		<h:panelGrid columns="3">
+			<h:outputLabel for="from" value="from:" />
+			<t:inputDate id="from" value="#{addEntryHandler.from}" type="both"
+				required="true" popupCalendar="true"/>
+			<h:message for="from" />
+			<h:outputLabel for="until" value="until:" />
+			<t:inputDate id="until" value="#{addEntryHandler.until}" type="both"
+				required="true" popupCalendar="true"/>
+			<h:message for="until" />
+			<h:outputLabel for="title" value="title:" />
+			<h:inputText id="title" value="#{addEntryHandler.title}" required="true" />
+			<h:message for="title" />
+			<h:outputLabel for="location" value="location:" />
+			<h:inputText id="location" value="#{addEntryHandler.location}" />
+			<h:message for="location" />
+			<h:outputLabel for="comments" value="comments:" />
+			<h:inputTextarea id="comments" value="#{addEntryHandler.comments}" />
+			<h:message for="comments" />
+		</h:panelGrid>
+		<h:panelGrid columns="2">
+			<h:commandButton action="#{addEntryHandler.add}" value="add" />
+			<h:commandButton action="cancel" value="cancel" immediate="true"/>
+		</h:panelGrid>
+	</h:form>
+<%@include file="../inc/page_footer.jsp"%>
+</f:view>
+</body>
+</html>

Added: myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/editsettings.jsp
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/editsettings.jsp?rev=368941&view=auto
==============================================================================
--- myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/editsettings.jsp (added)
+++ myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/editsettings.jsp Fri Jan 13 17:03:22 2006
@@ -0,0 +1,104 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
+<%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s"%>
+
+<!--
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//-->
+
+<html>
+<%@include file="../inc/head.inc"%>
+<body>
+<f:view>
+	<h:form>
+		<t:htmlTag value="h3">Edit settings</t:htmlTag>
+		<h:messages tooltip="true" layout="table" globalOnly="true" />
+		<h:panelGrid columns="3">
+			<h:outputLabel for="mode" value="Display mode:" />
+			<h:selectOneRadio id="mode" value="#{scheduleHandler2.model.mode}">
+				<f:selectItem itemValue="0" itemLabel="day"/>
+				<f:selectItem itemValue="1" itemLabel="workweek"/>
+				<f:selectItem itemValue="2" itemLabel="week" />
+				<f:selectItem itemValue="3" itemLabel="month" />
+			</h:selectOneRadio>
+			<h:message for="mode" />
+			<h:outputLabel for="visibleStartHour" value="Display from:" />
+			<h:inputText id="visibleStartHour"
+				value="#{scheduleSettings2.visibleStartHour}" required="true">
+				<f:validateLongRange minimum="0" maximum="11" />
+			</h:inputText>
+			<h:message for="visibleStartHour" />
+			<h:outputLabel for="visibleEndHour" value="Display until:" />
+			<h:inputText id="visibleEndHour"
+				value="#{scheduleSettings2.visibleEndHour}" required="true">
+				<f:validateLongRange minimum="13" maximum="24" />
+			</h:inputText>
+			<h:message for="visibleEndHour" />
+			<h:outputLabel for="workingStartHour" value="Working day starts at:" />
+			<h:inputText id="workingStartHour"
+				value="#{scheduleSettings2.workingStartHour}" required="true">
+				<f:validateLongRange minimum="7" maximum="11" />
+			</h:inputText>
+			<h:message for="workingStartHour" />
+			<h:outputLabel for="workingEndHour" value="Working day ends at:" />
+			<h:inputText id="workingEndHour"
+				value="#{scheduleSettings2.workingEndHour}" required="true">
+				<f:validateLongRange minimum="15" maximum="22" />
+			</h:inputText>
+			<h:message for="workingEndHour" />
+			<h:outputLabel for="readonly" value="Schedule is read only:" />
+			<h:selectBooleanCheckbox id="readonly"
+				value="#{scheduleSettings2.readonly}" required="true" />
+			<h:message for="readonly" />
+			<h:outputLabel for="tooltip" value="Show tooltips:" />
+			<h:selectBooleanCheckbox id="tooltip"
+				value="#{scheduleSettings2.tooltip}" required="true" />
+			<h:message for="tooltip" />
+			<h:outputLabel for="theme" value="Theme:" />
+			<h:selectOneRadio id="theme" value="#{scheduleSettings2.theme}"
+				required="true">
+				<f:selectItems value="#{scheduleThemeChoices}" />
+			</h:selectOneRadio>
+			<h:message for="theme" />
+			<h:outputLabel for="headerDateFormat" value="Header date format:" />
+			<h:inputText id="headerDateFormat"
+				value="#{scheduleSettings2.headerDateFormat}" required="true" />
+			<h:message for="headerDateFormat" />
+			<h:outputLabel for="compactWeekRowHeight"
+				value="Row height in week mode:" />
+			<h:inputText id="compactWeekRowHeight"
+				value="#{scheduleSettings2.compactWeekRowHeight}" required="true">
+				<f:validateLongRange minimum="100" maximum="300" />
+			</h:inputText>
+			<h:message for="compactWeekRowHeight" />
+			<h:outputLabel for="compactMonthRowHeight"
+				value="Row height in month mode:" />
+			<h:inputText id="compactMonthRowHeight"
+				value="#{scheduleSettings2.compactMonthRowHeight}" required="true">
+				<f:validateLongRange minimum="50" maximum="150" />
+			</h:inputText>
+			<h:message for="compactMonthRowHeight" />
+		</h:panelGrid>
+		<h:panelGrid columns="2">
+			<h:commandButton action="#{scheduleSettings2.save}" value="save" />
+		</h:panelGrid>
+	</h:form>
+	<%@include file="../inc/page_footer.jsp"%>
+</f:view>
+</body>
+</html>

Added: myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example1.jsp
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example1.jsp?rev=368941&view=auto
==============================================================================
--- myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example1.jsp (added)
+++ myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example1.jsp Fri Jan 13 17:03:22 2006
@@ -0,0 +1,53 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
+<%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s"%>
+
+<!--
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//-->
+
+<html>
+<%@include file="../inc/head.inc"%>
+<body>
+<f:view>
+	<h:form>
+		<!--  The schedule itself -->
+		<t:div style="position: absolute; left: 220px; top: 5px; right: 5px;">
+			<s:schedule value="#{scheduleHandler1.model}" id="schedule1"
+				rendered="true" visibleEndHour="18" visibleStartHour="8"
+				workingEndHour="17" workingStartHour="9" readonly="false"
+				theme="evolution" tooltip="true" />
+		</t:div>
+		<!--  The column on the left, containing the calendar and other controls -->
+		<t:div style="position: absolute; left: 5px; top: 5px; width: 210px;">
+			<h:panelGrid columns="1">
+				<t:inputCalendar id="scheduleNavigator"
+					value="#{scheduleHandler1.model.selectedDate}" />
+				<h:commandButton
+					actionListener="#{scheduleHandler1.addSampleEntries}"
+					value="add sample entries" />
+				<h:commandButton
+					actionListener="#{scheduleHandler1.addSampleHoliday}"
+					value="add sample holiday" />
+			</h:panelGrid>
+    <%@include file="../inc/page_footer.jsp" %>
+		</t:div>
+	</h:form>
+</f:view>
+</body>
+</html>

Added: myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example2.jsp
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example2.jsp?rev=368941&view=auto
==============================================================================
--- myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example2.jsp (added)
+++ myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example2.jsp Fri Jan 13 17:03:22 2006
@@ -0,0 +1,54 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
+<%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s"%>
+
+<!--
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//-->
+
+<html>
+<%@include file="../inc/head.inc"%>
+<body>
+<f:view>
+	<h:form>
+		<!--  The schedule itself -->
+		<t:div style="position: absolute; left: 220px; top: 5px; right: 5px;">
+			<s:schedule value="#{scheduleHandler1.model}" id="schedule1"
+				rendered="true" visibleEndHour="18" visibleStartHour="8"
+				workingEndHour="17" workingStartHour="9" readonly="false"
+				theme="evolution" tooltip="true" />
+		</t:div>
+		<!--  The column on the left, containing the calendar and other controls -->
+		<t:div style="position: absolute; left: 5px; top: 5px; width: 210px;">
+			<h:panelGrid columns="1">
+				<t:inputCalendar id="scheduleNavigator"
+					value="#{scheduleHandler1.model.selectedDate}" />
+				<h:commandButton
+					action="add_entry"
+					value="add entry" />
+				<h:commandButton
+					actionListener="#{scheduleHandler1.deleteSelectedEntry}"
+					value="delete selected entry"
+					rendered="#{scheduleHandler1.model.entrySelected}"/>
+			</h:panelGrid>
+		    <%@include file="../inc/page_footer.jsp" %>
+		</t:div>
+	</h:form>
+</f:view>
+</body>
+</html>

Added: myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example3.jsp
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example3.jsp?rev=368941&view=auto
==============================================================================
--- myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example3.jsp (added)
+++ myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example3.jsp Fri Jan 13 17:03:22 2006
@@ -0,0 +1,63 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
+<%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s"%>
+
+<!--
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//-->
+
+<html>
+<%@include file="../inc/head.inc"%>
+<body>
+<f:view>
+	<h:form>
+		<!--  The schedule itself -->
+		<t:div style="position: absolute; left: 220px; top: 5px; right: 5px;">
+			<s:schedule value="#{scheduleHandler2.model}" id="schedule1"
+				rendered="true" visibleEndHour="#{scheduleSettings2.visibleEndHour}"
+				visibleStartHour="#{scheduleSettings2.visibleStartHour}"
+				workingEndHour="#{scheduleSettings2.workingEndHour}"
+				workingStartHour="#{scheduleSettings2.workingStartHour}"
+				readonly="#{scheduleSettings2.readonly}"
+				theme="#{scheduleSettings2.theme}"
+				tooltip="#{scheduleSettings2.tooltip}"
+				headerDateFormat="#{scheduleSettings2.headerDateFormat}"
+				compactWeekRowHeight="#{scheduleSettings2.compactWeekRowHeight}"
+				compactMonthRowHeight="#{scheduleSettings2.compactMonthRowHeight}" />
+		</t:div>
+		<!--  The column on the left, containing the calendar and other controls -->
+		<t:div style="position: absolute; left: 5px; top: 5px; width: 210px;">
+			<h:panelGrid columns="1">
+				<t:inputCalendar id="scheduleNavigator"
+					value="#{scheduleHandler2.model.selectedDate}" />
+				<h:commandButton
+					actionListener="#{scheduleHandler2.addSampleEntries}"
+					value="add sample entries" />
+				<h:commandButton
+					actionListener="#{scheduleHandler2.addSampleHoliday}"
+					value="add sample holiday" />
+				<h:commandButton
+					action="edit_settings"
+					value="Schedule properties..." />
+			</h:panelGrid>
+			<%@include file="../inc/page_footer.jsp"%>
+		</t:div>
+	</h:form>
+</f:view>
+</body>
+</html>

Added: myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example4.jsp
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example4.jsp?rev=368941&view=auto
==============================================================================
--- myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example4.jsp (added)
+++ myfaces/sandbox/trunk/sandbox-examples/src/main/webapp/schedule/example4.jsp Fri Jan 13 17:03:22 2006
@@ -0,0 +1,83 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
+<%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s"%>
+
+<!--
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//-->
+
+<html>
+<head>
+<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8" />
+<title>MyFaces - the free JSF Implementation</title>
+<link rel="stylesheet" type="text/css" href="css/basic.css" />
+<style>
+table.background td.evenReddish,
+table.background td.unevenReddish,
+table.background td.freeReddish {
+    font-family: Verdana, Arial, Helvetica, Sans-Serif;
+    font-size: 10px;
+    text-align: center;
+}
+
+table.background td.unevenReddish {
+    background-color: rgb(240,220,220);
+    color: rgb(230,220,220);
+}
+
+table.background td.evenReddish {
+    background-color: rgb(255,230,230);
+    color: rgb(240,230,230);
+}
+
+table.background td.freeReddish {
+	background-color: rgb(255,0,0);
+	color: rgb(255,0,0);
+}
+  </style>
+</head>
+<body>
+<f:view>
+	<h:form>
+		<!--  The schedule itself -->
+		<t:div style="position: absolute; left: 220px; top: 5px; right: 5px;">
+			<s:schedule value="#{scheduleHandler1.model}" id="schedule1"
+				rendered="true" visibleEndHour="18" visibleStartHour="8"
+				workingEndHour="17" workingStartHour="9" readonly="false"
+				theme="outlookxp" tooltip="true"
+				evenClass="evenReddish" unevenClass="unevenReddish" freeClass="freeReddish"
+				entryRenderer="org.apache.myfaces.examples.schedule.RandomColorScheduleEntryRenderer" />
+		</t:div>
+		<!--  The column on the left, containing the calendar and other controls -->
+		<t:div style="position: absolute; left: 5px; top: 5px; width: 210px;">
+			<h:panelGrid columns="1">
+				<t:inputCalendar id="scheduleNavigator"
+					value="#{scheduleHandler1.model.selectedDate}" />
+				<h:commandButton
+					actionListener="#{scheduleHandler1.addSampleEntries}"
+					value="add sample entries" />
+				<h:commandButton
+					actionListener="#{scheduleHandler1.addSampleHoliday}"
+					value="add sample holiday" />
+			</h:panelGrid>
+			<%@include file="../inc/page_footer.jsp"%>
+		</t:div>
+	</h:form>
+</f:view>
+</body>
+</html>

Modified: myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/ScheduleTag.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/ScheduleTag.java?rev=368941&r1=368940&r2=368941&view=diff
==============================================================================
--- myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/ScheduleTag.java (original)
+++ myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/ScheduleTag.java Fri Jan 13 17:03:22 2006
@@ -50,6 +50,34 @@
     private String visibleStartHour;
     private String workingEndHour;
     private String workingStartHour;
+    
+    private String columnClass;
+    private String backgroundClass;
+    private String freeClass;
+    private String evenClass;
+    private String unevenClass;
+    private String gutterClass;
+    private String headerClass;
+    private String dateClass;
+    private String holidayClass;
+    private String hoursClass;
+    private String minutesClass;
+    private String selectedEntryClass;
+    private String textClass;
+    private String titleClass;
+    private String subtitleClass;
+    private String entryClass;
+    private String foregroundClass;
+    
+    private String dayClass;
+    private String inactiveDayClass;
+    private String contentClass;
+    private String selectedClass;
+    private String monthClass;
+    private String weekClass;
+    
+    private String entryRenderer;
+    
 
     //~ Methods ----------------------------------------------------------------
 
@@ -433,6 +461,246 @@
         return workingStartHour;
     }
 
+    public String getBackgroundClass()
+    {
+        return backgroundClass;
+    }
+
+    public void setBackgroundClass(String backgroundClass)
+    {
+        this.backgroundClass = backgroundClass;
+    }
+
+    public String getColumnClass()
+    {
+        return columnClass;
+    }
+
+    public void setColumnClass(String columnClass)
+    {
+        this.columnClass = columnClass;
+    }
+
+    public String getContentClass()
+    {
+        return contentClass;
+    }
+
+    public void setContentClass(String contentClass)
+    {
+        this.contentClass = contentClass;
+    }
+
+    public String getDateClass()
+    {
+        return dateClass;
+    }
+
+    public void setDateClass(String dateClass)
+    {
+        this.dateClass = dateClass;
+    }
+
+    public String getDayClass()
+    {
+        return dayClass;
+    }
+
+    public void setDayClass(String dayClass)
+    {
+        this.dayClass = dayClass;
+    }
+
+    public String getEntryClass()
+    {
+        return entryClass;
+    }
+
+    public void setEntryClass(String entryClass)
+    {
+        this.entryClass = entryClass;
+    }
+
+    public String getEvenClass()
+    {
+        return evenClass;
+    }
+
+    public void setEvenClass(String evenClass)
+    {
+        this.evenClass = evenClass;
+    }
+
+    public String getForegroundClass()
+    {
+        return foregroundClass;
+    }
+
+    public void setForegroundClass(String foregroundClass)
+    {
+        this.foregroundClass = foregroundClass;
+    }
+
+    public String getFreeClass()
+    {
+        return freeClass;
+    }
+
+    public void setFreeClass(String freeClass)
+    {
+        this.freeClass = freeClass;
+    }
+
+    public String getGutterClass()
+    {
+        return gutterClass;
+    }
+
+    public void setGutterClass(String gutterClass)
+    {
+        this.gutterClass = gutterClass;
+    }
+
+    public String getHeaderClass()
+    {
+        return headerClass;
+    }
+
+    public void setHeaderClass(String headerClass)
+    {
+        this.headerClass = headerClass;
+    }
+
+    public String getHolidayClass()
+    {
+        return holidayClass;
+    }
+
+    public void setHolidayClass(String holidayClass)
+    {
+        this.holidayClass = holidayClass;
+    }
+
+    public String getHoursClass()
+    {
+        return hoursClass;
+    }
+
+    public void setHoursClass(String hoursClass)
+    {
+        this.hoursClass = hoursClass;
+    }
+
+    public String getInactiveDayClass()
+    {
+        return inactiveDayClass;
+    }
+
+    public void setInactiveDayClass(String inactiveDayClass)
+    {
+        this.inactiveDayClass = inactiveDayClass;
+    }
+
+    public String getMinutesClass()
+    {
+        return minutesClass;
+    }
+
+    public void setMinutesClass(String minutesClass)
+    {
+        this.minutesClass = minutesClass;
+    }
+
+    public String getMonthClass()
+    {
+        return monthClass;
+    }
+
+    public void setMonthClass(String monthClass)
+    {
+        this.monthClass = monthClass;
+    }
+
+    public String getSelectedClass()
+    {
+        return selectedClass;
+    }
+
+    public void setSelectedClass(String selectedClass)
+    {
+        this.selectedClass = selectedClass;
+    }
+
+    public String getSelectedEntryClass()
+    {
+        return selectedEntryClass;
+    }
+
+    public void setSelectedEntryClass(String selectedEntryClass)
+    {
+        this.selectedEntryClass = selectedEntryClass;
+    }
+
+    public String getSubtitleClass()
+    {
+        return subtitleClass;
+    }
+
+    public void setSubtitleClass(String subtitleClass)
+    {
+        this.subtitleClass = subtitleClass;
+    }
+
+    public String getTextClass()
+    {
+        return textClass;
+    }
+
+    public void setTextClass(String textClass)
+    {
+        this.textClass = textClass;
+    }
+
+    public String getTitleClass()
+    {
+        return titleClass;
+    }
+
+    public void setTitleClass(String titleClass)
+    {
+        this.titleClass = titleClass;
+    }
+
+    public String getUnevenClass()
+    {
+        return unevenClass;
+    }
+
+    public void setUnevenClass(String unevenClass)
+    {
+        this.unevenClass = unevenClass;
+    }
+
+    public String getWeekClass()
+    {
+        return weekClass;
+    }
+
+    public void setWeekClass(String weekClass)
+    {
+        this.weekClass = weekClass;
+    }
+
+    public String getEntryRenderer()
+    {
+        return entryRenderer;
+    }
+
+    public void setEntryRenderer(String entryRenderer)
+    {
+        this.entryRenderer = entryRenderer;
+    }
+
     /**
      * @see javax.servlet.jsp.tagext.Tag#release()
      */
@@ -452,6 +720,33 @@
         theme = null;
         tooltip = null;
         rendered = null;
+        
+        columnClass = null;
+        backgroundClass = null;
+        freeClass = null;
+        evenClass = null;
+        unevenClass = null;
+        gutterClass = null;
+        headerClass = null;
+        dateClass = null;
+        holidayClass = null;
+        hoursClass = null;
+        minutesClass = null;
+        selectedEntryClass = null;
+        textClass = null;
+        titleClass = null;
+        subtitleClass = null;
+        entryClass = null;
+        foregroundClass = null;
+        
+        dayClass = null;
+        inactiveDayClass = null;
+        contentClass = null;
+        selectedClass = null;
+        monthClass = null;
+        weekClass = null;
+        
+        entryRenderer = null;
     }
 
     /**
@@ -608,6 +903,32 @@
                 compactWeekRowHeight);
         addAttribute(app, schedule, "compactMonthRowHeight",
                 compactMonthRowHeight);
+        addAttribute(app, schedule, "column", columnClass);
+        addAttribute(app, schedule, "background", backgroundClass);
+        addAttribute(app, schedule, "free", freeClass);
+        addAttribute(app, schedule, "even", evenClass);
+        addAttribute(app, schedule, "uneven", unevenClass);
+        addAttribute(app, schedule, "gutter", gutterClass);
+        addAttribute(app, schedule, "header", headerClass);
+        addAttribute(app, schedule, "date", dateClass);
+        addAttribute(app, schedule, "holiday", holidayClass);
+        addAttribute(app, schedule, "hours", hoursClass);
+        addAttribute(app, schedule, "minutes", minutesClass);
+        addAttribute(app, schedule, "entry-selected", selectedEntryClass);
+        addAttribute(app, schedule, "text", textClass);
+        addAttribute(app, schedule, "title", titleClass);
+        addAttribute(app, schedule, "subtitle", subtitleClass);
+        addAttribute(app, schedule, "entry", entryClass);
+        addAttribute(app, schedule, "foreground", foregroundClass);
+        
+        addAttribute(app, schedule, "day", dayClass);
+        addAttribute(app, schedule, "inactive-day", inactiveDayClass);
+        addAttribute(app, schedule, "content", contentClass);
+        addAttribute(app, schedule, "selected", selectedClass);
+        addAttribute(app, schedule, "month", monthClass);
+        addAttribute(app, schedule, "week", weekClass);
+        
+        addAttribute(app, schedule, "entryRenderer", entryRenderer);
     }
 
     private void addAttribute(Application app, UIComponent component,

Modified: myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/AbstractScheduleModel.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/AbstractScheduleModel.java?rev=368941&r1=368940&r2=368941&view=diff
==============================================================================
--- myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/AbstractScheduleModel.java (original)
+++ myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/AbstractScheduleModel.java Fri Jan 13 17:03:22 2006
@@ -23,26 +23,29 @@
 import java.util.Iterator;
 import java.util.TreeSet;
 
-
 /**
  * <p>
  * Extend this class to create your own implementation of a ScheduleModel
  * </p>
- *
+ * 
  * @author Jurgen Lust (latest modification by $Author$)
  * @version $Revision$
  */
-public abstract class AbstractScheduleModel
-    implements ScheduleModel
+public abstract class AbstractScheduleModel implements ScheduleModel
 {
-    //~ Instance fields --------------------------------------------------------
+    // ~ Instance fields
+    // --------------------------------------------------------
 
     protected final TreeSet days;
-    private Date selectedDate;
+
+    private Date selectedDate = new Date();
+
     private ScheduleEntry selectedEntry;
+
     private int mode;
 
-    //~ Constructors -----------------------------------------------------------
+    // ~ Constructors
+    // -----------------------------------------------------------
 
     /**
      * Creates a new AbstractScheduleModel object.
@@ -52,7 +55,8 @@
         this.days = new TreeSet();
     }
 
-    //~ Methods ----------------------------------------------------------------
+    // ~ Methods
+    // ----------------------------------------------------------------
 
     /**
      * @see org.apache.myfaces.custom.schedule.model.ScheduleModel#isEmpty()
@@ -83,31 +87,38 @@
      */
     public void setSelectedDate(Date date)
     {
+        if (date == null)
+        {
+            // do nothing when the date is null
+            return;
+        }
+
         this.selectedDate = date;
 
-        switch (mode) {
-            case DAY:
-                setDay(date);
+        switch (mode)
+        {
+        case DAY:
+            setDay(this.selectedDate);
 
-                break;
+            break;
 
-            case WORKWEEK:
-                setWorkWeek(date);
+        case WORKWEEK:
+            setWorkWeek(this.selectedDate);
 
-                break;
+            break;
 
-            case WEEK:
-                setWeek(date);
+        case WEEK:
+            setWeek(this.selectedDate);
 
-                break;
+            break;
 
-            case MONTH:
-                setMonth(date);
+        case MONTH:
+            setMonth(this.selectedDate);
 
-                break;
+            break;
 
-            default:
-                setDay(date);
+        default:
+            setDay(this.selectedDate);
         }
     }
 
@@ -134,16 +145,25 @@
     {
         return selectedEntry;
     }
+    
+    /**
+     * @see org.apache.myfaces.custom.schedule.model.ScheduleModel#isEntrySelected()
+     */
+    public boolean isEntrySelected() {
+        return getSelectedEntry() != null;
+    }
 
     /**
      * @see org.apache.myfaces.custom.schedule.model.ScheduleModel#containsDate(java.util.Date)
      */
     public boolean containsDate(Date date)
     {
-        for (Iterator iterator = iterator(); iterator.hasNext();) {
+        for (Iterator iterator = iterator(); iterator.hasNext();)
+        {
             ScheduleDay day = (ScheduleDay) iterator.next();
 
-            if (day.equalsDate(date)) {
+            if (day.equalsDate(date))
+            {
                 return true;
             }
         }
@@ -183,17 +203,19 @@
      * <p>
      * Set the day
      * </p>
-     *
-     * @param date the new day
+     * 
+     * @param date
+     *            the new day
      */
     protected void setDay(Date date)
     {
-        clear();
-
-        if (date == null) {
+        if (date == null)
+        {
             return;
         }
 
+        clear();
+
         ScheduleDay day = add(date);
         load(day.getDayStart(), day.getDayEnd());
     }
@@ -202,21 +224,23 @@
      * <p>
      * navigate to the specified month
      * </p>
-     *
-     * @param date the date to navigate to
+     * 
+     * @param date
+     *            the date to navigate to
      */
     protected void setMonth(Date date)
     {
-        clear();
-
-        if (date == null) {
+        if (date == null)
+        {
             return;
         }
 
+        clear();
+
         Calendar cal = GregorianCalendar.getInstance();
         cal.setTime(date);
 
-        //go back to the first day of the month;
+        // go back to the first day of the month;
         cal.set(Calendar.DAY_OF_MONTH, cal.getMinimum(Calendar.DAY_OF_MONTH));
 
         int currentMonth = cal.get(Calendar.MONTH);
@@ -224,10 +248,12 @@
         ScheduleDay firstDay = null;
         ScheduleDay lastDay = null;
 
-        while (cal.get(Calendar.MONTH) == currentMonth) {
+        while (cal.get(Calendar.MONTH) == currentMonth)
+        {
             ScheduleDay addedDay = add(cal.getTime());
 
-            if (firstDay == null) {
+            if (firstDay == null)
+            {
                 firstDay = addedDay;
             }
 
@@ -242,30 +268,34 @@
      * <p>
      * navigate to the specified week
      * </p>
-     *
-     * @param date the date to navigate to
+     * 
+     * @param date
+     *            the date to navigate to
      */
     protected void setWeek(Date date)
     {
-        clear();
-
-        if (date == null) {
+        if (date == null)
+        {
             return;
         }
 
+        clear();
+
         Calendar cal = GregorianCalendar.getInstance();
         cal.setTime(date);
 
-        //go back to the monday of this week
+        // go back to the monday of this week
         cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
 
         ScheduleDay firstDay = null;
         ScheduleDay lastDay = null;
 
-        for (int i = 0; i < 7; i++) {
+        for (int i = 0; i < 7; i++)
+        {
             ScheduleDay addedDay = add(cal.getTime());
 
-            if (firstDay == null) {
+            if (firstDay == null)
+            {
                 firstDay = addedDay;
             }
 
@@ -280,30 +310,34 @@
      * <p>
      * navigate to the specified workweek
      * </p>
-     *
-     * @param date the date to navigate to
+     * 
+     * @param date
+     *            the date to navigate to
      */
     protected void setWorkWeek(Date date)
     {
-        clear();
-
-        if (date == null) {
+        if (date == null)
+        {
             return;
         }
 
+        clear();
+
         Calendar cal = GregorianCalendar.getInstance();
         cal.setTime(date);
 
-        //go back to the monday of this week
+        // go back to the monday of this week
         cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
 
         ScheduleDay firstDay = null;
         ScheduleDay lastDay = null;
 
-        for (int i = 0; i < 5; i++) {
+        for (int i = 0; i < 5; i++)
+        {
             ScheduleDay addedDay = add(cal.getTime());
 
-            if (firstDay == null) {
+            if (firstDay == null)
+            {
                 firstDay = addedDay;
             }
 
@@ -318,14 +352,16 @@
      * <p>
      * Add a day to the schedule
      * </p>
-     *
-     * @param date the day to add
-     *
+     * 
+     * @param date
+     *            the day to add
+     * 
      * @return the day that was added
      */
     protected ScheduleDay add(Date date)
     {
-        if (date == null) {
+        if (date == null)
+        {
             return null;
         }
 
@@ -343,59 +379,58 @@
      */
     protected void clear()
     {
-        for (Iterator dayIterator = days.iterator(); dayIterator.hasNext();) {
+        for (Iterator dayIterator = days.iterator(); dayIterator.hasNext();)
+        {
             ScheduleDay day = (ScheduleDay) dayIterator.next();
             day.clear();
         }
 
         days.clear();
     }
-    
+
     /**
-     * <p>
-     * This refreshes the visible days of the model
-     * </p>
+     * @see org.apache.myfaces.custom.schedule.model.ScheduleModel#refresh()
      */
-    public void refresh() {
+    public void refresh()
+    {
         setSelectedDate(selectedDate);
     }
 
     /**
      * <p>
-     * Load the schedule entries that fall between the startDate and the endDate.
+     * Load the schedule entries that fall between the startDate and the
+     * endDate.
      * </p>
-     *
-     * @param startDate 0 AM on the start date
-     * @param endDate 12 PM on the end date
-     */
-    protected abstract Collection loadEntries(
-        Date startDate,
-        Date endDate
-    );
-    
+     * 
+     * @param startDate
+     *            0 AM on the start date
+     * @param endDate
+     *            12 PM on the end date
+     */
+    protected abstract Collection loadEntries(Date startDate, Date endDate);
+
     /**
      * <p>
-     * Load any attributes for this day: is it a working day or a holiday,
-     * and what is the name of the day (e.g. "Christmas").
+     * Load any attributes for this day: is it a working day or a holiday, and
+     * what is the name of the day (e.g. "Christmas").
      * </p>
      * 
-     * @param day the day that should be loaded
+     * @param day
+     *            the day that should be loaded
      */
     protected abstract void loadDayAttributes(Day day);
 
-    private void load(
-        Date startDate,
-        Date endDate
-    )
+    private void load(Date startDate, Date endDate)
     {
         Collection entries = loadEntries(startDate, endDate);
 
-        for (Iterator entryIterator = entries.iterator();
-                entryIterator.hasNext();
-        ) {
+        for (Iterator entryIterator = entries.iterator(); entryIterator
+                .hasNext();)
+        {
             ScheduleEntry entry = (ScheduleEntry) entryIterator.next();
 
-            for (Iterator dayIterator = days.iterator(); dayIterator.hasNext();) {
+            for (Iterator dayIterator = days.iterator(); dayIterator.hasNext();)
+            {
                 ScheduleDay day = (ScheduleDay) dayIterator.next();
 
                 day.addEntry(entry);
@@ -403,4 +438,4 @@
         }
     }
 }
-//The End
+// The End

Modified: myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/ScheduleModel.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/ScheduleModel.java?rev=368941&r1=368940&r2=368941&view=diff
==============================================================================
--- myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/ScheduleModel.java (original)
+++ myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/ScheduleModel.java Fri Jan 13 17:03:22 2006
@@ -75,6 +75,11 @@
      * @return the selected entry
      */
     public abstract ScheduleEntry getSelectedEntry();
+    
+    /**
+     * @return whether an entry is currently selected
+     */
+    public abstract boolean isEntrySelected();
 
     /**
      * <p>
@@ -107,5 +112,30 @@
      * @return the number of days in this model
      */
     public abstract int size();
+    
+    /**
+     * Add an entry to the this model. 
+     *  
+     * @param entry the entry to be added
+     */
+    public abstract void addEntry(ScheduleEntry entry);
+    
+    /**
+     * Remove an entry from this model
+     * 
+     * @param entry the entry to be removed
+     */
+    public abstract void removeEntry(ScheduleEntry entry);
+    
+    /**
+     * Remove the currently selected entry from this model. If no entry
+     * is currently selected, nothing should happen.
+     */
+    public abstract void removeSelectedEntry();
+    
+    /**
+     * Reload the entries for the currently selected period
+     */
+    public abstract void refresh();
 }
 //The End

Modified: myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/SimpleScheduleModel.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/SimpleScheduleModel.java?rev=368941&r1=368940&r2=368941&view=diff
==============================================================================
--- myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/SimpleScheduleModel.java (original)
+++ myfaces/sandbox/trunk/sandbox/src/main/java/org/apache/myfaces/custom/schedule/model/SimpleScheduleModel.java Fri Jan 13 17:03:22 2006
@@ -34,20 +34,24 @@
  * A simple implementation of the ScheduleModel, not backed by any kind of
  * datasource: entries have to be added manually.
  * </p>
- *
+ * 
  * @author Jurgen Lust (latest modification by $Author$)
  * @version $Revision$
  */
 public class SimpleScheduleModel extends AbstractScheduleModel implements
         Serializable
 {
-    //~ Instance fields --------------------------------------------------------
+    // ~ Instance fields
+    // --------------------------------------------------------
 
     private final TreeSet entries;
+
     private final HashMap holidays;
+
     private final DateFormat holidayFormat = new SimpleDateFormat("yyyyMMdd");
 
-    //~ Constructors -----------------------------------------------------------
+    // ~ Constructors
+    // -----------------------------------------------------------
 
     /**
      * Creates a new SimpleScheduleModel object.
@@ -58,13 +62,16 @@
         this.holidays = new HashMap();
     }
 
-    //~ Methods ----------------------------------------------------------------
+    // ~ Methods
+    // ----------------------------------------------------------------
 
     /**
      * Set the name of a holiday.
-     *
-     * @param date the date
-     * @param holidayName the name of the holiday
+     * 
+     * @param date
+     *            the date
+     * @param holidayName
+     *            the name of the holiday
      */
     public void setHoliday(Date date, String holidayName)
     {
@@ -79,8 +86,9 @@
 
     /**
      * Add an entry to the model.
-     *
-     * @param entry the entry to add
+     * 
+     * @param entry
+     *            the entry to add
      */
     public void addEntry(ScheduleEntry entry)
     {
@@ -90,7 +98,8 @@
     /**
      * Remove an entry from the model.
      * 
-     * @param entry the entry to remove
+     * @param entry
+     *            the entry to remove
      */
     public void removeEntry(ScheduleEntry entry)
     {
@@ -98,7 +107,20 @@
     }
 
     /**
-     * @see org.apache.myfaces.custom.schedule.model.AbstractScheduleModel#loadEntries(java.util.Date, java.util.Date)
+     * @see org.apache.myfaces.custom.schedule.model.ScheduleModel#removeSelectedEntry()
+     */
+    public void removeSelectedEntry()
+    {
+        if (!isEntrySelected())
+            return;
+        removeEntry(getSelectedEntry());
+        setSelectedEntry(null);
+        refresh();
+    }
+
+    /**
+     * @see org.apache.myfaces.custom.schedule.model.AbstractScheduleModel#loadEntries(java.util.Date,
+     *      java.util.Date)
      */
     protected Collection loadEntries(Date startDate, Date endDate)
     {
@@ -134,12 +156,11 @@
         {
             day.setSpecialDayName(holiday);
             day.setWorkingDay(false);
-        }
-        else
+        } else
         {
             day.setSpecialDayName(null);
             day.setWorkingDay(true);
         }
     }
 }
-//The End
+// The End