Added many improvements

This commit is contained in:
Robert Vokac 2024-02-25 09:40:45 +00:00
parent cef103066f
commit 1a187ca1ed
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055
12 changed files with 204 additions and 56 deletions

View File

@ -157,7 +157,6 @@ Smileys can be colored or white-black (can be set in configuration)
**Change these places:**
* timecalc-default.conf
* timecalc-template.conf
* TimeCalcProperty
* TimeCalcConfiguration
* ConfigWindow

View File

@ -25,8 +25,8 @@ public class TimeCalcConfiguration {
public final BooleanProperty clockHandsLongVisibleProperty
= new BooleanProperty(TimeCalcProperty.CLOCK_HANDS_LONG_VISIBLE
.getKey());
public final BooleanProperty clockHandsBlackProperty
= new BooleanProperty(TimeCalcProperty.CLOCK_HANDS_BLACK
public final BooleanProperty clockHandsColoredProperty
= new BooleanProperty(TimeCalcProperty.CLOCK_HANDS_COLORED
.getKey());
public final BooleanProperty clockHandsMinuteVisibleProperty
= new BooleanProperty(TimeCalcProperty.CLOCK_HANDS_MINUTE_VISIBLE
@ -62,10 +62,31 @@ public class TimeCalcConfiguration {
public final BooleanProperty clockCentreCircleBlackProperty
= new BooleanProperty(TimeCalcProperty.CLOCK_CENTRE_CIRCLE_BLACK
.getKey());
public final BooleanProperty clockProgressVisibleOnlyIfMouseMovingOverProperty
= new BooleanProperty(TimeCalcProperty.CLOCK_PROGRESS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER
.getKey());
public final BooleanProperty clockDateVisibleOnlyIfMouseMovingOverProperty
= new BooleanProperty(TimeCalcProperty.CLOCK_DATE_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER
.getKey());
//
public final BooleanProperty batteryWavesVisibleProperty
= new BooleanProperty(TimeCalcProperty.BATTERY_WAVES_VISIBLE
.getKey());
public final BooleanProperty batteryCircleProgressProperty
= new BooleanProperty(TimeCalcProperty.BATTERY_CIRCLE_PROGRESS_VISIBLE
.getKey());
public final BooleanProperty batteryPercentProgressProperty
= new BooleanProperty(TimeCalcProperty.BATTERY_PERCENT_PROGRESS_VISIBLE
.getKey());
public final BooleanProperty batteryChargingCharacterVisibleProperty
= new BooleanProperty(TimeCalcProperty.BATTERY_CHARGING_CHARACTER_VISIBLE
.getKey());
public final BooleanProperty batteryNameVisibleProperty
= new BooleanProperty(TimeCalcProperty.BATTERY_NAME_VISIBLE
.getKey());
public final BooleanProperty batteryLabelVisibleProperty
= new BooleanProperty(TimeCalcProperty.BATTERY_LABEL_VISIBLE
.getKey());
public final BooleanProperty jokesVisibleProperty
= new BooleanProperty(TimeCalcProperty.JOKES_VISIBLE
@ -78,6 +99,9 @@ public class TimeCalcConfiguration {
.getKey());
public final BooleanProperty smileysColoredProperty
= new BooleanProperty(TimeCalcProperty.SMILEYS_COLORED.getKey());
public final BooleanProperty smileysVisibleOnlyIfMouseMovingOverProperty
= new BooleanProperty(TimeCalcProperty.SMILEYS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER.getKey());
public final BooleanProperty squareVisibleProperty
= new BooleanProperty(TimeCalcProperty.SQUARE_VISIBLE.getKey());
@ -90,7 +114,7 @@ public class TimeCalcConfiguration {
visibilityDefaultProperty,
visibilitySupportedColoredProperty,
clockHandsLongVisibleProperty,
clockHandsBlackProperty,
clockHandsColoredProperty,
clockHandsMinuteVisibleProperty,
clockHandsSecondVisibleProperty,
clockHandsMillisecondVisibleProperty,
@ -102,11 +126,19 @@ public class TimeCalcConfiguration {
clockCircleBorderColorProperty,
clockCentreCircleVisibleProperty,
clockCentreCircleBlackProperty,
clockProgressVisibleOnlyIfMouseMovingOverProperty,
clockDateVisibleOnlyIfMouseMovingOverProperty,
batteryWavesVisibleProperty,
batteryCircleProgressProperty,
batteryPercentProgressProperty,
batteryChargingCharacterVisibleProperty,
batteryNameVisibleProperty,
batteryLabelVisibleProperty,
jokesVisibleProperty,
commandsVisibleProperty,
notificationsVisibleProperty,
smileysColoredProperty,
smileysVisibleOnlyIfMouseMovingOverProperty,
squareVisibleProperty,}) {
allProperties.add(p);
}

View File

@ -1,15 +1,10 @@
package org.nanoboot.utils.timecalc.app;
import lombok.Getter;
import org.nanoboot.utils.timecalc.entity.Visibility;
import java.awt.Color;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Optional;
import java.util.Properties;
/**
* @author Robert Vokac
@ -20,7 +15,7 @@ public enum TimeCalcProperty {
VISIBILITY_SUPPORTED_COLORED("visibility.supported.colored", "Visibility : Supported : Colored"),
//
CLOCK_HANDS_LONG_VISIBLE("clock.hands.long.visible", "Clock : Hands are long"),
CLOCK_HANDS_BLACK("clock.hands.black", "Clock : Hands are black"),
CLOCK_HANDS_COLORED("clock.hands.colored", "Clock : Hands are colored"),
CLOCK_HANDS_MINUTE_VISIBLE("clock.hands.minute.visible", "Clock : Minute hand"),
CLOCK_HANDS_SECOND_VISIBLE("clock.hands.second.visible", "Clock : Second hand"),
CLOCK_HANDS_MILLISECOND_VISIBLE("clock.hands.millisecond.visible", "Clock : Millisecond hand"),
@ -33,12 +28,24 @@ public enum TimeCalcProperty {
Color.class),
CLOCK_CENTRE_CIRCLE_VISIBLE("clock.centre-circle.visible", "Clock : Centre circle"),
CLOCK_CENTRE_CIRCLE_BLACK("clock.centre-circle.black", "Clock : Centre Circle is black"),
CLOCK_PROGRESS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER("clock.progress.visible-only-if-mouse-moving-over", "Clock : Progress visible only, if mouse moving over"),
CLOCK_DATE_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER("clock.date.visible-only-if-mouse-moving-over", "Clock : Date visible only, if mouse moving over"),
//
BATTERY_WAVES_VISIBLE("battery.waves.visible", "Battery : Waves"),
BATTERY_CIRCLE_PROGRESS_VISIBLE("battery.circle-progress.visible", "Battery : Circle Progress"),
BATTERY_PERCENT_PROGRESS_VISIBLE("battery.percent-progress.visible", "Battery : Percent Progress"),
BATTERY_CHARGING_CHARACTER_VISIBLE("battery.charging-character.visible", "Battery : Charging Character"),
BATTERY_NAME_VISIBLE("battery.name.visible", "Battery : Name"),
BATTERY_LABEL_VISIBLE("battery.label.visible", "Battery : Label"),
JOKES_VISIBLE("jokes.visible", "Jokes"),
COMMANDS_VISIBLE("commands.visible", "Commands"),
NOTIFICATIONS_VISIBLE("notifications.visible", "Notifications"),
SMILEYS_COLORED("smileys.colored", "Smileys : Colored"),
SMILEYS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER("smileys.visible-only-if-mouse-moving-over", "Smileys : Visible only, if mouse moving over"),
SQUARE_VISIBLE("square.visible", "Square");
@Getter

View File

@ -37,6 +37,8 @@ public class ConfigWindow extends TWindow {
private int currentY = SwingUtils.MARGIN;
private List<JComponent> propertiesList = new ArrayList<>();
private Map<TimeCalcProperty, JComponent> propertiesMap = new HashMap<>();
private TButton enableAsMuchAsPossible = new TButton("Enable as much as possible");
private TButton disableAsMuchAsPossible = new TButton("Disable as much as possible");
public final JComboBox visibilityDefaultProperty = new JComboBox(Arrays.stream(Visibility.values()).map(v -> v.name()).collect(
Collectors.toList()).toArray());
@ -44,8 +46,8 @@ public class ConfigWindow extends TWindow {
= new JCheckBox(TimeCalcProperty.VISIBILITY_SUPPORTED_COLORED.getKey());
private JCheckBox clockHandsLongVisibleProperty
= new JCheckBox(TimeCalcProperty.CLOCK_HANDS_LONG_VISIBLE.getKey());
private JCheckBox clockHandsBlackProperty
= new JCheckBox(TimeCalcProperty.CLOCK_HANDS_BLACK.getKey());
private JCheckBox clockHandsColoredProperty
= new JCheckBox(TimeCalcProperty.CLOCK_HANDS_COLORED.getKey());
private JCheckBox clockHandsMinuteVisibleProperty
= new JCheckBox(TimeCalcProperty.CLOCK_HANDS_MINUTE_VISIBLE.getKey());
private JCheckBox clockHandsSecondVisibleProperty
@ -69,11 +71,26 @@ public class ConfigWindow extends TWindow {
= new JCheckBox(TimeCalcProperty.CLOCK_CENTRE_CIRCLE_VISIBLE.getKey());
private JCheckBox clockCentreCircleBlackProperty
= new JCheckBox(TimeCalcProperty.CLOCK_CENTRE_CIRCLE_BLACK.getKey());
private JCheckBox clockProgressVisibleOnlyIfMouseMovingOverProperty
= new JCheckBox(TimeCalcProperty.CLOCK_PROGRESS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER.getKey());
private JCheckBox clockDateVisibleOnlyIfMouseMovingOverProperty
= new JCheckBox(TimeCalcProperty.CLOCK_DATE_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER.getKey());
//
private JCheckBox batteryWavesVisibleProperty
= new JCheckBox(TimeCalcProperty.BATTERY_WAVES_VISIBLE.getKey());
private JCheckBox batteryCircleProgressVisibleProperty
= new JCheckBox(TimeCalcProperty.BATTERY_CIRCLE_PROGRESS_VISIBLE.getKey());
private JCheckBox batteryPercentProgressProperty
= new JCheckBox(TimeCalcProperty.BATTERY_PERCENT_PROGRESS_VISIBLE.getKey());
private JCheckBox batteryChargingCharacterVisibleProperty
= new JCheckBox(TimeCalcProperty.BATTERY_CHARGING_CHARACTER_VISIBLE.getKey());
private JCheckBox batteryNameVisibleProperty
= new JCheckBox(TimeCalcProperty.BATTERY_NAME_VISIBLE.getKey());
private JCheckBox batteryLabelVisibleProperty
= new JCheckBox(TimeCalcProperty.BATTERY_LABEL_VISIBLE.getKey());
private JCheckBox jokesVisibleProperty
= new JCheckBox(TimeCalcProperty.JOKES_VISIBLE.getKey());
private JCheckBox commandsVisibleProperty
@ -82,22 +99,70 @@ public class ConfigWindow extends TWindow {
= new JCheckBox(TimeCalcProperty.NOTIFICATIONS_VISIBLE.getKey());
private JCheckBox smileysColoredProperty
= new JCheckBox(TimeCalcProperty.SMILEYS_COLORED.getKey());
private JCheckBox smileysVisibleOnlyIfMouseMovingOverProperty
= new JCheckBox(TimeCalcProperty.SMILEYS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER.getKey());
private JCheckBox squareVisibleProperty
= new JCheckBox(TimeCalcProperty.SQUARE_VISIBLE.getKey());
public ConfigWindow(TimeCalcConfiguration timeCalcConfiguration) {
this.timeCalcConfiguration = timeCalcConfiguration;
setTitle("Configuration");
this.setSize(800, WIDTH1);
this.setSize(800, 1000);
setLayout(null);
add(enableAsMuchAsPossible);
enableAsMuchAsPossible.setBounds(SwingUtils.MARGIN, currentY, 200,
HEIGHT1);
add(disableAsMuchAsPossible);
disableAsMuchAsPossible.setBounds(enableAsMuchAsPossible.getX() + enableAsMuchAsPossible.getWidth() + SwingUtils.MARGIN, currentY, 200,
HEIGHT1);
nextRow();
for(boolean enable:new boolean[]{true, false}) {
TButton button = enable ? enableAsMuchAsPossible : disableAsMuchAsPossible;
button.addActionListener(e -> {
visibilityDefaultProperty.setSelectedItem(Visibility.STRONGLY_COLORED.name());
clockHandsMinuteVisibleProperty.setSelected(true);
clockHandsSecondVisibleProperty.setSelected(enable);
clockHandsMillisecondVisibleProperty.setSelected(enable);
clockHandsLongVisibleProperty.setSelected(enable);
clockHandsColoredProperty.setSelected(enable);
clockBorderVisibleProperty.setSelected(enable);
clockBorderOnlyHoursProperty.setSelected(!enable);
clockNumbersVisibleProperty.setSelected(enable);
clockCircleVisibleProperty.setSelected(enable);
clockCircleStrongBorderProperty.setSelected(!enable);
clockCircleBorderColorProperty.setColor(enable ? Color.BLUE : Color.BLACK);
timeCalcConfiguration.clockCircleBorderColorProperty.setValue(enable ? "0,0,255" : "0,0,0");
clockCentreCircleVisibleProperty.setSelected(enable);
clockCentreCircleBlackProperty.setSelected(!enable);
clockProgressVisibleOnlyIfMouseMovingOverProperty.setSelected(!enable);
clockDateVisibleOnlyIfMouseMovingOverProperty.setSelected(!enable);
batteryWavesVisibleProperty.setSelected(enable);
batteryCircleProgressVisibleProperty.setSelected(enable);
batteryPercentProgressProperty.setSelected(enable);
batteryChargingCharacterVisibleProperty.setSelected(enable);
batteryNameVisibleProperty.setSelected(enable);
batteryLabelVisibleProperty.setSelected(enable);
jokesVisibleProperty.setSelected(true);
commandsVisibleProperty.setSelected(enable);
notificationsVisibleProperty.setSelected(enable);
smileysVisibleOnlyIfMouseMovingOverProperty.setSelected(!enable);
smileysColoredProperty.setSelected(enable);
squareVisibleProperty.setSelected(true);
});
}
propertiesList.addAll(Arrays.asList(visibilityDefaultProperty,
visibilitySupportedColoredProperty,
clockHandsMinuteVisibleProperty,
clockHandsSecondVisibleProperty,
clockHandsMillisecondVisibleProperty,
clockHandsLongVisibleProperty,
clockHandsBlackProperty,
clockHandsColoredProperty,
clockBorderVisibleProperty,
clockBorderOnlyHoursProperty,
clockNumbersVisibleProperty,
@ -106,10 +171,18 @@ public class ConfigWindow extends TWindow {
clockCircleBorderColorProperty,
clockCentreCircleVisibleProperty,
clockCentreCircleBlackProperty,
clockProgressVisibleOnlyIfMouseMovingOverProperty,
clockDateVisibleOnlyIfMouseMovingOverProperty,
batteryWavesVisibleProperty,
batteryCircleProgressVisibleProperty,
batteryPercentProgressProperty,
batteryChargingCharacterVisibleProperty,
batteryNameVisibleProperty,
batteryLabelVisibleProperty,
jokesVisibleProperty,
commandsVisibleProperty,
notificationsVisibleProperty,
smileysVisibleOnlyIfMouseMovingOverProperty,
smileysColoredProperty,
squareVisibleProperty));
//
@ -131,7 +204,7 @@ public class ConfigWindow extends TWindow {
TimeCalcProperty timeCalcProperty
= TimeCalcProperty.forKey(timeCalcPropertyKey);
jComboBox.setSelectedItem(timeCalcConfiguration.getProperty(timeCalcProperty));
jComboBox.addActionListener(e -> {
jComboBox.addPropertyChangeListener(e -> {
((StringProperty) timeCalcConfiguration.getProperty(timeCalcProperty))
.setValue(
(String) jComboBox.getSelectedItem());
@ -151,7 +224,7 @@ public class ConfigWindow extends TWindow {
= (BooleanProperty) timeCalcConfiguration
.getProperty(timeCalcProperty);
checkBox.setSelected(property.isEnabled());
checkBox.addActionListener(e -> {
checkBox.addItemListener(e -> {
property
.setValue(checkBox.isSelected());
});

View File

@ -1,12 +1,10 @@
package org.nanoboot.utils.timecalc.swing.common;
import org.nanoboot.utils.timecalc.utils.common.ProgressSmiley;
import org.nanoboot.utils.timecalc.utils.common.Utils;
import javax.swing.JEditorPane;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import java.io.File;
import java.io.IOException;
/**
@ -32,7 +30,7 @@ public class HelpWindow extends TWindow {
}
helpHtml = "<div style=\"font-family:sans;margin-bottom:20px;\">" + helpHtml + "</div>";
System.out.println(helpHtml);
this.setLayout(null);
JScrollPane scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setBounds(1, 1,

View File

@ -258,8 +258,10 @@ public class MainWindow extends TWindow {
analogClock.circleStrongBorderProperty.bindTo(timeCalcConfiguration.clockCircleStrongBorderProperty);
analogClock.centreCircleVisibleProperty.bindTo(timeCalcConfiguration.clockCentreCircleVisibleProperty);
analogClock.centreCircleBorderColorProperty.bindTo(timeCalcConfiguration.clockCircleBorderColorProperty);
analogClock.handsBlackProperty.bindTo(timeCalcConfiguration.clockHandsBlackProperty);
analogClock.handsColoredProperty.bindTo(timeCalcConfiguration.clockHandsColoredProperty);
analogClock.centreCircleBlackProperty.bindTo(timeCalcConfiguration.clockCentreCircleBlackProperty);
analogClock.progressVisibleOnlyIfMouseMovingOverProperty.bindTo(timeCalcConfiguration.clockProgressVisibleOnlyIfMouseMovingOverProperty);
analogClock.dateVisibleOnlyIfMouseMovingOverProperty.bindTo(timeCalcConfiguration.clockDateVisibleOnlyIfMouseMovingOverProperty);
MinuteBattery minuteBattery = new MinuteBattery(progressCircle.getBounds().x,
progressCircle.getY() + SwingUtils.MARGIN + progressCircle.getHeight(), 140);
@ -329,10 +331,24 @@ public class MainWindow extends TWindow {
});
componentRegistry.getSet().stream().filter(c -> c instanceof Battery).forEach(c
-> ((Battery) c).wavesProperty.bindTo(timeCalcConfiguration.batteryWavesVisibleProperty));
-> {
Battery battery = ((Battery) c);
battery.wavesVisibleProperty.bindTo(timeCalcConfiguration.batteryWavesVisibleProperty);
battery.circleProgressVisibleProperty.bindTo(timeCalcConfiguration.batteryCircleProgressProperty);
battery.percentProgressVisibleProperty.bindTo(timeCalcConfiguration.batteryPercentProgressProperty);
battery.chargingCharacterVisibleProperty.bindTo(timeCalcConfiguration.batteryChargingCharacterVisibleProperty);
battery.nameVisibleProperty.bindTo(timeCalcConfiguration.batteryNameVisibleProperty);
battery.labelVisibleProperty.bindTo(timeCalcConfiguration.batteryLabelVisibleProperty);
});
componentRegistry.getSet().stream().filter(c -> c instanceof Widget).forEach(c
-> ((Widget) c).smileysColoredProperty.bindTo(timeCalcConfiguration.smileysColoredProperty));
-> {
Widget widget = (Widget) c;
widget.smileysColoredProperty.bindTo(timeCalcConfiguration.smileysColoredProperty);
widget.smileysVisibleOnlyIfMouseMovingOverProperty.bindTo(timeCalcConfiguration.smileysVisibleOnlyIfMouseMovingOverProperty);
}
);
setSize(dayBattery.getX() + dayBattery.getWidth() + 3 * SwingUtils.MARGIN,
focusButton.getY() + focusButton.getHeight() + SwingUtils.MARGIN + focusButton.getHeight() + 2 * SwingUtils.MARGIN);
while (true) {

View File

@ -81,4 +81,8 @@ public class TButton extends JButton implements GetProperty {
public Property getVisibilitySupportedColoredProperty() {
return visibilitySupportedColoredProperty;
}
void addActionListener() {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
}

View File

@ -17,10 +17,10 @@ import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import org.nanoboot.utils.timecalc.app.TimeCalcProperty;
/**
* @author Robert Vokac
@ -45,7 +45,8 @@ public class Widget extends JPanel implements
= new BooleanProperty("visibilitySupportedColoredProperty", true);
public final BooleanProperty visibleProperty
= new BooleanProperty("visibleProperty", true);
public final BooleanProperty smileysVisibleOnlyIfMouseMovingOverProperty
= new BooleanProperty(TimeCalcProperty.SMILEYS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER.getKey());
protected int side = 0;
protected double donePercent = 0;
protected boolean mouseOver = false;
@ -180,9 +181,10 @@ public class Widget extends JPanel implements
}
protected void paintSmiley(Visibility visibility, Graphics2D brush, int x, int y) {
if (!mouseOver) {
if (!mouseOver && smileysVisibleOnlyIfMouseMovingOverProperty.isEnabled()) {
if (this.smileyIcon != null) {
this.remove(smileyIcon);
this.smileyIcon = null;
}
//nothing more to do
@ -194,6 +196,10 @@ public class Widget extends JPanel implements
}
if (!colored) {
if (this.smileyIcon != null) {
this.remove(smileyIcon);
this.smileyIcon = null;
}
if (!visibility.isStronglyColored()) {
brush.setColor(Color.GRAY);
}
@ -221,6 +227,7 @@ public class Widget extends JPanel implements
ImageIcon imageIcon = ProgressSmileyIcon.forSmiley(ProgressSmiley.forProgress(donePercent)).getIcon();
if (this.smileyIcon != null) {
this.remove(smileyIcon);
this.smileyIcon = null;
}
this.smileyIcon = new JLabel(imageIcon);
smileyIcon.setBounds(x, y, 15, 15);

View File

@ -8,8 +8,6 @@ import org.nanoboot.utils.timecalc.utils.common.DateFormats;
import org.nanoboot.utils.timecalc.utils.common.TimeHM;
import org.nanoboot.utils.timecalc.utils.property.BooleanProperty;
import org.nanoboot.utils.timecalc.utils.property.IntegerProperty;
import org.nanoboot.utils.timecalc.utils.property.InvalidationListener;
import org.nanoboot.utils.timecalc.utils.property.Property;
import org.nanoboot.utils.timecalc.utils.property.StringProperty;
import javax.swing.JFrame;
@ -57,8 +55,8 @@ public class AnalogClock extends Widget {
= new BooleanProperty("millisecondEnabledProperty", false);
public BooleanProperty handsLongProperty
= new BooleanProperty("handsLongProperty", true);
public BooleanProperty handsBlackProperty
= new BooleanProperty("handsBlackProperty", false);
public BooleanProperty handsColoredProperty
= new BooleanProperty("handsColoredProperty", true);
public final BooleanProperty borderVisibleProperty
= new BooleanProperty(TimeCalcProperty.CLOCK_BORDER_VISIBLE
.getKey());
@ -84,6 +82,10 @@ public class AnalogClock extends Widget {
public final BooleanProperty centreCircleBlackProperty
= new BooleanProperty(TimeCalcProperty.CLOCK_CENTRE_CIRCLE_BLACK
.getKey());
public final BooleanProperty progressVisibleOnlyIfMouseMovingOverProperty
= new BooleanProperty(TimeCalcProperty.CLOCK_PROGRESS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER.getKey());
public final BooleanProperty dateVisibleOnlyIfMouseMovingOverProperty
= new BooleanProperty(TimeCalcProperty.CLOCK_DATE_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER.getKey());
private TimeHM startTime;
private final TimeHM endTime;
private int startAngle;
@ -161,7 +163,7 @@ public class AnalogClock extends Widget {
if (customCircleColor == null) {
customCircleColor = SwingUtils.getColorFromString(centreCircleBorderColorProperty.getValue());
}
if (mouseOver && visibility.isStronglyColored()) {
if ((mouseOver || progressVisibleOnlyIfMouseMovingOverProperty.isDisabled()) && visibility.isStronglyColored()) {
this.startTime = new TimeHM(hour, minute);
this.startAngle
= (int) ((startTime.getHour() + startTime.getMinute() / 60d)
@ -273,7 +275,7 @@ public class AnalogClock extends Widget {
int endX = (int) (getWidth() / 2 + length * Math.cos(angle));
int endY = (int) (getHeight() / 2 + length * Math.sin(angle));
brush.setColor((visibility.isStronglyColored() || mouseOver) ? (handsBlackProperty.isEnabled() ? Color.BLACK : color)
brush.setColor((visibility.isStronglyColored() || mouseOver) ? (handsColoredProperty.isEnabled() ? color : Color.BLACK)
: FOREGROUND_COLOR);
brush.setStroke(new BasicStroke(stroke));
brush.drawLine(getWidth() / 2, getHeight() / 2, endX, endY);
@ -300,7 +302,7 @@ public class AnalogClock extends Widget {
brush.setColor(currentColor);
}
if (this.mouseOver) {
if (this.mouseOver || dateVisibleOnlyIfMouseMovingOverProperty.isDisabled()) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, yearProperty.getValue());
cal.set(Calendar.MONTH, monthProperty.getValue() - 1);

View File

@ -39,7 +39,17 @@ public class Battery extends Widget {
private final String name;
private final double[] randomDoubles
= new double[]{1d, 1d, 1d, 1d, 1d, 1d, 1};
public BooleanProperty wavesProperty = new BooleanProperty(TimeCalcProperty.BATTERY_WAVES_VISIBLE
public BooleanProperty wavesVisibleProperty = new BooleanProperty(TimeCalcProperty.BATTERY_WAVES_VISIBLE
.getKey(), true);
public BooleanProperty circleProgressVisibleProperty = new BooleanProperty(TimeCalcProperty.BATTERY_CIRCLE_PROGRESS_VISIBLE
.getKey(), true);
public BooleanProperty percentProgressVisibleProperty = new BooleanProperty(TimeCalcProperty.BATTERY_PERCENT_PROGRESS_VISIBLE
.getKey(), true);
public BooleanProperty chargingCharacterVisibleProperty = new BooleanProperty(TimeCalcProperty.BATTERY_CHARGING_CHARACTER_VISIBLE
.getKey(), true);
public BooleanProperty nameVisibleProperty = new BooleanProperty(TimeCalcProperty.BATTERY_NAME_VISIBLE
.getKey(), true);
public BooleanProperty labelVisibleProperty = new BooleanProperty(TimeCalcProperty.BATTERY_LABEL_VISIBLE
.getKey(), true);
private final BooleanProperty blinking = new BooleanProperty("blinking");
private long tmpNanoTime = 0l;
@ -116,7 +126,7 @@ public class Battery extends Widget {
= 1;//donePercent < 0.5 ? 0.5 : donePercent;// (donePercent * 100 - ((int)(donePercent * 100)));
int waterSurfaceHeight
= (int) (4 * surfacePower);//2 + (int) (Math.random() * 3);
if (waterSurfaceHeight <= 2 || wavesProperty.isDisabled()) {
if (waterSurfaceHeight <= 2 || wavesVisibleProperty.isDisabled()) {
waterSurfaceHeight = 0;
}
@ -196,19 +206,20 @@ public class Battery extends Widget {
{
Font currentFont = brush.getFont();
brush.setFont(BIG_FONT);
brush.drawString(
CHARCHING, ((int) (totalWidth * 0.45)),
(donePercent < 0.5 ? totalHeight / 4 * 3
: totalHeight / 4 * 1) + 10
);
if (chargingCharacterVisibleProperty.isEnabled()) {
brush.drawString(
CHARCHING, ((int) (totalWidth * 0.45)),
(donePercent < 0.5 ? totalHeight / 4 * 3
: totalHeight / 4 * 1) + 10
);
}
paintSmiley(visibility, brush, ((int) (totalWidth * 0.45)) + 15,
(donePercent < 0.5 ? totalHeight / 4 * 3
: totalHeight / 4 * 1) + 8 - 16);
brush.setFont(currentFont);
}
{
if(circleProgressVisibleProperty.isEnabled()) {
Color currentColor = brush.getColor();
brush.setColor(
visibility.isStronglyColored() ? HIGH_HIGHLIGHTED : (visibility.isWeaklyColored() ? HIGH : Color.lightGray));
@ -228,20 +239,22 @@ public class Battery extends Widget {
brush.setColor(currentColor);
}
}
if(percentProgressVisibleProperty.isEnabled()) {
brush.drawString(
NumberFormats.FORMATTER_THREE_DECIMAL_PLACES
.format(donePercent * 100) + "%",
((int) (totalWidth * 0.15)),
donePercent > 0.5 ? totalHeight / 4 * 3 : totalHeight / 4 * 1);
}
if (label != null && !label.isEmpty()) {
if (labelVisibleProperty.isEnabled() && label != null && !label.isEmpty()) {
brush.drawString(
label,
((int) (totalWidth * 0.15)),
(donePercent > 0.5 ? totalHeight / 4 * 3
: totalHeight / 4 * 1) + 20);
}
if (name != null && !name.isEmpty()) {
if (nameVisibleProperty.isEnabled() && name != null && !name.isEmpty()) {
brush.drawString(
name,
((int) (totalWidth * 0.10)),

View File

@ -157,7 +157,6 @@ Smileys can be colored or white-black (can be set in configuration)
**Change these places:**
* timecalc-default.conf
* timecalc-template.conf
* TimeCalcProperty
* TimeCalcConfiguration
* ConfigWindow

View File

@ -13,14 +13,21 @@ clock.circle.visible=true
clock.circle.strong-border=false
clock.circle.border-color=0,0,0
clock.centre-circle.visible=true
clock.hands.black=false
clock.hands.colored=true
clock.progress.visible-only-if-mouse-moving-over=true
clock.date.visible-only-if-mouse-moving-over=true
#
battery.waves.visible=true
battery.circle-progress.visible=true
battery.percent-progress.visible=true
battery.charging-character.visible=true
battery.name.visible=true
battery.label.visible=true
#
jokes.visible=true
commands.visible=true
notifications.visible=true
smileys.visible-only-if-mouse-moving-over=true
smileys.colored=true
square.visible=true
@ -30,16 +37,9 @@ square.visible=true
#TODO:
logs.detailed=false
battery.smileys.visible=true
square.smileys.visible=true
circle.smileys.visible=true
battery.charging-unicode-character.visible=true
battery.percent-precision.count-of-decimal-points=5
battery.percent-progress.visible
battery.label.visible=true
battery.circle-progress.visible=true
clock.visible=true
clock.date.visible-if-mouse-moving-over=true
circle.visible=true
walking-human.visible=true
@ -52,5 +52,3 @@ battery.month.visible=true
battery.year.visible=true
battery.blinking-if-critical-low=true
smileys.visible=true
smileys.visible-only-if-mouse-moving-over=true