proceeded year calendar

master
Markus Kreth 7 years ago
parent 91cc7f7f54
commit 4f9a59389e
  1. 7
      src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/calendar/Year.java
  2. 5843
      src/main/resources/jasper/calendar_year.jrxml
  3. 9
      src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/calendar/WeeksOfMonthTest.java

@ -46,7 +46,12 @@ public class Year {
* @return numeric value of the day of the month. * @return numeric value of the day of the month.
*/ */
public String getDay(Month month, short week, DayOfWeek dayOfWeek) { public String getDay(Month month, short week, DayOfWeek dayOfWeek) {
Integer res = monthWeeks.get(month).getWeek(week - 1).get(dayOfWeek);
WeeksOfMonth weeksOfMonth = monthWeeks.get(month);
if (week >= weeksOfMonth.weekCount()) {
return "";
}
Integer res = weeksOfMonth.getWeek(week - 1).get(dayOfWeek);
return res == null ? "" : res.toString(); return res == null ? "" : res.toString();

File diff suppressed because it is too large Load Diff

@ -12,6 +12,15 @@ import org.junit.jupiter.api.Test;
class WeeksOfMonthTest { class WeeksOfMonthTest {
@Test
void test2018January() {
WeeksOfMonth january = new WeeksOfMonth(Month.JANUARY, 2018);
assertEquals(31, january.dayCount());
assertEquals(5, january.weekCount());
assertEquals(1, january.getWeek(0).get(DayOfWeek.MONDAY).intValue());
assertEquals(31, january.getWeek(4).get(DayOfWeek.WEDNESDAY).intValue());
}
@Test @Test
void test2018November() { void test2018November() {
WeeksOfMonth november = new WeeksOfMonth(Month.NOVEMBER, 2018); WeeksOfMonth november = new WeeksOfMonth(Month.NOVEMBER, 2018);

Loading…
Cancel
Save