diff --git a/.classpath b/.classpath deleted file mode 100644 index d83c3c7..0000000 --- a/.classpath +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 5521d3c..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/.project b/.project deleted file mode 100644 index bd288b1..0000000 --- a/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - trainerinvoice - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.springframework.ide.eclipse.boot.validation.springbootbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index e977bd2..0000000 --- a/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,9 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/generated=UTF-8 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/main/resources/reports/mtv_gross_buchholz.jrxml=UTF-8 -encoding//src/main/resources/reports/mtv_gross_buchholz_trainer.jrxml=UTF-8 -encoding//src/packaging=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.apt.core.prefs b/.settings/org.eclipse.jdt.apt.core.prefs deleted file mode 100644 index 8c71713..0000000 --- a/.settings/org.eclipse.jdt.apt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.apt.aptEnabled=false -org.eclipse.jdt.apt.genSrcDir=target\\generated-sources\\annotations -org.eclipse.jdt.apt.genTestSrcDir=.apt_generated_tests -org.eclipse.jdt.apt.reconcileEnabled=true diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 8a04631..0000000 --- a/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,17 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=11 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning -org.eclipse.jdt.core.compiler.processAnnotations=disabled -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=11 diff --git a/pom.xml b/pom.xml index 11111cc..d4179f1 100644 --- a/pom.xml +++ b/pom.xml @@ -187,12 +187,6 @@ jasperreports 6.19.1 - com.lowagie itext @@ -203,6 +197,11 @@ mysql mysql-connector-java + + de.kreth.property2java + PropertyToJavaGenerator + 2.0.1-SNAPSHOT + @@ -217,25 +216,14 @@ - org.springframework.boot spring-boot-maven-plugin diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 0000000..254272e --- /dev/null +++ b/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/src/main/java/de/kreth/invoice/Localization_Properties.java b/src/main/java/de/kreth/invoice/Localization_Properties.java deleted file mode 100644 index 1fffc4b..0000000 --- a/src/main/java/de/kreth/invoice/Localization_Properties.java +++ /dev/null @@ -1,324 +0,0 @@ -package de.kreth.invoice; - -import java.util.Properties; -import java.util.ResourceBundle; -import java.util.function.UnaryOperator; - -import javax.annotation.processing.Generated; - -/** - * Property keys from localization.properties - */ -@Generated(date = "22.05.2022, 19:41:47", value = "de.kreth.property2java.Generator") -public enum Localization_Properties { - - /** - * caption.invoiceitem.date = "Datum" - */ - CAPTION_INVOICEITEM_DATE ("caption.invoiceitem.date"), - /** - * caption.user.login = "Anmelden" - */ - CAPTION_USER_LOGIN ("caption.user.login"), - /** - * error.invoice.title.noitems = "Leere Abrechnung nicht erlaubt." - */ - ERROR_INVOICE_TITLE_NOITEMS ("error.invoice.title.noitems"), - /** - * caption.invoice.sum = "Summe" - */ - CAPTION_INVOICE_SUM ("caption.invoice.sum"), - /** - * caption.invoiceitem.participants = "Teilnehmer" - */ - CAPTION_INVOICEITEM_PARTICIPANTS ("caption.invoiceitem.participants"), - /** - * caption.invoiceitem.add = "Neuer Posten" - */ - CAPTION_INVOICEITEM_ADD ("caption.invoiceitem.add"), - /** - * caption.invoice.pattern = "Rechnung-{0}" - */ - CAPTION_INVOICE_PATTERN ("caption.invoice.pattern"), - /** - * caption.invoiceitem.start = "Beginn" - */ - CAPTION_INVOICEITEM_START ("caption.invoiceitem.start"), - /** - * caption.article.report = "Mit Trainer-Lizenz" - */ - CAPTION_ARTICLE_REPORT ("caption.article.report"), - /** - * caption.invoice.invoiceno = "Rechnungsnummer" - */ - CAPTION_INVOICE_INVOICENO ("caption.invoice.invoiceno"), - /** - * caption.invoiceitems = "Rechnungspositionen" - */ - CAPTION_INVOICEITEMS ("caption.invoiceitems"), - /** - * message.user.passwordmissmatch = "Passworter stimmen nicht überein!" - */ - MESSAGE_USER_PASSWORDMISSMATCH ("message.user.passwordmissmatch"), - /** - * label.delete = "Löschen" - */ - LABEL_DELETE ("label.delete"), - /** - * message.user.loginfailure = "Anmeldefehler! Falscher Name oder Passwort?" - */ - MESSAGE_USER_LOGINFAILURE ("message.user.loginfailure"), - /** - * caption.article.type.trainer = "Trainer" - */ - CAPTION_ARTICLE_TYPE_TRAINER ("caption.article.type.trainer"), - /** - * caption.invoiceitem.sumprice = "Betrag" - */ - CAPTION_INVOICEITEM_SUMPRICE ("caption.invoiceitem.sumprice"), - /** - * message.delete.text = "Soll {0} wirklich gelöscht werden?" - */ - MESSAGE_DELETE_TEXT ("message.delete.text"), - /** - * label.user.register = "Registrieren" - */ - LABEL_USER_REGISTER ("label.user.register"), - /** - * error.userdetails.bankname_empty = "Bankname darf nicht leer sein." - */ - ERROR_USERDETAILS_BANKNAME_EMPTY ("error.userdetails.bankname_empty"), - /** - * label.ok = "OK" - */ - LABEL_OK ("label.ok"), - /** - * label.open = "Öffnen" - */ - LABEL_OPEN ("label.open"), - /** - * label.discart = "Verwerfen" - */ - LABEL_DISCART ("label.discart"), - /** - * caption.article = "Artikel" - */ - CAPTION_ARTICLE ("caption.article"), - /** - * message.article.priceerror = "Bitte legen Sie den Preis fest." - */ - MESSAGE_ARTICLE_PRICEERROR ("message.article.priceerror"), - /** - * error.userdetails.iban_empty = "Iban darf nicht leer sein." - */ - ERROR_USERDETAILS_IBAN_EMPTY ("error.userdetails.iban_empty"), - /** - * message.user.create.success = "{0} erstellt!" - */ - MESSAGE_USER_CREATE_SUCCESS ("message.user.create.success"), - /** - * error.userdetails.prename_empty = "Vorname darf nicht leer sein." - */ - ERROR_USERDETAILS_PRENAME_EMPTY ("error.userdetails.prename_empty"), - /** - * error.invoice.text.noitems = "Bitte Posten für Rechnung auswählen." - */ - ERROR_INVOICE_TEXT_NOITEMS ("error.invoice.text.noitems"), - /** - * caption.invoiceitem.end = "Ende" - */ - CAPTION_INVOICEITEM_END ("caption.invoiceitem.end"), - /** - * caption.invoiceitem = "" - */ - CAPTION_INVOICEITEM ("caption.invoiceitem"), - /** - * caption.adress.zipcode = "Postleitzahl" - */ - CAPTION_ADRESS_ZIPCODE ("caption.adress.zipcode"), - /** - * caption.user.password = "Ihr Password:" - */ - CAPTION_USER_PASSWORD ("caption.user.password"), - /** - * caption.invoiceitem.name = "Rechnungsposition" - */ - CAPTION_INVOICEITEM_NAME ("caption.invoiceitem.name"), - /** - * message.delete.title = "Wirklich löschen?" - */ - MESSAGE_DELETE_TITLE ("message.delete.title"), - /** - * error.userdetails.zip_empty = "Postleitzahl darf nicht leer sein." - */ - ERROR_USERDETAILS_ZIP_EMPTY ("error.userdetails.zip_empty"), - /** - * message.invoiceitem.allfieldsmustbeset = "Start, Ende und Artikel müssen gesetzt sein!" - */ - MESSAGE_INVOICEITEM_ALLFIELDSMUSTBESET ("message.invoiceitem.allfieldsmustbeset"), - /** - * caption.invoices = "Rechnungen" - */ - CAPTION_INVOICES ("caption.invoices"), - /** - * caption.user.passwordconfirmation = "Password bestätigen:" - */ - CAPTION_USER_PASSWORDCONFIRMATION ("caption.user.passwordconfirmation"), - /** - * caption.adress.city = "Ort" - */ - CAPTION_ADRESS_CITY ("caption.adress.city"), - /** - * caption.invoice.printsignature = "Unterschrift drucken" - */ - CAPTION_INVOICE_PRINTSIGNATURE ("caption.invoice.printsignature"), - /** - * caption.article.title = "Titel" - */ - CAPTION_ARTICLE_TITLE ("caption.article.title"), - /** - * caption.article.price = "Stundenpreis" - */ - CAPTION_ARTICLE_PRICE ("caption.article.price"), - /** - * error.userdetails.adress_empty = "Adresse darf nicht leer sein." - */ - ERROR_USERDETAILS_ADRESS_EMPTY ("error.userdetails.adress_empty"), - /** - * caption.bank.iban = "IBAN" - */ - CAPTION_BANK_IBAN ("caption.bank.iban"), - /** - * caption.invoice.create = "Rechnung erstellen" - */ - CAPTION_INVOICE_CREATE ("caption.invoice.create"), - /** - * error.article.undefined = "Bitte Artikel anlegen." - */ - ERROR_ARTICLE_UNDEFINED ("error.article.undefined"), - /** - * caption.bank.bic = "BIC" - */ - CAPTION_BANK_BIC ("caption.bank.bic"), - /** - * caption.article.type.assistant = "Übungsleiter" - */ - CAPTION_ARTICLE_TYPE_ASSISTANT ("caption.article.type.assistant"), - /** - * error.userdetails.city_empty = "Ort darf nicht leer sein." - */ - ERROR_USERDETAILS_CITY_EMPTY ("error.userdetails.city_empty"), - /** - * label.cancel = "Abbrechen" - */ - LABEL_CANCEL ("label.cancel"), - /** - * message.user.create.failure = "Fehler beim Erstellen von Benutzer {0}! Ändern Sie den Benutzernamen oder fragen Sie nach dem Passwort. Detail: {1}" - */ - MESSAGE_USER_CREATE_FAILURE ("message.user.create.failure"), - /** - * caption.article.description = "Beschreibung" - */ - CAPTION_ARTICLE_DESCRIPTION ("caption.article.description"), - /** - * caption.user.loginname = "Anmeldename:" - */ - CAPTION_USER_LOGINNAME ("caption.user.loginname"), - /** - * message.article.error.invoiceexists = "Kann nicht geändert werden, da bereits Rechnungen bestehen. Bitte neuen Artikel anlegen." - */ - MESSAGE_ARTICLE_ERROR_INVOICEEXISTS ("message.article.error.invoiceexists"), - /** - * error.userdetails.surname_empty = "Nachname darf nicht leer sein." - */ - ERROR_USERDETAILS_SURNAME_EMPTY ("error.userdetails.surname_empty"), - /** - * label.close = "Schließen" - */ - LABEL_CLOSE ("label.close"), - /** - * caption.adress.street2 = "Adresse" - */ - CAPTION_ADRESS_STREET2 ("caption.adress.street2"), - /** - * caption.adress.street1 = "Adresse" - */ - CAPTION_ADRESS_STREET1 ("caption.adress.street1"), - /** - * caption.user.surname = "Nachname:" - */ - CAPTION_USER_SURNAME ("caption.user.surname"), - /** - * label.loggedin = "Angemeldet:" - */ - LABEL_LOGGEDIN ("label.loggedin"), - /** - * label.logout = "Abmelden" - */ - LABEL_LOGOUT ("label.logout"), - /** - * caption.user.prename = "Vorname:" - */ - CAPTION_USER_PRENAME ("caption.user.prename"), - /** - * caption.bank.name = "Bankname" - */ - CAPTION_BANK_NAME ("caption.bank.name"), - /** - * label.addarticle = "Neuer Artikel" - */ - LABEL_ADDARTICLE ("label.addarticle"), - /** - * label.preview = "Vorschau" - */ - LABEL_PREVIEW ("label.preview"), - /** - * message.invoiceitem.startbeforeend = "Ende darf nicht vor Start liegen." - */ - MESSAGE_INVOICEITEM_STARTBEFOREEND ("message.invoiceitem.startbeforeend"), - /** - * caption.articles = "Artikel" - */ - CAPTION_ARTICLES ("caption.articles"), - /** - * caption.invoice.invoicedate = "Rechnungsdatum" - */ - CAPTION_INVOICE_INVOICEDATE ("caption.invoice.invoicedate"), - /** - * caption.user.details = "Benutzer Details" - */ - CAPTION_USER_DETAILS ("caption.user.details"), - /** - * error.userdetails.username_empty = "Anmeldename darf nicht leer sein." - */ - ERROR_USERDETAILS_USERNAME_EMPTY ("error.userdetails.username_empty"), - /** - * label.store = "Speichern" - */ - LABEL_STORE ("label.store"); - - private final String value; - - private Localization_Properties (String value) { - this.value = value; - } - - /** - * Represented Key in property File. - * @return key - */ - public String getValue() { - return value; - } - - /** - * Resolves the value for this key from the parameter function. - *

