svnno****@sourc*****
svnno****@sourc*****
2009年 1月 31日 (土) 07:21:12 JST
Revision: 1708 http://svn.sourceforge.jp/view?root=pal&view=rev&rev=1708 Author: shinsuke Date: 2009-01-31 07:21:12 +0900 (Sat, 31 Jan 2009) Log Message: ----------- fixed a process for changing a calendar. Modified Paths: -------------- scheduler/trunk/src/main/java/jp/sf/pal/scheduler/form/user/facility/CalendarForm.java scheduler/trunk/src/main/java/jp/sf/pal/scheduler/form/user/schedule/CalendarForm.java -------------- next part -------------- Modified: scheduler/trunk/src/main/java/jp/sf/pal/scheduler/form/user/facility/CalendarForm.java =================================================================== --- scheduler/trunk/src/main/java/jp/sf/pal/scheduler/form/user/facility/CalendarForm.java 2009-01-30 22:04:55 UTC (rev 1707) +++ scheduler/trunk/src/main/java/jp/sf/pal/scheduler/form/user/facility/CalendarForm.java 2009-01-30 22:21:12 UTC (rev 1708) @@ -50,13 +50,29 @@ } public void changeCalendarToPrevMonth() { - month = String.valueOf(Integer.parseInt(month) - 1); + int oldValue = Integer.parseInt(month); + month = String.valueOf(oldValue - 1); updateCalendarValue(); + int newValue = Integer.parseInt(month); + if (oldValue == newValue) { + // in this case, not change a month. + month = String.valueOf(oldValue - 1); + date = String.valueOf(1); + updateCalendarValue(); + } } public void changeCalendarToNextMonth() { - month = String.valueOf(Integer.parseInt(month) + 1); + int oldValue = Integer.parseInt(month); + month = String.valueOf(oldValue + 1); updateCalendarValue(); + int newValue = Integer.parseInt(month); + if (newValue - oldValue > 1) { + // in this case, skip a next month. + month = String.valueOf(oldValue + 1); + date = String.valueOf(1); + updateCalendarValue(); + } } private void updateCalendarValue() { Modified: scheduler/trunk/src/main/java/jp/sf/pal/scheduler/form/user/schedule/CalendarForm.java =================================================================== --- scheduler/trunk/src/main/java/jp/sf/pal/scheduler/form/user/schedule/CalendarForm.java 2009-01-30 22:04:55 UTC (rev 1707) +++ scheduler/trunk/src/main/java/jp/sf/pal/scheduler/form/user/schedule/CalendarForm.java 2009-01-30 22:21:12 UTC (rev 1708) @@ -46,13 +46,29 @@ } public void changeCalendarToPrevMonth() { - month = String.valueOf(Integer.parseInt(month) - 1); + int oldValue = Integer.parseInt(month); + month = String.valueOf(oldValue - 1); updateCalendarValue(); + int newValue = Integer.parseInt(month); + if (oldValue == newValue) { + // in this case, not change a month. + month = String.valueOf(oldValue - 1); + date = String.valueOf(1); + updateCalendarValue(); + } } public void changeCalendarToNextMonth() { - month = String.valueOf(Integer.parseInt(month) + 1); + int oldValue = Integer.parseInt(month); + month = String.valueOf(oldValue + 1); updateCalendarValue(); + int newValue = Integer.parseInt(month); + if (newValue - oldValue > 1) { + // in this case, skip a next month. + month = String.valueOf(oldValue + 1); + date = String.valueOf(1); + updateCalendarValue(); + } } private void updateCalendarValue() {