This commit is contained in:
Robert Vokac 2024-03-23 08:20:00 +01:00
parent d21ec2f0e8
commit 4d6dbd3285
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055
7 changed files with 46 additions and 0 deletions

View File

@ -78,6 +78,14 @@ public class TimeCalcConfiguration {
= new BooleanProperty(
TimeCalcProperty.CLOCK_DATE_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER
.getKey());
public final BooleanProperty clockSmileyVisibleProperty
= new BooleanProperty(
TimeCalcProperty.CLOCK_SMILEY_VISIBLE
.getKey());
public final BooleanProperty clockPercentProgressVisibleProperty
= new BooleanProperty(
TimeCalcProperty.CLOCK_PERCENT_PROGRESS_VISIBLE
.getKey());
//
public final BooleanProperty batteryWavesVisibleProperty
= new BooleanProperty(TimeCalcProperty.BATTERY_WAVES_VISIBLE
@ -201,6 +209,8 @@ public class TimeCalcConfiguration {
clockCentreCircleBlackProperty,
clockProgressVisibleOnlyIfMouseMovingOverProperty,
clockDateVisibleOnlyIfMouseMovingOverProperty,
clockSmileyVisibleProperty,
clockPercentProgressVisibleProperty,
batteryWavesVisibleProperty,
batteryCircleProgressProperty,
batteryPercentProgressProperty,

View File

@ -45,6 +45,8 @@ public enum TimeCalcProperty {
CLOCK_DATE_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER(
"clock.date.visible-only-if-mouse-moving-over",
"Clock : Date visible only, if mouse moving over"),
CLOCK_SMILEY_VISIBLE("clock.smiley.visible","Clock : Smiley : Visible"),
CLOCK_PERCENT_PROGRESS_VISIBLE("clock.percent-progress.visible","Clock : Percent progress : Visible"),
//
BATTERY_WAVES_VISIBLE("battery.waves.visible", "Battery : Waves"),
BATTERY_CIRCLE_PROGRESS_VISIBLE("battery.circle-progress.visible",

View File

@ -258,6 +258,7 @@ public class Widget extends JPanel implements
this.remove(smileyIcon);
this.smileyIcon = null;
}
Color originalColor = brush.getColor();
if (!visibility.isStronglyColored()) {
brush.setColor(Color.GRAY);
}
@ -283,6 +284,7 @@ public class Widget extends JPanel implements
x + 1, y + 16
);
brush.setFont(currentFont);
brush.setColor(originalColor);
}
if (colored) {
x = x + 2;

View File

@ -5,6 +5,7 @@ import org.nanoboot.utils.timecalc.entity.Visibility;
import org.nanoboot.utils.timecalc.swing.common.SwingUtils;
import org.nanoboot.utils.timecalc.swing.common.Widget;
import org.nanoboot.utils.timecalc.utils.common.DateFormats;
import org.nanoboot.utils.timecalc.utils.common.NumberFormats;
import org.nanoboot.utils.timecalc.utils.common.TTime;
import org.nanoboot.utils.timecalc.utils.property.BooleanProperty;
import org.nanoboot.utils.timecalc.utils.property.IntegerProperty;
@ -92,6 +93,8 @@ public class AnalogClock extends Widget {
= new BooleanProperty("handsLongProperty", true);
public BooleanProperty handsColoredProperty
= new BooleanProperty("handsColoredProperty", true);
public final BooleanProperty smileyVisibleProperty = new BooleanProperty("smileyVisibleProperty");
public final BooleanProperty percentProgressVisibleProperty = new BooleanProperty("percentProgressVisibleProperty");
private Color customCircleColor = null;
public AnalogClock() {
@ -178,6 +181,7 @@ public class AnalogClock extends Widget {
int total = endMS - startMS;
int done = nowMS - startMS;
double progress = ((double)done) / ((double)total);
setDonePercent(progress);
//System.out.println("clock.handsLongProperty=" + handsLongProperty.isEnabled());
Visibility visibility
@ -374,6 +378,18 @@ public class AnalogClock extends Widget {
((int) (side * 0.25) + 30),
((int) (side * 0.35)) + 60);
}
if(percentProgressVisibleProperty.isEnabled()) {
brush.drawString(((int) Math.floor(donePercent * 100)) + "%",
((int) (side * 0.25)),
((int) (side * 0.35)) + 35);
}
if(smileyVisibleProperty.isEnabled()) {
paintSmiley(visibility, brush, ((int) (side * 0.25) + 90),
((int) (side * 0.35)) + 20);
}
if (numbersVisibleProperty.isEnabled()) {
for (int i = 1; i <= 12; i++) {
double angle = Math.PI * 2 * (i / 12.0 - 0.25);

View File

@ -109,6 +109,14 @@ public class ConfigWindow extends TWindow {
= new JCheckBox(
TimeCalcProperty.CLOCK_DATE_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER
.getKey());
private final JCheckBox clockSmileyVisibleProperty
= new JCheckBox(
TimeCalcProperty.CLOCK_SMILEY_VISIBLE
.getKey());
private final JCheckBox clockPercentProgressVisibleProperty
= new JCheckBox(
TimeCalcProperty.CLOCK_PERCENT_PROGRESS_VISIBLE
.getKey());
//
private final JCheckBox batteryWavesVisibleProperty
= new JCheckBox(TimeCalcProperty.BATTERY_WAVES_VISIBLE.getKey());
@ -298,6 +306,8 @@ public class ConfigWindow extends TWindow {
.setSelected(!enable);
clockDateVisibleOnlyIfMouseMovingOverProperty
.setSelected(false);
clockSmileyVisibleProperty.setSelected(enable);
clockPercentProgressVisibleProperty.setSelected(enable);
batteryVisibleProperty.setSelected(true);
batteryWavesVisibleProperty.setSelected(enable);
batteryCircleProgressVisibleProperty.setSelected(enable);
@ -345,6 +355,8 @@ public class ConfigWindow extends TWindow {
clockCentreCircleBlackProperty,
clockProgressVisibleOnlyIfMouseMovingOverProperty,
clockDateVisibleOnlyIfMouseMovingOverProperty,
clockSmileyVisibleProperty,
clockPercentProgressVisibleProperty,
batteryVisibleProperty,
batteryWavesVisibleProperty,
batteryCircleProgressVisibleProperty,

View File

@ -534,6 +534,8 @@ public class MainWindow extends TWindow {
.bindTo(timeCalcConfiguration.clockDateVisibleOnlyIfMouseMovingOverProperty);
clock.visibleProperty
.bindTo(timeCalcConfiguration.clockVisibleProperty);
clock.percentProgressVisibleProperty.bindTo(timeCalcConfiguration.clockPercentProgressVisibleProperty);
clock.smileyVisibleProperty.bindTo(timeCalcConfiguration.clockSmileyVisibleProperty);
ComponentRegistry<Component> componentRegistry
= new ComponentRegistry();

View File

@ -18,6 +18,8 @@ clock.centre-circle.visible=true
clock.hands.colored=true
clock.progress.visible-only-if-mouse-moving-over=true
clock.date.visible-only-if-mouse-moving-over=true
clock.smiley.visible=false
clock.percent-progress.visible=false
#
battery.waves.visible=true
battery.circle-progress.visible=true