- * e.g. Localization_Properties.getString(resBundle::getString) - * @param resourceFunction {@link Properties#getProperty(String)} or {@link ResourceBundle#getString(String)} - * @return - */ - public String getString(UnaryOperator resourceFunction) { - return resourceFunction.apply(value); - } -} diff --git a/src/main/java/de/kreth/invoice/Version_Properties.java b/src/main/java/de/kreth/invoice/Version_Properties.java deleted file mode 100644 index 2dc88f6..0000000 --- a/src/main/java/de/kreth/invoice/Version_Properties.java +++ /dev/null @@ -1,56 +0,0 @@ -package de.kreth.invoice; - -import java.util.Properties; -import java.util.ResourceBundle; -import java.util.function.UnaryOperator; - -import javax.annotation.processing.Generated; - -/** - * Property keys from version.properties - */ -@Generated(date = "29.05.2022, 21:56:35", value = "de.kreth.property2java.Generator") -public enum Version_Properties { - - /** - * project.version = "${project.version}" - */ - PROJECT_VERSION ("project.version"), - /** - * package_name = "${project.artifactId}-${project.version}.${project.packaging}" - */ - PACKAGE_NAME ("package_name"), - /** - * build.dateTime = "${timestamp}" - */ - BUILD_DATETIME ("build.dateTime"), - /** - * project.artifactId = "${project.artifactId}" - */ - PROJECT_ARTIFACTID ("project.artifactId"); - - private final String value; - - private Version_Properties (String value) { - this.value = value; - } - - /** - * Represented Key in property File. - * @return key - */ - public String getValue() { - return value; - } - - /** - * Resolves the value for this key from the parameter function. - *

- * e.g. Version_Properties.getString(resBundle::getString) - * @param resourceFunction {@link Properties#getProperty(String)} or {@link ResourceBundle#getString(String)} - * @return - */ - public String getString(UnaryOperator resourceFunction) { - return resourceFunction.apply(value); - } -} diff --git a/src/main/java/de/kreth/invoice/business/ArticleBusiness.java b/src/main/java/de/kreth/invoice/business/ArticleBusiness.java index 825d1c2..bc940ef 100644 --- a/src/main/java/de/kreth/invoice/business/ArticleBusiness.java +++ b/src/main/java/de/kreth/invoice/business/ArticleBusiness.java @@ -28,6 +28,7 @@ public class ArticleBusiness extends AbstractBusiness

{ } public List
findByUserId(Long id) { + return articleRepository.findByUserId(id); } diff --git a/src/main/java/de/kreth/invoice/report/InvoiceReportSource.java b/src/main/java/de/kreth/invoice/report/InvoiceReportSource.java index 624d8bc..bcd593e 100644 --- a/src/main/java/de/kreth/invoice/report/InvoiceReportSource.java +++ b/src/main/java/de/kreth/invoice/report/InvoiceReportSource.java @@ -99,77 +99,77 @@ public class InvoiceReportSource implements JRDataSource, JRDataSourceProvider { @Override public Object getFieldValue(JRField jrField) throws JRException { switch (jrField.getName()) { - case FIELD_INVOICE_NO: - return invoice.getInvoiceId(); - case FIELD_INVOICE_DATE: - return invoice.getInvoiceDate(); - case FIELD_INVOICE_SUM: - return invoice.getSum(); - case FIELD_USER_PRENAME: - return invoice.getUser().getGivenName(); - case FIELD_USER_SURNAME: - return invoice.getUser().getFamilyName(); - - case FIELD_BANK_NAME: - return invoice.getUser().getBank().getBankName(); - case FIELD_BANK_IBAN: - return invoice.getUser().getBank().getIban(); - case FIELD_BANK_BIC: - return invoice.getUser().getBank().getBic(); - case FIELD_USER_ADRESS1: - return invoice.getUser().getAdress().getAdress1(); - case FIELD_USER_ADRESS2: - return invoice.getUser().getAdress().getAdress2(); - case FIELD_USER_ZIP: - return invoice.getUser().getAdress().getZip(); - case FIELD_USER_CITY: - return invoice.getUser().getAdress().getCity(); - - case FIELD_SIGNATURE_PATH: - return invoice.getSignImagePath(); - default: - break; + case FIELD_INVOICE_NO: + return invoice.getInvoiceId(); + case FIELD_INVOICE_DATE: + return invoice.getInvoiceDate(); + case FIELD_INVOICE_SUM: + return invoice.getSum(); + case FIELD_USER_PRENAME: + return invoice.getUser().getGivenName(); + case FIELD_USER_SURNAME: + return invoice.getUser().getFamilyName(); + + case FIELD_BANK_NAME: + return invoice.getUser().getBank().getBankName(); + case FIELD_BANK_IBAN: + return invoice.getUser().getBank().getIban(); + case FIELD_BANK_BIC: + return invoice.getUser().getBank().getBic(); + case FIELD_USER_ADRESS1: + return invoice.getUser().getAdress().getAdress1(); + case FIELD_USER_ADRESS2: + return invoice.getUser().getAdress().getAdress2(); + case FIELD_USER_ZIP: + return invoice.getUser().getAdress().getZip(); + case FIELD_USER_CITY: + return invoice.getUser().getAdress().getCity(); + + case FIELD_SIGNATURE_PATH: + return determineImagePath(); + default: + break; } if (currentItem != null) { switch (jrField.getName()) { - case FIELD_ARTICLE_TITLE: - return currentItem.getTitle(); - case FIELD_ARTICLE_DESCRIPTION: - return currentItem.getDescription(); - case FIELD_ARTICLE_PRICE_PER_HOUR: - return currentItem.getPricePerHour(); - case FIELD_ITEM_START: - return currentItem.getStart(); - case FIELD_ITEM_END: - return currentItem.getEnd(); - case FIELD_ITEM_DURATION_MINUTES: - return currentItem.getDurationInMinutes(); - case FIELD_ITEM_SUM: - return currentItem.getSumPrice(); - case FIELD_ITEM_PARTICIPANTS: - return currentItem.getParticipants(); - case FIELD_ITEM_SPORTART: - return currentItem.getSportArt() != null ? currentItem.getSportArt().getName() : "Trampolin"; - case FIELD_ITEM_SPORTSTAETTE: - return currentItem.getSportStaette() != null ? currentItem.getSportStaette().getName() - : "IGS Roderbruch"; - - default: - break; + case FIELD_ARTICLE_TITLE: + return currentItem.getTitle(); + case FIELD_ARTICLE_DESCRIPTION: + return currentItem.getDescription(); + case FIELD_ARTICLE_PRICE_PER_HOUR: + return currentItem.getPricePerHour(); + case FIELD_ITEM_START: + return currentItem.getStart(); + case FIELD_ITEM_END: + return currentItem.getEnd(); + case FIELD_ITEM_DURATION_MINUTES: + return currentItem.getDurationInMinutes(); + case FIELD_ITEM_SUM: + return currentItem.getSumPrice(); + case FIELD_ITEM_PARTICIPANTS: + return currentItem.getParticipants(); + case FIELD_ITEM_SPORTART: + return currentItem.getSportArt() != null ? currentItem.getSportArt().getName() : "Trampolin"; + case FIELD_ITEM_SPORTSTAETTE: + return currentItem.getSportStaette() != null ? currentItem.getSportStaette().getName() + : "IGS Roderbruch"; + + default: + break; } } else { switch (jrField.getName()) { - case FIELD_ARTICLE_TITLE: - return article.getTitle(); - case FIELD_ARTICLE_DESCRIPTION: - return article.getDescription(); - case FIELD_ARTICLE_PRICE_PER_HOUR: - return article.getPricePerHour(); - default: - break; + case FIELD_ARTICLE_TITLE: + return article.getTitle(); + case FIELD_ARTICLE_DESCRIPTION: + return article.getDescription(); + case FIELD_ARTICLE_PRICE_PER_HOUR: + return article.getPricePerHour(); + default: + break; } } @@ -178,6 +178,18 @@ public class InvoiceReportSource implements JRDataSource, JRDataSourceProvider { return null; } + private Object determineImagePath() { + String signImagePath = invoice.getSignImagePath(); + if (signImagePath == null) { + return null; + } + Path of = Path.of(signImagePath); + if (!of.toFile().exists()) { + return null; + } + return of; + } + public static InvoiceReportSource create(Invoice invoice) { InvoiceReportSource invoiceReportSource = new InvoiceReportSource(); invoiceReportSource.setInvoice(invoice); diff --git a/src/main/java/de/kreth/invoice/views/FooterComponent.java b/src/main/java/de/kreth/invoice/views/FooterComponent.java index c968f0e..3fcad89 100644 --- a/src/main/java/de/kreth/invoice/views/FooterComponent.java +++ b/src/main/java/de/kreth/invoice/views/FooterComponent.java @@ -88,6 +88,6 @@ public class FooterComponent extends FormLayout { } private String getString(Version_Properties prop) { - return prop.getString(VERSION::getProperty); + return prop.getText(); } } diff --git a/src/main/java/de/kreth/invoice/views/View.java b/src/main/java/de/kreth/invoice/views/View.java index ac987a5..9b3890e 100644 --- a/src/main/java/de/kreth/invoice/views/View.java +++ b/src/main/java/de/kreth/invoice/views/View.java @@ -1,7 +1,5 @@ package de.kreth.invoice.views; -import static de.kreth.invoice.Application.getString; - import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -157,9 +155,9 @@ public class View extends VerticalLayout implements BeforeEnterObserver { Label name = new Label(user.getGivenName() + " " + user.getFamilyName()); Label email = new Label(user.getEmail()); - Button openDetailDialog = new Button(getString(Localization_Properties.CAPTION_USER_DETAILS)); + Button openDetailDialog = new Button(Localization_Properties.CAPTION_USER_DETAILS.getText()); openDetailDialog.addClickListener(ev -> openDetailDialog()); - Button openArticleDialog = new Button(getString(Localization_Properties.CAPTION_ARTICLES)); + Button openArticleDialog = new Button(Localization_Properties.CAPTION_ARTICLES.getText()); openArticleDialog.addClickListener(ev -> openArticleDialog()); FormLayout layout = new FormLayout(name, email, openDetailDialog, openArticleDialog); add(layout); diff --git a/src/main/java/de/kreth/invoice/views/article/ArticleDialog.java b/src/main/java/de/kreth/invoice/views/article/ArticleDialog.java index e5d1c1c..b3db50e 100644 --- a/src/main/java/de/kreth/invoice/views/article/ArticleDialog.java +++ b/src/main/java/de/kreth/invoice/views/article/ArticleDialog.java @@ -1,7 +1,5 @@ package de.kreth.invoice.views.article; -import static de.kreth.invoice.Application.getString; - import java.math.BigDecimal; import java.util.List; import java.util.Optional; @@ -88,10 +86,10 @@ public class ArticleDialog extends Dialog { } }); - Button closeButton = new Button(getString(Localization_Properties.LABEL_CLOSE), + Button closeButton = new Button(Localization_Properties.LABEL_CLOSE.getText(), ev -> close()); - deleteButton = new Button(getString(Localization_Properties.LABEL_DELETE), ev -> { + deleteButton = new Button(Localization_Properties.LABEL_DELETE.getText(), ev -> { business.delete(current); current = null; binder.setBean(null); diff --git a/src/main/java/de/kreth/invoice/views/invoice/InvoiceDialog.java b/src/main/java/de/kreth/invoice/views/invoice/InvoiceDialog.java index 28503b3..31152ae 100644 --- a/src/main/java/de/kreth/invoice/views/invoice/InvoiceDialog.java +++ b/src/main/java/de/kreth/invoice/views/invoice/InvoiceDialog.java @@ -1,6 +1,5 @@ package de.kreth.invoice.views.invoice; -import static de.kreth.invoice.Application.getString; import static de.kreth.invoice.Localization_Properties.CAPTION_INVOICE_PRINTSIGNATURE; import static de.kreth.invoice.Localization_Properties.LABEL_CANCEL; import static de.kreth.invoice.Localization_Properties.LABEL_CLOSE; @@ -113,7 +112,7 @@ public class InvoiceDialog extends Dialog { itemGrid = new InvoiceItemGrid<>(); - printSignature = new Checkbox(getString(CAPTION_INVOICE_PRINTSIGNATURE)); + printSignature = new Checkbox(CAPTION_INVOICE_PRINTSIGNATURE.getText()); if (InvoiceMode.VIEW_ONLY == pdfOpenLabel) { printSignature.setEnabled(false); } @@ -125,18 +124,18 @@ public class InvoiceDialog extends Dialog { invoice.setSignImagePath(null); } }); - okButton = new Button(getString(LABEL_STORE), ev -> close()); + okButton = new Button(LABEL_STORE.getText(), ev -> close()); deleteButton = new Button("Löschen"); String previewCaption; String closeCaption; if (pdfOpenLabel == InvoiceMode.VIEW_ONLY) { - previewCaption = getString(LABEL_OPEN); - closeCaption = getString(LABEL_CLOSE); + previewCaption = LABEL_OPEN.getText(); + closeCaption = LABEL_CLOSE.getText(); okButton.setVisible(false); } else { - previewCaption = getString(LABEL_PREVIEW); - closeCaption = getString(LABEL_CANCEL); + previewCaption = LABEL_PREVIEW.getText(); + closeCaption = LABEL_CANCEL.getText(); deleteButton.setVisible(false); } Button cancel = new Button(closeCaption, ev -> close()); diff --git a/src/main/java/de/kreth/invoice/views/invoiceitem/InvoiceItemGrid.java b/src/main/java/de/kreth/invoice/views/invoiceitem/InvoiceItemGrid.java index b04e2c8..648fb94 100644 --- a/src/main/java/de/kreth/invoice/views/invoiceitem/InvoiceItemGrid.java +++ b/src/main/java/de/kreth/invoice/views/invoiceitem/InvoiceItemGrid.java @@ -1,6 +1,5 @@ package de.kreth.invoice.views.invoiceitem; -import static de.kreth.invoice.Application.getString; import static de.kreth.invoice.Localization_Properties.CAPTION_INVOICEITEM_DATE; import static de.kreth.invoice.Localization_Properties.CAPTION_INVOICEITEM_END; import static de.kreth.invoice.Localization_Properties.CAPTION_INVOICEITEM_NAME; @@ -48,26 +47,26 @@ public class InvoiceItemGrid extends Grid { public InvoiceItemGrid() { Column articleColumn = addColumn(InvoiceItem::getTitle) - .setHeader(getString(CAPTION_INVOICEITEM_NAME)); + .setHeader(CAPTION_INVOICEITEM_NAME.getText()); LocalDateTimeRenderer renderer = new LocalDateTimeRenderer<>(InvoiceItem::getStart, DateTimeFormatter.ofPattern("EEE, dd.MM.yyyy")); - Column dateColumn = addColumn(renderer).setHeader(getString(CAPTION_INVOICEITEM_DATE)); + Column dateColumn = addColumn(renderer).setHeader(CAPTION_INVOICEITEM_DATE.getText()); dateColumn.setId("Date"); Column startColumn = addColumn(new LocalDateTimeRenderer<>(InvoiceItem::getStart, DateTimeFormatter.ofPattern("HH:mm"))) - .setHeader(getString(CAPTION_INVOICEITEM_START)); + .setHeader(CAPTION_INVOICEITEM_START.getText()); Column endColumn = addColumn(new LocalDateTimeRenderer<>(InvoiceItem::getEnd, DateTimeFormatter.ofPattern("HH:mm"))) - .setHeader(getString(CAPTION_INVOICEITEM_END)); + .setHeader(CAPTION_INVOICEITEM_END.getText()); addColumn(InvoiceItem::getParticipants) - .setHeader(getString(CAPTION_INVOICEITEM_PARTICIPANTS)); + .setHeader(CAPTION_INVOICEITEM_PARTICIPANTS.getText()); Column priceColumn = addColumn( new NumberRenderer<>(InvoiceItem::getSumPrice, NumberFormat.getCurrencyInstance())) - .setHeader(getString(CAPTION_INVOICEITEM_SUMPRICE)); + .setHeader(CAPTION_INVOICEITEM_SUMPRICE.getText()); FooterRow footer = appendFooterRow(); footer = appendFooterRow(); diff --git a/src/main/java/de/kreth/invoice/views/invoiceitem/InvoiceItemOverviewComponent.java b/src/main/java/de/kreth/invoice/views/invoiceitem/InvoiceItemOverviewComponent.java index 0a1eed1..7d5beeb 100644 --- a/src/main/java/de/kreth/invoice/views/invoiceitem/InvoiceItemOverviewComponent.java +++ b/src/main/java/de/kreth/invoice/views/invoiceitem/InvoiceItemOverviewComponent.java @@ -1,6 +1,5 @@ package de.kreth.invoice.views.invoiceitem; -import static de.kreth.invoice.Application.getString; import static de.kreth.invoice.Localization_Properties.CAPTION_INVOICEITEMS; import static de.kreth.invoice.Localization_Properties.CAPTION_INVOICEITEM_ADD; @@ -55,8 +54,8 @@ public class InvoiceItemOverviewComponent extends VerticalLayout { this.user = user; this.selectListener = new ArrayList<>(); - Button addButton = new Button(getString(CAPTION_INVOICEITEM_ADD), this::createNewitem); - H3 title = new H3(getString(CAPTION_INVOICEITEMS)); + Button addButton = new Button(CAPTION_INVOICEITEM_ADD.getText(), this::createNewitem); + H3 title = new H3(CAPTION_INVOICEITEMS.getText()); HorizontalLayout horizontalLayout = new HorizontalLayout(title, addButton); @@ -66,7 +65,7 @@ public class InvoiceItemOverviewComponent extends VerticalLayout { grid.addItemClickListener(this::itemClicked); grid.setSelectionMode(SelectionMode.MULTI); GridContextMenu contextMenu = grid.addContextMenu(); - contextMenu.addItem(getString(Localization_Properties.LABEL_DELETE), this::deleteEvent); + contextMenu.addItem(Localization_Properties.LABEL_DELETE.getText(), this::deleteEvent); add(grid); } @@ -74,12 +73,12 @@ public class InvoiceItemOverviewComponent extends VerticalLayout { private void deleteEvent(GridContextMenuItemClickEvent event) { if (event.getItem().isPresent()) { ConfirmDialog dlg = new ConfirmDialog(); - dlg.setHeader(getString(Localization_Properties.MESSAGE_DELETE_TITLE)); - dlg.setText(MessageFormat.format(getString(Localization_Properties.MESSAGE_DELETE_TEXT), + dlg.setHeader(Localization_Properties.MESSAGE_DELETE_TITLE.getText()); + dlg.setText(MessageFormat.format(Localization_Properties.MESSAGE_DELETE_TEXT.getText(), event.getItem().get())); dlg.setCancelable(true); - dlg.setCancelText("Nicht " + getString(Localization_Properties.LABEL_DELETE)); - dlg.setConfirmText(getString(Localization_Properties.LABEL_DELETE)); + dlg.setCancelText("Nicht " + Localization_Properties.LABEL_DELETE.getText()); + dlg.setConfirmText(Localization_Properties.LABEL_DELETE.getText()); dlg.addConfirmListener(ev -> { invoiceItemRepository.delete(event.getItem().get()); refreshData(); diff --git a/src/main/java/de/kreth/invoice/views/invoiceitem/InvoiceOverviewComponent.java b/src/main/java/de/kreth/invoice/views/invoiceitem/InvoiceOverviewComponent.java index d20bdae..b93f45b 100644 --- a/src/main/java/de/kreth/invoice/views/invoiceitem/InvoiceOverviewComponent.java +++ b/src/main/java/de/kreth/invoice/views/invoiceitem/InvoiceOverviewComponent.java @@ -1,7 +1,5 @@ package de.kreth.invoice.views.invoiceitem; -import static de.kreth.invoice.Application.getString; - import java.text.MessageFormat; import java.time.LocalDateTime; import java.time.format.TextStyle; @@ -44,9 +42,9 @@ public class InvoiceOverviewComponent extends VerticalLayout { this.grid = new InvoiceGrid(); this.creationListener = new ArrayList<>(); - Button addButton = new Button(getString(Localization_Properties.CAPTION_INVOICE_CREATE), + Button addButton = new Button(Localization_Properties.CAPTION_INVOICE_CREATE.getText(), this::createNewRechnung); - FormLayout titleComponent = new FormLayout(new H3(getString(Localization_Properties.CAPTION_INVOICES)), + FormLayout titleComponent = new FormLayout(new H3(Localization_Properties.CAPTION_INVOICES.getText()), addButton); add(new VerticalLayout(titleComponent, grid)); grid.addItemClickListener(ev -> openDialog(ev.getItem(), InvoiceMode.VIEW_ONLY)); @@ -55,12 +53,12 @@ public class InvoiceOverviewComponent extends VerticalLayout { private void confirmAndExecuteDelete(Invoice item) { ConfirmDialog dlg = new ConfirmDialog(); - dlg.setHeader(getString(Localization_Properties.MESSAGE_DELETE_TITLE)); - dlg.setText(MessageFormat.format(getString(Localization_Properties.MESSAGE_DELETE_TEXT), + dlg.setHeader(Localization_Properties.MESSAGE_DELETE_TITLE.getText()); + dlg.setText(MessageFormat.format(Localization_Properties.MESSAGE_DELETE_TEXT.getText(), item)); dlg.setCancelable(true); - dlg.setCancelText("Nicht " + getString(Localization_Properties.LABEL_DELETE)); - dlg.setConfirmText(getString(Localization_Properties.LABEL_DELETE)); + dlg.setCancelText("Nicht " + Localization_Properties.LABEL_DELETE.getText()); + dlg.setConfirmText(Localization_Properties.LABEL_DELETE.getText()); dlg.addConfirmListener(ev -> { business.delete(item); if (invoiceDialog != null) { diff --git a/src/main/resources/localization.properties b/src/main/resources/localization.properties index 77d8825..609aa94 100644 --- a/src/main/resources/localization.properties +++ b/src/main/resources/localization.properties @@ -10,7 +10,7 @@ caption.article.price = Stundenpreis caption.article.title = Titel caption.article.report = Mit Trainer-Lizenz caption.article.type.trainer = Trainer -caption.article.type.assistant = Übungsleiter +caption.article.type.assistant = Übungsleiter caption.articles = Artikel caption.bank.bic = BIC caption.bank.iban = IBAN @@ -66,14 +66,14 @@ label.open = PDF \u00D6ffnen label.user.register = Registrieren message.article.priceerror = Bitte legen Sie den Preis fest. -message.article.error.invoiceexists = Kann nicht geändert werden, da bereits Rechnungen bestehen. Bitte neuen Artikel anlegen. +message.article.error.invoiceexists = Kann nicht geändert werden, da bereits Rechnungen bestehen. Bitte neuen Artikel anlegen. message.delete.text = Soll {0} wirklich gel\u00F6scht werden? message.delete.title = Wirklich l\u00F6schen? message.invoiceitem.allfieldsmustbeset = Start, Ende und Artikel m\u00FCssen \ gesetzt sein! message.invoiceitem.startbeforeend = Ende darf nicht vor Start liegen. message.user.create.success = {0} erstellt! -message.user.create.failure = Fehler beim Erstellen von Benutzer {0}! Ändern Sie den Benutzernamen oder fragen Sie nach dem Passwort. Detail: {1} +message.user.create.failure = Fehler beim Erstellen von Benutzer {0}! Ändern Sie den Benutzernamen oder fragen Sie nach dem Passwort. Detail: {1} message.user.loginfailure = Anmeldefehler! Falscher Name oder \ Passwort? message.user.passwordmissmatch = Passworter stimmen nicht \u00FCberein!