diff --git a/src/de/deadlocker8/budgetmaster/logic/Category.java b/src/de/deadlocker8/budgetmaster/logic/Category.java index 29c523ae028ab6709db76c641e9a2b0022498f70..96a2f3df86918678577bb9eb579b55cef78a7d72 100644 --- a/src/de/deadlocker8/budgetmaster/logic/Category.java +++ b/src/de/deadlocker8/budgetmaster/logic/Category.java @@ -1,6 +1,8 @@ package de.deadlocker8.budgetmaster.logic; +import de.deadlocker8.budgetmaster.logic.utils.Strings; import javafx.scene.paint.Color; +import tools.Localization; public class Category { @@ -27,7 +29,12 @@ public class Category } public String getName() - { + { + if(ID == 1) + { + return Localization.getString(Strings.CATEGORY_NONE); + } + return name; } diff --git a/src/de/deadlocker8/budgetmaster/logic/CategoryBudget.java b/src/de/deadlocker8/budgetmaster/logic/CategoryBudget.java index 35457be494cd81e7ab2cc7af27c81ff95e79d303..1e904cd4ef08e3217746613849c990267a450b61 100644 --- a/src/de/deadlocker8/budgetmaster/logic/CategoryBudget.java +++ b/src/de/deadlocker8/budgetmaster/logic/CategoryBudget.java @@ -1,6 +1,8 @@ package de.deadlocker8.budgetmaster.logic; +import de.deadlocker8.budgetmaster.logic.utils.Strings; import javafx.scene.paint.Color; +import tools.Localization; public class CategoryBudget { @@ -17,6 +19,11 @@ public class CategoryBudget public String getName() { + //TODO this is not safe! --> if user wishes to name a category "NONE" --> use ID to identify NONE-category instead + if(name != null && name.equals("NONE")) + { + return Localization.getString(Strings.CATEGORY_NONE); + } return name; } diff --git a/src/de/deadlocker8/budgetmaster/logic/CategoryInOutSum.java b/src/de/deadlocker8/budgetmaster/logic/CategoryInOutSum.java index 4b49c5b10d088b5b6a51ddf7c14a03d82e918c40..68246434d14a3c5bd8d99cad3086890b6f41d838 100644 --- a/src/de/deadlocker8/budgetmaster/logic/CategoryInOutSum.java +++ b/src/de/deadlocker8/budgetmaster/logic/CategoryInOutSum.java @@ -1,6 +1,8 @@ package de.deadlocker8.budgetmaster.logic; +import de.deadlocker8.budgetmaster.logic.utils.Strings; import javafx.scene.paint.Color; +import tools.Localization; public class CategoryInOutSum { @@ -20,9 +22,14 @@ public class CategoryInOutSum } public String getName() - { - return name; - } + { + if(ID == 1) + { + return Localization.getString(Strings.CATEGORY_NONE); + } + + return name; + } public void setName(String name) { diff --git a/src/de/deadlocker8/budgetmaster/logic/charts/CategoriesChart.java b/src/de/deadlocker8/budgetmaster/logic/charts/CategoriesChart.java index 37c153d1a0d288ea42667e610b50dee9864f58c0..54a0395707ce4380038d2dc3c0976c561e3ae2cf 100644 --- a/src/de/deadlocker8/budgetmaster/logic/charts/CategoriesChart.java +++ b/src/de/deadlocker8/budgetmaster/logic/charts/CategoriesChart.java @@ -3,7 +3,9 @@ package de.deadlocker8.budgetmaster.logic.charts; import java.util.ArrayList; import de.deadlocker8.budgetmaster.logic.CategoryInOutSum; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; +import de.deadlocker8.budgetmaster.logic.utils.Strings; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; @@ -21,6 +23,7 @@ import javafx.scene.transform.Transform; import javafx.stage.Modality; import javafx.stage.Stage; import tools.ConvertTo; +import tools.Localization; public class CategoriesChart extends VBox implements ChartExportable { @@ -103,14 +106,11 @@ public class CategoriesChart extends VBox implements ChartExportable currentPart.prefWidthProperty().bind(chart.widthProperty().multiply(percentage)); - String categoryName = currentItem.getName(); - if(categoryName.equals("NONE")) - { - categoryName = "Keine Kategorie"; - } - Tooltip tooltip = new Tooltip(); - tooltip.setText(categoryName + "\n" + Helpers.NUMBER_FORMAT.format(percentage*100) + " %\n" + Helpers.getCurrencyString(value, currency));// + tooltip.setText(Localization.getString(Strings.TOOLTIP_CHART_CATEGORIES, + currentItem.getName(), + Helpers.NUMBER_FORMAT.format(percentage * 100), + Helpers.getCurrencyString(value, currency))); currentPart.setTooltip(tooltip); } @@ -126,7 +126,7 @@ public class CategoriesChart extends VBox implements ChartExportable legend.setHgap(20); legend.setVgap(10); legend.setAlignment(Pos.CENTER); - legend.setStyle("-fx-background-color: #EEEEEE; -fx-border-color: #212121; -fx-border-width: 1; -fx-border-radius: 5;"); + legend.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_CHART_LEGEND) + "; -fx-border-color: #212121; -fx-border-width: 1; -fx-border-radius: 5;"); if(categoryInOutSums.size() == 0) { @@ -135,13 +135,8 @@ public class CategoriesChart extends VBox implements ChartExportable ArrayList<HBox> legendItems = new ArrayList<>(); for(CategoryInOutSum currentItem : categoryInOutSums) - { - String label = currentItem.getName(); - if(label.equals("NONE")) - { - label = "Keine Kategorie"; - } - legendItems.add(getLegendItem(label, currentItem.getColor())); + { + legendItems.add(getLegendItem(currentItem.getName(), currentItem.getColor())); } int legendWidth; @@ -170,7 +165,7 @@ public class CategoriesChart extends VBox implements ChartExportable VBox legend = new VBox(); legend.setPadding(new Insets(10)); legend.setSpacing(10); - legend.setStyle("-fx-background-color: #EEEEEE; -fx-border-color: #212121; -fx-border-width: 1; -fx-border-radius: 5;"); + legend.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_CHART_LEGEND) + "; -fx-border-color: #212121; -fx-border-width: 1; -fx-border-radius: 5;"); if(categoryInOutSums.size() == 0) { @@ -197,36 +192,30 @@ public class CategoriesChart extends VBox implements ChartExportable labelHeaderSpacer.setMinHeight(20); vboxCircles.getChildren().add(labelHeaderSpacer); - Label labelHeaderName = new Label("Kategorie"); + Label labelHeaderName = new Label(Localization.getString(Strings.TITLE_CATEGORIES)); labelHeaderName.setStyle("-fx-font-weight: bold; -fx-underline: true;"); labelHeaderName.setMinHeight(20); vboxNames.getChildren().add(labelHeaderName); - Label labelHeaderIn = new Label("Einnahmen"); + Label labelHeaderIn = new Label(Localization.getString(Strings.TITLE_INCOMES)); labelHeaderIn.setStyle("-fx-font-weight: bold; -fx-underline: true;"); labelHeaderIn.setMinHeight(20); vboxIn.getChildren().add(labelHeaderIn); - Label labelHeaderOut = new Label("Ausgaben"); + Label labelHeaderOut = new Label(Localization.getString(Strings.TITLE_PAYMENTS)); labelHeaderOut.setStyle("-fx-font-weight: bold; -fx-underline: true;"); labelHeaderOut.setMinHeight(20); vboxOut.getChildren().add(labelHeaderOut); for(CategoryInOutSum currentItem : categoryInOutSums) - { - String name = currentItem.getName(); - if(name.equals("NONE")) - { - name = "Keine Kategorie"; - } - + { Label labelCircle = new Label(); labelCircle.setMinWidth(20); labelCircle.setMinHeight(20); labelCircle.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(currentItem.getColor()) + "; -fx-background-radius: 50%; -fx-border-width: 1; -fx-border-color: black - fx-border-radius: 50%"); vboxCircles.getChildren().add(labelCircle); - Label labelName = new Label(name); + Label labelName = new Label(currentItem.getName()); labelName.setStyle("-fx-font-weight: bold;"); labelName.setMinHeight(20); vboxNames.getChildren().add(labelName); @@ -290,23 +279,31 @@ public class CategoriesChart extends VBox implements ChartExportable } return total; } + + private VBox prepareExportChart() + { + //TODO won't work because vbox is not added to stage at this point + VBox root = new VBox(); + root.setStyle("-fx-background-color: transparent;"); + root.setPadding(new Insets(25)); + + root.getChildren().add(generate(titleIncomes, true)); + root.getChildren().add(generate(titlePayments, false)); + + Region spacer = new Region(); + root.getChildren().add(spacer); + VBox.setVgrow(spacer, Priority.ALWAYS); + + root.getChildren().add(generateFullLegend()); + + return root; + } @Override public WritableImage export(int width, int height) { - VBox root = new VBox(); - root.setStyle("-fx-background-color: transparent;"); - root.setPadding(new Insets(25)); - - root.getChildren().add(generate(titleIncomes, true)); - root.getChildren().add(generate(titlePayments, false)); - - Region spacer = new Region(); - root.getChildren().add(spacer); - VBox.setVgrow(spacer, Priority.ALWAYS); - - root.getChildren().add(generateFullLegend()); - + VBox root = prepareExportChart(); + Stage newStage = new Stage(); newStage.initModality(Modality.NONE); newStage.setScene(new Scene(root, width, height)); @@ -323,12 +320,12 @@ public class CategoriesChart extends VBox implements ChartExportable @Override public double getSuggestedWidth() { - return getWidth() + 50; + return prepareExportChart().getWidth() + 50; } @Override public double getSuggestedHeight() { - return getHeight() + 100; + return prepareExportChart().getHeight() + 50; } } \ No newline at end of file diff --git a/src/de/deadlocker8/budgetmaster/logic/charts/MonthBarChart.java b/src/de/deadlocker8/budgetmaster/logic/charts/MonthBarChart.java index 6251812423272a5e189beb9be99c40f92dcb19d3..98e20266e63c92a4b0e51ccaceaaef6d562ef645 100644 --- a/src/de/deadlocker8/budgetmaster/logic/charts/MonthBarChart.java +++ b/src/de/deadlocker8/budgetmaster/logic/charts/MonthBarChart.java @@ -4,7 +4,9 @@ import java.util.ArrayList; import de.deadlocker8.budgetmaster.logic.CategoryInOutSum; import de.deadlocker8.budgetmaster.logic.MonthInOutSum; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; +import de.deadlocker8.budgetmaster.logic.utils.Strings; import javafx.geometry.Insets; import javafx.geometry.Orientation; import javafx.geometry.Pos; @@ -28,6 +30,7 @@ import javafx.scene.transform.Transform; import javafx.stage.Modality; import javafx.stage.Stage; import tools.ConvertTo; +import tools.Localization; public class MonthBarChart extends VBox implements ChartExportable { @@ -134,14 +137,11 @@ public class MonthBarChart extends VBox implements ChartExportable currentPart.setMinHeight(0); currentPart.prefHeightProperty().bind(chart.heightProperty().multiply(percentage)); - String categoryName = currentItem.getName(); - if(categoryName.equals("NONE")) - { - categoryName = "Keine Kategorie"; - } - Tooltip tooltip = new Tooltip(); - tooltip.setText(categoryName + "\n"+ Helpers.NUMBER_FORMAT.format(percentage * 100) + " %\n" + Helpers.NUMBER_FORMAT.format(value).replace(".", ",") + currency);// + tooltip.setText(Localization.getString(Strings.TOOLTIP_CHART_CATEGORIES, + currentItem.getName(), + Helpers.NUMBER_FORMAT.format(percentage * 100), + Helpers.getCurrencyString(value, currency))); currentPart.setTooltip(tooltip); } @@ -158,7 +158,7 @@ public class MonthBarChart extends VBox implements ChartExportable legend.setHgap(20); legend.setVgap(10); legend.setAlignment(Pos.CENTER); - legend.setStyle("-fx-background-color: #EEEEEE; -fx-border-color: #212121; -fx-border-width: 1; -fx-border-radius: 5;"); + legend.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_CHART_LEGEND) + "; -fx-border-color: #212121; -fx-border-width: 1; -fx-border-radius: 5;"); if(monthInOutSums.size() == 0) { @@ -167,13 +167,8 @@ public class MonthBarChart extends VBox implements ChartExportable ArrayList<HBox> legendItems = new ArrayList<>(); for(CategoryInOutSum currentItem : monthInOutSums.get(0).getSums()) - { - String label = currentItem.getName(); - if(label.equals("NONE")) - { - label = "Keine Kategorie"; - } - legendItems.add(getLegendItem(label, currentItem.getColor())); + { + legendItems.add(getLegendItem(currentItem.getName(), currentItem.getColor())); } int legendWidth; diff --git a/src/de/deadlocker8/budgetmaster/logic/charts/MonthLineChart.java b/src/de/deadlocker8/budgetmaster/logic/charts/MonthLineChart.java index af5152f69354a666eb8f4993bf29bddbbff8a88e..b4e02909204f200a21c787cd48745ba009a1b023 100644 --- a/src/de/deadlocker8/budgetmaster/logic/charts/MonthLineChart.java +++ b/src/de/deadlocker8/budgetmaster/logic/charts/MonthLineChart.java @@ -5,7 +5,9 @@ import java.util.Iterator; import java.util.Set; import de.deadlocker8.budgetmaster.logic.MonthInOutSum; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; +import de.deadlocker8.budgetmaster.logic.utils.Strings; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.geometry.Point2D; @@ -24,6 +26,8 @@ import javafx.scene.layout.VBox; import javafx.scene.transform.Transform; import javafx.stage.Modality; import javafx.stage.Stage; +import tools.ConvertTo; +import tools.Localization; public class MonthLineChart extends VBox implements ChartExportable { @@ -48,12 +52,12 @@ public class MonthLineChart extends VBox implements ChartExportable generatedChart.setAnimated(animated); xAxis.setLabel(""); - yAxis.setLabel("Summe in " + currency); + yAxis.setLabel(Localization.getString(Strings.CHART_MONTH_LINE_SUM, currency)); XYChart.Series<String, Number> seriesIN = new XYChart.Series<String, Number>(); - seriesIN.setName("Einnahmen"); + seriesIN.setName(Localization.getString(Strings.TITLE_INCOMES)); XYChart.Series<String, Number> seriesOUT = new XYChart.Series<String, Number>(); - seriesOUT.setName("Ausgaben"); + seriesOUT.setName(Localization.getString(Strings.TITLE_PAYMENTS)); for(MonthInOutSum currentItem : monthInOutSums) { @@ -100,25 +104,25 @@ public class MonthLineChart extends VBox implements ChartExportable // style line for incomes for(Node n : generatedChart.lookupAll(".default-color0.chart-series-line")) { - n.setStyle("-fx-stroke: " + Helpers.COLOR_INCOME + ";"); + n.setStyle("-fx-stroke: " + ConvertTo.toRGBHexWithoutOpacity(Colors.INCOME) + ";"); } // style line dots for incomes for(Node n : generatedChart.lookupAll(".default-color0.chart-line-symbol")) { - n.setStyle("-fx-background-color: " + Helpers.COLOR_INCOME + ", white;"); + n.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.INCOME) + ", white;"); } // style line for payments for(Node n : generatedChart.lookupAll(".default-color1.chart-series-line")) { - n.setStyle("-fx-stroke: " + Helpers.COLOR_PAYMENT + ";"); + n.setStyle("-fx-stroke: " + ConvertTo.toRGBHexWithoutOpacity(Colors.PAYMENT) + ";"); } // style line dots for payments for(Node n : generatedChart.lookupAll(".default-color1.chart-line-symbol")) { - n.setStyle("-fx-background-color: " + Helpers.COLOR_PAYMENT + ", white;"); + n.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.PAYMENT) + ", white;"); } // style legend item according to color @@ -135,11 +139,11 @@ public class MonthLineChart extends VBox implements ChartExportable Label labelLegendItem = (Label)node; if(counter == 0) { - labelLegendItem.getGraphic().setStyle("-fx-background-color: " + Helpers.COLOR_INCOME + ";"); + labelLegendItem.getGraphic().setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.INCOME) + ";"); } else { - labelLegendItem.getGraphic().setStyle("-fx-background-color: " + Helpers.COLOR_PAYMENT + ";"); + labelLegendItem.getGraphic().setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.PAYMENT) + ";"); } } counter++; diff --git a/src/de/deadlocker8/budgetmaster/logic/report/ColumnType.java b/src/de/deadlocker8/budgetmaster/logic/report/ColumnType.java index b7503a80ce55a7b2d0da8699c98f17edf4f022c4..9229d6f51fc3612ba28b8638fb02454c5408a25e 100644 --- a/src/de/deadlocker8/budgetmaster/logic/report/ColumnType.java +++ b/src/de/deadlocker8/budgetmaster/logic/report/ColumnType.java @@ -1,15 +1,18 @@ package de.deadlocker8.budgetmaster.logic.report; +import de.deadlocker8.budgetmaster.logic.utils.Strings; +import tools.Localization; + public enum ColumnType { - POSITION("Nr."), - DATE("Datum"), - REPEATING("Wiederholend"), - CATEGORY("Kategorie"), - NAME("Name"), - DESCRIPTION("Notiz"), - RATING("Bewertung"), - AMOUNT("Betrag"); + POSITION(Strings.REPORT_POSITION), + DATE(Strings.REPORT_DATE), + REPEATING(Strings.REPORT_REPEATING), + CATEGORY(Strings.REPORT_CATEGORY), + NAME(Strings.REPORT_NAME), + DESCRIPTION(Strings.REPORT_DESCRIPTION), + RATING(Strings.REPORT_RATING), + AMOUNT(Strings.REPORT_AMOUNT); private String name; @@ -20,6 +23,6 @@ public enum ColumnType public String getName() { - return name; + return Localization.getString(name); } } \ No newline at end of file diff --git a/src/de/deadlocker8/budgetmaster/logic/report/HeaderFooterPageEvent.java b/src/de/deadlocker8/budgetmaster/logic/report/HeaderFooterPageEvent.java index 5eff761741caa39d961e6e88c15df86b0e56328a..6909497dfde3d30c06981bf4a88239f284e8ecc3 100644 --- a/src/de/deadlocker8/budgetmaster/logic/report/HeaderFooterPageEvent.java +++ b/src/de/deadlocker8/budgetmaster/logic/report/HeaderFooterPageEvent.java @@ -12,6 +12,9 @@ import com.itextpdf.text.pdf.GrayColor; import com.itextpdf.text.pdf.PdfPageEventHelper; import com.itextpdf.text.pdf.PdfWriter; +import de.deadlocker8.budgetmaster.logic.utils.Strings; +import tools.Localization; + public class HeaderFooterPageEvent extends PdfPageEventHelper { public void onStartPage(PdfWriter writer, Document document) @@ -23,8 +26,8 @@ public class HeaderFooterPageEvent extends PdfPageEventHelper { Font font = new Font(FontFamily.HELVETICA, 8, Font.NORMAL, GrayColor.BLACK); - ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase("BudgetMaster Monatsbericht", font), 100, 25, 0); - ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase("Seite " + document.getPageNumber(), font), 300, 25, 0); + ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase(Localization.getString(Strings.REPORT_FOOTER_LEFT), font), 100, 25, 0); + ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase(Localization.getString(Strings.REPORT_FOOTER_LEFT, document.getPageNumber()), font), 300, 25, 0); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase(DateTime.now().toString("dd.MM.YYYY"), font), 500, 25, 0); } } \ No newline at end of file diff --git a/src/de/deadlocker8/budgetmaster/logic/report/ReportGenerator.java b/src/de/deadlocker8/budgetmaster/logic/report/ReportGenerator.java index 9ad46eb9572e7f72a2c5b635cf47819cc0e9a928..58de7364c582bc4a19256feb393a7d23b5fb17fc 100644 --- a/src/de/deadlocker8/budgetmaster/logic/report/ReportGenerator.java +++ b/src/de/deadlocker8/budgetmaster/logic/report/ReportGenerator.java @@ -7,6 +7,7 @@ import java.io.FileOutputStream; import java.util.ArrayList; import org.joda.time.DateTime; +import org.joda.time.format.DateTimeFormat; import com.itextpdf.text.BaseColor; import com.itextpdf.text.Chapter; @@ -25,6 +26,8 @@ import com.itextpdf.text.pdf.PdfWriter; import de.deadlocker8.budgetmaster.logic.CategoryBudget; import de.deadlocker8.budgetmaster.logic.utils.Helpers; +import de.deadlocker8.budgetmaster.logic.utils.Strings; +import tools.Localization; public class ReportGenerator { @@ -53,11 +56,11 @@ public class ReportGenerator { Font chapterFont = new Font(FontFamily.HELVETICA, 16, Font.BOLDITALIC); Font paragraphFont = new Font(FontFamily.HELVETICA, 12, Font.NORMAL); - Chunk chunk = new Chunk("Monatsbericht - " + date.toString("MMMM yyyy"), chapterFont); + Chunk chunk = new Chunk(Localization.getString(Strings.REPORT_HEADLINE, date.toString("MMMM yyyy")), chapterFont); Chapter chapter = new Chapter(new Paragraph(chunk), 1); chapter.setNumberDepth(0); chapter.add(Chunk.NEWLINE); - chapter.add(new Paragraph("Buchungsübersicht", paragraphFont)); + chapter.add(new Paragraph(Localization.getString(Strings.REPORT_HEADLINE_PAYMENTS_OVERVIEW), paragraphFont)); return chapter; } @@ -116,13 +119,13 @@ public class ReportGenerator case BOTH: String totalIncomeString = Helpers.getCurrencyString(totalIncome, currency); String totalPaymentString = Helpers.getCurrencyString(totalPayment, currency); - total = "Einnahmen: " + totalIncomeString + " / Ausgaben: " + totalPaymentString; + total = Localization.getString(Strings.REPORT_SUM_TOTAL, totalIncomeString, totalPaymentString); break; case INCOME: - total = "Summe: " + Helpers.getCurrencyString(totalIncome, currency); + total = Localization.getString(Strings.REPORT_SUM, Helpers.getCurrencyString(totalIncome, currency)); break; case PAYMENT: - total = "Summe: " + Helpers.getCurrencyString(totalPayment, currency); + total = Localization.getString(Strings.REPORT_SUM, Helpers.getCurrencyString(totalPayment, currency)); break; default: break; @@ -153,7 +156,7 @@ public class ReportGenerator if(splitTable) { - document.add(new Paragraph("Einnahmen", paragraphFont)); + document.add(new Paragraph(Localization.getString(Strings.TITLE_INCOMES), paragraphFont)); document.add(Chunk.NEWLINE); PdfPTable table = generateTable(100, AmountType.INCOME); if(table != null) @@ -162,7 +165,7 @@ public class ReportGenerator } document.add(Chunk.NEWLINE); - document.add(new Paragraph("Ausgaben", paragraphFont)); + document.add(new Paragraph(Localization.getString(Strings.TITLE_PAYMENTS), paragraphFont)); document.add(Chunk.NEWLINE); table = generateTable(100, AmountType.PAYMENT); if(table != null) @@ -182,7 +185,7 @@ public class ReportGenerator if(includeCategoryBudgets) { document.add(Chunk.NEWLINE); - document.add(new Paragraph("Verbrauch nach Kategorien", paragraphFont)); + document.add(new Paragraph(Localization.getString(Strings.TITLE_CATEGORY_BUDGETS), paragraphFont)); document.add(Chunk.NEWLINE); PdfPTable table = generateCategoryBudgets(); if(table != null) @@ -201,23 +204,18 @@ public class ReportGenerator Font font = new Font(FontFamily.HELVETICA, 8, Font.NORMAL, GrayColor.BLACK); //header cells - PdfPCell cellHeaderCategory = new PdfPCell(new Phrase("Kategorie", font)); + PdfPCell cellHeaderCategory = new PdfPCell(new Phrase(Localization.getString(Strings.TITLE_CATEGORY), font)); cellHeaderCategory.setBackgroundColor(GrayColor.LIGHT_GRAY); cellHeaderCategory.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cellHeaderCategory); - PdfPCell cellHeaderAmount = new PdfPCell(new Phrase("Betrag", font)); + PdfPCell cellHeaderAmount = new PdfPCell(new Phrase(Localization.getString(Strings.TITLE_AMOUNT), font)); cellHeaderAmount.setBackgroundColor(GrayColor.LIGHT_GRAY); cellHeaderAmount.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cellHeaderAmount); for(CategoryBudget budget : categoryBudgets) - { - String name = budget.getName(); - if(name.equals("NONE")) - { - name = "Keine Kategorie"; - } - PdfPCell cellName = new PdfPCell(new Phrase(name, font)); + { + PdfPCell cellName = new PdfPCell(new Phrase(budget.getName(), font)); cellName.setBackgroundColor(new BaseColor(Color.WHITE)); cellName.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cellName); @@ -237,15 +235,10 @@ public class ReportGenerator { case AMOUNT: return Helpers.getCurrencyString(reportItem.getAmount(), currency); - case CATEGORY: - String name = reportItem.getCategory().getName(); - if(name.equals("NONE")) - { - name = "Keine Kategorie"; - } - return name; - case DATE: - return reportItem.getDate(); + case CATEGORY: + return reportItem.getCategory().getName(); + case DATE: + return DateTime.parse(reportItem.getDate(), DateTimeFormat.forPattern("YYYY-MM-dd")).toString("dd.MM.YYYY"); case DESCRIPTION: return reportItem.getDescription(); case NAME: @@ -257,11 +250,11 @@ public class ReportGenerator case REPEATING: if(reportItem.getRepeating()) { - return "Ja"; + return Localization.getString(Strings.REPORT_REPEATING_YES); } else { - return "Nein"; + return Localization.getString(Strings.REPORT_REPEATING_NO); } default: return null; diff --git a/src/de/deadlocker8/budgetmaster/logic/serverconnection/ExceptionHandler.java b/src/de/deadlocker8/budgetmaster/logic/serverconnection/ExceptionHandler.java index 171a7b68a4c2f1bd054950581c29802589249054..c22912ac563283d82d669161db027d942146cf03 100644 --- a/src/de/deadlocker8/budgetmaster/logic/serverconnection/ExceptionHandler.java +++ b/src/de/deadlocker8/budgetmaster/logic/serverconnection/ExceptionHandler.java @@ -2,6 +2,9 @@ package de.deadlocker8.budgetmaster.logic.serverconnection; import java.net.UnknownHostException; +import de.deadlocker8.budgetmaster.logic.utils.Strings; +import tools.Localization; + public class ExceptionHandler { public static String getMessageForException(Exception e) @@ -13,23 +16,21 @@ public class ExceptionHandler if(e instanceof UnknownHostException) { - return "Es konnte keine Verbindung mit dem Internet hergestellt werden."; + return Localization.getString(Strings.ERROR_UNKNOWN_HOST); } if(e.getMessage() == null) { - return "Unbekannter Fehler (" + e.getClass() + ")"; + return Localization.getString(Strings.ERROR_UNKNOWN_ERROR, e.getClass()); } if(e.getMessage().contains("Connection refused")) { - return "Server nicht erreichbar."; + return Localization.getString(Strings.ERROR_CONNECTION_REFUSED); } else if(e.getMessage().contains("HTTPS hostname wrong")) { - return "Der Server verwendet ein selbst signiertes Zertifkat für die Verschlüsselung. " - + "Aus Sicherheitsgründen werden diese Zertifikate standardmäßig blockiert. " - + "Wenn du dem Zertifikat trotzdem vertrauen möchtest, dann füge den Hostnamen des Servers zur Liste der vertrauenswürdigen Hosts in den Einstellungen hinzu."; + return Localization.getString(Strings.ERROR_HTTPS_HOSTNAME_WRONG); } return e.getMessage(); } @@ -38,9 +39,9 @@ public class ExceptionHandler { switch(e.getMessage()) { - case "400": return "Der Server erhielt eine fehlerhafte Anfrage oder ungültige Parameter."; - case "401": return "Ungültiges Passwort."; - case "500": return "Beim Ausführen der Anfrage ist ein interner Serverfehler ist aufgetreten."; + case "400": return Localization.getString(Strings.ERROR_400); + case "401": return Localization.getString(Strings.ERROR_401); + case "500": return Localization.getString(Strings.ERROR_500); default: return e.getMessage(); } } diff --git a/src/de/deadlocker8/budgetmaster/logic/utils/Colors.java b/src/de/deadlocker8/budgetmaster/logic/utils/Colors.java new file mode 100644 index 0000000000000000000000000000000000000000..5fedfa500585e77ce537bffe2c4523befb78f18b --- /dev/null +++ b/src/de/deadlocker8/budgetmaster/logic/utils/Colors.java @@ -0,0 +1,35 @@ +package de.deadlocker8.budgetmaster.logic.utils; + +import javafx.scene.paint.Color; + +public class Colors +{ + public static final Color TEXT = Color.web("#212121"); + public static final Color INCOME = Color.web("#22BAD9"); + public static final Color PAYMENT = Color.web("#F2612D"); + public static final Color BACKGROUND = Color.web("#F4F4F4"); + public static final Color BACKGROUND_MAIN = Color.web("#DDDDDD"); + public static final Color BACKGROUND_BUTTON_BLUE = Color.web("#2E79B9"); + public static final Color BACKGROUND_BUTTON_RED = Color.web("#FF5047"); + public static final Color BACKGROUND_NOTIFICATION = Color.web("#323232"); + public static final Color BACKGROUND_REPORT_TABLE_HEADER_DISABLED = Color.SALMON; + public static final Color BACKGROUND_CHART_LEGEND = Color.web("#EEEEEE"); + + // CATEGORIES + public static final Color CATEGORIES_LIGHT_GREY = Color.web("#EEEEEE"); + public static final Color CATEGORIES_GREY = Color.web("#888888"); + public static final Color CATEGORIES_DARK_GREY = Color.web("#333333"); + public static final Color CATEGORIES_LIGHT_YELLOW = Color.rgb(255,241,119); + public static final Color CATEGORIES_YELLOW = Color.rgb(255,204,0); + public static final Color CATEGORIES_ORANGE = Color.rgb(255,149,0); + public static final Color CATEGORIES_RED = Color.rgb(255,59,48); + public static final Color CATEGORIES_DARK_RED = Color.rgb(169,3,41); + public static final Color CATEGORIES_PINK = Color.rgb(255,81,151); + public static final Color CATEGORIES_PURPLE = Color.rgb(155,89,182); + public static final Color CATEGORIES_DARK_PURPLE = Color.rgb(88,86,214); + public static final Color CATEGORIES_BLUE = Color.rgb(0,122,250); + public static final Color CATEGORIES_LIGHT_BLUE = Color.rgb(90,200,250); + public static final Color CATEGORIES_LIGHT_GREEN = Color.rgb(76,217,100); + public static final Color CATEGORIES_DARK_GREEN = Color.rgb(46,124,43); + +} \ No newline at end of file diff --git a/src/de/deadlocker8/budgetmaster/logic/utils/FileHelper.java b/src/de/deadlocker8/budgetmaster/logic/utils/FileHelper.java index 2e6766f7dcbab1a416fd8db16f770706feaeb38e..ee576f3c546ad679e841cd5ad65b8d735d27a7fd 100644 --- a/src/de/deadlocker8/budgetmaster/logic/utils/FileHelper.java +++ b/src/de/deadlocker8/budgetmaster/logic/utils/FileHelper.java @@ -7,26 +7,23 @@ import java.io.Writer; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.Locale; -import java.util.ResourceBundle; import com.google.gson.Gson; import de.deadlocker8.budgetmaster.logic.Settings; import de.deadlocker8.budgetmasterserver.logic.Database; +import tools.Localization; import tools.PathUtils; public class FileHelper -{ - private static final ResourceBundle bundle = ResourceBundle.getBundle("de/deadlocker8/budgetmaster/main/", Locale.GERMANY); - +{ public static Settings loadSettings() { Settings settings; try { Gson gson = new Gson(); - Reader reader = Files.newBufferedReader(Paths.get(PathUtils.getOSindependentPath() + bundle.getString("folder") + "/settings.json"), Charset.forName("UTF-8")); + Reader reader = Files.newBufferedReader(Paths.get(PathUtils.getOSindependentPath() + Localization.getString(Strings.FOLDER) + "/settings.json"), Charset.forName("UTF-8")); settings = gson.fromJson(reader, Settings.class); reader.close(); return settings; @@ -41,8 +38,8 @@ public class FileHelper { Gson gson = new Gson(); String jsonString = gson.toJson(settings); - PathUtils.checkFolder(new File(PathUtils.getOSindependentPath() + bundle.getString("folder"))); - Writer writer = Files.newBufferedWriter(Paths.get(PathUtils.getOSindependentPath() + bundle.getString("folder") + "/settings.json"), Charset.forName("UTF-8")); + PathUtils.checkFolder(new File(PathUtils.getOSindependentPath() + Localization.getString(Strings.FOLDER))); + Writer writer = Files.newBufferedWriter(Paths.get(PathUtils.getOSindependentPath() + Localization.getString(Strings.FOLDER) + "/settings.json"), Charset.forName("UTF-8")); writer.write(jsonString); writer.close(); } diff --git a/src/de/deadlocker8/budgetmaster/logic/utils/Helpers.java b/src/de/deadlocker8/budgetmaster/logic/utils/Helpers.java index 1933a2fe17a7f8f23c0b1511f5d8fc4c8d4420bb..1dc0c1be412c804d2353506ebc5f2e4d22abc55e 100644 --- a/src/de/deadlocker8/budgetmaster/logic/utils/Helpers.java +++ b/src/de/deadlocker8/budgetmaster/logic/utils/Helpers.java @@ -19,13 +19,11 @@ import javafx.scene.paint.Color; import javafx.stage.Modality; import javafx.stage.Stage; import logger.Logger; +import tools.Localization; public class Helpers { public static final DecimalFormat NUMBER_FORMAT = new DecimalFormat("0.00"); - - public static final String COLOR_INCOME = "#22BAD9"; - public static final String COLOR_PAYMENT = "#F2612D"; public static final String SALT = "ny9/Y+G|WrJ,82|oIYQQ X %i-sq#4,uA-qKPtwFPnw+s(k2`rV)^-a1|t{D3Z>S"; public static String getCurrencyString(int amount, String currency) @@ -63,18 +61,18 @@ public class Helpers public static ArrayList<String> getMonthList() { ArrayList<String> monthNames = new ArrayList<>(); - monthNames.add("Januar"); - monthNames.add("Februar"); - monthNames.add("März"); - monthNames.add("April"); - monthNames.add("Mai"); - monthNames.add("Juni"); - monthNames.add("Juli"); - monthNames.add("August"); - monthNames.add("September"); - monthNames.add("Oktober"); - monthNames.add("November"); - monthNames.add("Dezember"); + monthNames.add(Localization.getString(Strings.MONTH_JANUARY)); + monthNames.add(Localization.getString(Strings.MONTH_FEBRUARY)); + monthNames.add(Localization.getString(Strings.MONTH_MARCH)); + monthNames.add(Localization.getString(Strings.MONTH_APRIL)); + monthNames.add(Localization.getString(Strings.MONTH_MAY)); + monthNames.add(Localization.getString(Strings.MONTH_JUNE)); + monthNames.add(Localization.getString(Strings.MONTH_JULY)); + monthNames.add(Localization.getString(Strings.MONTH_AUGUST)); + monthNames.add(Localization.getString(Strings.MONTH_SEPTEMBER)); + monthNames.add(Localization.getString(Strings.MONTH_OCTOBER)); + monthNames.add(Localization.getString(Strings.MONTH_NOVEMBER)); + monthNames.add(Localization.getString(Strings.MONTH_DECEMBER)); return monthNames; } @@ -91,22 +89,21 @@ public class Helpers public static ArrayList<Color> getCategoryColorList() { ArrayList<Color> colors = new ArrayList<>(); - //grey (light to dark) - colors.add(Color.web("#CCCCCC")); - colors.add(Color.web("#888888")); - colors.add(Color.web("#333333")); - colors.add(Color.rgb(255, 241, 119)); //lighyellow - colors.add(Color.rgb(255, 204, 0)); //yellow - colors.add(Color.rgb(255, 149, 0)); //orange - colors.add(Color.rgb(255, 59, 48)); //red - colors.add(Color.rgb(169, 3, 41)); //darkred - colors.add(Color.rgb(255, 81, 151)); //pink - colors.add(Color.rgb(155, 89, 182)); //purple - colors.add(Color.rgb(88, 86, 214)); //darkpurple - colors.add(Color.rgb(0, 122, 250)); //blue - colors.add(Color.rgb(90, 200, 250)); //lightblue - colors.add(Color.rgb(76, 217, 100)); //lightgreen - colors.add(Color.rgb(46, 124, 43)); //darkgreen + colors.add(Colors.CATEGORIES_LIGHT_GREY); + colors.add(Colors.CATEGORIES_GREY); + colors.add(Colors.CATEGORIES_DARK_GREY); + colors.add(Colors.CATEGORIES_LIGHT_YELLOW); + colors.add(Colors.CATEGORIES_YELLOW); + colors.add(Colors.CATEGORIES_ORANGE); + colors.add(Colors.CATEGORIES_RED); + colors.add(Colors.CATEGORIES_DARK_RED); + colors.add(Colors.CATEGORIES_PINK); + colors.add(Colors.CATEGORIES_PURPLE); + colors.add(Colors.CATEGORIES_DARK_PURPLE); + colors.add(Colors.CATEGORIES_BLUE); + colors.add(Colors.CATEGORIES_LIGHT_BLUE); + colors.add(Colors.CATEGORIES_LIGHT_GREEN); + colors.add(Colors.CATEGORIES_DARK_GREEN); return colors; } diff --git a/src/de/deadlocker8/budgetmaster/logic/utils/Strings.java b/src/de/deadlocker8/budgetmaster/logic/utils/Strings.java new file mode 100644 index 0000000000000000000000000000000000000000..61d2132d333c84ec7bb48debf8610464975ba826 --- /dev/null +++ b/src/de/deadlocker8/budgetmaster/logic/utils/Strings.java @@ -0,0 +1,69 @@ +package de.deadlocker8.budgetmaster.logic.utils; + +public class Strings +{ + //APP_INFO + public static final String APP_NAME = "app.name"; + public static final String VERSION_CODE = "version.code"; + public static final String VERSION_NAME = "version.name"; + public static final String VERSION_DATE = "version.date"; + public static final String AUTHOR = "author"; + public static final String FOLDER = "folder"; + + //TITLE + public static final String TITLE_INCOMES = "title.incomes"; + public static final String TITLE_PAYMENTS = "title.payments"; + public static final String TITLE_CATEGORY = "title.category"; + public static final String TITLE_CATEGORIES = "title.categories"; + public static final String TITLE_CATEGORY_BUDGETS = "title.category.budgets"; + public static final String TITLE_AMOUNT = "title.amount"; + public static final String TITLE_INFO = "title.info"; + public static final String TITLE_WARNING = "title.warning"; + public static final String TITLE_ERROR = "title.error"; + + //MISC + public static final String CATEGORY_NONE = "category.none"; + public static final String TOOLTIP_CHART_CATEGORIES = "tooltip.chart.categories"; + public static final String CHART_MONTH_LINE_SUM = "chart.month.line.sum"; + + //REPORT + public static final String REPORT_POSITION = "report.position"; + public static final String REPORT_DATE = "report.date"; + public static final String REPORT_REPEATING = "report.repeating"; + public static final String REPORT_CATEGORY = "report.category"; + public static final String REPORT_NAME = "report.name"; + public static final String REPORT_DESCRIPTION = "report.description"; + public static final String REPORT_RATING = "report.rating"; + public static final String REPORT_AMOUNT = "report.amount"; + public static final String REPORT_HEADLINE = "report.headline"; + public static final String REPORT_HEADLINE_PAYMENTS_OVERVIEW = "report.headline.payments.overview"; + public static final String REPORT_SUM_TOTAL = "report.sum.total"; + public static final String REPORT_SUM = "report.sum"; + public static final String REPORT_FOOTER_LEFT = "report.footer.left"; + public static final String REPORT_FOOTER_CENTER = "report.footer.center"; + public static final String REPORT_REPEATING_YES ="report.repeating.yes"; + public static final String REPORT_REPEATING_NO ="report.repeating.no"; + + //MONTH_NAMES + public static final String MONTH_JANUARY ="month.january"; + public static final String MONTH_FEBRUARY ="month.february"; + public static final String MONTH_MARCH ="month.march"; + public static final String MONTH_APRIL ="month.april"; + public static final String MONTH_MAY ="month.may"; + public static final String MONTH_JUNE ="month.june"; + public static final String MONTH_JULY ="month.july"; + public static final String MONTH_AUGUST ="month.august"; + public static final String MONTH_SEPTEMBER ="month.september"; + public static final String MONTH_OCTOBER ="month.october"; + public static final String MONTH_NOVEMBER ="month.november"; + public static final String MONTH_DECEMBER ="month.december"; + + //ERROR + public static final String ERROR_UNKNOWN_HOST = "error.unknown.host"; + public static final String ERROR_UNKNOWN_ERROR = "error.unknown.error"; + public static final String ERROR_CONNECTION_REFUSED = "error.connection.refused"; + public static final String ERROR_HTTPS_HOSTNAME_WRONG = "error.https.hostname.wrong"; + public static final String ERROR_400 = "error.400"; + public static final String ERROR_401 = "error.401"; + public static final String ERROR_500 = "error.500"; +} \ No newline at end of file diff --git a/src/de/deadlocker8/budgetmaster/main/Main.java b/src/de/deadlocker8/budgetmaster/main/Main.java index 30857a6e29f8b1a3de8bbae3e3ebd062199ef5b9..84931641e70e53791440c025e49aa2a8bcc95941 100644 --- a/src/de/deadlocker8/budgetmaster/main/Main.java +++ b/src/de/deadlocker8/budgetmaster/main/Main.java @@ -13,6 +13,7 @@ import javafx.scene.image.Image; import javafx.stage.Stage; import logger.FileOutputMode; import logger.Logger; +import tools.Localization; import tools.PathUtils; public class Main extends Application @@ -24,6 +25,9 @@ public class Main extends Application { try { + Localization.init("de/deadlocker8/budgetmaster/main/"); + Localization.loadLanguage(Locale.GERMANY); + Image icon = new Image("/de/deadlocker8/budgetmaster/resources/icon.png"); FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("de/deadlocker8/budgetmaster/ui/fxml/SplashScreen.fxml")); Parent root = (Parent)loader.load(); diff --git a/src/de/deadlocker8/budgetmaster/main/_de.properties b/src/de/deadlocker8/budgetmaster/main/_de.properties index d82abed3111911a5cf8458a12db8f1427b0437b9..2e420091c9a2451d1bbe791984b50f4bf7ca472f 100644 --- a/src/de/deadlocker8/budgetmaster/main/_de.properties +++ b/src/de/deadlocker8/budgetmaster/main/_de.properties @@ -1,3 +1,4 @@ +# DEFAULT app.name=BudgetMaster version.code=4 version.name=1.3.0 @@ -5,4 +6,61 @@ version.date=10.08.17 author=Robert Goldmann folder=Deadlocker/BudgetMaster -color.text=#212121 \ No newline at end of file + + +# TITLE +title.incomes=Einnahmen +title.payments=Ausgaben +title.categories=Kategorien +title.categorie=Kategorie +title.category.budgets=Verbrauch nach Kategorien +title.amount=Betrag +title.info=Hinweis +title.warning=Warnung +title.error=Fehler + +# MISC +category.none=Keine Kategorie +tooltip.chart.categories={0}\n{1} %\n{2} +chart.month.line.sum=Summe in {0} + +# REPORT +report.position=Nr. +report.date=Datum +report.repeating=Wiederholend +report.category=Kategorie +report.name=Name +report.description=Notiz +report.rating=Bewertung +report.amount=Betrag +report.headline=Monatsbericht - {0} +report.headline.payments.overview=Buchungs�bersicht +report.sum.total=Einnahmen: {0} / Ausgaben: {1} +report.sum=Summe: {0} +report.footer.left=BudgetMaster Monatsbericht +report.footer.center=Seite {0} +report.repeating.yes=Ja +report.repeating.no=Nein + +# MONTH +month.january=Januar +month.february=Februar +month.march=M�rz +month.april=April +month.may=Mai +month.june=Juni +month.july=Juli +month.august=August +month.september=September +month.october=Oktober +month.november=November +month.december=Dezember + +# ERROR +error.unknown.host=Es konnte keine Verbindung mit dem Internet hergestellt werden. +error.unknown.error=Unbekannter Fehler ({0}) +error.connection.refused=Server nicht erreichbar. +error.https.hostname.wrong=Der Server verwendet ein selbst signiertes Zertifkat f�r die Verschl�sselung. Aus Sicherheitsgr�nden werden diese Zertifikate standardm��ig blockiert. Wenn du dem Zertifikat trotzdem vertrauen m�chtest, dann f�ge den Hostnamen des Servers zur Liste der vertrauensw�rdigen Hosts in den Einstellungen hinzu. +error.400=Der Server erhielt eine fehlerhafte Anfrage oder ung�ltige Parameter. +error.401=Ung�ltiges Passwort. +error.500=Beim Ausf�hren der Anfrage ist ein interner Serverfehler ist aufgetreten. diff --git a/src/de/deadlocker8/budgetmaster/ui/cells/ButtonCategoryCell.java b/src/de/deadlocker8/budgetmaster/ui/cells/ButtonCategoryCell.java index 233398f6aba6a04a8cb2b52a050ce440c49bfa4c..1158ed1c078ea8c2b04c8feaab89b94a0c301ce6 100644 --- a/src/de/deadlocker8/budgetmaster/ui/cells/ButtonCategoryCell.java +++ b/src/de/deadlocker8/budgetmaster/ui/cells/ButtonCategoryCell.java @@ -31,12 +31,7 @@ public class ButtonCategoryCell extends ListCell<Category> if(!empty) { - HBox hbox = new HBox(); - - if(item.getID() == 1) - { - item.setName("Keine Kategorie"); - } + HBox hbox = new HBox(); Label labelName = new Label(item.getName()); labelName.setStyle("-fx-font-weight: bold; -fx-font-size: 14; -fx-text-fill: " + ConvertTo.toRGBHex(ConvertTo.getAppropriateTextColor(color))); diff --git a/src/de/deadlocker8/budgetmaster/ui/cells/PaymentCell.java b/src/de/deadlocker8/budgetmaster/ui/cells/PaymentCell.java index ce02969c7f592b4da63f44009aeaebe7f97fcd45..e10dfdf31e46914685255a60f5deb6d5c4088903 100644 --- a/src/de/deadlocker8/budgetmaster/ui/cells/PaymentCell.java +++ b/src/de/deadlocker8/budgetmaster/ui/cells/PaymentCell.java @@ -88,20 +88,14 @@ public class PaymentCell extends ListCell<Payment> hbox.getChildren().add(labelRepeating); HBox.setMargin(labelRepeating, new Insets(0, 20, 0, 15)); - String categoryName = category.getName(); - if(categoryName.equals("NONE")) - { - categoryName = "Keine Kategorie"; - } - - Label labelCircle = new Label(categoryName.substring(0, 1).toUpperCase()); + Label labelCircle = new Label(category.getName().substring(0, 1).toUpperCase()); labelCircle.setMinWidth(HEIGHT); labelCircle.setMinHeight(HEIGHT); labelCircle.setAlignment(Pos.CENTER); labelCircle.getStyleClass().add("greylabel"); String textColor = ConvertTo.toRGBHex(ConvertTo.getAppropriateTextColor(category.getColor())); labelCircle.setStyle("-fx-background-color: " + ConvertTo.toRGBHex(category.getColor()) + "; -fx-background-radius: 50%; -fx-text-fill: " + textColor + "; -fx-font-weight: bold; -fx-font-size: 20;"); - Tooltip tooltip = new Tooltip(categoryName); + Tooltip tooltip = new Tooltip(category.getName()); tooltip.setStyle("-fx-font-size: 14"); labelCircle.setTooltip(tooltip); hbox.getChildren().add(labelCircle); diff --git a/src/de/deadlocker8/budgetmaster/ui/cells/SmallCategoryCell.java b/src/de/deadlocker8/budgetmaster/ui/cells/SmallCategoryCell.java index 9aa0b9baa4fe7a468d833f1441a2670aeeb0a56c..7edf363e2a0b5162d0fbabe856854a9df88f75e0 100644 --- a/src/de/deadlocker8/budgetmaster/ui/cells/SmallCategoryCell.java +++ b/src/de/deadlocker8/budgetmaster/ui/cells/SmallCategoryCell.java @@ -21,20 +21,13 @@ public class SmallCategoryCell extends ListCell<Category> { HBox hbox = new HBox(); - if(item.getID() != 1) - { - Label labelCircle = new Label(item.getName().substring(0, 1).toUpperCase()); - labelCircle.setPrefWidth(HEIGHT); - labelCircle.setPrefHeight(HEIGHT); - labelCircle.setAlignment(Pos.CENTER); - String textColor = ConvertTo.toRGBHex(ConvertTo.getAppropriateTextColor(item.getColor())); - labelCircle.setStyle("-fx-background-color: " + ConvertTo.toRGBHex(item.getColor()) + "; -fx-background-radius: 50%; -fx-text-fill: " + textColor + "; -fx-font-weight: bold; -fx-font-size: 15;"); - hbox.getChildren().add(labelCircle); - } - else - { - item.setName("Keine Kategorie"); - } + Label labelCircle = new Label(item.getName().substring(0, 1).toUpperCase()); + labelCircle.setPrefWidth(HEIGHT); + labelCircle.setPrefHeight(HEIGHT); + labelCircle.setAlignment(Pos.CENTER); + String textColor = ConvertTo.toRGBHex(ConvertTo.getAppropriateTextColor(item.getColor())); + labelCircle.setStyle("-fx-background-color: " + ConvertTo.toRGBHex(item.getColor()) + "; -fx-background-radius: 50%; -fx-text-fill: " + textColor + "; -fx-font-weight: bold; -fx-font-size: 15;"); + hbox.getChildren().add(labelCircle); Label labelName = new Label(item.getName()); labelName.setPrefHeight(HEIGHT); diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/CategoryController.java b/src/de/deadlocker8/budgetmaster/ui/controller/CategoryController.java index 5a03fcc229c5f70451d3e7c966c239398b062acf..2c8762fe1a8182cba3cde01d5cd57aaa8f2a305b 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/CategoryController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/CategoryController.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import de.deadlocker8.budgetmaster.logic.Category; import de.deadlocker8.budgetmaster.logic.serverconnection.ExceptionHandler; import de.deadlocker8.budgetmaster.logic.serverconnection.ServerConnection; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; import de.deadlocker8.budgetmaster.ui.Refreshable; import de.deadlocker8.budgetmaster.ui.cells.CategoryCell; @@ -30,6 +31,7 @@ import javafx.stage.Modality; import javafx.stage.Stage; import javafx.util.Callback; import logger.Logger; +import tools.ConvertTo; public class CategoryController implements Refreshable { @@ -91,8 +93,8 @@ public class CategoryController implements Refreshable buttonCategory.setGraphic(Helpers.getFontIcon(FontIconType.PLUS, 18, Color.WHITE)); //apply theme - anchorPaneMain.setStyle("-fx-background-color: #F4F4F4;"); - buttonCategory.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); + anchorPaneMain.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND)); + buttonCategory.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); refreshListView(); } diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/ChartController.java b/src/de/deadlocker8/budgetmaster/ui/controller/ChartController.java index ddd9882794e82ad3ac4b51db0cf6069e19bfd8db..98132a22382e76492b88aefc4b1f50ce8f957bd0 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/ChartController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/ChartController.java @@ -17,6 +17,7 @@ import de.deadlocker8.budgetmaster.logic.charts.MonthBarChart; import de.deadlocker8.budgetmaster.logic.charts.MonthLineChart; import de.deadlocker8.budgetmaster.logic.serverconnection.ExceptionHandler; import de.deadlocker8.budgetmaster.logic.serverconnection.ServerConnection; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; import de.deadlocker8.budgetmaster.ui.Refreshable; import fontAwesome.FontIconType; @@ -43,6 +44,7 @@ import javafx.stage.Stage; import javafx.util.Callback; import logger.Logger; import tools.AlertGenerator; +import tools.ConvertTo; import tools.Worker; public class ChartController implements Refreshable @@ -75,21 +77,21 @@ public class ChartController implements Refreshable { this.controller = controller; - anchorPaneMain.setStyle("-fx-background-color: #F4F4F4;"); - vboxChartCategories.setStyle("-fx-background-color: #F4F4F4;"); + anchorPaneMain.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND)); + vboxChartCategories.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND)); vboxChartCategories.setSpacing(20); - vboxChartMonth.setStyle("-fx-background-color: #F4F4F4;"); + vboxChartMonth.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND)); - buttonChartCategoriesShow.setStyle("-fx-background-color: #2E79B9;"); + buttonChartCategoriesShow.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE)); buttonChartCategoriesShow.setGraphic(Helpers.getFontIcon(FontIconType.CHECK, 16, Color.WHITE)); - buttonChartCategoriesExport.setStyle("-fx-background-color: #2E79B9;"); + buttonChartCategoriesExport.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE)); buttonChartCategoriesExport.setGraphic(Helpers.getFontIcon(FontIconType.SAVE, 16, Color.WHITE)); - buttonChartMonthShow.setStyle("-fx-background-color: #2E79B9;"); + buttonChartMonthShow.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE)); buttonChartMonthShow.setGraphic(Helpers.getFontIcon(FontIconType.CHECK, 16, Color.WHITE)); - buttonChartMonthExport.setStyle("-fx-background-color: #2E79B9;"); + buttonChartMonthExport.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE)); buttonChartMonthExport.setGraphic(Helpers.getFontIcon(FontIconType.SAVE, 16, Color.WHITE)); datePickerEnd.setDayCellFactory(new Callback<DatePicker, DateCell>() diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/Controller.java b/src/de/deadlocker8/budgetmaster/ui/controller/Controller.java index 5d78940b58085a2e06211f3fa5c9ac6e17bd384e..711c4a64ae321b41c4537cd2fc45af9845227b99 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/Controller.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/Controller.java @@ -14,6 +14,7 @@ import de.deadlocker8.budgetmaster.logic.PaymentHandler; import de.deadlocker8.budgetmaster.logic.Settings; import de.deadlocker8.budgetmaster.logic.serverconnection.ExceptionHandler; import de.deadlocker8.budgetmaster.logic.serverconnection.ServerConnection; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; import fontAwesome.FontIconType; import javafx.animation.FadeTransition; @@ -30,11 +31,11 @@ import javafx.scene.control.Tab; import javafx.scene.control.TabPane; import javafx.scene.image.Image; import javafx.scene.layout.AnchorPane; -import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.util.Duration; import logger.Logger; import tools.AlertGenerator; +import tools.ConvertTo; import tools.Worker; public class Controller @@ -142,14 +143,14 @@ public class Controller }); } - buttonLeft.setGraphic(Helpers.getFontIcon(FontIconType.CHEVRON_LEFT, 20, Color.web(bundle.getString("color.text")))); - buttonRight.setGraphic(Helpers.getFontIcon(FontIconType.CHEVRON_RIGHT, 20, Color.web(bundle.getString("color.text")))); - buttonToday.setGraphic(Helpers.getFontIcon(FontIconType.CALENDAR_ALT, 20, Color.web(bundle.getString("color.text")))); - buttonAbout.setGraphic(Helpers.getFontIcon(FontIconType.INFO, 20, Color.web(bundle.getString("color.text")))); + buttonLeft.setGraphic(Helpers.getFontIcon(FontIconType.CHEVRON_LEFT, 20, Colors.TEXT)); + buttonRight.setGraphic(Helpers.getFontIcon(FontIconType.CHEVRON_RIGHT, 20, Colors.TEXT)); + buttonToday.setGraphic(Helpers.getFontIcon(FontIconType.CALENDAR_ALT, 20, Colors.TEXT)); + buttonAbout.setGraphic(Helpers.getFontIcon(FontIconType.INFO, 20, Colors.TEXT)); // apply theme - anchorPaneMain.setStyle("-fx-background-color: #DDDDDD"); - labelMonth.setStyle("-fx-text-fill: " + bundle.getString("color.text")); + anchorPaneMain.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_MAIN)); + labelMonth.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT)); labelNotification.setStyle("-fx-text-fill: #FFFFFF; -fx-font-size: 16; -fx-font-weight: bold; -fx-background-color: transparent;"); buttonLeft.setStyle("-fx-background-color: transparent;"); buttonRight.setStyle("-fx-background-color: transparent;"); @@ -198,7 +199,7 @@ public class Controller public void showNotification(String text) { labelNotification.setText(text); - labelNotification.setStyle("-fx-text-fill: #FFFFFF; -fx-font-size: 16; -fx-font-weight: bold; -fx-background-color: #323232;"); + labelNotification.setStyle("-fx-text-fill: #FFFFFF; -fx-font-size: 16; -fx-font-weight: bold; -fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_NOTIFICATION)); FadeTransition fadeIn = new FadeTransition(Duration.millis(200), labelNotification); fadeIn.setFromValue(0.0); fadeIn.setToValue(1.0); diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/ExportChartController.java b/src/de/deadlocker8/budgetmaster/ui/controller/ExportChartController.java index 14e7cc02eacbf9a44b792f27d0fb4f24eaa1c910..eb8037e9212074d899647a5fb09b62e6fc4210a3 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/ExportChartController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/ExportChartController.java @@ -8,6 +8,7 @@ import java.util.Optional; import javax.imageio.ImageIO; import de.deadlocker8.budgetmaster.logic.charts.ChartExportable; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; import fontAwesome.FontIconType; import javafx.embed.swing.SwingFXUtils; @@ -26,6 +27,7 @@ import javafx.stage.FileChooser; import javafx.stage.Stage; import logger.Logger; import tools.AlertGenerator; +import tools.ConvertTo; public class ExportChartController { @@ -57,15 +59,15 @@ public class ExportChartController textFieldWidth.setText(String.valueOf((int)chart.getSuggestedWidth())); textFieldHeight.setText(String.valueOf((int)chart.getSuggestedHeight())); - anchorPaneMain.setStyle("-fx-background-color: #F4F4F4;"); + anchorPaneMain.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND)); - buttonChooseFile.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); + buttonChooseFile.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); buttonChooseFile.setGraphic(Helpers.getFontIcon(FontIconType.FOLDER_OPEN, 14, Color.WHITE)); - buttonExport.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); + buttonExport.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); buttonExport.setGraphic(Helpers.getFontIcon(FontIconType.SAVE, 14, Color.WHITE)); - buttonCancel.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); + buttonCancel.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); buttonCancel.setGraphic(Helpers.getFontIcon(FontIconType.TIMES, 14, Color.WHITE)); textFieldWidth.setTextFormatter(new TextFormatter<>(c -> { diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/FilterController.java b/src/de/deadlocker8/budgetmaster/ui/controller/FilterController.java index c264a28baa2f8bd6bf014f9eff8f3a3acdc75545..0acf4e391f139ef6b32491bd14779fbdefdcce99 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/FilterController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/FilterController.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import de.deadlocker8.budgetmaster.logic.Category; import de.deadlocker8.budgetmaster.logic.FilterSettings; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; import fontAwesome.FontIconType; import javafx.fxml.FXML; @@ -14,6 +15,7 @@ import javafx.scene.control.TextField; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Stage; +import tools.ConvertTo; public class FilterController { @@ -44,11 +46,11 @@ public class FilterController buttonReset.setGraphic(Helpers.getFontIcon(FontIconType.UNDO, 17, Color.WHITE)); buttonFilter.setGraphic(Helpers.getFontIcon(FontIconType.FILTER, 17, Color.WHITE)); - buttonCancel.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 15;"); - buttonReset.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 15;"); - buttonFilter.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 15;"); - buttonCategoryAll.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 13;"); - buttonCategoryNone.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 13;"); + buttonCancel.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 15;"); + buttonReset.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 15;"); + buttonFilter.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 15;"); + buttonCategoryAll.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 13;"); + buttonCategoryNone.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 13;"); for(Category currentCategory : controller.getCategoryHandler().getCategories()) { diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/HomeController.java b/src/de/deadlocker8/budgetmaster/ui/controller/HomeController.java index 5a8dcb30e95b48de692afc4a55dc37ddd4652b2b..d87127aa2134f285417cef77284105918d09a8bf 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/HomeController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/HomeController.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import de.deadlocker8.budgetmaster.logic.Budget; import de.deadlocker8.budgetmaster.logic.CategoryBudget; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; import de.deadlocker8.budgetmaster.ui.Refreshable; import de.deadlocker8.budgetmaster.ui.cells.CategoryBudgetCell; @@ -17,6 +18,7 @@ import javafx.scene.control.ListView; import javafx.scene.control.ProgressBar; import javafx.scene.layout.AnchorPane; import javafx.util.Callback; +import tools.ConvertTo; public class HomeController implements Refreshable { @@ -60,7 +62,7 @@ public class HomeController implements Refreshable }); } }); - anchorPaneMain.setStyle("-fx-background-color: #F4F4F4;"); + anchorPaneMain.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND)); refresh(); } @@ -94,7 +96,7 @@ public class HomeController implements Refreshable } else { - labelBudget.setStyle("-fx-text-fill: " + controller.getBundle().getString("color.text")); + labelBudget.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT)); } labelStartBudget.setText("von " + Helpers.getCurrencyString(budget.getIncomeSum(), currency) + " verbleibend"); diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/NewCategoryController.java b/src/de/deadlocker8/budgetmaster/ui/controller/NewCategoryController.java index 6b08ff5dfb10bf6e97afb7d54d813a5dfd30d7f8..ad09a8290937bfaa8cc6337eb4f6db178b0af8d3 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/NewCategoryController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/NewCategoryController.java @@ -8,6 +8,7 @@ import org.controlsfx.control.PopOver.ArrowLocation; import de.deadlocker8.budgetmaster.logic.Category; import de.deadlocker8.budgetmaster.logic.serverconnection.ExceptionHandler; import de.deadlocker8.budgetmaster.logic.serverconnection.ServerConnection; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; import de.deadlocker8.budgetmaster.ui.colorPick.ColorView; import fontAwesome.FontIconType; @@ -49,8 +50,8 @@ public class NewCategoryController buttonCancel.setGraphic(Helpers.getFontIcon(FontIconType.TIMES, 17, Color.WHITE)); buttonSave.setGraphic(Helpers.getFontIcon(FontIconType.SAVE, 17, Color.WHITE)); - buttonCancel.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 15;"); - buttonSave.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 15;"); + buttonCancel.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 15;"); + buttonSave.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 15;"); buttonColor.setStyle("-fx-border-color: #000000; -fx-border-width: 2; -fx-border-radius: 5; -fx-background-radius: 5;"); buttonColor.prefWidthProperty().bind(textFieldName.widthProperty()); diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/NewPaymentController.java b/src/de/deadlocker8/budgetmaster/ui/controller/NewPaymentController.java index 51031c0f7d10537ed92d4cc1e1dca19bf7b97d62..b0b4d51f13def5ba7d8cb0aea65907eb7cd768e3 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/NewPaymentController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/NewPaymentController.java @@ -12,6 +12,7 @@ import de.deadlocker8.budgetmaster.logic.RepeatingPayment; import de.deadlocker8.budgetmaster.logic.RepeatingPaymentEntry; import de.deadlocker8.budgetmaster.logic.serverconnection.ExceptionHandler; import de.deadlocker8.budgetmaster.logic.serverconnection.ServerConnection; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; import de.deadlocker8.budgetmaster.ui.cells.ButtonCategoryCell; import de.deadlocker8.budgetmaster.ui.cells.RepeatingDayCell; @@ -74,8 +75,8 @@ public class NewPaymentController buttonCancel.setGraphic(Helpers.getFontIcon(FontIconType.TIMES, 17, Color.WHITE)); buttonSave.setGraphic(Helpers.getFontIcon(FontIconType.SAVE, 17, Color.WHITE)); - buttonCancel.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 15;"); - buttonSave.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 15;"); + buttonCancel.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 15;"); + buttonSave.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 15;"); SpinnerValueFactory<Integer> valueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 1000, 0); spinnerRepeatingPeriod.setValueFactory(valueFactory); diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/PaymentController.java b/src/de/deadlocker8/budgetmaster/ui/controller/PaymentController.java index 634a08e0e6cbf62d42436177f6a349709ba379a9..28a73ce19bd42f152908fd87ec582f8f472064ca 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/PaymentController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/PaymentController.java @@ -11,6 +11,7 @@ import de.deadlocker8.budgetmaster.logic.RepeatingPayment; import de.deadlocker8.budgetmaster.logic.RepeatingPaymentEntry; import de.deadlocker8.budgetmaster.logic.serverconnection.ExceptionHandler; import de.deadlocker8.budgetmaster.logic.serverconnection.ServerConnection; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; import de.deadlocker8.budgetmaster.ui.Refreshable; import de.deadlocker8.budgetmaster.ui.cells.PaymentCell; @@ -34,6 +35,7 @@ import javafx.stage.Modality; import javafx.stage.Stage; import javafx.util.Callback; import logger.Logger; +import tools.ConvertTo; public class PaymentController implements Refreshable { @@ -103,18 +105,18 @@ public class PaymentController implements Refreshable buttonNewIncome.setGraphic(Helpers.getFontIcon(FontIconType.DOWNLOAD, 18, Color.WHITE)); buttonFilter.setGraphic(Helpers.getFontIcon(FontIconType.FILTER, 18, Color.WHITE)); buttonNewPayment.setGraphic(Helpers.getFontIcon(FontIconType.UPLOAD, 18, Color.WHITE)); - labelFilterActive.setGraphic(Helpers.getFontIcon(FontIconType.WARNING, 13, Color.web(controller.getBundle().getString("color.text")))); + labelFilterActive.setGraphic(Helpers.getFontIcon(FontIconType.WARNING, 13, Colors.TEXT)); // apply theme - anchorPaneMain.setStyle("-fx-background-color: #F4F4F4;"); - labelIncome.setStyle("-fx-text-fill: " + controller.getBundle().getString("color.text")); - labelIncomes.setStyle("-fx-text-fill: " + controller.getBundle().getString("color.text")); - labelPayment.setStyle("-fx-text-fill: " + controller.getBundle().getString("color.text")); - labelPayments.setStyle("-fx-text-fill: " + controller.getBundle().getString("color.text")); - labelFilterActive.setStyle("-fx-text-fill: " + controller.getBundle().getString("color.text")); - buttonNewIncome.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); - buttonFilter.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); - buttonNewPayment.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); + anchorPaneMain.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND)); + labelIncome.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT)); + labelIncomes.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT)); + labelPayment.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT)); + labelPayments.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT)); + labelFilterActive.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT)); + buttonNewIncome.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); + buttonFilter.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); + buttonNewPayment.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); refresh(); } diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/ReportController.java b/src/de/deadlocker8/budgetmaster/ui/controller/ReportController.java index 4790ea4e2a084fb0a68e878ac533fca679e01494..ffd4724cc4bcd4ab63db6c9b40ffcf2a68a682f0 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/ReportController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/ReportController.java @@ -9,6 +9,8 @@ import java.util.ArrayList; import java.util.Date; import java.util.Optional; +import org.joda.time.DateTime; + import de.deadlocker8.budgetmaster.logic.FilterSettings; import de.deadlocker8.budgetmaster.logic.Payment; import de.deadlocker8.budgetmaster.logic.RepeatingPaymentEntry; @@ -19,6 +21,7 @@ import de.deadlocker8.budgetmaster.logic.report.ColumnOrder; import de.deadlocker8.budgetmaster.logic.report.ColumnType; import de.deadlocker8.budgetmaster.logic.report.ReportGenerator; import de.deadlocker8.budgetmaster.logic.report.ReportItem; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; import de.deadlocker8.budgetmaster.ui.Refreshable; import fontAwesome.FontIconType; @@ -53,6 +56,7 @@ import javafx.stage.Stage; import javafx.util.Callback; import logger.Logger; import tools.AlertGenerator; +import tools.ConvertTo; import tools.Worker; public class ReportController implements Refreshable @@ -76,17 +80,17 @@ public class ReportController implements Refreshable buttonFilter.setGraphic(Helpers.getFontIcon(FontIconType.FILTER, 18, Color.WHITE)); buttonGenerate.setGraphic(Helpers.getFontIcon(FontIconType.COGS, 18, Color.WHITE)); - labelFilterActive.setGraphic(Helpers.getFontIcon(FontIconType.WARNING, 16, Color.web(controller.getBundle().getString("color.text")))); + labelFilterActive.setGraphic(Helpers.getFontIcon(FontIconType.WARNING, 16, Colors.TEXT)); initTable(); // apply theme - anchorPaneMain.setStyle("-fx-background-color: #F4F4F4;"); - labelFilterActive.setStyle("-fx-text-fill: " + controller.getBundle().getString("color.text")); - buttonFilter.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); - buttonGenerate.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); - checkBoxSplitTable.setStyle("-fx-text-fill: " + controller.getBundle().getString("color.text") + "; -fx-font-size: 14;"); - checkBoxIncludeCategoryBudgets.setStyle("-fx-text-fill: " + controller.getBundle().getString("color.text") + "; -fx-font-size: 14;"); + anchorPaneMain.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND)); + labelFilterActive.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT)); + buttonFilter.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); + buttonGenerate.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); + checkBoxSplitTable.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT) + "; -fx-font-size: 14;"); + checkBoxIncludeCategoryBudgets.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT) + "; -fx-font-size: 14;"); refresh(); } @@ -110,7 +114,7 @@ public class ReportController implements Refreshable hboxColumnPosition.getChildren().add(labelColumnPosition); checkBoxPositions.selectedProperty().addListener((a, b, c)->{ - String style = c ? "" : "-fx-background-color: salmon;"; + String style = c ? "" : "-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_REPORT_TABLE_HEADER_DISABLED); hboxColumnPosition.setStyle(style); columnFilter.toggleColumn(ColumnType.POSITION, c); }); @@ -157,7 +161,7 @@ public class ReportController implements Refreshable hboxColumnDate.getChildren().add(labelComlumnDate); checkBoxDate.selectedProperty().addListener((a, b, c)->{ - String style = c ? "" : "-fx-background-color: salmon;"; + String style = c ? "" : "-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_REPORT_TABLE_HEADER_DISABLED); hboxColumnDate.setStyle(style); columnFilter.toggleColumn(ColumnType.DATE, c); }); @@ -186,7 +190,7 @@ public class ReportController implements Refreshable Label labelRepeating = new Label(); if(item) { - labelRepeating.setGraphic(Helpers.getFontIcon(FontIconType.CALENDAR, 16, Color.web(controller.getBundle().getString("color.text")))); + labelRepeating.setGraphic(Helpers.getFontIcon(FontIconType.CALENDAR, 16, Colors.TEXT)); } else { @@ -219,7 +223,7 @@ public class ReportController implements Refreshable hboxColumnIsRepeating.getChildren().add(labelColumnIsRepeating); checkBoxRepeating.selectedProperty().addListener((a, b, c)->{ - String style = c ? "" : "-fx-background-color: salmon;"; + String style = c ? "" : "-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_REPORT_TABLE_HEADER_DISABLED); hboxColumnIsRepeating.setStyle(style); columnFilter.toggleColumn(ColumnType.REPEATING, c); }); @@ -237,12 +241,7 @@ public class ReportController implements Refreshable @Override public ObservableValue<String> call(CellDataFeatures<ReportItem, String> param) { - String categoryName = param.getValue().getCategory().getName(); - if(categoryName.equals("NONE")) - { - categoryName = ""; - } - return new SimpleStringProperty(categoryName); + return new SimpleStringProperty(param.getValue().getCategory().getName()); } }); columnCategory.setStyle("-fx-alignment: CENTER;"); @@ -259,7 +258,7 @@ public class ReportController implements Refreshable hboxColumnCategory.getChildren().add(labelColumnCategory); checkBoxCategory.selectedProperty().addListener((a, b, c)->{ - String style = c ? "" : "-fx-background-color: salmon;"; + String style = c ? "" : "-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_REPORT_TABLE_HEADER_DISABLED); hboxColumnCategory.setStyle(style); columnFilter.toggleColumn(ColumnType.CATEGORY, c); }); @@ -286,7 +285,7 @@ public class ReportController implements Refreshable hboxColumnName.getChildren().add(labelColumnName); checkBoxName.selectedProperty().addListener((a, b, c)->{ - String style = c ? "" : "-fx-background-color: salmon;"; + String style = c ? "" : "-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_REPORT_TABLE_HEADER_DISABLED); hboxColumnName.setStyle(style); columnFilter.toggleColumn(ColumnType.NAME, c); }); @@ -313,7 +312,7 @@ public class ReportController implements Refreshable hboxColumnDescription.getChildren().add(labelColumnDescription); checkBoxDescription.selectedProperty().addListener((a, b, c)->{ - String style = c ? "" : "-fx-background-color: salmon;"; + String style = c ? "" : "-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_REPORT_TABLE_HEADER_DISABLED); hboxColumnDescription.setStyle(style); columnFilter.toggleColumn(ColumnType.DESCRIPTION, c); }); @@ -341,11 +340,11 @@ public class ReportController implements Refreshable Label labelRepeating = new Label(); if(item > 0) { - labelRepeating.setGraphic(Helpers.getFontIcon(FontIconType.PLUS, 14, Color.web(controller.getBundle().getString("color.text")))); + labelRepeating.setGraphic(Helpers.getFontIcon(FontIconType.PLUS, 14, Colors.TEXT)); } else { - labelRepeating.setGraphic(Helpers.getFontIcon(FontIconType.MINUS, 14, Color.web(controller.getBundle().getString("color.text")))); + labelRepeating.setGraphic(Helpers.getFontIcon(FontIconType.MINUS, 14, Colors.TEXT)); } labelRepeating.setStyle("-fx-font-weight: bold; -fx-font-size: 14; -fx-text-fill: #212121"); labelRepeating.setAlignment(Pos.CENTER); @@ -374,7 +373,7 @@ public class ReportController implements Refreshable hboxColumnRating.getChildren().add(labelColumnRating); checkBoxRating.selectedProperty().addListener((a, b, c)->{ - String style = c ? "" : "-fx-background-color: salmon;"; + String style = c ? "" : "-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_REPORT_TABLE_HEADER_DISABLED); hboxColumnRating.setStyle(style); columnFilter.toggleColumn(ColumnType.RATING, c); }); @@ -412,7 +411,7 @@ public class ReportController implements Refreshable hboxColumnAmount.getChildren().add(labelColumnAmount); checkBoxAmount.selectedProperty().addListener((a, b, c)->{ - String style = c ? "" : "-fx-background-color: salmon;"; + String style = c ? "" : "-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_REPORT_TABLE_HEADER_DISABLED); hboxColumnAmount.setStyle(style); columnFilter.toggleColumn(ColumnType.AMOUNT, c); }); @@ -522,6 +521,13 @@ public class ReportController implements Refreshable fileChooser.setInitialDirectory(reportPath.getParentFile()); fileChooser.setInitialFileName(reportPath.getName()); } + else + { + DateTime currentDate = controller.getCurrentDate(); + String currentMonth = currentDate.toString("MMMM"); + String currentYear = currentDate.toString("YYYY"); + fileChooser.setInitialFileName("BudgetMaster Monatsbericht - " + currentMonth + " " + currentYear + ".pdf"); + } fileChooser.getExtensionFilters().add(extFilter); File file = fileChooser.showSaveDialog(controller.getStage()); if(file != null) diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/SettingsController.java b/src/de/deadlocker8/budgetmaster/ui/controller/SettingsController.java index 34993a4d68c4e92cded299e56cda8413a8723971..8e89adaaa0aac4c444a8baac16944cab98e5591b 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/SettingsController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/SettingsController.java @@ -8,6 +8,7 @@ import java.util.Optional; import de.deadlocker8.budgetmaster.logic.Settings; import de.deadlocker8.budgetmaster.logic.serverconnection.ExceptionHandler; import de.deadlocker8.budgetmaster.logic.serverconnection.ServerConnection; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.FileHelper; import de.deadlocker8.budgetmaster.logic.utils.Helpers; import de.deadlocker8.budgetmasterserver.logic.Database; @@ -79,15 +80,15 @@ public class SettingsController setTextAreaTrustedHosts(controller.getSettings().getTrustedHosts()); } - anchorPaneMain.setStyle("-fx-background-color: #F4F4F4;"); - labelClientSecret.setStyle("-fx-text-fill: " + controller.getBundle().getString("color.text")); - labelSecret.setStyle("-fx-text-fill: " + controller.getBundle().getString("color.text")); - labelURL.setStyle("-fx-text-fill: " + controller.getBundle().getString("color.text")); - labelCurrency.setStyle("-fx-text-fill: " + controller.getBundle().getString("color.text")); - buttonSave.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); - buttonExportDB.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); - buttonImportDB.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); - buttonDeleteDB.setStyle("-fx-background-color: #FF5047; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); + anchorPaneMain.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND)); + labelClientSecret.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT)); + labelSecret.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT)); + labelURL.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT)); + labelCurrency.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT)); + buttonSave.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); + buttonExportDB.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); + buttonImportDB.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); + buttonDeleteDB.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_RED) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); textFieldURL.setPromptText("z.B. https://yourdomain.de"); textFieldCurrency.setPromptText("z.B. €, CHF, $"); textAreaTrustedHosts.setPromptText("z.B. localhost"); diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/SplashScreenController.java b/src/de/deadlocker8/budgetmaster/ui/controller/SplashScreenController.java index 5c2efed54bb7f3915b404fff847525345184aa2d..fadccd9c0f5a841ba59955282c936463a0c3d9a7 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/SplashScreenController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/SplashScreenController.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.util.ResourceBundle; import de.deadlocker8.budgetmaster.logic.Settings; +import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.FileHelper; import de.deadlocker8.budgetmaster.logic.utils.Helpers; import fontAwesome.FontIconType; @@ -24,6 +25,7 @@ import javafx.scene.paint.Color; import javafx.stage.Stage; import logger.Logger; import tools.AlertGenerator; +import tools.ConvertTo; import tools.HashUtils; public class SplashScreenController @@ -50,7 +52,7 @@ public class SplashScreenController labelVersion.setText("v" + bundle.getString("version.name")); buttonLogin.setGraphic(Helpers.getFontIcon(FontIconType.SIGN_IN, 18, Color.WHITE)); - buttonLogin.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); + buttonLogin.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); buttonLogin.setPadding(new Insets(3, 7, 3, 7)); textFieldPassword.setOnKeyReleased((event)->{