patch22
This commit is contained in:
parent
bf2e692b10
commit
e0f62c66bb
@ -180,6 +180,14 @@ public class TimeCalcConfiguration {
|
||||
= new StringProperty(TimeCalcProperty.LIFE_TYPE.getKey());
|
||||
public final StringProperty lifeBirthDateProperty
|
||||
= new StringProperty(TimeCalcProperty.LIFE_BIRTH_DATE.getKey());
|
||||
public final BooleanProperty moneyVisibleProperty
|
||||
= new BooleanProperty(TimeCalcProperty.MONEY_VISIBLE.getKey());
|
||||
public final StringProperty moneyTypeProperty
|
||||
= new StringProperty(TimeCalcProperty.MONEY_TYPE.getKey());
|
||||
public final IntegerProperty moneyPerMonthProperty
|
||||
= new IntegerProperty(TimeCalcProperty.MONEY_PER_MONTH.getKey());
|
||||
public final StringProperty moneyCurrencyProperty
|
||||
= new StringProperty(TimeCalcProperty.MONEY_CURRENCY.getKey());
|
||||
public final StringProperty mainWindowCustomTitleProperty
|
||||
= new StringProperty(
|
||||
TimeCalcProperty.MAIN_WINDOW_CUSTOM_TITLE.getKey());
|
||||
@ -266,6 +274,10 @@ public class TimeCalcConfiguration {
|
||||
lifeVisibleProperty,
|
||||
lifeTypeProperty,
|
||||
lifeBirthDateProperty,
|
||||
moneyVisibleProperty,
|
||||
moneyTypeProperty,
|
||||
moneyPerMonthProperty,
|
||||
moneyCurrencyProperty,
|
||||
mainWindowCustomTitleProperty,
|
||||
profileNameProperty,
|
||||
activityNeededFlagsProperty,
|
||||
|
@ -91,6 +91,10 @@ public enum TimeCalcProperty {
|
||||
LIFE_VISIBLE("life.visible", "Life"),
|
||||
LIFE_TYPE("life.type", "Life : Type"),
|
||||
LIFE_BIRTH_DATE("life.birth-date", "Life : Birth date"),
|
||||
MONEY_VISIBLE("money.visible", "Money"),
|
||||
MONEY_TYPE("money.type", "Money : Type"),
|
||||
MONEY_PER_MONTH("money.per-month", "Money : Per month", Integer.class),
|
||||
MONEY_CURRENCY("money.currency", "Money : Currency", String.class),
|
||||
MAIN_WINDOW_CUSTOM_TITLE("main-window.custom-title","Main Window : Custom Title"),
|
||||
PROFILE_NAME("profile.name", "Profile : Name"),
|
||||
TEST_ENABLED("test.enabled", "Test : Enabled", Boolean.class),
|
||||
|
@ -1,6 +1,11 @@
|
||||
package org.nanoboot.utils.timecalc.entity;
|
||||
|
||||
import org.nanoboot.utils.timecalc.app.TimeCalcException;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.AnalogClock;
|
||||
import org.nanoboot.utils.timecalc.utils.common.TTime;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* @author pc00289
|
||||
@ -8,10 +13,120 @@ import org.nanoboot.utils.timecalc.app.TimeCalcException;
|
||||
*/
|
||||
public class Progress {
|
||||
private final double[] array = new double[6];
|
||||
@Getter
|
||||
@Setter
|
||||
private int workDaysInMonth;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean weekend;
|
||||
|
||||
public void set(WidgetType type, double value) {
|
||||
array[type.getIndex()] = value > 1 ? 1 : (value < 0 ? 0 : value);
|
||||
}
|
||||
public double get(WidgetType type) {
|
||||
return array[type.getIndex()];
|
||||
}
|
||||
public static double getMinuteProgress(int secondNow, int millisecondNow) {
|
||||
return millisecondNow / 60d / 1000d + secondNow / 60d;
|
||||
}
|
||||
|
||||
public static double getHourProgress(TTime timeRemains, int secondsRemains,
|
||||
int millisecondsRemains) {
|
||||
if (secondsRemains < 0 || millisecondsRemains < 0
|
||||
|| timeRemains.getHour() < 0 || timeRemains.getMinute() < 0) {
|
||||
return 1;
|
||||
}
|
||||
double minutesRemainsD = timeRemains.getMinute();
|
||||
double secondsRemainsD = secondsRemains;
|
||||
double millisecondsRemainsD = millisecondsRemains;
|
||||
minutesRemainsD = minutesRemainsD + secondsRemainsD / 60d;
|
||||
minutesRemainsD
|
||||
= minutesRemainsD + millisecondsRemainsD / 1000d / 60d;
|
||||
if (secondsRemainsD > 0) {
|
||||
minutesRemainsD = minutesRemainsD - 1d;
|
||||
}
|
||||
if (millisecondsRemainsD > 0) {
|
||||
minutesRemainsD = minutesRemainsD - 1d / 1000d;
|
||||
}
|
||||
double hourProgress = 1 - ((minutesRemainsD % 60d) / 60d);
|
||||
return hourProgress;
|
||||
}
|
||||
|
||||
public static double getWeekProgress(int weekDayWhenMondayIsOne,
|
||||
double done) {
|
||||
if (done > 1) {
|
||||
done = 1;
|
||||
}
|
||||
return weekDayWhenMondayIsOne == 0
|
||||
|| weekDayWhenMondayIsOne == 6
|
||||
? 100 : ((weekDayWhenMondayIsOne - 1) * 0.20 + done * 0.20);
|
||||
}
|
||||
|
||||
public static double getMonthProgress(int weekDayWhenMondayIsOne,
|
||||
int workDaysDone, int workDaysTotal, double done) {
|
||||
|
||||
if (done > 1) {
|
||||
done = 1;
|
||||
}
|
||||
double result = weekDayWhenMondayIsOne == 6
|
||||
|| weekDayWhenMondayIsOne == 7
|
||||
? (double) workDaysDone / workDaysTotal
|
||||
: (workDaysDone + done) / workDaysTotal;
|
||||
// System.out.println("result=" + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static double getYearProgress(Integer year, Integer month,
|
||||
Integer day, Integer hour, Integer minute, Integer second,
|
||||
Integer millisecond) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(Calendar.YEAR, year);
|
||||
cal.set(Calendar.MONTH, month - 1);
|
||||
cal.set(Calendar.DAY_OF_MONTH, day);
|
||||
cal.set(Calendar.HOUR, hour);
|
||||
cal.set(Calendar.MINUTE, minute);
|
||||
cal.set(Calendar.SECOND, second);
|
||||
cal.set(Calendar.MILLISECOND, millisecond);
|
||||
|
||||
double seconds = second + millisecond / 1000d;
|
||||
double minutes = minute + seconds / 60d;
|
||||
double hours = hour + minutes / 60d;
|
||||
double days = cal.get(Calendar.DAY_OF_YEAR) + hours / 24d;
|
||||
// System.out.println("millisecond=" + millisecond);
|
||||
// System.out.println("seconds=" + seconds);
|
||||
// System.out.println("minutes=" + minutes);
|
||||
// System.out.println("hours=" + hours);
|
||||
// System.out.println("days=" + days);
|
||||
// System.out.println("cal.get(Calendar.DAY_OF_YEAR)=" + cal.get(Calendar.DAY_OF_YEAR));
|
||||
|
||||
double totalCountOfDaysInAYear = getTotalCountOfDaysInAYear(year);
|
||||
return days / totalCountOfDaysInAYear;
|
||||
}
|
||||
|
||||
private static double getTotalCountOfDaysInAYear(Integer year) {
|
||||
boolean leapYear = isLeapYear(year);
|
||||
double daysInYear = 365d;
|
||||
if (leapYear) {
|
||||
daysInYear++;
|
||||
}
|
||||
return daysInYear;
|
||||
}
|
||||
|
||||
private static boolean isLeapYear(Integer year) {
|
||||
return year % 4 == 0;
|
||||
}
|
||||
|
||||
public static double getYearProgress(AnalogClock analogClock) {
|
||||
return getYearProgress(
|
||||
analogClock.yearProperty.getValue(),
|
||||
analogClock.monthProperty.getValue(),
|
||||
analogClock.dayProperty.getValue(),
|
||||
analogClock.hourProperty.getValue(),
|
||||
analogClock.minuteProperty.getValue(),
|
||||
analogClock.secondProperty.getValue(),
|
||||
analogClock.millisecondProperty.getValue()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import org.nanoboot.utils.timecalc.utils.property.StringProperty;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.Timer;
|
||||
import java.awt.BasicStroke;
|
||||
@ -28,7 +27,6 @@ import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
@ -71,7 +69,7 @@ public class Widget extends JPanel implements
|
||||
public StringProperty typeProperty
|
||||
= new StringProperty("widget.typeProperty", WidgetType.DAY.name().toLowerCase());
|
||||
protected int side = 0;
|
||||
private Progress progress = null;
|
||||
protected Progress progress = null;
|
||||
protected boolean mouseOver = false;
|
||||
private boolean mouseOverCloseButton = false;
|
||||
protected JLabel smileyIcon;
|
||||
@ -244,6 +242,9 @@ public class Widget extends JPanel implements
|
||||
|
||||
paintCloseIcon(brush, getWidth(), mouseOver, mouseOverCloseButton);
|
||||
|
||||
if (mouseOver) {
|
||||
brush.drawRect(1, 1, getWidth() - 2, getHeight() - 2);
|
||||
}
|
||||
}
|
||||
|
||||
private static void paintCloseIcon(Graphics brush, int width,
|
||||
|
@ -2,6 +2,7 @@ package org.nanoboot.utils.timecalc.swing.common;
|
||||
|
||||
import org.nanoboot.utils.timecalc.app.TimeCalcException;
|
||||
import org.nanoboot.utils.timecalc.entity.WidgetType;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.AnalogClock;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.Battery;
|
||||
|
||||
import javax.swing.JMenu;
|
||||
@ -54,7 +55,7 @@ public class WidgetMenu extends JPopupMenu {
|
||||
|
||||
BiConsumer<JMenuItem, WidgetType> typeActionCreator = (m,w) -> {
|
||||
m.addActionListener(e -> {
|
||||
if(widget instanceof Battery && !widget.typeProperty.getValue().equals(w.name().toLowerCase(Locale.ROOT))) {
|
||||
if(((widget instanceof Battery) || (widget instanceof AnalogClock)) && !widget.typeProperty.getValue().equals(w.name().toLowerCase(Locale.ROOT))) {
|
||||
//nothing to do
|
||||
return;
|
||||
}
|
||||
|
@ -14,25 +14,4 @@ public class HourBattery extends Battery {
|
||||
super(HOUR, x, i, i1);
|
||||
}
|
||||
|
||||
public static double getHourProgress(TTime timeRemains, int secondsRemains,
|
||||
int millisecondsRemains) {
|
||||
if (secondsRemains < 0 || millisecondsRemains < 0
|
||||
|| timeRemains.getHour() < 0 || timeRemains.getMinute() < 0) {
|
||||
return 1;
|
||||
}
|
||||
double minutesRemainsD = timeRemains.getMinute();
|
||||
double secondsRemainsD = secondsRemains;
|
||||
double millisecondsRemainsD = millisecondsRemains;
|
||||
minutesRemainsD = minutesRemainsD + secondsRemainsD / 60d;
|
||||
minutesRemainsD
|
||||
= minutesRemainsD + millisecondsRemainsD / 1000d / 60d;
|
||||
if (secondsRemainsD > 0) {
|
||||
minutesRemainsD = minutesRemainsD - 1d;
|
||||
}
|
||||
if (millisecondsRemainsD > 0) {
|
||||
minutesRemainsD = minutesRemainsD - 1d / 1000d;
|
||||
}
|
||||
double hourProgress = 1 - ((minutesRemainsD % 60d) / 60d);
|
||||
return hourProgress;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,4 @@ public class MinuteBattery extends Battery {
|
||||
super(MINUTE, x, i, i1);
|
||||
}
|
||||
|
||||
public static double getMinuteProgress(int secondNow, int millisecondNow) {
|
||||
return millisecondNow / 60d / 1000d + secondNow / 60d;
|
||||
}
|
||||
}
|
||||
|
@ -12,17 +12,4 @@ public class MonthBattery extends Battery {
|
||||
super(MONTH, x, i, i1);
|
||||
}
|
||||
|
||||
public static double getMonthProgress(int weekDayWhenMondayIsOne,
|
||||
int workDaysDone, int workDaysTotal, double done) {
|
||||
|
||||
if (done > 1) {
|
||||
done = 1;
|
||||
}
|
||||
double result = weekDayWhenMondayIsOne == 6
|
||||
|| weekDayWhenMondayIsOne == 7
|
||||
? (double) workDaysDone / workDaysTotal
|
||||
: (workDaysDone + done) / workDaysTotal;
|
||||
// System.out.println("result=" + result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -93,13 +93,10 @@ public class ProgressLife extends Widget implements GetProperty {
|
||||
// }
|
||||
brush.setFont(SwingUtils.MEDIUM_MONOSPACE_FONT);
|
||||
|
||||
brush.drawString(date, SwingUtils.MARGIN, 3 * SwingUtils.MARGIN);
|
||||
brush.drawString(time, SwingUtils.MARGIN, (int) (SwingUtils.MARGIN
|
||||
+ (getHeight() - SwingUtils.MARGIN)
|
||||
* 0.6d));
|
||||
brush.drawString(typeProperty.getValue(), SwingUtils.MARGIN, (int) (SwingUtils.MARGIN
|
||||
+ (getHeight() - SwingUtils.MARGIN)
|
||||
* 0.6d) + 20);
|
||||
brush.drawString(date, SwingUtils.MARGIN, SwingUtils.MARGIN);
|
||||
brush.drawString(time, SwingUtils.MARGIN,
|
||||
(int) (2.5 * SwingUtils.MARGIN) + 5);
|
||||
brush.drawString(typeProperty.getValue(), SwingUtils.MARGIN, 4 * SwingUtils.MARGIN + 5);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,99 @@
|
||||
package org.nanoboot.utils.timecalc.swing.progress;
|
||||
|
||||
import org.nanoboot.utils.timecalc.app.GetProperty;
|
||||
import org.nanoboot.utils.timecalc.entity.Visibility;
|
||||
import org.nanoboot.utils.timecalc.entity.WidgetType;
|
||||
import org.nanoboot.utils.timecalc.swing.common.SwingUtils;
|
||||
import org.nanoboot.utils.timecalc.swing.common.Widget;
|
||||
import org.nanoboot.utils.timecalc.swing.windows.MainWindow;
|
||||
import org.nanoboot.utils.timecalc.utils.common.DateFormats;
|
||||
import org.nanoboot.utils.timecalc.utils.common.NumberFormats;
|
||||
import org.nanoboot.utils.timecalc.utils.property.IntegerProperty;
|
||||
import org.nanoboot.utils.timecalc.utils.property.Property;
|
||||
import org.nanoboot.utils.timecalc.utils.property.StringProperty;
|
||||
|
||||
import javax.swing.Timer;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author Robert Vokac
|
||||
* @since 21.02.2024
|
||||
*/
|
||||
public class ProgressMoney extends Widget implements GetProperty {
|
||||
|
||||
private final Time time;
|
||||
public IntegerProperty perMonthProperty
|
||||
= new IntegerProperty("money.perMonthProperty");
|
||||
public StringProperty currencyProperty
|
||||
= new StringProperty("money.currencyProperty");
|
||||
|
||||
public ProgressMoney(Time time) {
|
||||
this.time = time;
|
||||
setFont(new Font(Font.MONOSPACED, Font.PLAIN, 11));
|
||||
|
||||
setFocusable(false);
|
||||
setForeground(Color.GRAY);
|
||||
setBackground(MainWindow.BACKGROUND_COLOR);
|
||||
|
||||
new Timer(100, e -> {
|
||||
Visibility visibility
|
||||
= Visibility.valueOf(visibilityProperty.getValue());
|
||||
setForeground(
|
||||
visibility.isStronglyColored()
|
||||
|| mouseOver
|
||||
? Color.BLACK : Color.LIGHT_GRAY);
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintWidget(Graphics brush) {
|
||||
double perMonth = this.perMonthProperty.getValue();
|
||||
if (perMonth == 0) {
|
||||
//nothing to do
|
||||
return;
|
||||
} else {
|
||||
double workDaysInMonth = progress.getWorkDaysInMonth();
|
||||
boolean isWeekend = progress.isWeekend();
|
||||
double perDay = perMonth / workDaysInMonth;
|
||||
double value = 0;
|
||||
switch(WidgetType.valueOf(this.typeProperty.getValue().toUpperCase(
|
||||
Locale.ROOT))) {
|
||||
case MINUTE: value = perDay / 8d / 60d * progress.get(WidgetType.MINUTE);break;
|
||||
case HOUR: value = perDay / 8d * progress.get(WidgetType.HOUR);break;
|
||||
case DAY: value = perDay * progress.get(WidgetType.DAY);break;
|
||||
case WEEK: value = perDay * 5d * progress.get(WidgetType.WEEK);break;
|
||||
case MONTH: value = perMonth * progress.get(WidgetType.MONTH);break;
|
||||
case YEAR: value = perMonth * 12 * progress.get(WidgetType.YEAR);break;
|
||||
}
|
||||
|
||||
Visibility visibility
|
||||
= Visibility.valueOf(visibilityProperty.getValue());
|
||||
|
||||
brush.setColor(visibility.isStronglyColored() ? Color.BLUE
|
||||
: visibility.isWeaklyColored() ? Color.GRAY
|
||||
: Color.LIGHT_GRAY);
|
||||
brush.setFont(SwingUtils.MEDIUM_MONOSPACE_FONT);
|
||||
|
||||
String valueFinal = NumberFormats.FORMATTER_FIVE_DECIMAL_PLACES.format(value) + " " + this.currencyProperty.getValue();
|
||||
brush.drawString(valueFinal, SwingUtils.MARGIN, SwingUtils.MARGIN + 10);
|
||||
brush.drawString(typeProperty.getValue(), SwingUtils.MARGIN, SwingUtils.MARGIN + 25);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property getVisibilityProperty() {
|
||||
return visibilityProperty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property getVisibilitySupportedColoredProperty() {
|
||||
return visibilitySupportedColoredProperty;
|
||||
}
|
||||
}
|
@ -12,13 +12,4 @@ public class WeekBattery extends Battery {
|
||||
super(WEEK, x, i, i1);
|
||||
}
|
||||
|
||||
public static double getWeekProgress(int weekDayWhenMondayIsOne,
|
||||
double done) {
|
||||
if (done > 1) {
|
||||
done = 1;
|
||||
}
|
||||
return weekDayWhenMondayIsOne == 0
|
||||
|| weekDayWhenMondayIsOne == 6
|
||||
? 100 : ((weekDayWhenMondayIsOne - 1) * 0.20 + done * 0.20);
|
||||
}
|
||||
}
|
||||
|
@ -14,55 +14,4 @@ public class YearBattery extends Battery {
|
||||
super(YEAR, x, i, i1);
|
||||
}
|
||||
|
||||
public static double getYearProgress(Integer year, Integer month,
|
||||
Integer day, Integer hour, Integer minute, Integer second,
|
||||
Integer millisecond) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(Calendar.YEAR, year);
|
||||
cal.set(Calendar.MONTH, month - 1);
|
||||
cal.set(Calendar.DAY_OF_MONTH, day);
|
||||
cal.set(Calendar.HOUR, hour);
|
||||
cal.set(Calendar.MINUTE, minute);
|
||||
cal.set(Calendar.SECOND, second);
|
||||
cal.set(Calendar.MILLISECOND, millisecond);
|
||||
|
||||
double seconds = second + millisecond / 1000d;
|
||||
double minutes = minute + seconds / 60d;
|
||||
double hours = hour + minutes / 60d;
|
||||
double days = cal.get(Calendar.DAY_OF_YEAR) + hours / 24d;
|
||||
// System.out.println("millisecond=" + millisecond);
|
||||
// System.out.println("seconds=" + seconds);
|
||||
// System.out.println("minutes=" + minutes);
|
||||
// System.out.println("hours=" + hours);
|
||||
// System.out.println("days=" + days);
|
||||
// System.out.println("cal.get(Calendar.DAY_OF_YEAR)=" + cal.get(Calendar.DAY_OF_YEAR));
|
||||
|
||||
double totalCountOfDaysInAYear = getTotalCountOfDaysInAYear(year);
|
||||
return days / totalCountOfDaysInAYear;
|
||||
}
|
||||
|
||||
private static double getTotalCountOfDaysInAYear(Integer year) {
|
||||
boolean leapYear = isLeapYear(year);
|
||||
double daysInYear = 365d;
|
||||
if (leapYear) {
|
||||
daysInYear++;
|
||||
}
|
||||
return daysInYear;
|
||||
}
|
||||
|
||||
private static boolean isLeapYear(Integer year) {
|
||||
return year % 4 == 0;
|
||||
}
|
||||
|
||||
public static double getYearProgress(AnalogClock analogClock) {
|
||||
return getYearProgress(
|
||||
analogClock.yearProperty.getValue(),
|
||||
analogClock.monthProperty.getValue(),
|
||||
analogClock.dayProperty.getValue(),
|
||||
analogClock.hourProperty.getValue(),
|
||||
analogClock.minuteProperty.getValue(),
|
||||
analogClock.secondProperty.getValue(),
|
||||
analogClock.millisecondProperty.getValue()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -195,6 +195,14 @@ public class ConfigWindow extends TWindow {
|
||||
= new JCheckBox(TimeCalcProperty.LIFE_VISIBLE.getKey());
|
||||
public final JTextField lifeTypeProperty
|
||||
= new JTextField(TimeCalcProperty.LIFE_TYPE.getKey());
|
||||
public final JCheckBox moneyVisibleProperty
|
||||
= new JCheckBox(TimeCalcProperty.MONEY_VISIBLE.getKey());
|
||||
public final JTextField moneyTypeProperty
|
||||
= new JTextField(TimeCalcProperty.MONEY_TYPE.getKey());
|
||||
public final JTextField moneyPerMonthProperty
|
||||
= new JTextField(TimeCalcProperty.MONEY_PER_MONTH.getKey());
|
||||
public final JTextField moneyCurrencyProperty
|
||||
= new JTextField(TimeCalcProperty.MONEY_CURRENCY.getKey());
|
||||
public final JTextField lifeBirthDateProperty
|
||||
= new JTextField(TimeCalcProperty.LIFE_BIRTH_DATE.getKey());
|
||||
private final JTextField mainWindowCustomTitleProperty
|
||||
@ -362,6 +370,7 @@ public class ConfigWindow extends TWindow {
|
||||
.setSelected(!enable);
|
||||
squareVisibleProperty.setSelected(enable);
|
||||
lifeVisibleProperty.setSelected(enable);
|
||||
moneyVisibleProperty.setSelected(enable);
|
||||
circleVisibleProperty.setSelected(enable);
|
||||
swingVisibleProperty.setSelected(enable);
|
||||
swingQuarterIconVisibleProperty.setSelected(enable);
|
||||
@ -432,6 +441,10 @@ public class ConfigWindow extends TWindow {
|
||||
lifeVisibleProperty,
|
||||
lifeTypeProperty,
|
||||
lifeBirthDateProperty,
|
||||
moneyVisibleProperty,
|
||||
moneyTypeProperty,
|
||||
moneyPerMonthProperty,
|
||||
moneyCurrencyProperty,
|
||||
mainWindowCustomTitleProperty,
|
||||
profileNameProperty,
|
||||
activityNeededFlagsProperty,
|
||||
@ -500,6 +513,15 @@ public class ConfigWindow extends TWindow {
|
||||
if (p == activityNeededFlagsProperty) {
|
||||
addLabelToNextRow(TimeCalcProperty.ACTIVITY_NEEDED_FLAGS);
|
||||
}
|
||||
if (p == moneyTypeProperty) {
|
||||
addLabelToNextRow(TimeCalcProperty.MONEY_TYPE);
|
||||
}
|
||||
if (p == moneyPerMonthProperty) {
|
||||
addLabelToNextRow(TimeCalcProperty.MONEY_PER_MONTH);
|
||||
}
|
||||
if (p == moneyCurrencyProperty) {
|
||||
addLabelToNextRow(TimeCalcProperty.MONEY_CURRENCY);
|
||||
}
|
||||
|
||||
if (p == testClockCustomYearProperty) {
|
||||
JLabel label = new JLabel("Test");
|
||||
|
@ -34,6 +34,7 @@ import org.nanoboot.utils.timecalc.swing.progress.MinuteBattery;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.MonthBattery;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.ProgressCircle;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.ProgressLife;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.ProgressMoney;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.ProgressSquare;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.ProgressSwing;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.Time;
|
||||
@ -100,6 +101,7 @@ public class MainWindow extends TWindow {
|
||||
private final TTextField remainingTextField;
|
||||
private final TButton saveButton;
|
||||
private final ProgressLife progressLife;
|
||||
private final ProgressMoney progressMoney;
|
||||
private HelpWindow helpWindow = null;
|
||||
private ConfigWindow configWindow = null;
|
||||
private ActivitiesWindow activitiesWindow = null;
|
||||
@ -318,7 +320,7 @@ public class MainWindow extends TWindow {
|
||||
|
||||
this.progressLife = new ProgressLife(time);
|
||||
progressLife.setBounds(progressSwing.getX() + progressSwing.getWidth() + SwingUtils.MARGIN, progressSwing.getY(),
|
||||
100, 100);
|
||||
100, 50);
|
||||
|
||||
{
|
||||
progressSquare.typeProperty
|
||||
@ -337,6 +339,24 @@ public class MainWindow extends TWindow {
|
||||
.bindTo(timeCalcConfiguration.lifeVisibleProperty);
|
||||
}
|
||||
add(progressLife);
|
||||
|
||||
|
||||
this.progressMoney
|
||||
= new ProgressMoney(time);
|
||||
progressMoney.setBounds(progressLife.getX(), progressSwing.getY() + progressLife.getHeight() + SwingUtils.MARGIN,
|
||||
100, 50);
|
||||
|
||||
progressMoney.visibleProperty
|
||||
.bindTo(timeCalcConfiguration.moneyVisibleProperty);
|
||||
progressMoney.typeProperty
|
||||
.bindTo(timeCalcConfiguration.moneyTypeProperty);
|
||||
progressMoney.perMonthProperty
|
||||
.bindTo(timeCalcConfiguration.moneyPerMonthProperty);
|
||||
progressMoney.currencyProperty
|
||||
.bindTo(timeCalcConfiguration.moneyCurrencyProperty);
|
||||
|
||||
add(progressMoney);
|
||||
|
||||
TLabel arrivalTextFieldLabel = new TLabel("Arrival:", 70);
|
||||
arrivalTextFieldLabel.setBoundsFromTop(progressSwing, 3);
|
||||
|
||||
@ -981,38 +1001,40 @@ public class MainWindow extends TWindow {
|
||||
Progress progress = new Progress();
|
||||
progress.set(WidgetType.DAY, done);
|
||||
|
||||
try {
|
||||
WeekStatistics weekStatisticsTmp = new WeekStatistics(clock, time);
|
||||
weekStatistics = weekStatisticsTmp;
|
||||
} catch (DateTimeException e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
WeekStatistics weekStatisticsTmp = new WeekStatistics(clock, time);
|
||||
weekStatistics = weekStatisticsTmp;
|
||||
} catch (DateTimeException e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException interruptedException) {
|
||||
interruptedException.printStackTrace();
|
||||
}
|
||||
// return false;
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException interruptedException) {
|
||||
interruptedException.printStackTrace();
|
||||
}
|
||||
final boolean nowIsWeekend = weekStatistics.isNowIsWeekend();
|
||||
final int workDaysDone = weekStatistics.getWorkDaysDone();
|
||||
final int workDaysTotal = weekStatistics.getWorkDaysTotal();
|
||||
// return false;
|
||||
}
|
||||
final boolean nowIsWeekend = weekStatistics.isNowIsWeekend();
|
||||
final int workDaysDone = weekStatistics.getWorkDaysDone();
|
||||
final int workDaysTotal = weekStatistics.getWorkDaysTotal();
|
||||
|
||||
int weekDayWhenMondayIsOne = clock.dayOfWeekProperty.getValue();
|
||||
double weekProgress = WeekBattery.getWeekProgress(weekDayWhenMondayIsOne, done);
|
||||
progress.setWorkDaysInMonth(workDaysTotal);
|
||||
progress.setWeekend(nowIsWeekend);
|
||||
int weekDayWhenMondayIsOne = clock.dayOfWeekProperty.getValue();
|
||||
double weekProgress = Progress.getWeekProgress(weekDayWhenMondayIsOne, done);
|
||||
weekBattery.setProgress(progress);
|
||||
weekBattery.setLabel(
|
||||
nowIsWeekend ? "5/5" : (weekDayWhenMondayIsOne + "/5"));
|
||||
|
||||
double monthProgress = MonthBattery
|
||||
double monthProgress = Progress
|
||||
.getMonthProgress(weekDayWhenMondayIsOne, workDaysDone,
|
||||
workDaysTotal, done);
|
||||
progress.set(WidgetType.MONTH, monthProgress);
|
||||
double hourProgress =
|
||||
HourBattery.getHourProgress(timeRemains, secondsRemains,
|
||||
Progress.getHourProgress(timeRemains, secondsRemains,
|
||||
millisecondsRemains);
|
||||
double minuteProgress =
|
||||
MinuteBattery.getMinuteProgress(secondNow, millisecondNow);
|
||||
double yearProgress = YearBattery.getYearProgress(clock);
|
||||
Progress.getMinuteProgress(secondNow, millisecondNow);
|
||||
double yearProgress = Progress.getYearProgress(clock);
|
||||
progress.set(WidgetType.HOUR, hourProgress);
|
||||
progress.set(WidgetType.WEEK, weekProgress);
|
||||
progress.set(WidgetType.MINUTE, minuteProgress);
|
||||
@ -1021,6 +1043,7 @@ public class MainWindow extends TWindow {
|
||||
progressCircle.setProgress(progress);
|
||||
progressSwing.setProgress(progress);
|
||||
progressLife.setProgress(progress);
|
||||
progressMoney.setProgress(progress);
|
||||
dayBattery.setProgress(progress);
|
||||
|
||||
monthBattery.setProgress(progress);
|
||||
|
@ -51,9 +51,13 @@ circle.type=day
|
||||
swing.visible=true
|
||||
swing.type=day
|
||||
swing.quarter-icon.visible=true
|
||||
life.visible=true
|
||||
life.visible=false
|
||||
life.type=day
|
||||
life.birth-date=
|
||||
money.visible=false
|
||||
money.type=day
|
||||
money.per-month=0
|
||||
money.currency=
|
||||
walking-human.visible=true
|
||||
walking-human.type=day
|
||||
main-window.custom-title=---
|
||||
@ -67,8 +71,7 @@ test.clock.custom.hour=2147483647
|
||||
test.clock.custom.minute=2147483647
|
||||
test.clock.custom.second=2147483647
|
||||
test.clock.custom.millisecond=2147483647
|
||||
activity.needed-flags=
|
||||
#TODO:
|
||||
logs.detailed=false
|
||||
battery.percent-precision.count-of-decimal-points=5
|
||||
main-window.custom-title=---
|
||||
activity.needed-flags=
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user