Added sqlite support - wip 4

This commit is contained in:
Robert Vokac 2024-03-09 12:38:33 +00:00
parent edba3362d7
commit d28b92915e
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055
2 changed files with 21 additions and 16 deletions

View File

@ -529,13 +529,18 @@ public class MainWindow extends TWindow {
//System.out.println("timeCalcConfiguration.handsLongProperty=" + timeCalcConfiguration.clockHandLongProperty.isEnabled()); //System.out.println("timeCalcConfiguration.handsLongProperty=" + timeCalcConfiguration.clockHandLongProperty.isEnabled());
{ {
TTime startTime = arrivalTextField.asTimeHM(); TTime startTime = arrivalTextField.asTimeHM();
TTime overtime = overtimeTextField.asTimeHM(); TTime overtime = overtimeTextField.asTimeHM();
departureTextField.valueProperty.setValue(new TTime( TTime newDeparture = startTime.add(new TTime(8,30));
startTime.getHour() + Constants.WORKING_HOURS_LENGTH + overtime if(overtime.isNegative()) {
.getHour(), TTime tmpTTime = overtime.cloneInstance();
startTime.getMinute() + Constants.WORKING_MINUTES_LENGTH tmpTTime.setNegative(false);
+ overtime.getMinute()).toString().substring(0, 5)); newDeparture = newDeparture.remove(tmpTTime);
} else {
newDeparture = newDeparture.add(overtime);
}
departureTextField.valueProperty.setValue(newDeparture.toString().substring(0, 5));
} }
Visibility currentVisibility = Visibility Visibility currentVisibility = Visibility
.valueOf(timeCalcApp.visibilityProperty.getValue()); .valueOf(timeCalcApp.visibilityProperty.getValue());

View File

@ -103,10 +103,10 @@ public class TTime implements Comparable<TTime> {
this(false, hourIn, minuteIn, secondIn, millisecondIn); this(false, hourIn, minuteIn, secondIn, millisecondIn);
} }
public TTime(boolean negative, int hourIn, int minuteIn, int secondIn, int millisecondIn) { public TTime(boolean negative, int hourIn, int minuteIn, int secondIn, int millisecondIn) {
this.hour = hourIn; this.hour = Math.abs(hourIn);
this.minute = minuteIn; this.minute = Math.abs(minuteIn);
this.second = secondIn; this.second = Math.abs(secondIn);
this.millisecond = millisecondIn; this.millisecond = Math.abs(millisecondIn);
this.negative = negative; this.negative = negative;
while (minute >= MINUTES_PER_HOUR) { while (minute >= MINUTES_PER_HOUR) {
minute = minute - MINUTES_PER_HOUR; minute = minute - MINUTES_PER_HOUR;
@ -125,7 +125,7 @@ public class TTime implements Comparable<TTime> {
return result; return result;
} }
private static TTime ofMilliseconds(int s) { public static TTime ofMilliseconds(int s) {
int hours = s / 60 / 60 / 1000; int hours = s / 60 / 60 / 1000;
int milliseconds = s - hours * 60 * 60 * 1000; int milliseconds = s - hours * 60 * 60 * 1000;
int minutes = milliseconds / 60 / 1000; int minutes = milliseconds / 60 / 1000;
@ -138,12 +138,12 @@ public class TTime implements Comparable<TTime> {
public TTime add(TTime tTimeToBeAdded) { public TTime add(TTime tTimeToBeAdded) {
TTime result = this.cloneInstance(); TTime result = this.cloneInstance();
// if(result.isNegative()) { if(result.isNegative()) {
// result.setNegative(false); result.setNegative(false);
// result.remove(tTimeToBeAdded); result = result.remove(tTimeToBeAdded);
// result.setNegative(true); result.setNegative(result.toTotalMilliseconds() != 0);
// return result; return result;
// } }
Calendar cal = asCalendar(); Calendar cal = asCalendar();
cal.add(Calendar.HOUR_OF_DAY, tTimeToBeAdded.hour); cal.add(Calendar.HOUR_OF_DAY, tTimeToBeAdded.hour);
cal.add(Calendar.MINUTE, tTimeToBeAdded.minute); cal.add(Calendar.MINUTE, tTimeToBeAdded.minute);