Added several improvements

This commit is contained in:
Robert Vokac 2024-04-30 18:22:03 +02:00
parent fcafe1f3e5
commit a9333194c7
No known key found for this signature in database
GPG Key ID: C459E1E4B4A986BB
4 changed files with 20 additions and 17 deletions

View File

@ -5,10 +5,7 @@ import org.nanoboot.utils.timecalc.app.TimeCalcProperty;
import org.nanoboot.utils.timecalc.entity.Progress; import org.nanoboot.utils.timecalc.entity.Progress;
import org.nanoboot.utils.timecalc.entity.Visibility; import org.nanoboot.utils.timecalc.entity.Visibility;
import org.nanoboot.utils.timecalc.entity.WidgetType; import org.nanoboot.utils.timecalc.entity.WidgetType;
import org.nanoboot.utils.timecalc.swing.progress.ProgressDot;
import org.nanoboot.utils.timecalc.swing.progress.ProgressFuelGauge; import org.nanoboot.utils.timecalc.swing.progress.ProgressFuelGauge;
import org.nanoboot.utils.timecalc.swing.progress.ProgressLife;
import org.nanoboot.utils.timecalc.swing.progress.ProgressMoney;
import org.nanoboot.utils.timecalc.swing.progress.battery.Battery; import org.nanoboot.utils.timecalc.swing.progress.battery.Battery;
import org.nanoboot.utils.timecalc.swing.progress.ProgressSmileyIcon; import org.nanoboot.utils.timecalc.swing.progress.ProgressSmileyIcon;
import org.nanoboot.utils.timecalc.swing.progress.ProgressSwing; import org.nanoboot.utils.timecalc.swing.progress.ProgressSwing;
@ -35,6 +32,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Supplier;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
import org.nanoboot.utils.timecalc.app.TimeCalcApp; import org.nanoboot.utils.timecalc.app.TimeCalcApp;
import static org.nanoboot.utils.timecalc.swing.progress.battery.Battery.HIGH_STRONGLY_COLORED; import static org.nanoboot.utils.timecalc.swing.progress.battery.Battery.HIGH_STRONGLY_COLORED;
@ -66,6 +64,7 @@ public class Widget extends JPanel implements
126, 179, 227); 126, 179, 227);
private static final Color VERY_LIGHT_GRAY = new Color(220, 220, 220); private static final Color VERY_LIGHT_GRAY = new Color(220, 220, 220);
private static final Font FONT = new Font("sans", Font.PLAIN, 12); private static final Font FONT = new Font("sans", Font.PLAIN, 12);
public static final Color WIDGET_BACKGROUND_COLOR = ((Supplier<Color>) () ->{int i = 232;return new Color(i,i,i);}).get();
public final BooleanProperty visibilitySupportedColoredProperty public final BooleanProperty visibilitySupportedColoredProperty
= new BooleanProperty("visibilitySupportedColoredProperty", true); = new BooleanProperty("visibilitySupportedColoredProperty", true);
public final BooleanProperty visibleProperty public final BooleanProperty visibleProperty
@ -287,6 +286,10 @@ public class Widget extends JPanel implements
setVisible(visibleProperty.isEnabled()); setVisible(visibleProperty.isEnabled());
Visibility visibility Visibility visibility
= Visibility.valueOf(visibilityProperty.getValue()); = Visibility.valueOf(visibilityProperty.getValue());
Color currentColor = brush.getColor();
brush.setColor(WIDGET_BACKGROUND_COLOR);
brush.fillRect(1, 1, getWidth(), getHeight());
brush.setColor(currentColor);
if (visibleProperty.isDisabled() || hiddenProperty.isEnabled()) { if (visibleProperty.isDisabled() || hiddenProperty.isEnabled()) {
if(hiddenProperty.isEnabled()) { if(hiddenProperty.isEnabled()) {
@ -299,7 +302,7 @@ public class Widget extends JPanel implements
this.smileyIcon2 = null; this.smileyIcon2 = null;
} }
if (mouseOver) { if (mouseOver) {
Color currentColor = brush.getColor(); currentColor = brush.getColor();
brush.setColor(VERY_LIGHT_GRAY); brush.setColor(VERY_LIGHT_GRAY);
brush.fillRect(1, 1, getWidth() - 2, getHeight() - 2); brush.fillRect(1, 1, getWidth() - 2, getHeight() - 2);
brush.setColor(currentColor); brush.setColor(currentColor);
@ -338,7 +341,7 @@ public class Widget extends JPanel implements
paintMinimizeIcon(brush, getWidth(), mouseOver, mouseOverMinimizeButton); paintMinimizeIcon(brush, getWidth(), mouseOver, mouseOverMinimizeButton);
if (mouseOver) { if (mouseOver) {
Color currentColor = brush.getColor(); currentColor = brush.getColor();
if(visibility.isStronglyColored()) { if(visibility.isStronglyColored()) {
brush.setColor(Color.BLUE); brush.setColor(Color.BLUE);
} }

View File

@ -397,7 +397,7 @@ public class Battery extends Widget {
@Override @Override
public void setBounds(int x, int y, int height) { public void setBounds(int x, int y, int height) {
setBounds(x, y, (int) (40d / 100d * ((double) height)), height); setBounds(x, y, (int) (50d / 100d * ((double) height)), height);
} }
@Override @Override

View File

@ -174,7 +174,7 @@ public class ProgressWeather extends Widget implements GetProperty {
sb sb
.append("Maximum: ") .append("Maximum: ")
.append(NumberFormats.FORMATTER_ONE_DECIMAL_PLACE.format(wf.getMaximumCelsius())) .append(NumberFormats.FORMATTER_ONE_DECIMAL_PLACE.format(wf.getMaximumCelsius()))
.append(" °C at ").append(TTime.ofMilliseconds((int) (wf.getMinimumCelsiusTime() * 1000d * 60d * 60d)).toString().substring(0, 5)) .append(" °C at ").append(TTime.ofMilliseconds((int) (wf.getMaximumCelsiusTime() * 1000d * 60d * 60d)).toString().substring(0, 5))
.append("\n"); .append("\n");
sb sb
.append("End: ") .append("End: ")

View File

@ -91,7 +91,7 @@ public class MainWindow extends TWindow {
public static final Color BACKGROUND_COLOR = new Color(238, 238, 238); public static final Color BACKGROUND_COLOR = new Color(238, 238, 238);
public static final Color FOREGROUND_COLOR = new Color(210, 210, 210); public static final Color FOREGROUND_COLOR = new Color(210, 210, 210);
public static final JCheckBox hideShowFormsCheckBox = new JCheckBox(); public static final JCheckBox hideShowFormsCheckBox = new JCheckBox();
private static final int BATTERY_WIDTH = 140; private static final int BATTERY_HEIGHT = 120;
private static final String BACKUP = "_backup"; private static final String BACKUP = "_backup";
private static final String BASIC_FEATURE__ = "__only_basic_features__"; private static final String BASIC_FEATURE__ = "__only_basic_features__";
private static final String DASH = "-"; private static final String DASH = "-";
@ -318,43 +318,43 @@ public class MainWindow extends TWindow {
MinuteBattery minuteBattery MinuteBattery minuteBattery
= new MinuteBattery(clock.getBounds().x + clock.getWidth() + SwingUtils.MARGIN, = new MinuteBattery(clock.getBounds().x + clock.getWidth() + SwingUtils.MARGIN,
clock.getY(), BATTERY_WIDTH); clock.getY(), BATTERY_HEIGHT);
add(minuteBattery); add(minuteBattery);
Battery hourBattery = new HourBattery( Battery hourBattery = new HourBattery(
minuteBattery.getBounds().x + minuteBattery.getWidth() minuteBattery.getBounds().x + minuteBattery.getWidth()
+ SwingUtils.MARGIN, + SwingUtils.MARGIN,
minuteBattery.getY(), minuteBattery.getY(),
BATTERY_WIDTH); BATTERY_HEIGHT);
add(hourBattery); add(hourBattery);
Battery dayBattery = new DayBattery( Battery dayBattery = new DayBattery(
hourBattery.getBounds().x + hourBattery.getWidth() hourBattery.getBounds().x + hourBattery.getWidth()
+ SwingUtils.MARGIN, + SwingUtils.MARGIN,
hourBattery.getY(), hourBattery.getY(),
BATTERY_WIDTH); BATTERY_HEIGHT);
add(dayBattery); add(dayBattery);
Battery weekBattery = new WeekBattery( Battery weekBattery = new WeekBattery(
dayBattery.getBounds().x + dayBattery.getWidth() + SwingUtils.MARGIN, dayBattery.getBounds().x + dayBattery.getWidth() + SwingUtils.MARGIN,
dayBattery.getY(), dayBattery.getY(),
BATTERY_WIDTH); BATTERY_HEIGHT);
add(weekBattery); add(weekBattery);
Battery monthBattery = new MonthBattery( Battery monthBattery = new MonthBattery(
weekBattery.getBounds().x + weekBattery.getWidth() weekBattery.getBounds().x + weekBattery.getWidth()
+ SwingUtils.MARGIN, + SwingUtils.MARGIN,
weekBattery.getY(), BATTERY_WIDTH); weekBattery.getY(), BATTERY_HEIGHT);
add(monthBattery); add(monthBattery);
Battery yearBattery = new YearBattery( Battery yearBattery = new YearBattery(
monthBattery.getBounds().x + monthBattery.getWidth() monthBattery.getBounds().x + monthBattery.getWidth()
+ SwingUtils.MARGIN, + SwingUtils.MARGIN,
monthBattery.getY(), BATTERY_WIDTH); monthBattery.getY(), BATTERY_HEIGHT);
add(yearBattery); add(yearBattery);
WalkingHumanProgress walkingHumanProgress WalkingHumanProgress walkingHumanProgress
= new WalkingHumanProgress(); = new WalkingHumanProgress();
walkingHumanProgress.setBounds(minuteBattery.getX(), walkingHumanProgress.setBounds(minuteBattery.getX(),
minuteBattery.getY() + minuteBattery.getHeight(), 400, 80); minuteBattery.getY() + minuteBattery.getHeight() + SwingUtils.MARGIN, 400, 80);
add(walkingHumanProgress); add(walkingHumanProgress);
walkingHumanProgress.visibleProperty walkingHumanProgress.visibleProperty
.bindTo(timeCalcConfiguration.walkingHumanVisibleProperty); .bindTo(timeCalcConfiguration.walkingHumanVisibleProperty);
@ -365,7 +365,7 @@ public class MainWindow extends TWindow {
// //
ProgressSquare progressSquare = new ProgressSquare(); ProgressSquare progressSquare = new ProgressSquare();
progressSquare progressSquare
.setBounds(yearBattery.getX() + yearBattery.getWidth() + 4 * SwingUtils.MARGIN, yearBattery.getY(), .setBounds(yearBattery.getX() + yearBattery.getWidth() + SwingUtils.MARGIN, yearBattery.getY(),
100); 100);
add(progressSquare); add(progressSquare);
progressSquare.visibleProperty progressSquare.visibleProperty
@ -871,7 +871,7 @@ public class MainWindow extends TWindow {
} }
); );
setSize(progressSquare.getX() + progressSquare.getWidth() setSize(progressSquare.getX() + progressSquare.getWidth()
+ 3 * SwingUtils.MARGIN, + 4 * SwingUtils.MARGIN,
focusButton.getY() + focusButton.getHeight() + SwingUtils.MARGIN focusButton.getY() + focusButton.getHeight() + SwingUtils.MARGIN
+ focusButton.getHeight() + 2 * SwingUtils.MARGIN); + focusButton.getHeight() + 2 * SwingUtils.MARGIN);