Removed ProgressColor

This commit is contained in:
Robert Vokac 2024-05-21 17:34:28 +02:00
parent 2217c7a29a
commit 764e54eb0a
No known key found for this signature in database
GPG Key ID: C459E1E4B4A986BB
7 changed files with 3 additions and 139 deletions

View File

@ -234,16 +234,6 @@ public class TimeCalcConfiguration {
public final BooleanProperty waterColoredProperty
= new BooleanProperty(TimeCalcProperty.WATER_COLORED.getKey());
//
public final BooleanProperty colorVisibleProperty
= new BooleanProperty(TimeCalcProperty.COLOR_VISIBLE.getKey());
public final BooleanProperty colorHiddenProperty
= new BooleanProperty(TimeCalcProperty.COLOR_HIDDEN.getKey());
public final StringProperty colorTypeProperty
= new StringProperty(TimeCalcProperty.COLOR_TYPE.getKey());
public final IntegerProperty colorHeightProperty
= new IntegerProperty(TimeCalcProperty.COLOR_HEIGHT.getKey());
//
public final BooleanProperty walkingHumanVisibleProperty
= new BooleanProperty(
@ -372,7 +362,6 @@ public class TimeCalcConfiguration {
circleVisibleProperty,circleTypeProperty,circleInnerCircleVisibleProperty,circleOuterCircleOnlyBorderProperty,
barVisibleProperty, barTypeProperty, barHiddenProperty, barHeightProperty,
waterVisibleProperty, waterTypeProperty, waterHiddenProperty, waterColoredProperty,
colorVisibleProperty, colorTypeProperty, colorHiddenProperty, colorHeightProperty,
dotVisibleProperty,dotTypeProperty,
fuelVisibleProperty, fuelTypeProperty, fuelHiddenProperty,
fuelIconVisibleProperty,

View File

@ -115,11 +115,6 @@ public enum TimeCalcProperty {
WATER_HIDDEN("water.hidden", "Water : Hidden"),
WATER_COLORED("water.colored", "Water : Colored"),
//
COLOR_VISIBLE("color.visible", "Color"),
COLOR_TYPE("color.type", "Color : Type"),
COLOR_HIDDEN("color.hidden", "Color : Hidden"),
COLOR_HEIGHT("color.height", "Color : Height", Integer.class),
//
WALKING_HUMAN_VISIBLE("walking-human.visible", "Walking Human"),
WALKING_HUMAN_TYPE("walking-human.type", "Walking Human : Type"),
WALKING_HUMAN_HIDDEN("walking-human.hidden", "Walking Human : Hidden"),

View File

@ -1,85 +0,0 @@
package org.nanoboot.utils.timecalc.swing.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.common.NumberFormats;
import org.nanoboot.utils.timecalc.utils.property.IntegerProperty;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Supplier;
public class ProgressColor extends Widget {
public IntegerProperty heightProperty = new IntegerProperty("heightProperty", 50);
public ProgressColor() {
setPreferredSize(new Dimension(600, 50));
}
private final Map<Integer, Color> colorMap = new HashMap<>();
@Override
public void paintWidget(Graphics g) {
Visibility visibility
= Visibility.valueOf(visibilityProperty.getValue());
Graphics2D brush = (Graphics2D) g;
boolean stronglyColored = visibility.isStronglyColored() || mouseOver;
int numberStart = 255;
int numberEnd = stronglyColored ? 0 : (visibility.isWeaklyColored() ? 128 : 192) ;
int numberDiff = numberStart - numberEnd;
int number = (int) (numberStart - donePercent() * numberDiff);
if(!colorMap.containsKey(number)) {
colorMap.put(number, new Color(number, number, number));
}
Function<Integer, Color> colorReturnFunction = (n) -> {
if(!colorMap.containsKey(n)) {
colorMap.put(n, new Color(n, n, n));
}
return colorMap.get(n);
};
Color color = colorReturnFunction.apply(number);
Color colorStart = colorReturnFunction.apply(numberStart);
Color colorEnd = colorReturnFunction.apply(numberEnd);
brush.setColor(color);
brush.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
int progressWidth = (int) (getWidth() * 0.5);
//int remainsWidth = getWidth() - progressWidth;
int h = heightProperty.getValue() > getHeight() ? getHeight() :
heightProperty.getValue();
// if(h < 1) {h = 1;}
brush.fillRect(0, 0, getWidth(), h);
brush.setColor(colorStart);
int iii = (int) (getWidth() * 0.05d);
brush.fillRect(0, 0, iii, h);
brush.setColor(colorEnd);
brush.fillRect(getWidth() - iii, 0, iii, h);
brush.setColor(Color.BLUE);
brush.setStroke(new BasicStroke(1f));
brush.drawLine(iii, 0 , iii, h);
brush.drawLine(getWidth() - iii, 0 , getWidth() - iii, h);
// brush.setColor(
// visibility.isStronglyColored() || mouseOver ?
// Battery.getColourForProgress(donePercent(), visibility, mouseOver)/*Color.darkGray*/
// : FOREGROUND_COLOR);
// brush.fillRect(0, 0, progressWidth, h);
brush.setColor(h <= 15 || progressWidth < 40 ? (visibility.isStronglyColored() ? Color.BLACK : Color.GRAY) : Color.WHITE);
brush.drawString(
NumberFormats.FORMATTER_ONE_DECIMAL_PLACE
.format(number) + " (" + numberStart + "-" + numberEnd + ")",
(int) (progressWidth * 0.2d),
h <= 15 ? h + 15 : 15);
}
}

View File

@ -43,7 +43,7 @@ public class ProgressWater extends Widget {
int w = getWidth() - 1;
int w48 = (int) (w * 0.48);
int w52 = (int) (w * 0.52);
int h48 = (int) (h * 0.48);
int h48 = (int) (h * 0.48) - 1;
int h52 = (int) (h * 0.52);
int w4 = (int) (w * 0.04);

View File

@ -219,15 +219,6 @@ public class ConfigWindow extends TWindow {
private final JCheckBox waterColoredProperty
= new JCheckBox(TimeCalcProperty.WATER_COLORED.getKey());
//
private final JCheckBox colorVisibleProperty
= new JCheckBox(TimeCalcProperty.COLOR_VISIBLE.getKey());
private final JTextField colorTypeProperty
= new JTextField(TimeCalcProperty.COLOR_TYPE.getKey());
private final JCheckBox colorHiddenProperty
= new JCheckBox(TimeCalcProperty.COLOR_HIDDEN.getKey());
private final JTextField colorHeightProperty
= new JTextField(TimeCalcProperty.COLOR_HEIGHT.getKey());
//
private final JCheckBox swingVisibleProperty
= new JCheckBox(TimeCalcProperty.SWING_VISIBLE.getKey());
private final JTextField swingTypeProperty
@ -508,8 +499,6 @@ public class ConfigWindow extends TWindow {
barHeightProperty.setText("50");
waterVisibleProperty.setSelected(enable);
waterColoredProperty.setSelected(enable);
colorVisibleProperty.setSelected(enable);
colorHeightProperty.setText("50");
swingVisibleProperty.setSelected(enable);
swingQuarterIconVisibleProperty.setSelected(enable);
walkingHumanVisibleProperty.setSelected(enable);
@ -603,7 +592,6 @@ public class ConfigWindow extends TWindow {
circleVisibleProperty,circleHiddenProperty,circleTypeProperty,circleInnerCircleVisibleProperty,circleOuterCircleVisibleProperty,
barVisibleProperty, barHiddenProperty, barTypeProperty, barHeightProperty,
waterVisibleProperty, waterHiddenProperty, waterTypeProperty,waterColoredProperty,
colorVisibleProperty, colorHiddenProperty, colorTypeProperty, colorHeightProperty,
dotVisibleProperty,dotHiddenProperty,dotTypeProperty,
fuelVisibleProperty,fuelTypeProperty,fuelHiddenProperty,fuelIconVisibleProperty,
rotationVisibleProperty, rotationTypeProperty, rotationHiddenProperty,

View File

@ -29,7 +29,6 @@ import org.nanoboot.utils.timecalc.swing.controls.TWindow;
import org.nanoboot.utils.timecalc.swing.progress.AnalogClock;
import org.nanoboot.utils.timecalc.swing.progress.ProgressBar;
import org.nanoboot.utils.timecalc.swing.progress.ProgressCircle;
import org.nanoboot.utils.timecalc.swing.progress.ProgressColor;
import org.nanoboot.utils.timecalc.swing.progress.ProgressDot;
import org.nanoboot.utils.timecalc.swing.progress.ProgressFuelGauge;
import org.nanoboot.utils.timecalc.swing.progress.ProgressLife;
@ -142,7 +141,6 @@ public class MainWindow extends TWindow {
private final ProgressFuelGauge progressFuelGauge;
private final ProgressRotation progressRotation;
private final ProgressBar progressBar;
private final ProgressColor progressColor;
private final ProgressWater progressWater;
private final JLabel hourGlassElapsedDayIcon;
private final JLabel hourGlassRemainsDayIcon;
@ -532,27 +530,11 @@ public class MainWindow extends TWindow {
add(progressBar);
//
//
this.progressColor = new ProgressColor();
progressColor.setBounds(progressBar.getX(), progressBar.getY() + progressBar.getHeight() + SwingUtils.MARGIN,
progressBar.getX() + progressBar.getWidth() - 2 * SwingUtils.MARGIN, 25);
progressColor.visibleProperty
.bindTo(timeCalcConfiguration.colorVisibleProperty);
progressColor.typeProperty
.bindTo(timeCalcConfiguration.colorTypeProperty);
progressColor.hiddenProperty
.bindTo(timeCalcConfiguration.colorHiddenProperty);
progressColor.heightProperty
.bindTo(timeCalcConfiguration.colorHeightProperty);
add(progressColor);
//
this.progressWater = new ProgressWater();
progressWater.setBounds(progressSquare.getX() + progressSquare.getWidth() + 4 * SwingUtils.MARGIN,
progressSquare.getY(),
100, 550 /*exitButton.getY() + exitButton.getHeight() - SwingUtils.MARGIN*/);
100, 520 /*exitButton.getY() + exitButton.getHeight() - SwingUtils.MARGIN*/);
progressWater.visibleProperty
.bindTo(timeCalcConfiguration.waterVisibleProperty);
@ -613,7 +595,7 @@ public class MainWindow extends TWindow {
progressWeather.hiddenProperty.bindTo(timeCalcConfiguration.weatherHiddenProperty);
}
TLabel arrivalTextFieldLabel = new TLabel("Arrival:", 50);
arrivalTextFieldLabel.setBoundsFromTop(progressColor, 2);
arrivalTextFieldLabel.setBoundsFromTop(progressBar, 2);
arrivalTextField.setBoundsFromLeft(arrivalTextFieldLabel);
TButton arrivalIncreaseButton = new SmallTButton('+');
@ -1648,7 +1630,6 @@ public class MainWindow extends TWindow {
progressFuelGauge.setProgress(progress);
progressRotation.setProgress(progress);
progressBar.setProgress(progress);
progressColor.setProgress(progress);
progressWater.setProgress(progress);
dayBattery.setProgress(progress);

View File

@ -68,10 +68,6 @@ water.visible=true
water.type=day
water.hidden=false
water.colored=false
color.visible=true
color.type=day
color.hidden=false
color.height=20
dot.visible=true
dot.type=day
dot.hidden=false