WalkingHumanProgress was refactored with several changes and improvements

This commit is contained in:
Robert Vokac 2024-03-03 12:22:58 +00:00
parent 9a7bdb15a1
commit 0f9f32bc32
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055
4 changed files with 265 additions and 234 deletions

View File

@ -226,7 +226,6 @@ public class ConfigWindow extends TWindow {
circleVisibleProperty.setSelected(enable);
walkingHumanVisibleProperty.setSelected(enable);
MainWindow.hideShowCheckBox.setSelected(enable);
mainWindowCustomTitleProperty.setText(enable ? THREE_DASHES : "");
});
}

View File

@ -17,7 +17,7 @@ import org.nanoboot.utils.timecalc.swing.progress.MonthBattery;
import org.nanoboot.utils.timecalc.swing.progress.ProgressCircle;
import org.nanoboot.utils.timecalc.swing.progress.ProgressSquare;
import org.nanoboot.utils.timecalc.swing.progress.Time;
import org.nanoboot.utils.timecalc.swing.progress.WalkingHumanProgressAsciiArt;
import org.nanoboot.utils.timecalc.swing.progress.WalkingHumanProgress;
import org.nanoboot.utils.timecalc.swing.progress.WeekBattery;
import org.nanoboot.utils.timecalc.swing.progress.YearBattery;
import org.nanoboot.utils.timecalc.utils.common.Constants;
@ -146,17 +146,18 @@ public class MainWindow extends TWindow {
add(progressCircle);
progressCircle.visibleProperty.bindTo(timeCalcConfiguration.circleVisibleProperty);
WalkingHumanProgressAsciiArt walkingHumanProgressAsciiArt
= new WalkingHumanProgressAsciiArt(analogClock.getX(), analogClock.getY() + analogClock.getHeight() + SwingUtils.MARGIN, 420, 180);
add(walkingHumanProgressAsciiArt);
walkingHumanProgressAsciiArt.visibleProperty.bindTo(timeCalcConfiguration.walkingHumanVisibleProperty);
WalkingHumanProgress walkingHumanProgress
= new WalkingHumanProgress();
walkingHumanProgress.setBounds(analogClock.getX(), analogClock.getY() + analogClock.getHeight() + SwingUtils.MARGIN, 420, 180);
add(walkingHumanProgress);
walkingHumanProgress.visibleProperty.bindTo(timeCalcConfiguration.walkingHumanVisibleProperty);
weatherButton
.setBounds(SwingUtils.MARGIN, walkingHumanProgressAsciiArt.getY()
+ walkingHumanProgressAsciiArt.getHeight()
+ SwingUtils.MARGIN);
.setBounds(SwingUtils.MARGIN, walkingHumanProgress.getY()
+ walkingHumanProgress.getHeight()
+ SwingUtils.MARGIN);
configButton.setBoundsFromTop(walkingHumanProgressAsciiArt);
configButton.setBoundsFromTop(walkingHumanProgress);
workDaysButton.setBoundsFromLeft(configButton);
activitiesButton.setBoundsFromLeft(workDaysButton);
restartButton.setBoundsFromLeft(activitiesButton);
@ -503,7 +504,7 @@ public class MainWindow extends TWindow {
toasterManager.setDisplayTime(30000);
toasterManager.showToaster(
"Congratulation :-) It is the time to go home.");
walkingHumanProgressAsciiArt
walkingHumanProgress
.printPercentToAscii(done, timeRemains.getHour(),
timeRemains.getMinute(), done,
totalSecondsRemainsDouble, endTime);
@ -520,7 +521,7 @@ public class MainWindow extends TWindow {
}
}
} else {
walkingHumanProgressAsciiArt
walkingHumanProgress
.printPercentToAscii(done, timeRemains.getHour(),
timeRemains.getMinute(), done,
totalSecondsRemainsDouble, endTime);

View File

@ -30,6 +30,7 @@ public class SwingUtils {
public static final Color CLOSE_BUTTON_BACKGROUND_COLOR = new Color(127, 127, 127);
public static final Font SMALL_FONT = new Font("sans", Font.BOLD, 10);
public static final Font MEDIUM_MONOSPACE_FONT = new Font(Font.MONOSPACED, Font.PLAIN, 12);
public static final Color getColorFromString(String s) {
if (s.isEmpty()) {
System.out.println("error: empty string for color");