Calendar Year view fixed.

master
Markus Kreth 7 years ago
parent abf14d9f4f
commit 3749163d60
  1. 4
      src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/YearlyCalendarCreator.java
  2. 4
      src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/calendar/Year.java
  3. 1791
      src/main/resources/jasper/calendar_year.jrxml
  4. 1
      src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/AbstractDatabaseTest.java
  5. 2
      src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/ClubEventDaoTest.java
  6. 7
      src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/calendar/YearTest.java

@ -1,14 +1,12 @@
package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components; package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components;
import java.io.InputStream; import java.io.InputStream;
import java.util.Collection;
import java.util.Map; import java.util.Map;
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.calendar.Year; import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.calendar.Year;
import net.sf.jasperreports.engine.JRDataSource; import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField; import net.sf.jasperreports.engine.JRField;
import net.sf.jasperreports.engine.JasperPrint;
public class YearlyCalendarCreator extends CalendarCreator { public class YearlyCalendarCreator extends CalendarCreator {
@ -33,7 +31,7 @@ public class YearlyCalendarCreator extends CalendarCreator {
return CalendarCreator.class.getResourceAsStream("/jasper/calendar_year.jrxml"); return CalendarCreator.class.getResourceAsStream("/jasper/calendar_year.jrxml");
} }
private static class EmptySource implements JRDataSource { public static class EmptySource implements JRDataSource {
@Override @Override
public boolean next() throws JRException { public boolean next() throws JRException {

@ -40,15 +40,15 @@ public class Year {
/** /**
* Day of month, numeric for the specified by parameters. * Day of month, numeric for the specified by parameters.
*
* @param month month of the day * @param month month of the day
* @param week 1-6th week of the month * @param week 1-6th week of the month
* @param dayOfWeek weekday of the week in the month. * @param dayOfWeek weekday of the week in the month.
* @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) {
WeeksOfMonth weeksOfMonth = monthWeeks.get(month); WeeksOfMonth weeksOfMonth = monthWeeks.get(month);
if (week >= weeksOfMonth.weekCount()) { if (week > weeksOfMonth.weekCount()) {
return ""; return "";
} }
Integer res = weeksOfMonth.getWeek(week - 1).get(dayOfWeek); Integer res = weeksOfMonth.getWeek(week - 1).get(dayOfWeek);

File diff suppressed because it is too large Load Diff

@ -29,7 +29,6 @@ public abstract class AbstractDatabaseTest {
Configuration configuration = createConfig(); Configuration configuration = createConfig();
sessionFactory = configuration.buildSessionFactory(); sessionFactory = configuration.buildSessionFactory();
session = sessionFactory.openSession(); session = sessionFactory.openSession();
} }

@ -7,8 +7,8 @@ import java.time.ZonedDateTime;
import java.util.List; import java.util.List;
import org.hibernate.query.Query; import org.hibernate.query.Query;
import org.junit.Test;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;

@ -1,6 +1,7 @@
package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.calendar; package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.calendar;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.time.DayOfWeek; import java.time.DayOfWeek;
import java.time.Month; import java.time.Month;
@ -20,13 +21,13 @@ class YearTest {
@Test @Test
void testMondayIsFirst() { void testMondayIsFirst() {
Year y = new Year(2018); Year y = new Year(2018);
assertEquals(Short.valueOf((short)1), y.getDay(Month.OCTOBER, (short)1, DayOfWeek.MONDAY)); assertEquals("1", y.getDay(Month.OCTOBER, (short) 1, DayOfWeek.MONDAY));
} }
@Test @Test
void testThursdayIsFirst() { void testThursdayIsFirst() {
Year y = new Year(2018); Year y = new Year(2018);
assertNull(y.getDay(Month.NOVEMBER, (short)1, DayOfWeek.MONDAY)); assertEquals("", y.getDay(Month.NOVEMBER, (short) 1, DayOfWeek.MONDAY));
} }
} }

Loading…
Cancel
Save