mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Added sqlite support - wip 6
This commit is contained in:
parent
119bba1578
commit
6b67b4512a
@ -32,7 +32,6 @@ import java.awt.Color;
|
|||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyVetoException;
|
import java.beans.PropertyVetoException;
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert Vokac
|
* @author Robert Vokac
|
||||||
@ -150,7 +149,7 @@ public class MainWindow extends TWindow {
|
|||||||
{
|
{
|
||||||
arrivalTextField.valueProperty.addListener(e -> {
|
arrivalTextField.valueProperty.addListener(e -> {
|
||||||
if (!arrivalTextField.valueProperty.getValue().isEmpty()) {
|
if (!arrivalTextField.valueProperty.getValue().isEmpty()) {
|
||||||
TTime startTime_ = arrivalTextField.asTimeHM();
|
TTime startTime_ = arrivalTextField.asTTime();
|
||||||
analogClock.startHourProperty
|
analogClock.startHourProperty
|
||||||
.setValue(startTime_.getHour());
|
.setValue(startTime_.getHour());
|
||||||
analogClock.startMinuteProperty
|
analogClock.startMinuteProperty
|
||||||
@ -160,7 +159,7 @@ public class MainWindow extends TWindow {
|
|||||||
});
|
});
|
||||||
departureTextField.valueProperty.addListener(e -> {
|
departureTextField.valueProperty.addListener(e -> {
|
||||||
if (!departureTextField.valueProperty.getValue().isEmpty()) {
|
if (!departureTextField.valueProperty.getValue().isEmpty()) {
|
||||||
TTime endTime = arrivalTextField.asTimeHM();
|
TTime endTime = arrivalTextField.asTTime();
|
||||||
analogClock.endHourProperty
|
analogClock.endHourProperty
|
||||||
.setValue(endTime.getHour());
|
.setValue(endTime.getHour());
|
||||||
analogClock.endMinuteProperty
|
analogClock.endMinuteProperty
|
||||||
@ -270,8 +269,8 @@ public class MainWindow extends TWindow {
|
|||||||
add(remainingTextField);
|
add(remainingTextField);
|
||||||
add(saveButton);
|
add(saveButton);
|
||||||
saveButton.addActionListener(e -> {
|
saveButton.addActionListener(e -> {
|
||||||
TTime overtime_ =overtimeTextField.asTimeHM();
|
TTime overtime_ =overtimeTextField.asTTime();
|
||||||
Utils.writeTextToFile(FileConstants.STARTTIME_TXT, arrivalTextField.asTimeHM().toString().substring(0,5));
|
Utils.writeTextToFile(FileConstants.STARTTIME_TXT, arrivalTextField.asTTime().toString().substring(0,5));
|
||||||
Utils.writeTextToFile(FileConstants.OVERTIME_TXT, overtime_.toString().substring(0,overtime_.isNegative() ? 6 : 5));
|
Utils.writeTextToFile(FileConstants.OVERTIME_TXT, overtime_.toString().substring(0,overtime_.isNegative() ? 6 : 5));
|
||||||
});
|
});
|
||||||
//
|
//
|
||||||
@ -534,14 +533,20 @@ public class MainWindow extends TWindow {
|
|||||||
+ focusButton.getHeight() + 2 * SwingUtils.MARGIN);
|
+ focusButton.getHeight() + 2 * SwingUtils.MARGIN);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
//System.out.println("timeCalcConfiguration.handsLongProperty=" + timeCalcConfiguration.clockHandLongProperty.isEnabled());
|
//System.out.println("timeCalcConfiguration.handsLongProperty=" + timeCalcConfiguration.clockHandLongProperty.isEnabled());
|
||||||
|
if(!departureTextField.valueProperty.getValue().isEmpty()){
|
||||||
|
TTime startTime = arrivalTextField.asTTime();
|
||||||
|
TTime endTime = departureTextField.asTTime();
|
||||||
|
analogClock.startHourProperty.setValue(startTime.getHour());
|
||||||
|
analogClock.startMinuteProperty.setValue(startTime.getMinute());
|
||||||
|
analogClock.endHourProperty.setValue(endTime.getHour());
|
||||||
|
analogClock.endMinuteProperty.setValue(endTime.getMinute());
|
||||||
|
}
|
||||||
{
|
{
|
||||||
|
|
||||||
TTime startTime = arrivalTextField.asTimeHM();
|
TTime startTime = arrivalTextField.asTTime();
|
||||||
TTime overtime = overtimeTextField.asTimeHM();
|
TTime overtime = overtimeTextField.asTTime();
|
||||||
TTime newDeparture = startTime.add(new TTime(8,30));
|
TTime newDeparture = startTime.add(new TTime(8,30));
|
||||||
if(overtime.isNegative()) {
|
if(overtime.isNegative()) {
|
||||||
TTime tmpTTime = overtime.cloneInstance();
|
TTime tmpTTime = overtime.cloneInstance();
|
||||||
@ -602,8 +607,8 @@ public class MainWindow extends TWindow {
|
|||||||
int secondNow = analogClock.secondProperty.getValue();
|
int secondNow = analogClock.secondProperty.getValue();
|
||||||
int millisecondNow = analogClock.millisecondProperty.getValue();
|
int millisecondNow = analogClock.millisecondProperty.getValue();
|
||||||
|
|
||||||
TTime startTime = arrivalTextField.asTimeHM();
|
TTime startTime = arrivalTextField.asTTime();
|
||||||
TTime endTime = departureTextField.asTimeHM();
|
TTime endTime = departureTextField.asTTime();
|
||||||
TTime nowTime = TTime.of(time.asCalendar());
|
TTime nowTime = TTime.of(time.asCalendar());
|
||||||
TTime timeElapsed = TTime
|
TTime timeElapsed = TTime
|
||||||
.computeTimeDiff(startTime, nowTime);
|
.computeTimeDiff(startTime, nowTime);
|
||||||
@ -628,7 +633,7 @@ public class MainWindow extends TWindow {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
TTime overtime = overtimeTextField.asTimeHM();
|
TTime overtime = overtimeTextField.asTTime();
|
||||||
int hourDone = (int) (Constants.WORKING_HOURS_LENGTH + overtime.getHour()
|
int hourDone = (int) (Constants.WORKING_HOURS_LENGTH + overtime.getHour()
|
||||||
- timeRemains.getHour());
|
- timeRemains.getHour());
|
||||||
int minutesDone
|
int minutesDone
|
||||||
@ -643,8 +648,8 @@ public class MainWindow extends TWindow {
|
|||||||
= totalSecondsDone * 1000 + millisecondsDone;
|
= totalSecondsDone * 1000 + millisecondsDone;
|
||||||
|
|
||||||
|
|
||||||
int totalMinutes = TTime.countDiffInMinutes(arrivalTextField.asTimeHM(),
|
int totalMinutes = TTime.countDiffInMinutes(arrivalTextField.asTTime(),
|
||||||
departureTextField.asTimeHM());
|
departureTextField.asTTime());
|
||||||
|
|
||||||
int totalSeconds = totalMinutes * TTime.SECONDS_PER_MINUTE;
|
int totalSeconds = totalMinutes * TTime.SECONDS_PER_MINUTE;
|
||||||
int totalMilliseconds = totalSeconds * TTime.MILLISECONDS_PER_SECOND;
|
int totalMilliseconds = totalSeconds * TTime.MILLISECONDS_PER_SECOND;
|
||||||
|
@ -124,7 +124,7 @@ public class TTextField extends JTextField implements GetProperty {
|
|||||||
public Property getVisibilitySupportedColoredProperty() {
|
public Property getVisibilitySupportedColoredProperty() {
|
||||||
return visibilitySupportedColoredProperty;
|
return visibilitySupportedColoredProperty;
|
||||||
}
|
}
|
||||||
public TTime asTimeHM() {
|
public TTime asTTime() {
|
||||||
return new TTime(valueProperty.getValue());
|
return new TTime(valueProperty.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user