Water can be now colored, if enabled in configuration
This commit is contained in:
parent
4c5823e6a2
commit
2217c7a29a
@ -231,6 +231,8 @@ public class TimeCalcConfiguration {
|
||||
= new BooleanProperty(TimeCalcProperty.WATER_HIDDEN.getKey());
|
||||
public final StringProperty waterTypeProperty
|
||||
= 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,
|
||||
circleVisibleProperty,circleTypeProperty,circleInnerCircleVisibleProperty,circleOuterCircleOnlyBorderProperty,
|
||||
barVisibleProperty, barTypeProperty, barHiddenProperty, barHeightProperty,
|
||||
waterVisibleProperty, waterTypeProperty, waterHiddenProperty,
|
||||
waterVisibleProperty, waterTypeProperty, waterHiddenProperty, waterColoredProperty,
|
||||
colorVisibleProperty, colorTypeProperty, colorHiddenProperty, colorHeightProperty,
|
||||
dotVisibleProperty,dotTypeProperty,
|
||||
fuelVisibleProperty, fuelTypeProperty, fuelHiddenProperty,
|
||||
|
@ -113,6 +113,7 @@ public enum TimeCalcProperty {
|
||||
WATER_VISIBLE("water.visible", "Water"),
|
||||
WATER_TYPE("water.type", "Water : Type"),
|
||||
WATER_HIDDEN("water.hidden", "Water : Hidden"),
|
||||
WATER_COLORED("water.colored", "Water : Colored"),
|
||||
//
|
||||
COLOR_VISIBLE("color.visible", "Color"),
|
||||
COLOR_TYPE("color.type", "Color : Type"),
|
||||
|
@ -1,7 +1,10 @@
|
||||
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.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.Dimension;
|
||||
@ -16,6 +19,7 @@ public class ProgressWater extends Widget {
|
||||
setPreferredSize(new Dimension(100, 400));
|
||||
}
|
||||
|
||||
public final BooleanProperty coloredProperty = new BooleanProperty("coloredProperty", false);
|
||||
private static final Color WATER_COLOR = new Color(128, 197, 222);
|
||||
|
||||
@Override
|
||||
@ -26,7 +30,7 @@ public class ProgressWater extends Widget {
|
||||
Graphics2D brush = (Graphics2D) g;
|
||||
brush.setColor(
|
||||
visibility.isStronglyColored() || mouseOver ?
|
||||
WATER_COLOR
|
||||
(coloredProperty.isEnabled() ? Battery.getColourForProgress(donePercent(), Visibility.WEAKLY_COLORED, mouseOver): WATER_COLOR)
|
||||
: FOREGROUND_COLOR);
|
||||
brush.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
|
@ -216,6 +216,8 @@ public class ConfigWindow extends TWindow {
|
||||
= new JTextField(TimeCalcProperty.WATER_TYPE.getKey());
|
||||
private final JCheckBox waterHiddenProperty
|
||||
= new JCheckBox(TimeCalcProperty.WATER_HIDDEN.getKey());
|
||||
private final JCheckBox waterColoredProperty
|
||||
= new JCheckBox(TimeCalcProperty.WATER_COLORED.getKey());
|
||||
//
|
||||
private final JCheckBox colorVisibleProperty
|
||||
= new JCheckBox(TimeCalcProperty.COLOR_VISIBLE.getKey());
|
||||
@ -505,6 +507,7 @@ public class ConfigWindow extends TWindow {
|
||||
barVisibleProperty.setSelected(enable);
|
||||
barHeightProperty.setText("50");
|
||||
waterVisibleProperty.setSelected(enable);
|
||||
waterColoredProperty.setSelected(enable);
|
||||
colorVisibleProperty.setSelected(enable);
|
||||
colorHeightProperty.setText("50");
|
||||
swingVisibleProperty.setSelected(enable);
|
||||
@ -599,7 +602,7 @@ public class ConfigWindow extends TWindow {
|
||||
squareVisibleProperty,squareHiddenProperty,squareTypeProperty,
|
||||
circleVisibleProperty,circleHiddenProperty,circleTypeProperty,circleInnerCircleVisibleProperty,circleOuterCircleVisibleProperty,
|
||||
barVisibleProperty, barHiddenProperty, barTypeProperty, barHeightProperty,
|
||||
waterVisibleProperty, waterHiddenProperty, waterTypeProperty,
|
||||
waterVisibleProperty, waterHiddenProperty, waterTypeProperty,waterColoredProperty,
|
||||
colorVisibleProperty, colorHiddenProperty, colorTypeProperty, colorHeightProperty,
|
||||
dotVisibleProperty,dotHiddenProperty,dotTypeProperty,
|
||||
fuelVisibleProperty,fuelTypeProperty,fuelHiddenProperty,fuelIconVisibleProperty,
|
||||
|
@ -560,6 +560,8 @@ public class MainWindow extends TWindow {
|
||||
.bindTo(timeCalcConfiguration.waterTypeProperty);
|
||||
progressWater.hiddenProperty
|
||||
.bindTo(timeCalcConfiguration.waterHiddenProperty);
|
||||
progressWater.coloredProperty
|
||||
.bindTo(timeCalcConfiguration.waterColoredProperty);
|
||||
|
||||
add(progressWater);
|
||||
//
|
||||
|
@ -67,6 +67,7 @@ bar.height=25
|
||||
water.visible=true
|
||||
water.type=day
|
||||
water.hidden=false
|
||||
water.colored=false
|
||||
color.visible=true
|
||||
color.type=day
|
||||
color.hidden=false
|
||||
|
Loading…
x
Reference in New Issue
Block a user