parent
17820770e7
commit
3709ddfdbe
@ -0,0 +1,79 @@ |
|||||||
|
package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components; |
||||||
|
|
||||||
|
import java.time.YearMonth; |
||||||
|
import java.util.Calendar; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author markus |
||||||
|
* |
||||||
|
*/ |
||||||
|
public class DateMetadata { |
||||||
|
|
||||||
|
private Calendar date; |
||||||
|
private int dow; |
||||||
|
private int dom; |
||||||
|
private int doy; |
||||||
|
private int days; |
||||||
|
private int cells; |
||||||
|
private int limit; |
||||||
|
|
||||||
|
public DateMetadata(java.sql.Date date) { |
||||||
|
this(CalendarCreator.toCalendar(date.getTime())); |
||||||
|
} |
||||||
|
|
||||||
|
public DateMetadata(long date) { |
||||||
|
this(CalendarCreator.toCalendar(date)); |
||||||
|
} |
||||||
|
|
||||||
|
public DateMetadata(Calendar date) { |
||||||
|
this.date = (Calendar) date.clone(); |
||||||
|
date.set(Calendar.DAY_OF_MONTH, 1); |
||||||
|
dow = date.get(Calendar.DAY_OF_WEEK); |
||||||
|
|
||||||
|
dom = date.get(Calendar.MONTH) + 1; |
||||||
|
doy = date.get(Calendar.YEAR); |
||||||
|
days = YearMonth.of(doy, dom).lengthOfMonth(); |
||||||
|
cells = dow - 1 + days; |
||||||
|
limit = cells > 28 ? (cells>35?42:35) : 28; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @param date |
||||||
|
*/ |
||||||
|
public DateMetadata(Date date) { |
||||||
|
this(CalendarCreator.toCalendar(date.getTime())); |
||||||
|
} |
||||||
|
|
||||||
|
public Date getDate() { |
||||||
|
return date.getTime(); |
||||||
|
} |
||||||
|
|
||||||
|
public int getDow() { |
||||||
|
return dow; |
||||||
|
} |
||||||
|
|
||||||
|
public int getDom() { |
||||||
|
return dom; |
||||||
|
} |
||||||
|
|
||||||
|
public int getDoy() { |
||||||
|
return doy; |
||||||
|
} |
||||||
|
|
||||||
|
public int getDays() { |
||||||
|
return days; |
||||||
|
} |
||||||
|
|
||||||
|
public int getCells() { |
||||||
|
return cells; |
||||||
|
} |
||||||
|
|
||||||
|
public int getLimit() { |
||||||
|
return limit; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,52 @@ |
|||||||
|
package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components; |
||||||
|
|
||||||
|
import java.io.InputStream; |
||||||
|
import java.sql.Timestamp; |
||||||
|
import java.time.YearMonth; |
||||||
|
import java.time.ZoneId; |
||||||
|
import java.util.Collection; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
import net.sf.jasperreports.engine.JRDataSource; |
||||||
|
|
||||||
|
public class MonthlyCalendarCreator<T extends CharSequence> extends CalendarCreator { |
||||||
|
|
||||||
|
private final YearMonth yearMonthObject; |
||||||
|
private Map<Integer, T> values; |
||||||
|
private Collection<Integer> holidays; |
||||||
|
|
||||||
|
public MonthlyCalendarCreator(Date date) { |
||||||
|
this.yearMonthObject = YearMonth.from(date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); |
||||||
|
} |
||||||
|
|
||||||
|
public MonthlyCalendarCreator<T> setValues(Map<Integer, T> values) { |
||||||
|
this.values = values; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public MonthlyCalendarCreator<T> setHolidays(Collection<Integer> holidays) { |
||||||
|
this.holidays = holidays; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void fillParameterMap(Map<String, Object> parameters) { |
||||||
|
|
||||||
|
Timestamp timestamp = new Timestamp( |
||||||
|
yearMonthObject.atDay(1).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()); |
||||||
|
|
||||||
|
parameters.put("Date", timestamp); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected InputStream jrxmlResource() { |
||||||
|
return CalendarCreator.class.getResourceAsStream("/jasper/calendar_month.jrxml"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected JRDataSource getSource() { |
||||||
|
return new MonthlyCalendarSource<>(yearMonthObject, values, holidays); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,49 @@ |
|||||||
|
package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components; |
||||||
|
|
||||||
|
import java.io.InputStream; |
||||||
|
import java.util.Collection; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.calendar.Year; |
||||||
|
import net.sf.jasperreports.engine.JRDataSource; |
||||||
|
import net.sf.jasperreports.engine.JRException; |
||||||
|
import net.sf.jasperreports.engine.JRField; |
||||||
|
import net.sf.jasperreports.engine.JasperPrint; |
||||||
|
|
||||||
|
public class YearlyCalendarCreator extends CalendarCreator { |
||||||
|
|
||||||
|
private Year year; |
||||||
|
|
||||||
|
public YearlyCalendarCreator(int year) { |
||||||
|
this.year = new Year(year); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected JRDataSource getSource() { |
||||||
|
return new EmptySource(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void fillParameterMap(Map<String, Object> parameters) { |
||||||
|
parameters.put("Year", year); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected InputStream jrxmlResource() { |
||||||
|
return CalendarCreator.class.getResourceAsStream("/jasper/calendar_year.jrxml"); |
||||||
|
} |
||||||
|
|
||||||
|
private static class EmptySource implements JRDataSource { |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean next() throws JRException { |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Object getFieldValue(JRField jrField) throws JRException { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,60 @@ |
|||||||
|
package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.calendar; |
||||||
|
|
||||||
|
import java.time.DayOfWeek; |
||||||
|
import java.time.LocalDate; |
||||||
|
import java.time.Month; |
||||||
|
import java.time.format.TextStyle; |
||||||
|
import java.util.Arrays; |
||||||
|
import java.util.LinkedList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Locale; |
||||||
|
import java.util.Queue; |
||||||
|
|
||||||
|
public class Year { |
||||||
|
|
||||||
|
private final LocalDate date; |
||||||
|
private final Locale locale; |
||||||
|
|
||||||
|
public Year(int year) { |
||||||
|
this(year, Locale.getDefault()); |
||||||
|
} |
||||||
|
|
||||||
|
public Year(int year, Locale locale) { |
||||||
|
if (year < 1900 || year >2100) { |
||||||
|
throw new IllegalArgumentException("Year value must be between 1900 and 2100"); |
||||||
|
} |
||||||
|
this.date = LocalDate.of(year, 1, 1); |
||||||
|
this.locale = locale; |
||||||
|
} |
||||||
|
|
||||||
|
public int getYear() { |
||||||
|
return date.getYear(); |
||||||
|
} |
||||||
|
|
||||||
|
public CharSequence getMonth(Month month) { |
||||||
|
return month.getDisplayName(TextStyle.FULL_STANDALONE, locale); |
||||||
|
} |
||||||
|
|
||||||
|
List<Integer> days = Arrays.asList(null, null, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,28,30,31,32); |
||||||
|
Queue<Integer> queue = new LinkedList<>(days); |
||||||
|
|
||||||
|
/** |
||||||
|
* Day of month, numeric for the specified by parameters. |
||||||
|
* @param month month of the day |
||||||
|
* @param week 1-5th week of the month |
||||||
|
* @param dayOfWeek weekday of the week in the month. |
||||||
|
* @return numeric value of the day of the month. |
||||||
|
*/ |
||||||
|
public String getDay(Month month, short week, DayOfWeek dayOfWeek) { |
||||||
|
if (queue.isEmpty()) { |
||||||
|
queue.addAll(days); |
||||||
|
} |
||||||
|
Integer poll = queue.poll(); |
||||||
|
if (poll != null) { |
||||||
|
return poll.toString(); |
||||||
|
} else { |
||||||
|
return ""; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,300 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 --> |
||||||
|
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="clubhelper_calendar" printOrder="Horizontal" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="573" leftMargin="11" rightMargin="11" topMargin="6" bottomMargin="6" uuid="32abf871-39b8-4cc7-b03c-d950a55e2bfb"> |
||||||
|
<property name="com.jaspersoft.studio.data.sql.tables" value=""/> |
||||||
|
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="CalendarSource"/> |
||||||
|
<property name="com.jaspersoft.studio.unit." value="pixel"/> |
||||||
|
<style name="Style_Calendar_Day_Number" forecolor="#050505" backcolor="#FFFFFF"> |
||||||
|
<conditionalStyle> |
||||||
|
<conditionExpression><![CDATA[$F{id}.intValue()%7==0]]></conditionExpression> |
||||||
|
<style forecolor="#FA0702"/> |
||||||
|
</conditionalStyle> |
||||||
|
<conditionalStyle> |
||||||
|
<conditionExpression><![CDATA[$F{IsHoliday}]]></conditionExpression> |
||||||
|
<style backcolor="#FFFFCC"/> |
||||||
|
</conditionalStyle> |
||||||
|
</style> |
||||||
|
<style name="Style_Calendar_Holiday" backcolor="#FFFFFF"> |
||||||
|
<conditionalStyle> |
||||||
|
<conditionExpression><![CDATA[$F{IsHoliday}]]></conditionExpression> |
||||||
|
<style backcolor="#FFFFCC"/> |
||||||
|
</conditionalStyle> |
||||||
|
</style> |
||||||
|
<parameter name="Date" class="java.time.LocalDate"> |
||||||
|
<defaultValueExpression><![CDATA[java.time.LocalDate.now()]]></defaultValueExpression> |
||||||
|
</parameter> |
||||||
|
<parameter name="Year" class="de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.calendar.Year"/> |
||||||
|
<queryString> |
||||||
|
<![CDATA[SELECT i as id FROM generate_series(1, 31 ) i]]> |
||||||
|
</queryString> |
||||||
|
<field name="id" class="java.lang.Integer"/> |
||||||
|
<field name="Field_Value" class="java.lang.String"/> |
||||||
|
<field name="IsHoliday" class="java.lang.Boolean"> |
||||||
|
<fieldDescription><![CDATA[Current Day is a holiday]]></fieldDescription> |
||||||
|
</field> |
||||||
|
<title> |
||||||
|
<band height="505"> |
||||||
|
<textField pattern="MMMM"> |
||||||
|
<reportElement isPrintRepeatedValues="false" x="0" y="0" width="286" height="25" uuid="21293131-3839-43aa-b449-b19867eee2da"/> |
||||||
|
<box> |
||||||
|
<topPen lineWidth="1.0"/> |
||||||
|
<leftPen lineWidth="1.0"/> |
||||||
|
<rightPen lineWidth="1.0"/> |
||||||
|
</box> |
||||||
|
<textElement textAlignment="Center"> |
||||||
|
<font size="16" isBold="true"/> |
||||||
|
</textElement> |
||||||
|
<textFieldExpression><![CDATA[java.time.Month.JANUARY.getDisplayName(java.time.format.TextStyle.FULL_STANDALONE, java.util.Locale.getDefault())]]></textFieldExpression> |
||||||
|
</textField> |
||||||
|
<staticText> |
||||||
|
<reportElement mode="Opaque" x="0" y="26" width="41" height="10" forecolor="#FFFCFC" backcolor="#403D3D" uuid="1b4d6c56-6d09-482b-8eb5-662c88cbe870"> |
||||||
|
<property name="com.jaspersoft.studio.unit.y" value="pixel"/> |
||||||
|
</reportElement> |
||||||
|
<box> |
||||||
|
<pen lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="1.0"/> |
||||||
|
<bottomPen lineWidth="1.0"/> |
||||||
|
</box> |
||||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||||
|
<font size="6" isBold="true"/> |
||||||
|
</textElement> |
||||||
|
<text><![CDATA[Montag]]></text> |
||||||
|
</staticText> |
||||||
|
<staticText> |
||||||
|
<reportElement mode="Opaque" x="42" y="26" width="41" height="10" forecolor="#FFFCFC" backcolor="#403D3D" uuid="a373077e-66c1-4218-b9a2-bd35f7d19f7a"> |
||||||
|
<property name="com.jaspersoft.studio.unit.y" value="pixel"/> |
||||||
|
</reportElement> |
||||||
|
<box> |
||||||
|
<pen lineColor="#000000"/> |
||||||
|
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
</box> |
||||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||||
|
<font size="6" isBold="true"/> |
||||||
|
</textElement> |
||||||
|
<text><![CDATA[Dienstag]]></text> |
||||||
|
</staticText> |
||||||
|
<staticText> |
||||||
|
<reportElement mode="Opaque" x="84" y="26" width="41" height="10" forecolor="#FFFCFC" backcolor="#403D3D" uuid="d1e26dda-0b1a-4ef2-b48c-276accc3eeaa"> |
||||||
|
<property name="com.jaspersoft.studio.unit.y" value="pixel"/> |
||||||
|
</reportElement> |
||||||
|
<box> |
||||||
|
<pen lineColor="#000000"/> |
||||||
|
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
</box> |
||||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||||
|
<font size="6" isBold="true"/> |
||||||
|
</textElement> |
||||||
|
<text><![CDATA[Mittwoch]]></text> |
||||||
|
</staticText> |
||||||
|
<staticText> |
||||||
|
<reportElement mode="Opaque" x="126" y="26" width="41" height="10" forecolor="#FFFCFC" backcolor="#403D3D" uuid="9c9395c6-7cc2-4571-97f6-e3b4bfe58263"> |
||||||
|
<property name="com.jaspersoft.studio.unit.y" value="pixel"/> |
||||||
|
</reportElement> |
||||||
|
<box> |
||||||
|
<pen lineColor="#000000"/> |
||||||
|
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
</box> |
||||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||||
|
<font size="6" isBold="true"/> |
||||||
|
</textElement> |
||||||
|
<text><![CDATA[Donnerstag]]></text> |
||||||
|
</staticText> |
||||||
|
<staticText> |
||||||
|
<reportElement mode="Opaque" x="168" y="26" width="41" height="10" forecolor="#FFFCFC" backcolor="#403D3D" uuid="12589ff4-2da8-448f-995a-99cf8446ccfa"> |
||||||
|
<property name="com.jaspersoft.studio.unit.y" value="pixel"/> |
||||||
|
</reportElement> |
||||||
|
<box> |
||||||
|
<pen lineColor="#000000"/> |
||||||
|
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
</box> |
||||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||||
|
<font size="6" isBold="true"/> |
||||||
|
</textElement> |
||||||
|
<text><![CDATA[Freitag]]></text> |
||||||
|
</staticText> |
||||||
|
<staticText> |
||||||
|
<reportElement mode="Opaque" x="210" y="26" width="41" height="10" forecolor="#FFFCFC" backcolor="#403D3D" uuid="c2f7be3d-5ccf-4838-b55d-51eafd78f3e4"> |
||||||
|
<property name="com.jaspersoft.studio.unit.y" value="pixel"/> |
||||||
|
</reportElement> |
||||||
|
<box> |
||||||
|
<pen lineColor="#000000"/> |
||||||
|
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
</box> |
||||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||||
|
<font size="6" isBold="true"/> |
||||||
|
</textElement> |
||||||
|
<text><![CDATA[Samstag]]></text> |
||||||
|
</staticText> |
||||||
|
<staticText> |
||||||
|
<reportElement mode="Opaque" x="252" y="26" width="41" height="10" forecolor="#FFFCFC" backcolor="#403D3D" uuid="bc9c8dee-afda-435c-8f11-d7294c248f8c"> |
||||||
|
<property name="com.jaspersoft.studio.unit.y" value="pixel"/> |
||||||
|
</reportElement> |
||||||
|
<box> |
||||||
|
<pen lineColor="#000000"/> |
||||||
|
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
</box> |
||||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||||
|
<font size="6" isBold="true"/> |
||||||
|
</textElement> |
||||||
|
<text><![CDATA[Sonntag]]></text> |
||||||
|
</staticText> |
||||||
|
<frame> |
||||||
|
<reportElement mode="Transparent" x="0" y="38" width="41" height="50" backcolor="#F7C86F" uuid="7621d880-6dae-4cfb-9d99-6c4c83dd1983"> |
||||||
|
<property name="com.jaspersoft.studio.unit.x" value="pixel"/> |
||||||
|
<property name="com.jaspersoft.studio.unit.y" value="pixel"/> |
||||||
|
<property name="com.jaspersoft.studio.unit.width" value="pixel"/> |
||||||
|
</reportElement> |
||||||
|
<textField> |
||||||
|
<reportElement style="Style_Calendar_Day_Number" mode="Opaque" x="0" y="0" width="41" height="10" isRemoveLineWhenBlank="true" uuid="e30cd5f6-c9f8-459d-b37e-401dadccba90"/> |
||||||
|
<box> |
||||||
|
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
</box> |
||||||
|
<textElement textAlignment="Right" verticalAlignment="Middle"> |
||||||
|
<font size="6" isBold="true"/> |
||||||
|
<paragraph rightIndent="1"/> |
||||||
|
</textElement> |
||||||
|
<textFieldExpression><![CDATA[$P{Year}.getDay( java.time.Month.JANUARY, (short)1, java.time.DayOfWeek.MONDAY )]]></textFieldExpression> |
||||||
|
</textField> |
||||||
|
<textField> |
||||||
|
<reportElement x="0" y="10" width="41" height="40" isRemoveLineWhenBlank="true" uuid="660304e6-2981-448f-8990-0cf8f2efbc23"/> |
||||||
|
<box> |
||||||
|
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
</box> |
||||||
|
<textElement> |
||||||
|
<font size="4"/> |
||||||
|
</textElement> |
||||||
|
<textFieldExpression><![CDATA[$F{Field_Value}]]></textFieldExpression> |
||||||
|
</textField> |
||||||
|
</frame> |
||||||
|
<frame> |
||||||
|
<reportElement mode="Transparent" x="41" y="38" width="41" height="50" backcolor="#F7C86F" uuid="7e44315b-20e3-43bf-9014-e0d0aa6072f3"> |
||||||
|
<property name="com.jaspersoft.studio.unit.x" value="pixel"/> |
||||||
|
<property name="com.jaspersoft.studio.unit.y" value="pixel"/> |
||||||
|
<property name="com.jaspersoft.studio.unit.width" value="pixel"/> |
||||||
|
</reportElement> |
||||||
|
<textField> |
||||||
|
<reportElement style="Style_Calendar_Day_Number" mode="Opaque" x="0" y="0" width="41" height="10" isRemoveLineWhenBlank="true" uuid="202fe000-98be-4c0f-b59c-7bc91a656a5b"/> |
||||||
|
<box> |
||||||
|
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
</box> |
||||||
|
<textElement textAlignment="Right" verticalAlignment="Middle"> |
||||||
|
<font size="6" isBold="true"/> |
||||||
|
<paragraph rightIndent="1"/> |
||||||
|
</textElement> |
||||||
|
<textFieldExpression><![CDATA[$P{Year}.getDay( java.time.Month.JANUARY, (short)1, java.time.DayOfWeek.TUESDAY )]]></textFieldExpression> |
||||||
|
</textField> |
||||||
|
<textField> |
||||||
|
<reportElement x="0" y="10" width="41" height="40" isRemoveLineWhenBlank="true" uuid="208dff4b-9244-4c50-9ae1-e6b1a36fc06a"/> |
||||||
|
<box> |
||||||
|
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
</box> |
||||||
|
<textElement> |
||||||
|
<font size="4"/> |
||||||
|
</textElement> |
||||||
|
<textFieldExpression><![CDATA[$F{Field_Value}]]></textFieldExpression> |
||||||
|
</textField> |
||||||
|
</frame> |
||||||
|
<frame> |
||||||
|
<reportElement mode="Transparent" x="41" y="90" width="41" height="50" backcolor="#F7C86F" uuid="55a1c7f6-7ce3-4824-9d1b-fb0290572f7c"> |
||||||
|
<property name="com.jaspersoft.studio.unit.x" value="pixel"/> |
||||||
|
<property name="com.jaspersoft.studio.unit.y" value="pixel"/> |
||||||
|
<property name="com.jaspersoft.studio.unit.width" value="pixel"/> |
||||||
|
</reportElement> |
||||||
|
<textField> |
||||||
|
<reportElement style="Style_Calendar_Day_Number" mode="Opaque" x="0" y="0" width="41" height="10" isRemoveLineWhenBlank="true" uuid="389d3764-a279-4825-bb7d-e36f1be6b580"/> |
||||||
|
<box> |
||||||
|
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
</box> |
||||||
|
<textElement textAlignment="Right" verticalAlignment="Middle"> |
||||||
|
<font size="6" isBold="true"/> |
||||||
|
<paragraph rightIndent="1"/> |
||||||
|
</textElement> |
||||||
|
<textFieldExpression><![CDATA[$P{Year}.getDay( java.time.Month.JANUARY, (short)2, java.time.DayOfWeek.TUESDAY )]]></textFieldExpression> |
||||||
|
</textField> |
||||||
|
<textField> |
||||||
|
<reportElement x="0" y="10" width="41" height="40" isRemoveLineWhenBlank="true" uuid="ecf323b4-70bd-4cdf-96e5-f16c400d7710"/> |
||||||
|
<box> |
||||||
|
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
</box> |
||||||
|
<textElement> |
||||||
|
<font size="4"/> |
||||||
|
</textElement> |
||||||
|
<textFieldExpression><![CDATA[$F{Field_Value}]]></textFieldExpression> |
||||||
|
</textField> |
||||||
|
</frame> |
||||||
|
<frame> |
||||||
|
<reportElement mode="Transparent" x="0" y="90" width="41" height="50" backcolor="#F7C86F" uuid="f72aa4b4-fc79-4ee5-bb8e-51df4c08d0b4"> |
||||||
|
<property name="com.jaspersoft.studio.unit.x" value="pixel"/> |
||||||
|
<property name="com.jaspersoft.studio.unit.y" value="pixel"/> |
||||||
|
<property name="com.jaspersoft.studio.unit.width" value="pixel"/> |
||||||
|
</reportElement> |
||||||
|
<textField> |
||||||
|
<reportElement style="Style_Calendar_Day_Number" mode="Opaque" x="0" y="0" width="41" height="10" isRemoveLineWhenBlank="true" uuid="74c81ac8-3588-4df4-bec7-bb3193c625c1"/> |
||||||
|
<box> |
||||||
|
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
</box> |
||||||
|
<textElement textAlignment="Right" verticalAlignment="Middle"> |
||||||
|
<font size="6" isBold="true"/> |
||||||
|
<paragraph rightIndent="1"/> |
||||||
|
</textElement> |
||||||
|
<textFieldExpression><![CDATA[$P{Year}.getDay( java.time.Month.JANUARY, (short)2, java.time.DayOfWeek.MONDAY )]]></textFieldExpression> |
||||||
|
</textField> |
||||||
|
<textField> |
||||||
|
<reportElement x="0" y="10" width="41" height="40" isRemoveLineWhenBlank="true" uuid="16724e14-9391-4fe0-99b8-4284ec4d39d1"/> |
||||||
|
<box> |
||||||
|
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> |
||||||
|
</box> |
||||||
|
<textElement> |
||||||
|
<font size="4"/> |
||||||
|
</textElement> |
||||||
|
<textFieldExpression><![CDATA[$F{Field_Value}]]></textFieldExpression> |
||||||
|
</textField> |
||||||
|
</frame> |
||||||
|
</band> |
||||||
|
</title> |
||||||
|
<detail> |
||||||
|
<band/> |
||||||
|
</detail> |
||||||
|
</jasperReport> |
||||||
@ -0,0 +1,32 @@ |
|||||||
|
package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.calendar; |
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*; |
||||||
|
|
||||||
|
import java.time.DayOfWeek; |
||||||
|
import java.time.Month; |
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test; |
||||||
|
|
||||||
|
class YearTest { |
||||||
|
|
||||||
|
@Test() |
||||||
|
void test18thCenturyEx() { |
||||||
|
assertThrows(IllegalArgumentException.class, () -> new Year(1899)); |
||||||
|
assertThrows(IllegalArgumentException.class, () -> new Year(2101)); |
||||||
|
new Year(1900); |
||||||
|
new Year(2100); |
||||||
|
} |
||||||
|
|
||||||
|
@Test |
||||||
|
void testMondayIsFirst() { |
||||||
|
Year y = new Year(2018); |
||||||
|
assertEquals(Short.valueOf((short)1), y.getDay(Month.OCTOBER, (short)1, DayOfWeek.MONDAY)); |
||||||
|
} |
||||||
|
|
||||||
|
@Test |
||||||
|
void testThursdayIsFirst() { |
||||||
|
Year y = new Year(2018); |
||||||
|
assertNull(y.getDay(Month.NOVEMBER, (short)1, DayOfWeek.MONDAY)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue