mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Added several improvements
This commit is contained in:
parent
f9bad51649
commit
e7c765f47e
@ -367,7 +367,9 @@ public class ConfigWindow extends TWindow {
|
|||||||
TimeCalcProperty.PROFILE_NAME.getKey());
|
TimeCalcProperty.PROFILE_NAME.getKey());
|
||||||
}
|
}
|
||||||
if (p == testClockCustomYearProperty) {
|
if (p == testClockCustomYearProperty) {
|
||||||
addToNextRow(new JLabel("Test"));
|
JLabel label = new JLabel("Test");
|
||||||
|
label.setFont(BIG_FONT);
|
||||||
|
addToNextRow(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p instanceof JComboBox) {
|
if (p instanceof JComboBox) {
|
||||||
|
@ -24,23 +24,14 @@ import org.nanoboot.utils.timecalc.utils.common.Constants;
|
|||||||
import org.nanoboot.utils.timecalc.utils.common.Jokes;
|
import org.nanoboot.utils.timecalc.utils.common.Jokes;
|
||||||
import org.nanoboot.utils.timecalc.utils.common.TimeHM;
|
import org.nanoboot.utils.timecalc.utils.common.TimeHM;
|
||||||
import org.nanoboot.utils.timecalc.utils.common.Utils;
|
import org.nanoboot.utils.timecalc.utils.common.Utils;
|
||||||
import org.nanoboot.utils.timecalc.utils.property.IntegerProperty;
|
|
||||||
import org.nanoboot.utils.timecalc.utils.property.Property;
|
|
||||||
|
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert Vokac
|
* @author Robert Vokac
|
||||||
@ -245,8 +236,6 @@ public class MainWindow extends TWindow {
|
|||||||
}
|
}
|
||||||
helpWindow.setVisible(true);
|
helpWindow.setVisible(true);
|
||||||
});
|
});
|
||||||
Calendar calNow = Calendar.getInstance();
|
|
||||||
calNow.setTime(new Date());
|
|
||||||
|
|
||||||
time.yearCustomProperty.bindTo(timeCalcConfiguration.testYearCustomProperty);
|
time.yearCustomProperty.bindTo(timeCalcConfiguration.testYearCustomProperty);
|
||||||
time.monthCustomProperty.bindTo(timeCalcConfiguration.testMonthCustomProperty);
|
time.monthCustomProperty.bindTo(timeCalcConfiguration.testMonthCustomProperty);
|
||||||
@ -332,7 +321,7 @@ public class MainWindow extends TWindow {
|
|||||||
int workDaysTodo = 0;
|
int workDaysTodo = 0;
|
||||||
int workDaysTotal;
|
int workDaysTotal;
|
||||||
for (int dayOfMonth = 1;
|
for (int dayOfMonth = 1;
|
||||||
dayOfMonth <= calNow.getActualMaximum(Calendar.DAY_OF_MONTH);
|
dayOfMonth <= time.asCalendar().getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||||
dayOfMonth++) {
|
dayOfMonth++) {
|
||||||
DayOfWeek dayOfWeek =
|
DayOfWeek dayOfWeek =
|
||||||
LocalDate.of(analogClock.yearProperty.getValue(),
|
LocalDate.of(analogClock.yearProperty.getValue(),
|
||||||
@ -349,8 +338,10 @@ public class MainWindow extends TWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String currentDayOfWeekAsString = LocalDate
|
String currentDayOfWeekAsString = LocalDate
|
||||||
.of(calNow.get(Calendar.YEAR), calNow.get(Calendar.MONTH) + 1,
|
.of(analogClock.yearProperty.getValue(),
|
||||||
currentDayOfMonth).getDayOfWeek().toString();
|
analogClock.monthProperty.getValue(),
|
||||||
|
analogClock.dayOfWeekProperty.getValue()).getDayOfWeek()
|
||||||
|
.toString();
|
||||||
boolean nowIsWeekend = currentDayOfWeekAsString.equals("SATURDAY")
|
boolean nowIsWeekend = currentDayOfWeekAsString.equals("SATURDAY")
|
||||||
|| currentDayOfWeekAsString.equals("SUNDAY");
|
|| currentDayOfWeekAsString.equals("SUNDAY");
|
||||||
workDaysTotal = workDaysDone + (nowIsWeekend ? 0 : 1) + workDaysTodo;
|
workDaysTotal = workDaysDone + (nowIsWeekend ? 0 : 1) + workDaysTodo;
|
||||||
@ -530,7 +521,7 @@ public class MainWindow extends TWindow {
|
|||||||
progressCircle.setDonePercent(done);
|
progressCircle.setDonePercent(done);
|
||||||
dayBattery.setDonePercent(done);
|
dayBattery.setDonePercent(done);
|
||||||
|
|
||||||
int weekDayWhenMondayIsOne = calNow.get(Calendar.DAY_OF_WEEK) - 1;
|
int weekDayWhenMondayIsOne = analogClock.dayOfWeekProperty.getValue();
|
||||||
weekBattery.setDonePercent(
|
weekBattery.setDonePercent(
|
||||||
WeekBattery.getWeekProgress(weekDayWhenMondayIsOne, done));
|
WeekBattery.getWeekProgress(weekDayWhenMondayIsOne, done));
|
||||||
weekBattery.setLabel(
|
weekBattery.setLabel(
|
||||||
|
@ -88,9 +88,12 @@ public class Time extends Thread {
|
|||||||
secondReadWriteProperty.setValue(returnCustomValueIfNeeded(cal, Calendar.SECOND, secondCustomProperty, secondProperty));
|
secondReadWriteProperty.setValue(returnCustomValueIfNeeded(cal, Calendar.SECOND, secondCustomProperty, secondProperty));
|
||||||
millisecondReadWriteProperty.setValue(returnCustomValueIfNeeded(cal, Calendar.MILLISECOND, millisecondCustomProperty, millisecondProperty));
|
millisecondReadWriteProperty.setValue(returnCustomValueIfNeeded(cal, Calendar.MILLISECOND, millisecondCustomProperty, millisecondProperty));
|
||||||
|
|
||||||
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
|
boolean customDayOfWeek = yearCustomProperty.getValue() != Integer.MAX_VALUE || monthCustomProperty.getValue() != Integer.MAX_VALUE || dayCustomProperty.getValue() != Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
int dayOfWeek = customDayOfWeek ? asCalendar().get(Calendar.DAY_OF_WEEK) : cal.get(Calendar.DAY_OF_WEEK);
|
||||||
|
dayOfWeek = dayOfWeek == 1 ? 7 : dayOfWeek - 1;
|
||||||
dayOfWeekReadWriteProperty
|
dayOfWeekReadWriteProperty
|
||||||
.setValue(dayOfWeek == 1 ? 7 : dayOfWeek - 1);
|
.setValue(dayOfWeek);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user