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); circleVisibleProperty.setSelected(enable);
walkingHumanVisibleProperty.setSelected(enable); walkingHumanVisibleProperty.setSelected(enable);
MainWindow.hideShowCheckBox.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.ProgressCircle;
import org.nanoboot.utils.timecalc.swing.progress.ProgressSquare; import org.nanoboot.utils.timecalc.swing.progress.ProgressSquare;
import org.nanoboot.utils.timecalc.swing.progress.Time; 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.WeekBattery;
import org.nanoboot.utils.timecalc.swing.progress.YearBattery; import org.nanoboot.utils.timecalc.swing.progress.YearBattery;
import org.nanoboot.utils.timecalc.utils.common.Constants; import org.nanoboot.utils.timecalc.utils.common.Constants;
@ -146,17 +146,18 @@ public class MainWindow extends TWindow {
add(progressCircle); add(progressCircle);
progressCircle.visibleProperty.bindTo(timeCalcConfiguration.circleVisibleProperty); progressCircle.visibleProperty.bindTo(timeCalcConfiguration.circleVisibleProperty);
WalkingHumanProgressAsciiArt walkingHumanProgressAsciiArt WalkingHumanProgress walkingHumanProgress
= new WalkingHumanProgressAsciiArt(analogClock.getX(), analogClock.getY() + analogClock.getHeight() + SwingUtils.MARGIN, 420, 180); = new WalkingHumanProgress();
add(walkingHumanProgressAsciiArt); walkingHumanProgress.setBounds(analogClock.getX(), analogClock.getY() + analogClock.getHeight() + SwingUtils.MARGIN, 420, 180);
walkingHumanProgressAsciiArt.visibleProperty.bindTo(timeCalcConfiguration.walkingHumanVisibleProperty); add(walkingHumanProgress);
walkingHumanProgress.visibleProperty.bindTo(timeCalcConfiguration.walkingHumanVisibleProperty);
weatherButton weatherButton
.setBounds(SwingUtils.MARGIN, walkingHumanProgressAsciiArt.getY() .setBounds(SwingUtils.MARGIN, walkingHumanProgress.getY()
+ walkingHumanProgressAsciiArt.getHeight() + walkingHumanProgress.getHeight()
+ SwingUtils.MARGIN); + SwingUtils.MARGIN);
configButton.setBoundsFromTop(walkingHumanProgressAsciiArt); configButton.setBoundsFromTop(walkingHumanProgress);
workDaysButton.setBoundsFromLeft(configButton); workDaysButton.setBoundsFromLeft(configButton);
activitiesButton.setBoundsFromLeft(workDaysButton); activitiesButton.setBoundsFromLeft(workDaysButton);
restartButton.setBoundsFromLeft(activitiesButton); restartButton.setBoundsFromLeft(activitiesButton);
@ -503,7 +504,7 @@ public class MainWindow extends TWindow {
toasterManager.setDisplayTime(30000); toasterManager.setDisplayTime(30000);
toasterManager.showToaster( toasterManager.showToaster(
"Congratulation :-) It is the time to go home."); "Congratulation :-) It is the time to go home.");
walkingHumanProgressAsciiArt walkingHumanProgress
.printPercentToAscii(done, timeRemains.getHour(), .printPercentToAscii(done, timeRemains.getHour(),
timeRemains.getMinute(), done, timeRemains.getMinute(), done,
totalSecondsRemainsDouble, endTime); totalSecondsRemainsDouble, endTime);
@ -520,7 +521,7 @@ public class MainWindow extends TWindow {
} }
} }
} else { } else {
walkingHumanProgressAsciiArt walkingHumanProgress
.printPercentToAscii(done, timeRemains.getHour(), .printPercentToAscii(done, timeRemains.getHour(),
timeRemains.getMinute(), done, timeRemains.getMinute(), done,
totalSecondsRemainsDouble, endTime); 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 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 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) { public static final Color getColorFromString(String s) {
if (s.isEmpty()) { if (s.isEmpty()) {
System.out.println("error: empty string for color"); System.out.println("error: empty string for color");