You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ba...@apache.org on 2006/01/26 20:12:35 UTC
svn commit: r372589 - in /myfaces/tomahawk/trunk/sandbox:
core/src/main/java/org/apache/myfaces/custom/schedule/model/
core/src/main/java/org/apache/myfaces/custom/schedule/renderer/
core/src/main/resources/org/apache/myfaces/custom/schedule/resource/c...
Author: baranda
Date: Thu Jan 26 11:12:19 2006
New Revision: 372589
URL: http://svn.apache.org/viewcvs?rev=372589&view=rev
Log:
Applied patch for MYFACES-1035
Modified:
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/schedule/model/AbstractScheduleModel.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/schedule/renderer/ScheduleCompactMonthRenderer.java
myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/css/schedule.css
myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleExampleHandler.java
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/schedule/model/AbstractScheduleModel.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/schedule/model/AbstractScheduleModel.java?rev=372589&r1=372588&r2=372589&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/schedule/model/AbstractScheduleModel.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/schedule/model/AbstractScheduleModel.java Thu Jan 26 11:12:19 2006
@@ -243,12 +243,18 @@
// 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);
+ Date temp = cal.getTime();
+ cal.add(Calendar.MONTH, 1);
+ int nextMonth = cal.get(Calendar.MONTH);
+ cal.setTime(temp);
ScheduleDay firstDay = null;
ScheduleDay lastDay = null;
+
+ // we want to show the whole first week, including the days from the previous month
+ cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
- while (cal.get(Calendar.MONTH) == currentMonth)
+ while (true)
{
ScheduleDay addedDay = add(cal.getTime());
@@ -259,6 +265,12 @@
lastDay = addedDay;
cal.add(Calendar.DATE, 1);
+
+ //stop when we are at the last day of the last week
+ if (cal.get(Calendar.MONTH) == nextMonth && cal.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY)
+ {
+ break;
+ }
}
load(firstDay.getDayStart(), lastDay.getDayEnd());
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/schedule/renderer/ScheduleCompactMonthRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/schedule/renderer/ScheduleCompactMonthRenderer.java?rev=372589&r1=372588&r2=372589&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/schedule/renderer/ScheduleCompactMonthRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/schedule/renderer/ScheduleCompactMonthRenderer.java Thu Jan 26 11:12:19 2006
@@ -85,6 +85,8 @@
writer.startElement(HTML.TBODY_ELEM, schedule);
Calendar cal = GregorianCalendar.getInstance();
+ cal.setTime(schedule.getModel().getSelectedDate());
+ int selectedMonth = cal.get(Calendar.MONTH);
for (
Iterator dayIterator = schedule.getModel().iterator();
@@ -95,60 +97,18 @@
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
+ int currentMonth = cal.get(Calendar.MONTH);
boolean isWeekend =
(dayOfWeek == Calendar.SATURDAY) ||
(dayOfWeek == Calendar.SUNDAY);
cal.setTime(day.getDate());
- if (dayOfMonth == 1) { //fill the cells of the previous month
-
- TreeSet previousMonth = new TreeSet();
-
- while (cal.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
- cal.add(Calendar.DATE, -1);
- previousMonth.add(new ScheduleDay(cal.getTime()));
- }
-
- for (
- Iterator prevMonthIterator = previousMonth.iterator();
- prevMonthIterator.hasNext();
- ) {
- ScheduleDay d = (ScheduleDay) prevMonthIterator.next();
- cal.setTime(d.getDate());
-
- int dow = cal.get(Calendar.DAY_OF_WEEK);
- int dom = cal.get(Calendar.DAY_OF_MONTH);
- boolean w =
- (dow == Calendar.SATURDAY) || (dow == Calendar.SUNDAY);
- writeDayCell(
- context, writer, schedule, d, dow, dom, w, false,
- w ? 1 : 2
- );
- }
- }
-
writeDayCell(
context, writer, schedule, day, dayOfWeek, dayOfMonth, isWeekend,
- true, isWeekend ? 1 : 2
+ currentMonth == selectedMonth, isWeekend ? 1 : 2
);
- if (!dayIterator.hasNext()) { //fill the empty cells of the next month
-
- while (cal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) {
- cal.add(Calendar.DATE, 1);
-
- ScheduleDay d = new ScheduleDay(cal.getTime());
- int dow = cal.get(Calendar.DAY_OF_WEEK);
- int dom = cal.get(Calendar.DAY_OF_MONTH);
- boolean w =
- (dow == Calendar.SATURDAY) || (dow == Calendar.SUNDAY);
- writeDayCell(
- context, writer, schedule, d, dow, dom, w, false,
- w ? 1 : 2
- );
- }
- }
}
writer.endElement(HTML.TBODY_ELEM);
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/css/schedule.css
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/css/schedule.css?rev=372589&r1=372588&r2=372589&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/css/schedule.css (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/css/schedule.css Thu Jan 26 11:12:19 2006
@@ -164,6 +164,16 @@
visibility: visible;
}
+div.schedule-compact-default td.inactive-day td.content td {
+ background-color: rgb(205,214,198);
+ border-color: rgb(205,214,198);
+}
+
+div.schedule-compact-default td.inactive-day td.content td.selected {
+ background-color: rgb(153,204,51);
+ border-color: rgb(153,204,51);
+}
+
div.schedule-compact-default td.inactive-day td.header {
background-color: rgb(205,214,198);
visibility: visible;
@@ -338,6 +348,16 @@
visibility: visible;
}
+div.schedule-compact-evolution td.inactive-day td.content td {
+ background-color: rgb(238,235,231);
+ border-color: rgb(238,235,231);
+}
+
+div.schedule-compact-evolution td.inactive-day td.content td.selected {
+ background-color: rgb(190,206,221);
+ border-color: rgb(190,206,221);
+}
+
div.schedule-compact-evolution td.inactive-day td.header {
background-color: rgb(238,235,231);
visibility: visible;
@@ -509,6 +529,18 @@
background-color: rgb(219,216,209);
visibility: visible;
}
+
+div.schedule-compact-outlookxp td.inactive-day td.content td {
+ background-color: rgb(219,216,209);
+ border-color: rgb(219,216,209);
+}
+
+div.schedule-compact-outlookxp td.inactive-day td.content td.selected {
+ background-color: rgb(1,2,217);
+ border-color: rgb(1,2,217);
+ color: rgb(255,255,255);
+}
+
div.schedule-compact-outlookxp td.inactive-day td.header {
background-color: rgb(219,216,209);
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleExampleHandler.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleExampleHandler.java?rev=372589&r1=372588&r2=372589&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleExampleHandler.java (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/schedule/ScheduleExampleHandler.java Thu Jan 26 11:12:19 2006
@@ -70,10 +70,10 @@
Calendar calendar = GregorianCalendar.getInstance();
calendar.setTime(model.getSelectedDate());
calendar.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
+ calendar.set(Calendar.HOUR_OF_DAY, 14);
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());
@@ -104,6 +104,26 @@
entry3.setEndTime(calendar.getTime());
entry3.setTitle("Thoroughly test schedule component");
model.addEntry(entry3);
+ DefaultScheduleEntry entry4 = new DefaultScheduleEntry();
+ entry4.setId(RandomStringUtils.randomNumeric(32));
+ calendar.add(Calendar.MONTH, -1);
+ calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
+ calendar.set(Calendar.HOUR_OF_DAY, 11);
+ entry4.setStartTime(calendar.getTime());
+ calendar.set(Calendar.HOUR_OF_DAY, 14);
+ entry4.setEndTime(calendar.getTime());
+ entry4.setTitle("Long lunch");
+ model.addEntry(entry4);
+ DefaultScheduleEntry entry5 = new DefaultScheduleEntry();
+ entry5.setId(RandomStringUtils.randomNumeric(32));
+ calendar.add(Calendar.MONTH, 2);
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
+ calendar.set(Calendar.HOUR_OF_DAY, 1);
+ entry5.setStartTime(calendar.getTime());
+ calendar.set(Calendar.HOUR_OF_DAY, 5);
+ entry5.setEndTime(calendar.getTime());
+ entry5.setTitle("Fishing trip");
+ model.addEntry(entry5);
model.refresh();
}
}
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml?rev=372589&r1=372588&r2=372589&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml Thu Jan 26 11:12:19 2006
@@ -507,22 +507,26 @@
<!-- navigational rules for the schedule examples -->
<navigation-rule>
- <from-view-id>/schedule.jsp</from-view-id>
+ <from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>schedule1</from-outcome>
<to-view-id>/schedule/example1.jsp</to-view-id>
+ <redirect />
</navigation-case>
<navigation-case>
<from-outcome>schedule2</from-outcome>
<to-view-id>/schedule/example2.jsp</to-view-id>
+ <redirect />
</navigation-case>
<navigation-case>
<from-outcome>schedule3</from-outcome>
<to-view-id>/schedule/example3.jsp</to-view-id>
+ <redirect />
</navigation-case>
<navigation-case>
<from-outcome>schedule4</from-outcome>
<to-view-id>/schedule/example4.jsp</to-view-id>
+ <redirect />
</navigation-case>
</navigation-rule>
@@ -531,6 +535,7 @@
<navigation-case>
<from-outcome>add_entry</from-outcome>
<to-view-id>/schedule/addentry.jsp</to-view-id>
+ <redirect />
</navigation-case>
</navigation-rule>
@@ -539,14 +544,17 @@
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/schedule/example2.jsp</to-view-id>
+ <redirect />
</navigation-case>
<navigation-case>
<from-outcome>cancel</from-outcome>
<to-view-id>/schedule/example2.jsp</to-view-id>
+ <redirect />
</navigation-case>
<navigation-case>
<from-outcome>failure</from-outcome>
<to-view-id>/schedule/addentry.jsp</to-view-id>
+ <redirect />
</navigation-case>
</navigation-rule>
@@ -555,6 +563,7 @@
<navigation-case>
<from-outcome>edit_settings</from-outcome>
<to-view-id>/schedule/editsettings.jsp</to-view-id>
+ <redirect />
</navigation-case>
</navigation-rule>
@@ -563,14 +572,17 @@
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/schedule/example3.jsp</to-view-id>
+ <redirect />
</navigation-case>
<navigation-case>
<from-outcome>cancel</from-outcome>
<to-view-id>/schedule/example3.jsp</to-view-id>
+ <redirect />
</navigation-case>
<navigation-case>
<from-outcome>failure</from-outcome>
<to-view-id>/schedule/editsettings.jsp</to-view-id>
+ <redirect />
</navigation-case>
</navigation-rule>