Water can be now colored, if enabled in configuration

This commit is contained in:
Robert Vokac 2024-05-21 17:32:48 +02:00
parent 4c5823e6a2
commit 2217c7a29a
No known key found for this signature in database
GPG Key ID: C459E1E4B4A986BB
7 changed files with 16 additions and 3 deletions

0
build.sh Normal file → Executable file
View File

View File

@ -231,6 +231,8 @@ public class TimeCalcConfiguration {
= new BooleanProperty(TimeCalcProperty.WATER_HIDDEN.getKey()); = new BooleanProperty(TimeCalcProperty.WATER_HIDDEN.getKey());
public final StringProperty waterTypeProperty public final StringProperty waterTypeProperty
= new StringProperty(TimeCalcProperty.WATER_TYPE.getKey()); = new StringProperty(TimeCalcProperty.WATER_TYPE.getKey());
public final BooleanProperty waterColoredProperty
= new BooleanProperty(TimeCalcProperty.WATER_COLORED.getKey());
// //
@ -369,7 +371,7 @@ public class TimeCalcConfiguration {
squareVisibleProperty,squareTypeProperty, squareVisibleProperty,squareTypeProperty,
circleVisibleProperty,circleTypeProperty,circleInnerCircleVisibleProperty,circleOuterCircleOnlyBorderProperty, circleVisibleProperty,circleTypeProperty,circleInnerCircleVisibleProperty,circleOuterCircleOnlyBorderProperty,
barVisibleProperty, barTypeProperty, barHiddenProperty, barHeightProperty, barVisibleProperty, barTypeProperty, barHiddenProperty, barHeightProperty,
waterVisibleProperty, waterTypeProperty, waterHiddenProperty, waterVisibleProperty, waterTypeProperty, waterHiddenProperty, waterColoredProperty,
colorVisibleProperty, colorTypeProperty, colorHiddenProperty, colorHeightProperty, colorVisibleProperty, colorTypeProperty, colorHiddenProperty, colorHeightProperty,
dotVisibleProperty,dotTypeProperty, dotVisibleProperty,dotTypeProperty,
fuelVisibleProperty, fuelTypeProperty, fuelHiddenProperty, fuelVisibleProperty, fuelTypeProperty, fuelHiddenProperty,

View File

@ -113,6 +113,7 @@ public enum TimeCalcProperty {
WATER_VISIBLE("water.visible", "Water"), WATER_VISIBLE("water.visible", "Water"),
WATER_TYPE("water.type", "Water : Type"), WATER_TYPE("water.type", "Water : Type"),
WATER_HIDDEN("water.hidden", "Water : Hidden"), WATER_HIDDEN("water.hidden", "Water : Hidden"),
WATER_COLORED("water.colored", "Water : Colored"),
// //
COLOR_VISIBLE("color.visible", "Color"), COLOR_VISIBLE("color.visible", "Color"),
COLOR_TYPE("color.type", "Color : Type"), COLOR_TYPE("color.type", "Color : Type"),

View File

@ -1,7 +1,10 @@
package org.nanoboot.utils.timecalc.swing.progress; package org.nanoboot.utils.timecalc.swing.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.swing.common.Widget; import org.nanoboot.utils.timecalc.swing.common.Widget;
import org.nanoboot.utils.timecalc.swing.progress.battery.Battery;
import org.nanoboot.utils.timecalc.utils.property.BooleanProperty;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
@ -16,6 +19,7 @@ public class ProgressWater extends Widget {
setPreferredSize(new Dimension(100, 400)); setPreferredSize(new Dimension(100, 400));
} }
public final BooleanProperty coloredProperty = new BooleanProperty("coloredProperty", false);
private static final Color WATER_COLOR = new Color(128, 197, 222); private static final Color WATER_COLOR = new Color(128, 197, 222);
@Override @Override
@ -26,7 +30,7 @@ public class ProgressWater extends Widget {
Graphics2D brush = (Graphics2D) g; Graphics2D brush = (Graphics2D) g;
brush.setColor( brush.setColor(
visibility.isStronglyColored() || mouseOver ? visibility.isStronglyColored() || mouseOver ?
WATER_COLOR (coloredProperty.isEnabled() ? Battery.getColourForProgress(donePercent(), Visibility.WEAKLY_COLORED, mouseOver): WATER_COLOR)
: FOREGROUND_COLOR); : FOREGROUND_COLOR);
brush.setRenderingHint(RenderingHints.KEY_ANTIALIASING, brush.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON); RenderingHints.VALUE_ANTIALIAS_ON);

View File

@ -216,6 +216,8 @@ public class ConfigWindow extends TWindow {
= new JTextField(TimeCalcProperty.WATER_TYPE.getKey()); = new JTextField(TimeCalcProperty.WATER_TYPE.getKey());
private final JCheckBox waterHiddenProperty private final JCheckBox waterHiddenProperty
= new JCheckBox(TimeCalcProperty.WATER_HIDDEN.getKey()); = new JCheckBox(TimeCalcProperty.WATER_HIDDEN.getKey());
private final JCheckBox waterColoredProperty
= new JCheckBox(TimeCalcProperty.WATER_COLORED.getKey());
// //
private final JCheckBox colorVisibleProperty private final JCheckBox colorVisibleProperty
= new JCheckBox(TimeCalcProperty.COLOR_VISIBLE.getKey()); = new JCheckBox(TimeCalcProperty.COLOR_VISIBLE.getKey());
@ -505,6 +507,7 @@ public class ConfigWindow extends TWindow {
barVisibleProperty.setSelected(enable); barVisibleProperty.setSelected(enable);
barHeightProperty.setText("50"); barHeightProperty.setText("50");
waterVisibleProperty.setSelected(enable); waterVisibleProperty.setSelected(enable);
waterColoredProperty.setSelected(enable);
colorVisibleProperty.setSelected(enable); colorVisibleProperty.setSelected(enable);
colorHeightProperty.setText("50"); colorHeightProperty.setText("50");
swingVisibleProperty.setSelected(enable); swingVisibleProperty.setSelected(enable);
@ -599,7 +602,7 @@ public class ConfigWindow extends TWindow {
squareVisibleProperty,squareHiddenProperty,squareTypeProperty, squareVisibleProperty,squareHiddenProperty,squareTypeProperty,
circleVisibleProperty,circleHiddenProperty,circleTypeProperty,circleInnerCircleVisibleProperty,circleOuterCircleVisibleProperty, circleVisibleProperty,circleHiddenProperty,circleTypeProperty,circleInnerCircleVisibleProperty,circleOuterCircleVisibleProperty,
barVisibleProperty, barHiddenProperty, barTypeProperty, barHeightProperty, barVisibleProperty, barHiddenProperty, barTypeProperty, barHeightProperty,
waterVisibleProperty, waterHiddenProperty, waterTypeProperty, waterVisibleProperty, waterHiddenProperty, waterTypeProperty,waterColoredProperty,
colorVisibleProperty, colorHiddenProperty, colorTypeProperty, colorHeightProperty, colorVisibleProperty, colorHiddenProperty, colorTypeProperty, colorHeightProperty,
dotVisibleProperty,dotHiddenProperty,dotTypeProperty, dotVisibleProperty,dotHiddenProperty,dotTypeProperty,
fuelVisibleProperty,fuelTypeProperty,fuelHiddenProperty,fuelIconVisibleProperty, fuelVisibleProperty,fuelTypeProperty,fuelHiddenProperty,fuelIconVisibleProperty,

View File

@ -560,6 +560,8 @@ public class MainWindow extends TWindow {
.bindTo(timeCalcConfiguration.waterTypeProperty); .bindTo(timeCalcConfiguration.waterTypeProperty);
progressWater.hiddenProperty progressWater.hiddenProperty
.bindTo(timeCalcConfiguration.waterHiddenProperty); .bindTo(timeCalcConfiguration.waterHiddenProperty);
progressWater.coloredProperty
.bindTo(timeCalcConfiguration.waterColoredProperty);
add(progressWater); add(progressWater);
// //

View File

@ -67,6 +67,7 @@ bar.height=25
water.visible=true water.visible=true
water.type=day water.type=day
water.hidden=false water.hidden=false
water.colored=false
color.visible=true color.visible=true
color.type=day color.type=day
color.hidden=false color.hidden=false