-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from deadlocker8/v1_2_0
merge v_1_2_0 into master
- Loading branch information
Showing
66 changed files
with
3,207 additions
and
504 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
82 changes: 82 additions & 0 deletions
82
src/de/deadlocker8/budgetmaster/logic/CategoryInOutSum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package de.deadlocker8.budgetmaster.logic; | ||
|
||
import javafx.scene.paint.Color; | ||
|
||
public class CategoryInOutSum | ||
{ | ||
private int ID; | ||
private String name; | ||
private Color color; | ||
private int budgetIN; | ||
private int budgetOUT; | ||
|
||
public CategoryInOutSum(int ID, String name, Color color, int budgetIN, int budgetOUT) | ||
{ | ||
this.ID = ID; | ||
this.name = name; | ||
this.color = color; | ||
this.budgetIN = budgetIN; | ||
this.budgetOUT = budgetOUT; | ||
} | ||
|
||
public String getName() | ||
{ | ||
return name; | ||
} | ||
|
||
public void setName(String name) | ||
{ | ||
this.name = name; | ||
} | ||
|
||
public Color getColor() | ||
{ | ||
return color; | ||
} | ||
|
||
public void setColor(Color color) | ||
{ | ||
this.color = color; | ||
} | ||
|
||
public int getBudgetIN() | ||
{ | ||
return budgetIN; | ||
} | ||
|
||
public void setBudgetIN(int budgetIN) | ||
{ | ||
this.budgetIN = budgetIN; | ||
} | ||
|
||
public int getBudgetOUT() | ||
{ | ||
return budgetOUT; | ||
} | ||
|
||
public void setBudgetOUT(int budgetOUT) | ||
{ | ||
this.budgetOUT = budgetOUT; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) | ||
{ | ||
if(this == obj) | ||
return true; | ||
if(obj == null) | ||
return false; | ||
if(getClass() != obj.getClass()) | ||
return false; | ||
CategoryInOutSum other = (CategoryInOutSum)obj; | ||
if(ID != other.ID) | ||
return false; | ||
return true; | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return "CategoryInOutSum [ID=" + ID + ", name=" + name + ", color=" + color + ", budgetIN=" + budgetIN + ", budgetOUT=" + budgetOUT + "]"; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
src/de/deadlocker8/budgetmaster/logic/ExceptionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package de.deadlocker8.budgetmaster.logic; | ||
|
||
public class ExceptionHandler | ||
{ | ||
public static String getMessageForException(Exception e) | ||
{ | ||
if(e instanceof ServerConnectionException) | ||
{ | ||
return handleServerConnectionException(e); | ||
} | ||
|
||
if(e.getMessage() == null) | ||
{ | ||
return "Unbekannter Fehler (" + e.getClass() + ")"; | ||
} | ||
|
||
if(e.getMessage().contains("Connection refused")) | ||
{ | ||
return "Server nicht erreichbar."; | ||
} | ||
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 e.getMessage(); | ||
} | ||
|
||
private static String handleServerConnectionException(Exception e) | ||
{ | ||
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."; | ||
default: return e.getMessage(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package de.deadlocker8.budgetmaster.logic; | ||
|
||
import java.util.ArrayList; | ||
|
||
import org.joda.time.DateTime; | ||
|
||
public class MonthInOutSum | ||
{ | ||
private int month; | ||
private int year; | ||
private ArrayList<CategoryInOutSum> sums; | ||
|
||
public MonthInOutSum(int month, int year, ArrayList<CategoryInOutSum> sums) | ||
{ | ||
this.month = month; | ||
this.year = year; | ||
this.sums = sums; | ||
} | ||
|
||
public int getMonth() | ||
{ | ||
return month; | ||
} | ||
|
||
public int getYear() | ||
{ | ||
return year; | ||
} | ||
|
||
public ArrayList<CategoryInOutSum> getSums() | ||
{ | ||
return sums; | ||
} | ||
|
||
public DateTime getDate() | ||
{ | ||
return DateTime.now().withYear(year).withMonthOfYear(month).withDayOfMonth(1); | ||
} | ||
|
||
public int getBudgetIN() | ||
{ | ||
int budget = 0; | ||
for(CategoryInOutSum currentCategorySum : sums) | ||
{ | ||
budget += currentCategorySum.getBudgetIN(); | ||
} | ||
|
||
return budget; | ||
} | ||
|
||
public int getBudgetOUT() | ||
{ | ||
int budget = 0; | ||
for(CategoryInOutSum currentCategorySum : sums) | ||
{ | ||
budget += currentCategorySum.getBudgetOUT(); | ||
} | ||
|
||
return budget; | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return "MonthInOutSum [month=" + month + ", year=" + year + ", sums=" + sums + "]"; | ||
} | ||
} |
Oops, something went wrong.