mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-26 15:59:24 +01:00
Formatted code
This commit is contained in:
parent
e12d5aaf25
commit
6930b3e8ed
@ -17,8 +17,8 @@ import java.util.Properties;
|
|||||||
*/
|
*/
|
||||||
public class TimeCalcConfiguration {
|
public class TimeCalcConfiguration {
|
||||||
|
|
||||||
public final StringProperty visibilityDefaultProperty =
|
public final StringProperty visibilityDefaultProperty
|
||||||
new StringProperty(TimeCalcProperty.VISIBILITY_DEFAULT
|
= new StringProperty(TimeCalcProperty.VISIBILITY_DEFAULT
|
||||||
.getKey());
|
.getKey());
|
||||||
public final BooleanProperty visibilitySupportedColoredProperty
|
public final BooleanProperty visibilitySupportedColoredProperty
|
||||||
= new BooleanProperty(TimeCalcProperty.VISIBILITY_SUPPORTED_COLORED
|
= new BooleanProperty(TimeCalcProperty.VISIBILITY_SUPPORTED_COLORED
|
||||||
@ -43,8 +43,7 @@ public class TimeCalcConfiguration {
|
|||||||
= new BooleanProperty(TimeCalcProperty.CLOCK_HANDS_SECOND_VISIBLE
|
= new BooleanProperty(TimeCalcProperty.CLOCK_HANDS_SECOND_VISIBLE
|
||||||
.getKey());
|
.getKey());
|
||||||
public final BooleanProperty clockHandsMillisecondVisibleProperty
|
public final BooleanProperty clockHandsMillisecondVisibleProperty
|
||||||
=
|
= new BooleanProperty(TimeCalcProperty.CLOCK_HANDS_MILLISECOND_VISIBLE
|
||||||
new BooleanProperty(TimeCalcProperty.CLOCK_HANDS_MILLISECOND_VISIBLE
|
|
||||||
.getKey());
|
.getKey());
|
||||||
public final BooleanProperty clockBorderVisibleProperty
|
public final BooleanProperty clockBorderVisibleProperty
|
||||||
= new BooleanProperty(TimeCalcProperty.CLOCK_BORDER_VISIBLE
|
= new BooleanProperty(TimeCalcProperty.CLOCK_BORDER_VISIBLE
|
||||||
@ -71,8 +70,7 @@ public class TimeCalcConfiguration {
|
|||||||
public final BooleanProperty clockCentreCircleBlackProperty
|
public final BooleanProperty clockCentreCircleBlackProperty
|
||||||
= new BooleanProperty(TimeCalcProperty.CLOCK_CENTRE_CIRCLE_BLACK
|
= new BooleanProperty(TimeCalcProperty.CLOCK_CENTRE_CIRCLE_BLACK
|
||||||
.getKey());
|
.getKey());
|
||||||
public final BooleanProperty
|
public final BooleanProperty clockProgressVisibleOnlyIfMouseMovingOverProperty
|
||||||
clockProgressVisibleOnlyIfMouseMovingOverProperty
|
|
||||||
= new BooleanProperty(
|
= new BooleanProperty(
|
||||||
TimeCalcProperty.CLOCK_PROGRESS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER
|
TimeCalcProperty.CLOCK_PROGRESS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER
|
||||||
.getKey());
|
.getKey());
|
||||||
@ -85,8 +83,7 @@ public class TimeCalcConfiguration {
|
|||||||
= new BooleanProperty(TimeCalcProperty.BATTERY_WAVES_VISIBLE
|
= new BooleanProperty(TimeCalcProperty.BATTERY_WAVES_VISIBLE
|
||||||
.getKey());
|
.getKey());
|
||||||
public final BooleanProperty batteryCircleProgressProperty
|
public final BooleanProperty batteryCircleProgressProperty
|
||||||
=
|
= new BooleanProperty(TimeCalcProperty.BATTERY_CIRCLE_PROGRESS_VISIBLE
|
||||||
new BooleanProperty(TimeCalcProperty.BATTERY_CIRCLE_PROGRESS_VISIBLE
|
|
||||||
.getKey());
|
.getKey());
|
||||||
public final BooleanProperty batteryPercentProgressProperty
|
public final BooleanProperty batteryPercentProgressProperty
|
||||||
= new BooleanProperty(
|
= new BooleanProperty(
|
||||||
@ -176,8 +173,8 @@ public class TimeCalcConfiguration {
|
|||||||
.getKey(), Integer.MAX_VALUE);
|
.getKey(), Integer.MAX_VALUE);
|
||||||
|
|
||||||
//
|
//
|
||||||
private final Map<TimeCalcProperty, Property> mapOfProperties =
|
private final Map<TimeCalcProperty, Property> mapOfProperties
|
||||||
new HashMap<>();
|
= new HashMap<>();
|
||||||
private final List<Property> allProperties = new ArrayList<>();
|
private final List<Property> allProperties = new ArrayList<>();
|
||||||
|
|
||||||
private TimeCalcProperties timeCalcProperties;
|
private TimeCalcProperties timeCalcProperties;
|
||||||
@ -234,8 +231,7 @@ public class TimeCalcConfiguration {
|
|||||||
testHourCustomProperty,
|
testHourCustomProperty,
|
||||||
testMinuteCustomProperty,
|
testMinuteCustomProperty,
|
||||||
testSecondCustomProperty,
|
testSecondCustomProperty,
|
||||||
testMillisecondCustomProperty,
|
testMillisecondCustomProperty,}) {
|
||||||
}) {
|
|
||||||
allProperties.add(p);
|
allProperties.add(p);
|
||||||
}
|
}
|
||||||
allProperties.stream().forEach(p -> mapOfProperties
|
allProperties.stream().forEach(p -> mapOfProperties
|
||||||
@ -264,6 +260,7 @@ public class TimeCalcConfiguration {
|
|||||||
}
|
}
|
||||||
return mapOfProperties.get(timeCalcProperty);
|
return mapOfProperties.get(timeCalcProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String print() {
|
public String print() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (Property p : allProperties) {
|
for (Property p : allProperties) {
|
||||||
|
@ -145,14 +145,29 @@ public class TimeCalcKeyAdapter extends KeyAdapter {
|
|||||||
|
|
||||||
if ((increase || decrease) && currentValue == Integer.MAX_VALUE) {
|
if ((increase || decrease) && currentValue == Integer.MAX_VALUE) {
|
||||||
switch (timeUnit) {
|
switch (timeUnit) {
|
||||||
case Calendar.YEAR: integerProperty.setValue(time.yearProperty.getValue());break;
|
case Calendar.YEAR:
|
||||||
case Calendar.MONTH:integerProperty.setValue(time.monthProperty.getValue());break;
|
integerProperty.setValue(time.yearProperty.getValue());
|
||||||
case Calendar.DAY_OF_MONTH:integerProperty.setValue(time.dayProperty.getValue());break;
|
break;
|
||||||
case Calendar.HOUR_OF_DAY:integerProperty.setValue(time.hourProperty.getValue());break;
|
case Calendar.MONTH:
|
||||||
case Calendar.MINUTE:integerProperty.setValue(time.minuteProperty.getValue());break;
|
integerProperty.setValue(time.monthProperty.getValue());
|
||||||
case Calendar.SECOND:integerProperty.setValue(time.secondProperty.getValue());break;
|
break;
|
||||||
case Calendar.MILLISECOND:integerProperty.setValue(time.millisecondProperty.getValue());break;
|
case Calendar.DAY_OF_MONTH:
|
||||||
default: throw new TimeCalcException("Unsupported time unit: " + timeUnit);
|
integerProperty.setValue(time.dayProperty.getValue());
|
||||||
|
break;
|
||||||
|
case Calendar.HOUR_OF_DAY:
|
||||||
|
integerProperty.setValue(time.hourProperty.getValue());
|
||||||
|
break;
|
||||||
|
case Calendar.MINUTE:
|
||||||
|
integerProperty.setValue(time.minuteProperty.getValue());
|
||||||
|
break;
|
||||||
|
case Calendar.SECOND:
|
||||||
|
integerProperty.setValue(time.secondProperty.getValue());
|
||||||
|
break;
|
||||||
|
case Calendar.MILLISECOND:
|
||||||
|
integerProperty.setValue(time.millisecondProperty.getValue());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new TimeCalcException("Unsupported time unit: " + timeUnit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Calendar cal = time.asCalendar();
|
Calendar cal = time.asCalendar();
|
||||||
@ -181,26 +196,78 @@ public class TimeCalcKeyAdapter extends KeyAdapter {
|
|||||||
int newMillisecond = cal.get(Calendar.MILLISECOND);
|
int newMillisecond = cal.get(Calendar.MILLISECOND);
|
||||||
if (increase) {
|
if (increase) {
|
||||||
switch (timeUnit) {
|
switch (timeUnit) {
|
||||||
case Calendar.YEAR: break;
|
case Calendar.YEAR:
|
||||||
case Calendar.MONTH: if(oldYear != newYear) { updateProperty(timeCalcConfiguration.testYearCustomProperty, increase, decrease, reset, Calendar.YEAR);}break;
|
break;
|
||||||
case Calendar.DAY_OF_MONTH:if(oldMonth != newMonth) { updateProperty(timeCalcConfiguration.testMonthCustomProperty, increase, decrease, reset, Calendar.MONTH);}break;
|
case Calendar.MONTH:
|
||||||
case Calendar.HOUR_OF_DAY:if(oldDay != newDay) { updateProperty(timeCalcConfiguration.testDayCustomProperty, increase, decrease, reset, Calendar.DAY_OF_MONTH);}break;
|
if (oldYear != newYear) {
|
||||||
case Calendar.MINUTE:if(oldHour != newHour) { updateProperty(timeCalcConfiguration.testHourCustomProperty, increase, decrease, reset, Calendar.HOUR_OF_DAY);}break;
|
updateProperty(timeCalcConfiguration.testYearCustomProperty, increase, decrease, reset, Calendar.YEAR);
|
||||||
case Calendar.SECOND:if(oldMinute != newMinute) { updateProperty(timeCalcConfiguration.testMinuteCustomProperty, increase, decrease, reset, Calendar.MINUTE);}break;
|
}
|
||||||
case Calendar.MILLISECOND:if(oldSecond != newSecond) { updateProperty(timeCalcConfiguration.testSecondCustomProperty, increase, decrease, reset, Calendar.SECOND);}break;
|
break;
|
||||||
default: throw new TimeCalcException("Unsupported time unit: " + timeUnit);
|
case Calendar.DAY_OF_MONTH:
|
||||||
|
if (oldMonth != newMonth) {
|
||||||
|
updateProperty(timeCalcConfiguration.testMonthCustomProperty, increase, decrease, reset, Calendar.MONTH);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Calendar.HOUR_OF_DAY:
|
||||||
|
if (oldDay != newDay) {
|
||||||
|
updateProperty(timeCalcConfiguration.testDayCustomProperty, increase, decrease, reset, Calendar.DAY_OF_MONTH);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Calendar.MINUTE:
|
||||||
|
if (oldHour != newHour) {
|
||||||
|
updateProperty(timeCalcConfiguration.testHourCustomProperty, increase, decrease, reset, Calendar.HOUR_OF_DAY);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Calendar.SECOND:
|
||||||
|
if (oldMinute != newMinute) {
|
||||||
|
updateProperty(timeCalcConfiguration.testMinuteCustomProperty, increase, decrease, reset, Calendar.MINUTE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Calendar.MILLISECOND:
|
||||||
|
if (oldSecond != newSecond) {
|
||||||
|
updateProperty(timeCalcConfiguration.testSecondCustomProperty, increase, decrease, reset, Calendar.SECOND);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new TimeCalcException("Unsupported time unit: " + timeUnit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (decrease) {
|
if (decrease) {
|
||||||
switch (timeUnit) {
|
switch (timeUnit) {
|
||||||
case Calendar.YEAR: break;
|
case Calendar.YEAR:
|
||||||
case Calendar.MONTH:if(oldYear != newYear) { updateProperty(timeCalcConfiguration.testYearCustomProperty, increase, decrease, reset, Calendar.YEAR);}break;
|
break;
|
||||||
case Calendar.DAY_OF_MONTH:if(oldMonth != newMonth) { updateProperty(timeCalcConfiguration.testMinuteCustomProperty, increase, decrease, reset, Calendar.MONTH);}break;
|
case Calendar.MONTH:
|
||||||
case Calendar.HOUR_OF_DAY:if(oldDay != newDay) { updateProperty(timeCalcConfiguration.testSecondCustomProperty, increase, decrease, reset, Calendar.DAY_OF_MONTH);}break;
|
if (oldYear != newYear) {
|
||||||
case Calendar.MINUTE:if(oldHour != newHour) { updateProperty(timeCalcConfiguration.testMillisecondCustomProperty, increase, decrease, reset, Calendar.HOUR_OF_DAY);}break;
|
updateProperty(timeCalcConfiguration.testYearCustomProperty, increase, decrease, reset, Calendar.YEAR);
|
||||||
case Calendar.SECOND:if(oldMinute != newMinute) { updateProperty(timeCalcConfiguration.testMillisecondCustomProperty, increase, decrease, reset, Calendar.MINUTE);}break;
|
}
|
||||||
case Calendar.MILLISECOND: if(oldSecond != newSecond) { updateProperty(timeCalcConfiguration.testMillisecondCustomProperty, increase, decrease, reset, Calendar.SECOND);}break;
|
break;
|
||||||
default: throw new TimeCalcException("Unsupported time unit: " + timeUnit);
|
case Calendar.DAY_OF_MONTH:
|
||||||
|
if (oldMonth != newMonth) {
|
||||||
|
updateProperty(timeCalcConfiguration.testMinuteCustomProperty, increase, decrease, reset, Calendar.MONTH);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Calendar.HOUR_OF_DAY:
|
||||||
|
if (oldDay != newDay) {
|
||||||
|
updateProperty(timeCalcConfiguration.testSecondCustomProperty, increase, decrease, reset, Calendar.DAY_OF_MONTH);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Calendar.MINUTE:
|
||||||
|
if (oldHour != newHour) {
|
||||||
|
updateProperty(timeCalcConfiguration.testMillisecondCustomProperty, increase, decrease, reset, Calendar.HOUR_OF_DAY);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Calendar.SECOND:
|
||||||
|
if (oldMinute != newMinute) {
|
||||||
|
updateProperty(timeCalcConfiguration.testMillisecondCustomProperty, increase, decrease, reset, Calendar.MINUTE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Calendar.MILLISECOND:
|
||||||
|
if (oldSecond != newSecond) {
|
||||||
|
updateProperty(timeCalcConfiguration.testMillisecondCustomProperty, increase, decrease, reset, Calendar.SECOND);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new TimeCalcException("Unsupported time unit: " + timeUnit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,16 +279,16 @@ public class TimeCalcKeyAdapter extends KeyAdapter {
|
|||||||
.isDisabled();
|
.isDisabled();
|
||||||
Visibility visibility = Visibility
|
Visibility visibility = Visibility
|
||||||
.valueOf(timeCalcApp.visibilityProperty.getValue());
|
.valueOf(timeCalcApp.visibilityProperty.getValue());
|
||||||
boolean numberKeyWasPressed = keyCode == KeyEvent.VK_0 ||
|
boolean numberKeyWasPressed = keyCode == KeyEvent.VK_0
|
||||||
keyCode == KeyEvent.VK_1 ||
|
|| keyCode == KeyEvent.VK_1
|
||||||
keyCode == KeyEvent.VK_2 ||
|
|| keyCode == KeyEvent.VK_2
|
||||||
keyCode == KeyEvent.VK_3 ||
|
|| keyCode == KeyEvent.VK_3
|
||||||
keyCode == KeyEvent.VK_4 ||
|
|| keyCode == KeyEvent.VK_4
|
||||||
keyCode == KeyEvent.VK_5 ||
|
|| keyCode == KeyEvent.VK_5
|
||||||
keyCode == KeyEvent.VK_6 ||
|
|| keyCode == KeyEvent.VK_6
|
||||||
keyCode == KeyEvent.VK_7 ||
|
|| keyCode == KeyEvent.VK_7
|
||||||
keyCode == KeyEvent.VK_8 ||
|
|| keyCode == KeyEvent.VK_8
|
||||||
keyCode == KeyEvent.VK_9;
|
|| keyCode == KeyEvent.VK_9;
|
||||||
|
|
||||||
if (numberKeyWasPressed && !FileConstants.TIME_CALC_PROFILES_TXT_FILE
|
if (numberKeyWasPressed && !FileConstants.TIME_CALC_PROFILES_TXT_FILE
|
||||||
.exists()) {
|
.exists()) {
|
||||||
@ -511,9 +578,8 @@ public class TimeCalcKeyAdapter extends KeyAdapter {
|
|||||||
+ "\" is already active. Nothing to do",
|
+ "\" is already active. Nothing to do",
|
||||||
5000);
|
5000);
|
||||||
} else {
|
} else {
|
||||||
Utils.showNotification("Info: Changing profile to: #" + profileNumber + " " + ((
|
Utils.showNotification("Info: Changing profile to: #" + profileNumber + " " + ((profileName.isEmpty() ? "{Default profile}"
|
||||||
profileName.isEmpty() ? "{Default profile}" :
|
: profileName)), 5000);
|
||||||
profileName)), 5000);
|
|
||||||
timeCalcConfiguration.saveToTimeCalcProperties();
|
timeCalcConfiguration.saveToTimeCalcProperties();
|
||||||
TimeCalcProperties.getInstance().loadProfile(profileName);
|
TimeCalcProperties.getInstance().loadProfile(profileName);
|
||||||
timeCalcConfiguration.loadFromTimeCalcProperties(
|
timeCalcConfiguration.loadFromTimeCalcProperties(
|
||||||
|
@ -28,11 +28,11 @@ public class TimeCalcProperties {
|
|||||||
System.out.println("Loading configuration - start");
|
System.out.println("Loading configuration - start");
|
||||||
String profileName = "";
|
String profileName = "";
|
||||||
try {
|
try {
|
||||||
profileName =
|
profileName
|
||||||
FileConstants.TIME_CALC_CURRENT_PROFILE_TXT_FILE.exists() ?
|
= FileConstants.TIME_CALC_CURRENT_PROFILE_TXT_FILE.exists()
|
||||||
Utils.readTextFromFile(
|
? Utils.readTextFromFile(
|
||||||
FileConstants.TIME_CALC_CURRENT_PROFILE_TXT_FILE) :
|
FileConstants.TIME_CALC_CURRENT_PROFILE_TXT_FILE)
|
||||||
"";
|
: "";
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new TimeCalcException(e);
|
throw new TimeCalcException(e);
|
||||||
@ -115,6 +115,7 @@ public class TimeCalcProperties {
|
|||||||
}
|
}
|
||||||
return (String) properties.get(key);
|
return (String) properties.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIntegerProperty(TimeCalcProperty timeCalcProperty) {
|
public int getIntegerProperty(TimeCalcProperty timeCalcProperty) {
|
||||||
return getIntegerProperty(timeCalcProperty,
|
return getIntegerProperty(timeCalcProperty,
|
||||||
Integer.valueOf(getDefaultStringValue(timeCalcProperty)));
|
Integer.valueOf(getDefaultStringValue(timeCalcProperty)));
|
||||||
@ -128,6 +129,7 @@ public class TimeCalcProperties {
|
|||||||
}
|
}
|
||||||
return Integer.valueOf((String) properties.get(key));
|
return Integer.valueOf((String) properties.get(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getVisibilityProperty(TimeCalcProperty timeCalcProperty) {
|
private String getVisibilityProperty(TimeCalcProperty timeCalcProperty) {
|
||||||
return getStringProperty(timeCalcProperty,
|
return getStringProperty(timeCalcProperty,
|
||||||
Visibility.STRONGLY_COLORED.name());
|
Visibility.STRONGLY_COLORED.name());
|
||||||
@ -178,9 +180,9 @@ public class TimeCalcProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private File getFile(String profileName) {
|
private File getFile(String profileName) {
|
||||||
return profileName == null || profileName.isEmpty() ?
|
return profileName == null || profileName.isEmpty()
|
||||||
FileConstants.FILE_WITHOUT_ANY_PROFILE :
|
? FileConstants.FILE_WITHOUT_ANY_PROFILE
|
||||||
new File(FileConstants.FILE_WITHOUT_ANY_PROFILE.getParentFile(),
|
: new File(FileConstants.FILE_WITHOUT_ANY_PROFILE.getParentFile(),
|
||||||
"timecalc." + profileName + ".conf");
|
"timecalc." + profileName + ".conf");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,19 +45,16 @@ 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.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_WAVES_VISIBLE("battery.waves.visible", "Battery : Waves"),
|
||||||
BATTERY_CIRCLE_PROGRESS_VISIBLE("battery.circle-progress.visible",
|
BATTERY_CIRCLE_PROGRESS_VISIBLE("battery.circle-progress.visible",
|
||||||
"Battery : Circle Progress"),
|
"Battery : Circle Progress"),
|
||||||
BATTERY_PERCENT_PROGRESS_VISIBLE("battery.percent-progress.visible",
|
BATTERY_PERCENT_PROGRESS_VISIBLE("battery.percent-progress.visible",
|
||||||
"Battery : Percent Progress"),
|
"Battery : Percent Progress"),
|
||||||
|
|
||||||
BATTERY_CHARGING_CHARACTER_VISIBLE("battery.charging-character.visible",
|
BATTERY_CHARGING_CHARACTER_VISIBLE("battery.charging-character.visible",
|
||||||
"Battery : Charging Character"),
|
"Battery : Charging Character"),
|
||||||
BATTERY_NAME_VISIBLE("battery.name.visible", "Battery : Name"),
|
BATTERY_NAME_VISIBLE("battery.name.visible", "Battery : Name"),
|
||||||
BATTERY_LABEL_VISIBLE("battery.label.visible", "Battery : Label"),
|
BATTERY_LABEL_VISIBLE("battery.label.visible", "Battery : Label"),
|
||||||
|
|
||||||
BATTERY_VISIBLE("battery.visible", "Battery"),
|
BATTERY_VISIBLE("battery.visible", "Battery"),
|
||||||
BATTERY_MINUTE_VISIBLE("battery.minute.visible", "Battery : Minute"),
|
BATTERY_MINUTE_VISIBLE("battery.minute.visible", "Battery : Minute"),
|
||||||
BATTERY_HOUR_VISIBLE("battery.hour.visible", "Battery : Hour"),
|
BATTERY_HOUR_VISIBLE("battery.hour.visible", "Battery : Hour"),
|
||||||
@ -67,7 +64,6 @@ public enum TimeCalcProperty {
|
|||||||
BATTERY_YEAR_VISIBLE("battery.year.visible", "Battery : Year"),
|
BATTERY_YEAR_VISIBLE("battery.year.visible", "Battery : Year"),
|
||||||
BATTERY_BLINKING_IF_CRITICAL_LOW("battery.blinking-if-critical-low",
|
BATTERY_BLINKING_IF_CRITICAL_LOW("battery.blinking-if-critical-low",
|
||||||
"Battery : Blinking, if critical low"),
|
"Battery : Blinking, if critical low"),
|
||||||
|
|
||||||
JOKES_VISIBLE("jokes.visible", "Jokes"),
|
JOKES_VISIBLE("jokes.visible", "Jokes"),
|
||||||
COMMANDS_VISIBLE("commands.visible", "Commands"),
|
COMMANDS_VISIBLE("commands.visible", "Commands"),
|
||||||
NOTIFICATIONS_VISIBLE("notifications.visible", "Notifications"),
|
NOTIFICATIONS_VISIBLE("notifications.visible", "Notifications"),
|
||||||
@ -76,7 +72,6 @@ public enum TimeCalcProperty {
|
|||||||
"smileys.visible-only-if-mouse-moving-over",
|
"smileys.visible-only-if-mouse-moving-over",
|
||||||
"Smileys : Visible only, if mouse moving over"),
|
"Smileys : Visible only, if mouse moving over"),
|
||||||
SMILEYS_COLORED("smileys.colored", "Smileys : Colored"),
|
SMILEYS_COLORED("smileys.colored", "Smileys : Colored"),
|
||||||
|
|
||||||
SQUARE_VISIBLE("square.visible", "Square"),
|
SQUARE_VISIBLE("square.visible", "Square"),
|
||||||
CIRCLE_VISIBLE("circle.visible", "Circle"),
|
CIRCLE_VISIBLE("circle.visible", "Circle"),
|
||||||
WALKING_HUMAN_VISIBLE("walking-human.visible", "Walking Human"),
|
WALKING_HUMAN_VISIBLE("walking-human.visible", "Walking Human"),
|
||||||
@ -109,8 +104,8 @@ public enum TimeCalcProperty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static TimeCalcProperty forKey(String key) {
|
public static TimeCalcProperty forKey(String key) {
|
||||||
Optional<TimeCalcProperty> timeCalcPropertyOptional =
|
Optional<TimeCalcProperty> timeCalcPropertyOptional
|
||||||
Arrays.stream(values()).filter(t -> t.getKey().equals(key))
|
= Arrays.stream(values()).filter(t -> t.getKey().equals(key))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
if (timeCalcPropertyOptional.isPresent()) {
|
if (timeCalcPropertyOptional.isPresent()) {
|
||||||
return timeCalcPropertyOptional.get();
|
return timeCalcPropertyOptional.get();
|
||||||
|
@ -16,6 +16,7 @@ public class ActivityForStats extends Activity {
|
|||||||
|
|
||||||
public ActivityForStats() {
|
public ActivityForStats() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ActivityForStats> createList(List<Activity> list) {
|
public List<ActivityForStats> createList(List<Activity> list) {
|
||||||
return null;//todo
|
return null;//todo
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,13 @@ import java.util.List;
|
|||||||
* @since 23.02.2024
|
* @since 23.02.2024
|
||||||
*/
|
*/
|
||||||
public interface ActivityRepositoryApi {
|
public interface ActivityRepositoryApi {
|
||||||
|
|
||||||
void create(Activity activity);
|
void create(Activity activity);
|
||||||
|
|
||||||
List<Activity> list(int year, int month, int day);
|
List<Activity> list(int year, int month, int day);
|
||||||
|
|
||||||
void update(Activity activity);
|
void update(Activity activity);
|
||||||
|
|
||||||
WorkingDay read(String id);
|
WorkingDay read(String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,13 @@ import java.util.List;
|
|||||||
* @since 23.02.2024
|
* @since 23.02.2024
|
||||||
*/
|
*/
|
||||||
public interface WorkingDayRepositoryApi {
|
public interface WorkingDayRepositoryApi {
|
||||||
|
|
||||||
void create(WorkingDay workingDay);
|
void create(WorkingDay workingDay);
|
||||||
|
|
||||||
List<WorkingDay> list(int year, int month);
|
List<WorkingDay> list(int year, int month);
|
||||||
|
|
||||||
void update(WorkingDay workingDay);
|
void update(WorkingDay workingDay);
|
||||||
|
|
||||||
WorkingDay read(int year, int month, int day);
|
WorkingDay read(int year, int month, int day);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package org.nanoboot.utils.timecalc.persistence.impl.sqlite;
|
package org.nanoboot.utils.timecalc.persistence.impl.sqlite;
|
||||||
|
|
||||||
|
|
||||||
import org.nanoboot.utils.timecalc.persistence.api.ConnectionFactory;
|
import org.nanoboot.utils.timecalc.persistence.api.ConnectionFactory;
|
||||||
import org.nanoboot.utils.timecalc.utils.common.FileConstants;
|
import org.nanoboot.utils.timecalc.utils.common.FileConstants;
|
||||||
|
|
||||||
@ -31,14 +30,17 @@ import java.sql.SQLException;
|
|||||||
* @author <a href="mailto:robertvokac@nanoboot.org">Robert Vokac</a>
|
* @author <a href="mailto:robertvokac@nanoboot.org">Robert Vokac</a>
|
||||||
*/
|
*/
|
||||||
public class SqliteConnectionFactory implements ConnectionFactory {
|
public class SqliteConnectionFactory implements ConnectionFactory {
|
||||||
|
|
||||||
private final String jdbcUrl;
|
private final String jdbcUrl;
|
||||||
|
|
||||||
private static String createJdbcUrl(String directoryWhereSqliteFileIs) {
|
private static String createJdbcUrl(String directoryWhereSqliteFileIs) {
|
||||||
return "jdbc:sqlite:" + directoryWhereSqliteFileIs + "/" + ".time-calc.sqlite3?foreign_keys=on;";
|
return "jdbc:sqlite:" + directoryWhereSqliteFileIs + "/" + ".time-calc.sqlite3?foreign_keys=on;";
|
||||||
}
|
}
|
||||||
|
|
||||||
public SqliteConnectionFactory() {
|
public SqliteConnectionFactory() {
|
||||||
this(FileConstants.TC_DIRECTORY.getName());
|
this(FileConstants.TC_DIRECTORY.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public SqliteConnectionFactory(String directoryWhereSqliteFileIs) {
|
public SqliteConnectionFactory(String directoryWhereSqliteFileIs) {
|
||||||
this.jdbcUrl = createJdbcUrl(directoryWhereSqliteFileIs);
|
this.jdbcUrl = createJdbcUrl(directoryWhereSqliteFileIs);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import java.util.List;
|
|||||||
* @since 23.02.2024
|
* @since 23.02.2024
|
||||||
*/
|
*/
|
||||||
public class WorkingDayRepositorySQLiteImpl implements WorkingDayRepositoryApi {
|
public class WorkingDayRepositorySQLiteImpl implements WorkingDayRepositoryApi {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create(WorkingDay workingDay) {
|
public void create(WorkingDay workingDay) {
|
||||||
|
|
||||||
@ -31,9 +32,6 @@ public class WorkingDayRepositorySQLiteImpl implements WorkingDayRepositoryApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// private org.nanoboot.bitinspector.persistence.impl.sqlite.SqliteConnectionFactory
|
// private org.nanoboot.bitinspector.persistence.impl.sqlite.SqliteConnectionFactory
|
||||||
// sqliteConnectionFactory;
|
// sqliteConnectionFactory;
|
||||||
//
|
//
|
||||||
|
@ -23,6 +23,7 @@ package org.nanoboot.utils.timecalc.persistence.impl.sqlite;
|
|||||||
* @author <a href="mailto:robertvokac@nanoboot.org">Robert Vokac</a>
|
* @author <a href="mailto:robertvokac@nanoboot.org">Robert Vokac</a>
|
||||||
*/
|
*/
|
||||||
class WorkingDayTable {
|
class WorkingDayTable {
|
||||||
|
|
||||||
public static final String TABLE_NAME = "WORKING_DAY";
|
public static final String TABLE_NAME = "WORKING_DAY";
|
||||||
|
|
||||||
public static final String ID = "ID";
|
public static final String ID = "ID";
|
||||||
@ -44,5 +45,4 @@ class WorkingDayTable {
|
|||||||
//Not meant to be instantiated.
|
//Not meant to be instantiated.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,8 @@ public class ConfigWindow extends TWindow {
|
|||||||
|
|
||||||
public static final int WIDTH1 = 600;
|
public static final int WIDTH1 = 600;
|
||||||
public static final int HEIGHT1 = 30;
|
public static final int HEIGHT1 = 30;
|
||||||
public static final String CLIENT_PROPERTY_KEY =
|
public static final String CLIENT_PROPERTY_KEY
|
||||||
TimeCalcProperty.class.getName();
|
= TimeCalcProperty.class.getName();
|
||||||
public static final String THREE_DASHES = "---";
|
public static final String THREE_DASHES = "---";
|
||||||
private static final Font BIG_FONT = new Font("sans", Font.BOLD, 24);
|
private static final Font BIG_FONT = new Font("sans", Font.BOLD, 24);
|
||||||
private static final String FIVE_SPACES = " ";
|
private static final String FIVE_SPACES = " ";
|
||||||
@ -55,10 +55,10 @@ public class ConfigWindow extends TWindow {
|
|||||||
private int currentY = SwingUtils.MARGIN;
|
private int currentY = SwingUtils.MARGIN;
|
||||||
private final List<JComponent> propertiesList = new ArrayList<>();
|
private final List<JComponent> propertiesList = new ArrayList<>();
|
||||||
private final Map<TimeCalcProperty, JComponent> propertiesMap = new HashMap<>();
|
private final Map<TimeCalcProperty, JComponent> propertiesMap = new HashMap<>();
|
||||||
private final TButton enableAsMuchAsPossible =
|
private final TButton enableAsMuchAsPossible
|
||||||
new TButton("Enable as much as possible");
|
= new TButton("Enable as much as possible");
|
||||||
private final TButton disableAsMuchAsPossible =
|
private final TButton disableAsMuchAsPossible
|
||||||
new TButton("Disable as much as possible");
|
= new TButton("Disable as much as possible");
|
||||||
private final JCheckBox visibilitySupportedColoredProperty
|
private final JCheckBox visibilitySupportedColoredProperty
|
||||||
= new JCheckBox(
|
= new JCheckBox(
|
||||||
TimeCalcProperty.VISIBILITY_SUPPORTED_COLORED.getKey());
|
TimeCalcProperty.VISIBILITY_SUPPORTED_COLORED.getKey());
|
||||||
@ -71,11 +71,9 @@ public class ConfigWindow extends TWindow {
|
|||||||
private final JCheckBox clockHandsHourVisibleProperty
|
private final JCheckBox clockHandsHourVisibleProperty
|
||||||
= new JCheckBox(TimeCalcProperty.CLOCK_HANDS_HOUR_VISIBLE.getKey());
|
= new JCheckBox(TimeCalcProperty.CLOCK_HANDS_HOUR_VISIBLE.getKey());
|
||||||
private final JCheckBox clockHandsMinuteVisibleProperty
|
private final JCheckBox clockHandsMinuteVisibleProperty
|
||||||
=
|
= new JCheckBox(TimeCalcProperty.CLOCK_HANDS_MINUTE_VISIBLE.getKey());
|
||||||
new JCheckBox(TimeCalcProperty.CLOCK_HANDS_MINUTE_VISIBLE.getKey());
|
|
||||||
private final JCheckBox clockHandsSecondVisibleProperty
|
private final JCheckBox clockHandsSecondVisibleProperty
|
||||||
=
|
= new JCheckBox(TimeCalcProperty.CLOCK_HANDS_SECOND_VISIBLE.getKey());
|
||||||
new JCheckBox(TimeCalcProperty.CLOCK_HANDS_SECOND_VISIBLE.getKey());
|
|
||||||
private final JCheckBox clockHandsMillisecondVisibleProperty
|
private final JCheckBox clockHandsMillisecondVisibleProperty
|
||||||
= new JCheckBox(
|
= new JCheckBox(
|
||||||
TimeCalcProperty.CLOCK_HANDS_MILLISECOND_VISIBLE.getKey());
|
TimeCalcProperty.CLOCK_HANDS_MILLISECOND_VISIBLE.getKey());
|
||||||
@ -88,16 +86,14 @@ public class ConfigWindow extends TWindow {
|
|||||||
private final JCheckBox clockCircleVisibleProperty
|
private final JCheckBox clockCircleVisibleProperty
|
||||||
= new JCheckBox(TimeCalcProperty.CLOCK_CIRCLE_VISIBLE.getKey());
|
= new JCheckBox(TimeCalcProperty.CLOCK_CIRCLE_VISIBLE.getKey());
|
||||||
private final JCheckBox clockCircleStrongBorderProperty
|
private final JCheckBox clockCircleStrongBorderProperty
|
||||||
=
|
= new JCheckBox(TimeCalcProperty.CLOCK_CIRCLE_STRONG_BORDER.getKey());
|
||||||
new JCheckBox(TimeCalcProperty.CLOCK_CIRCLE_STRONG_BORDER.getKey());
|
|
||||||
private final JColorChooser clockCircleBorderColorProperty
|
private final JColorChooser clockCircleBorderColorProperty
|
||||||
= new JColorChooser(Color.BLACK);
|
= new JColorChooser(Color.BLACK);
|
||||||
private final JCheckBox clockCentreCircleVisibleProperty
|
private final JCheckBox clockCentreCircleVisibleProperty
|
||||||
= new JCheckBox(
|
= new JCheckBox(
|
||||||
TimeCalcProperty.CLOCK_CENTRE_CIRCLE_VISIBLE.getKey());
|
TimeCalcProperty.CLOCK_CENTRE_CIRCLE_VISIBLE.getKey());
|
||||||
private final JCheckBox clockCentreCircleBlackProperty
|
private final JCheckBox clockCentreCircleBlackProperty
|
||||||
=
|
= new JCheckBox(TimeCalcProperty.CLOCK_CENTRE_CIRCLE_BLACK.getKey());
|
||||||
new JCheckBox(TimeCalcProperty.CLOCK_CENTRE_CIRCLE_BLACK.getKey());
|
|
||||||
private final JCheckBox clockProgressVisibleOnlyIfMouseMovingOverProperty
|
private final JCheckBox clockProgressVisibleOnlyIfMouseMovingOverProperty
|
||||||
= new JCheckBox(
|
= new JCheckBox(
|
||||||
TimeCalcProperty.CLOCK_PROGRESS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER
|
TimeCalcProperty.CLOCK_PROGRESS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER
|
||||||
@ -120,24 +116,24 @@ public class ConfigWindow extends TWindow {
|
|||||||
TimeCalcProperty.BATTERY_CHARGING_CHARACTER_VISIBLE.getKey());
|
TimeCalcProperty.BATTERY_CHARGING_CHARACTER_VISIBLE.getKey());
|
||||||
private final JCheckBox batteryNameVisibleProperty
|
private final JCheckBox batteryNameVisibleProperty
|
||||||
= new JCheckBox(TimeCalcProperty.BATTERY_NAME_VISIBLE.getKey());
|
= new JCheckBox(TimeCalcProperty.BATTERY_NAME_VISIBLE.getKey());
|
||||||
private final JCheckBox batteryLabelVisibleProperty =
|
private final JCheckBox batteryLabelVisibleProperty
|
||||||
new JCheckBox(TimeCalcProperty.BATTERY_LABEL_VISIBLE.getKey());
|
= new JCheckBox(TimeCalcProperty.BATTERY_LABEL_VISIBLE.getKey());
|
||||||
private final JCheckBox batteryVisibleProperty =
|
private final JCheckBox batteryVisibleProperty
|
||||||
new JCheckBox(TimeCalcProperty.BATTERY_VISIBLE.getKey());
|
= new JCheckBox(TimeCalcProperty.BATTERY_VISIBLE.getKey());
|
||||||
private final JCheckBox batteryMinuteVisibleProperty =
|
private final JCheckBox batteryMinuteVisibleProperty
|
||||||
new JCheckBox(TimeCalcProperty.BATTERY_MINUTE_VISIBLE.getKey());
|
= new JCheckBox(TimeCalcProperty.BATTERY_MINUTE_VISIBLE.getKey());
|
||||||
private final JCheckBox batteryHourVisibleProperty =
|
private final JCheckBox batteryHourVisibleProperty
|
||||||
new JCheckBox(TimeCalcProperty.BATTERY_HOUR_VISIBLE.getKey());
|
= new JCheckBox(TimeCalcProperty.BATTERY_HOUR_VISIBLE.getKey());
|
||||||
private final JCheckBox batteryDayVisibleProperty =
|
private final JCheckBox batteryDayVisibleProperty
|
||||||
new JCheckBox(TimeCalcProperty.BATTERY_DAY_VISIBLE.getKey());
|
= new JCheckBox(TimeCalcProperty.BATTERY_DAY_VISIBLE.getKey());
|
||||||
private final JCheckBox batteryWeekVisibleProperty =
|
private final JCheckBox batteryWeekVisibleProperty
|
||||||
new JCheckBox(TimeCalcProperty.BATTERY_WEEK_VISIBLE.getKey());
|
= new JCheckBox(TimeCalcProperty.BATTERY_WEEK_VISIBLE.getKey());
|
||||||
private final JCheckBox batteryMonthVisibleProperty =
|
private final JCheckBox batteryMonthVisibleProperty
|
||||||
new JCheckBox(TimeCalcProperty.BATTERY_MONTH_VISIBLE.getKey());
|
= new JCheckBox(TimeCalcProperty.BATTERY_MONTH_VISIBLE.getKey());
|
||||||
private final JCheckBox batteryYearVisibleProperty =
|
private final JCheckBox batteryYearVisibleProperty
|
||||||
new JCheckBox(TimeCalcProperty.BATTERY_YEAR_VISIBLE.getKey());
|
= new JCheckBox(TimeCalcProperty.BATTERY_YEAR_VISIBLE.getKey());
|
||||||
private final JCheckBox batteryBlinkingIfCriticalLowVisibleProperty =
|
private final JCheckBox batteryBlinkingIfCriticalLowVisibleProperty
|
||||||
new JCheckBox(
|
= new JCheckBox(
|
||||||
TimeCalcProperty.BATTERY_BLINKING_IF_CRITICAL_LOW.getKey());
|
TimeCalcProperty.BATTERY_BLINKING_IF_CRITICAL_LOW.getKey());
|
||||||
private final JCheckBox jokesVisibleProperty
|
private final JCheckBox jokesVisibleProperty
|
||||||
= new JCheckBox(TimeCalcProperty.JOKES_VISIBLE.getKey());
|
= new JCheckBox(TimeCalcProperty.JOKES_VISIBLE.getKey());
|
||||||
@ -177,6 +173,7 @@ public class ConfigWindow extends TWindow {
|
|||||||
= new JTextField(TimeCalcProperty.TEST_CLOCK_CUSTOM_SECOND.getKey());
|
= new JTextField(TimeCalcProperty.TEST_CLOCK_CUSTOM_SECOND.getKey());
|
||||||
private final JTextField testClockCustomMillisecondProperty
|
private final JTextField testClockCustomMillisecondProperty
|
||||||
= new JTextField(TimeCalcProperty.TEST_CLOCK_CUSTOM_MILLISECOND.getKey());
|
= new JTextField(TimeCalcProperty.TEST_CLOCK_CUSTOM_MILLISECOND.getKey());
|
||||||
|
|
||||||
public ConfigWindow(TimeCalcConfiguration timeCalcConfiguration) {
|
public ConfigWindow(TimeCalcConfiguration timeCalcConfiguration) {
|
||||||
this.timeCalcConfiguration = timeCalcConfiguration;
|
this.timeCalcConfiguration = timeCalcConfiguration;
|
||||||
setTitle("Configuration");
|
setTitle("Configuration");
|
||||||
@ -186,8 +183,8 @@ public class ConfigWindow extends TWindow {
|
|||||||
mainPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE,
|
mainPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE,
|
||||||
getHeight() - 6 * SwingUtils.MARGIN));
|
getHeight() - 6 * SwingUtils.MARGIN));
|
||||||
this.panelInsideScrollPane = new JPanel();
|
this.panelInsideScrollPane = new JPanel();
|
||||||
final BoxLayout boxLayout =
|
final BoxLayout boxLayout
|
||||||
new BoxLayout(panelInsideScrollPane, BoxLayout.Y_AXIS);
|
= new BoxLayout(panelInsideScrollPane, BoxLayout.Y_AXIS);
|
||||||
panelInsideScrollPane.setAlignmentX(LEFT_ALIGNMENT);
|
panelInsideScrollPane.setAlignmentX(LEFT_ALIGNMENT);
|
||||||
mainPanel.setAlignmentX(LEFT_ALIGNMENT);
|
mainPanel.setAlignmentX(LEFT_ALIGNMENT);
|
||||||
|
|
||||||
@ -226,8 +223,8 @@ public class ConfigWindow extends TWindow {
|
|||||||
mainPanel.add(scrollPane);
|
mainPanel.add(scrollPane);
|
||||||
|
|
||||||
for (boolean enable : new boolean[]{true, false}) {
|
for (boolean enable : new boolean[]{true, false}) {
|
||||||
TButton button =
|
TButton button
|
||||||
enable ? enableAsMuchAsPossible : disableAsMuchAsPossible;
|
= enable ? enableAsMuchAsPossible : disableAsMuchAsPossible;
|
||||||
|
|
||||||
button.addActionListener(e -> {
|
button.addActionListener(e -> {
|
||||||
visibilityDefaultProperty
|
visibilityDefaultProperty
|
||||||
@ -376,8 +373,8 @@ public class ConfigWindow extends TWindow {
|
|||||||
JComboBox jComboBox = ((JComboBox) p);
|
JComboBox jComboBox = ((JComboBox) p);
|
||||||
jComboBox.setMaximumSize(new Dimension(150, 25));
|
jComboBox.setMaximumSize(new Dimension(150, 25));
|
||||||
|
|
||||||
String timeCalcPropertyKey =
|
String timeCalcPropertyKey
|
||||||
(String) jComboBox.getClientProperty(
|
= (String) jComboBox.getClientProperty(
|
||||||
CLIENT_PROPERTY_KEY);
|
CLIENT_PROPERTY_KEY);
|
||||||
TimeCalcProperty timeCalcProperty
|
TimeCalcProperty timeCalcProperty
|
||||||
= TimeCalcProperty.forKey(timeCalcPropertyKey);
|
= TimeCalcProperty.forKey(timeCalcPropertyKey);
|
||||||
@ -428,11 +425,8 @@ public class ConfigWindow extends TWindow {
|
|||||||
panelInsideScrollPane.add(label);
|
panelInsideScrollPane.add(label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (timeCalcProperty == TimeCalcProperty.VISIBILITY_DEFAULT
|
||||||
timeCalcProperty == TimeCalcProperty.VISIBILITY_DEFAULT
|
|| timeCalcProperty == TimeCalcProperty.JOKES_VISIBLE) {
|
||||||
||
|
|
||||||
timeCalcProperty == TimeCalcProperty.JOKES_VISIBLE
|
|
||||||
) {
|
|
||||||
JLabel label = new JLabel("Misc");
|
JLabel label = new JLabel("Misc");
|
||||||
label.setFont(BIG_FONT);
|
label.setFont(BIG_FONT);
|
||||||
panelInsideScrollPane.add(label);
|
panelInsideScrollPane.add(label);
|
||||||
@ -442,8 +436,8 @@ public class ConfigWindow extends TWindow {
|
|||||||
JColorChooser colorChooser = ((JColorChooser) p);
|
JColorChooser colorChooser = ((JColorChooser) p);
|
||||||
//jColorChooser.setMaximumSize(new Dimension(150, 25));
|
//jColorChooser.setMaximumSize(new Dimension(150, 25));
|
||||||
|
|
||||||
String timeCalcPropertyKey =
|
String timeCalcPropertyKey
|
||||||
(String) colorChooser.getClientProperty(
|
= (String) colorChooser.getClientProperty(
|
||||||
CLIENT_PROPERTY_KEY);
|
CLIENT_PROPERTY_KEY);
|
||||||
TimeCalcProperty timeCalcProperty
|
TimeCalcProperty timeCalcProperty
|
||||||
= TimeCalcProperty.forKey(timeCalcPropertyKey);
|
= TimeCalcProperty.forKey(timeCalcPropertyKey);
|
||||||
@ -507,8 +501,8 @@ public class ConfigWindow extends TWindow {
|
|||||||
}
|
}
|
||||||
textField.setMaximumSize(new Dimension(150, 25));
|
textField.setMaximumSize(new Dimension(150, 25));
|
||||||
|
|
||||||
String timeCalcPropertyKey =
|
String timeCalcPropertyKey
|
||||||
(String) textField.getClientProperty(
|
= (String) textField.getClientProperty(
|
||||||
CLIENT_PROPERTY_KEY);
|
CLIENT_PROPERTY_KEY);
|
||||||
TimeCalcProperty timeCalcProperty
|
TimeCalcProperty timeCalcProperty
|
||||||
= TimeCalcProperty.forKey(timeCalcPropertyKey);
|
= TimeCalcProperty.forKey(timeCalcPropertyKey);
|
||||||
@ -517,19 +511,15 @@ public class ConfigWindow extends TWindow {
|
|||||||
.getProperty(timeCalcProperty).addListener(e -> {
|
.getProperty(timeCalcProperty).addListener(e -> {
|
||||||
|
|
||||||
textField.setText(isInteger
|
textField.setText(isInteger
|
||||||
?
|
? String.valueOf(timeCalcConfiguration
|
||||||
String.valueOf(timeCalcConfiguration
|
|
||||||
.getProperty(timeCalcProperty).getValue())
|
.getProperty(timeCalcProperty).getValue())
|
||||||
:
|
: (String) timeCalcConfiguration
|
||||||
(String) timeCalcConfiguration
|
|
||||||
.getProperty(timeCalcProperty).getValue());
|
.getProperty(timeCalcProperty).getValue());
|
||||||
});
|
});
|
||||||
textField.setText(isInteger
|
textField.setText(isInteger
|
||||||
?
|
? String.valueOf(timeCalcConfiguration
|
||||||
String.valueOf(timeCalcConfiguration
|
|
||||||
.getProperty(timeCalcProperty).getValue())
|
.getProperty(timeCalcProperty).getValue())
|
||||||
:
|
: (String) timeCalcConfiguration
|
||||||
(String) timeCalcConfiguration
|
|
||||||
.getProperty(timeCalcProperty).getValue());
|
.getProperty(timeCalcProperty).getValue());
|
||||||
|
|
||||||
textField.getDocument()
|
textField.getDocument()
|
||||||
@ -543,13 +533,14 @@ public class ConfigWindow extends TWindow {
|
|||||||
public void insertUpdate(DocumentEvent e) {
|
public void insertUpdate(DocumentEvent e) {
|
||||||
update(e);
|
update(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void update(DocumentEvent e) {
|
private void update(DocumentEvent e) {
|
||||||
String text = textField.getText();
|
String text = textField.getText();
|
||||||
boolean isInteger = Integer.class == timeCalcProperty.getClazz();
|
boolean isInteger = Integer.class == timeCalcProperty.getClazz();
|
||||||
timeCalcConfiguration
|
timeCalcConfiguration
|
||||||
.getProperty(timeCalcProperty)
|
.getProperty(timeCalcProperty)
|
||||||
.setValue(isInteger ? Integer.valueOf(text):
|
.setValue(isInteger ? Integer.valueOf(text)
|
||||||
text);
|
: text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@ public class HelpWindow extends TWindow {
|
|||||||
+ helpHtml + "</div>";
|
+ helpHtml + "</div>";
|
||||||
|
|
||||||
this.setLayout(null);
|
this.setLayout(null);
|
||||||
JScrollPane scrollPane =
|
JScrollPane scrollPane
|
||||||
new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
|
= new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
|
||||||
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
scrollPane.setBounds(1, 1,
|
scrollPane.setBounds(1, 1,
|
||||||
getWidth() - 2 * SwingUtils.MARGIN,
|
getWidth() - 2 * SwingUtils.MARGIN,
|
||||||
|
@ -80,6 +80,7 @@ public class MainWindow extends TWindow {
|
|||||||
this.elapsedTextField = new TTextField("", 100);
|
this.elapsedTextField = new TTextField("", 100);
|
||||||
this.remainingTextField = new TTextField("", 100);
|
this.remainingTextField = new TTextField("", 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MainWindow(String startTimeIn, String overTimeIn,
|
public MainWindow(String startTimeIn, String overTimeIn,
|
||||||
TimeCalcApp timeCalcApp) {
|
TimeCalcApp timeCalcApp) {
|
||||||
setFocusable(true);
|
setFocusable(true);
|
||||||
@ -145,8 +146,8 @@ public class MainWindow extends TWindow {
|
|||||||
Toaster.notificationsVisibleProperty.bindTo(timeCalcConfiguration.notificationsVisibleProperty);
|
Toaster.notificationsVisibleProperty.bindTo(timeCalcConfiguration.notificationsVisibleProperty);
|
||||||
|
|
||||||
Time time = new Time();
|
Time time = new Time();
|
||||||
TimeCalcKeyAdapter timeCalcKeyAdapter =
|
TimeCalcKeyAdapter timeCalcKeyAdapter
|
||||||
new TimeCalcKeyAdapter(timeCalcConfiguration, timeCalcApp,
|
= new TimeCalcKeyAdapter(timeCalcConfiguration, timeCalcApp,
|
||||||
this, time);
|
this, time);
|
||||||
addKeyListener(timeCalcKeyAdapter);
|
addKeyListener(timeCalcKeyAdapter);
|
||||||
|
|
||||||
@ -182,8 +183,8 @@ public class MainWindow extends TWindow {
|
|||||||
clock.setBounds(SwingUtils.MARGIN, SwingUtils.MARGIN, 200);
|
clock.setBounds(SwingUtils.MARGIN, SwingUtils.MARGIN, 200);
|
||||||
add(clock);
|
add(clock);
|
||||||
|
|
||||||
MinuteBattery minuteBattery =
|
MinuteBattery minuteBattery
|
||||||
new MinuteBattery(clock.getBounds().x + clock.getWidth() + SwingUtils.MARGIN,
|
= new MinuteBattery(clock.getBounds().x + clock.getWidth() + SwingUtils.MARGIN,
|
||||||
clock.getY(), BATTERY_WIDTH);
|
clock.getY(), BATTERY_WIDTH);
|
||||||
add(minuteBattery);
|
add(minuteBattery);
|
||||||
Battery hourBattery = new HourBattery(
|
Battery hourBattery = new HourBattery(
|
||||||
@ -330,7 +331,6 @@ public class MainWindow extends TWindow {
|
|||||||
exitButton.setBounds(saveButton.getX() + saveButton.getWidth() - activitiesButton.getWidth(), workDaysButton.getY(), activitiesButton.getWidth(), activitiesButton.getHeight());
|
exitButton.setBounds(saveButton.getX() + saveButton.getWidth() - activitiesButton.getWidth(), workDaysButton.getY(), activitiesButton.getWidth(), activitiesButton.getHeight());
|
||||||
restartButton.setBounds(exitButton.getX() - SwingUtils.MARGIN - activitiesButton.getWidth(), activitiesButton.getY(), activitiesButton.getWidth(), activitiesButton.getHeight());
|
restartButton.setBounds(exitButton.getX() - SwingUtils.MARGIN - activitiesButton.getWidth(), activitiesButton.getY(), activitiesButton.getWidth(), activitiesButton.getHeight());
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
helpButton.setBoundsFromTop(exitButton, 2);
|
helpButton.setBoundsFromTop(exitButton, 2);
|
||||||
focusButton.setBoundsFromLeft(helpButton);
|
focusButton.setBoundsFromLeft(helpButton);
|
||||||
@ -462,8 +462,8 @@ public class MainWindow extends TWindow {
|
|||||||
clock.visibleProperty
|
clock.visibleProperty
|
||||||
.bindTo(timeCalcConfiguration.clockVisibleProperty);
|
.bindTo(timeCalcConfiguration.clockVisibleProperty);
|
||||||
|
|
||||||
ComponentRegistry<Component> componentRegistry =
|
ComponentRegistry<Component> componentRegistry
|
||||||
new ComponentRegistry();
|
= new ComponentRegistry();
|
||||||
componentRegistry.addAll(this.getContentPane().getComponents());
|
componentRegistry.addAll(this.getContentPane().getComponents());
|
||||||
|
|
||||||
ComponentRegistry<TButton> buttonRegistry = new ComponentRegistry();
|
ComponentRegistry<TButton> buttonRegistry = new ComponentRegistry();
|
||||||
@ -858,16 +858,20 @@ public class MainWindow extends TWindow {
|
|||||||
|
|
||||||
this.configWindow.doDisableAlmostEverything();
|
this.configWindow.doDisableAlmostEverything();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void increaseArrivalByOneMinute() {
|
public void increaseArrivalByOneMinute() {
|
||||||
arrivalTextField.valueProperty.setValue(new TTime(this.arrivalTextField.valueProperty.getValue()).add(new TTime(0, 1)).toString().substring(0, 5));
|
arrivalTextField.valueProperty.setValue(new TTime(this.arrivalTextField.valueProperty.getValue()).add(new TTime(0, 1)).toString().substring(0, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void decreaseArrivalByOneMinute() {
|
public void decreaseArrivalByOneMinute() {
|
||||||
arrivalTextField.valueProperty.setValue(new TTime(this.arrivalTextField.valueProperty.getValue()).remove(new TTime(0, 1)).toString().substring(0, 5));
|
arrivalTextField.valueProperty.setValue(new TTime(this.arrivalTextField.valueProperty.getValue()).remove(new TTime(0, 1)).toString().substring(0, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void increaseOvertimeByOneMinute() {
|
public void increaseOvertimeByOneMinute() {
|
||||||
TTime newOvertime = new TTime(this.overtimeTextField.valueProperty.getValue()).add(new TTime(0, 1));
|
TTime newOvertime = new TTime(this.overtimeTextField.valueProperty.getValue()).add(new TTime(0, 1));
|
||||||
overtimeTextField.valueProperty.setValue(newOvertime.toString().substring(0, newOvertime.isNegative() ? 6 : 5));
|
overtimeTextField.valueProperty.setValue(newOvertime.toString().substring(0, newOvertime.isNegative() ? 6 : 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void decreaseOvertimeByOneMinute() {
|
public void decreaseOvertimeByOneMinute() {
|
||||||
TTime newOvertime = new TTime(this.overtimeTextField.valueProperty.getValue()).remove(new TTime(0, 1));
|
TTime newOvertime = new TTime(this.overtimeTextField.valueProperty.getValue()).remove(new TTime(0, 1));
|
||||||
overtimeTextField.valueProperty.setValue(newOvertime.toString().substring(0, newOvertime.isNegative() ? 6 : 5));
|
overtimeTextField.valueProperty.setValue(newOvertime.toString().substring(0, newOvertime.isNegative() ? 6 : 5));
|
||||||
|
@ -11,8 +11,8 @@ public class SwingUtils {
|
|||||||
|
|
||||||
public static final int MARGIN = 10;
|
public static final int MARGIN = 10;
|
||||||
public static final Font SMALL_FONT = new Font("sans", Font.BOLD, 10);
|
public static final Font SMALL_FONT = new Font("sans", Font.BOLD, 10);
|
||||||
public static final Font MEDIUM_MONOSPACE_FONT =
|
public static final Font MEDIUM_MONOSPACE_FONT
|
||||||
new Font(Font.MONOSPACED, Font.PLAIN, 12);
|
= new Font(Font.MONOSPACED, Font.PLAIN, 12);
|
||||||
|
|
||||||
private SwingUtils() {
|
private SwingUtils() {
|
||||||
//Not meant to be instantiated.
|
//Not meant to be instantiated.
|
||||||
|
@ -33,6 +33,7 @@ public class TButton extends JButton implements GetProperty {
|
|||||||
public TButton(String label) {
|
public TButton(String label) {
|
||||||
this(label, 0);
|
this(label, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TButton(String label, int customWidth) {
|
public TButton(String label, int customWidth) {
|
||||||
super(label);
|
super(label);
|
||||||
this.customWidth = customWidth;
|
this.customWidth = customWidth;
|
||||||
|
@ -21,6 +21,7 @@ public class TCheckBox extends JCheckBox implements GetProperty {
|
|||||||
private static final int HEIGHT = 30;
|
private static final int HEIGHT = 30;
|
||||||
private Color originalBackground;
|
private Color originalBackground;
|
||||||
private Color originalForeground;
|
private Color originalForeground;
|
||||||
|
|
||||||
public TCheckBox(String text) {
|
public TCheckBox(String text) {
|
||||||
this(text, false);
|
this(text, false);
|
||||||
}
|
}
|
||||||
@ -31,14 +32,15 @@ public class TCheckBox extends JCheckBox implements GetProperty {
|
|||||||
public StringProperty visibilityProperty
|
public StringProperty visibilityProperty
|
||||||
= new StringProperty("visibilityProperty",
|
= new StringProperty("visibilityProperty",
|
||||||
Visibility.STRONGLY_COLORED.name());
|
Visibility.STRONGLY_COLORED.name());
|
||||||
|
|
||||||
public TCheckBox(String text, boolean b) {
|
public TCheckBox(String text, boolean b) {
|
||||||
super(text, b);
|
super(text, b);
|
||||||
|
|
||||||
valueProperty.setValue(b);
|
valueProperty.setValue(b);
|
||||||
|
|
||||||
addActionListener(e -> valueProperty.setValue(isSelected()));
|
addActionListener(e -> valueProperty.setValue(isSelected()));
|
||||||
valueProperty.addListener(e ->
|
valueProperty.addListener(e
|
||||||
{
|
-> {
|
||||||
if (valueProperty.getValue().equals(getText())) {
|
if (valueProperty.getValue().equals(getText())) {
|
||||||
setSelected(valueProperty.isEnabled());
|
setSelected(valueProperty.isEnabled());
|
||||||
}
|
}
|
||||||
@ -64,6 +66,7 @@ public class TCheckBox extends JCheckBox implements GetProperty {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
public final BooleanProperty valueProperty = new BooleanProperty("");
|
public final BooleanProperty valueProperty = new BooleanProperty("");
|
||||||
|
|
||||||
public void setBounds(int x, int y) {
|
public void setBounds(int x, int y) {
|
||||||
setBounds(x, y, WIDTH, HEIGHT);
|
setBounds(x, y, WIDTH, HEIGHT);
|
||||||
this.originalBackground = getBackground();
|
this.originalBackground = getBackground();
|
||||||
@ -84,6 +87,7 @@ public class TCheckBox extends JCheckBox implements GetProperty {
|
|||||||
+ jComponent.getHeight()
|
+ jComponent.getHeight()
|
||||||
+ marginCount * SwingUtils.MARGIN);
|
+ marginCount * SwingUtils.MARGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOriginalBackground() {
|
public void setOriginalBackground() {
|
||||||
this.setBackground(originalBackground);
|
this.setBackground(originalBackground);
|
||||||
}
|
}
|
||||||
@ -91,6 +95,7 @@ public class TCheckBox extends JCheckBox implements GetProperty {
|
|||||||
public void setOriginalForeground() {
|
public void setOriginalForeground() {
|
||||||
this.setForeground(originalForeground);
|
this.setForeground(originalForeground);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Property getVisibilityProperty() {
|
public Property getVisibilityProperty() {
|
||||||
return visibilityProperty;
|
return visibilityProperty;
|
||||||
|
@ -29,9 +29,11 @@ public class TLabel extends JLabel implements GetProperty {
|
|||||||
public StringProperty visibilityProperty
|
public StringProperty visibilityProperty
|
||||||
= new StringProperty("visibilityProperty",
|
= new StringProperty("visibilityProperty",
|
||||||
Visibility.STRONGLY_COLORED.name());
|
Visibility.STRONGLY_COLORED.name());
|
||||||
|
|
||||||
public TLabel(String text) {
|
public TLabel(String text) {
|
||||||
this(text, 0);
|
this(text, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TLabel(String text, int customWidth) {
|
public TLabel(String text, int customWidth) {
|
||||||
super(text);
|
super(text);
|
||||||
this.customWidth = customWidth;
|
this.customWidth = customWidth;
|
||||||
@ -61,7 +63,6 @@ public class TLabel extends JLabel implements GetProperty {
|
|||||||
this.originalForeground = getForeground();
|
this.originalForeground = getForeground();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setBoundsFromLeft(JComponent jComponent) {
|
public void setBoundsFromLeft(JComponent jComponent) {
|
||||||
setBounds(jComponent.getX() + jComponent.getWidth() + SwingUtils.MARGIN,
|
setBounds(jComponent.getX() + jComponent.getWidth() + SwingUtils.MARGIN,
|
||||||
jComponent.getY());
|
jComponent.getY());
|
||||||
@ -76,6 +77,7 @@ public class TLabel extends JLabel implements GetProperty {
|
|||||||
+ jComponent.getHeight()
|
+ jComponent.getHeight()
|
||||||
+ marginCount * SwingUtils.MARGIN);
|
+ marginCount * SwingUtils.MARGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOriginalBackground() {
|
public void setOriginalBackground() {
|
||||||
this.setBackground(originalBackground);
|
this.setBackground(originalBackground);
|
||||||
}
|
}
|
||||||
@ -83,6 +85,7 @@ public class TLabel extends JLabel implements GetProperty {
|
|||||||
public void setOriginalForeground() {
|
public void setOriginalForeground() {
|
||||||
this.setForeground(originalForeground);
|
this.setForeground(originalForeground);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Property getVisibilityProperty() {
|
public Property getVisibilityProperty() {
|
||||||
return visibilityProperty;
|
return visibilityProperty;
|
||||||
|
@ -33,12 +33,15 @@ public class TTextField extends JTextField implements GetProperty {
|
|||||||
= new StringProperty("visibilityProperty",
|
= new StringProperty("visibilityProperty",
|
||||||
Visibility.STRONGLY_COLORED.name());
|
Visibility.STRONGLY_COLORED.name());
|
||||||
public final StringProperty valueProperty = new StringProperty();
|
public final StringProperty valueProperty = new StringProperty();
|
||||||
|
|
||||||
public TTextField() {
|
public TTextField() {
|
||||||
this("", 0);
|
this("", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TTextField(String s) {
|
public TTextField(String s) {
|
||||||
this(s, 0);
|
this(s, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TTextField(String s, int customWidth) {
|
public TTextField(String s, int customWidth) {
|
||||||
super(s);
|
super(s);
|
||||||
this.customWidth = customWidth;
|
this.customWidth = customWidth;
|
||||||
@ -56,13 +59,14 @@ public class TTextField extends JTextField implements GetProperty {
|
|||||||
public void insertUpdate(DocumentEvent e) {
|
public void insertUpdate(DocumentEvent e) {
|
||||||
update(e);
|
update(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void update(DocumentEvent e) {
|
private void update(DocumentEvent e) {
|
||||||
valueProperty.setValue(getText());
|
valueProperty.setValue(getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
valueProperty.addListener(e ->
|
valueProperty.addListener(e
|
||||||
{
|
-> {
|
||||||
if (!valueProperty.getValue().equals(getText())) {
|
if (!valueProperty.getValue().equals(getText())) {
|
||||||
setText(valueProperty.getValue());
|
setText(valueProperty.getValue());
|
||||||
}
|
}
|
||||||
@ -93,9 +97,11 @@ public class TTextField extends JTextField implements GetProperty {
|
|||||||
this.originalBackground = getBackground();
|
this.originalBackground = getBackground();
|
||||||
this.originalForeground = getForeground();
|
this.originalForeground = getForeground();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBoundsFromLeft(JComponent jComponent) {
|
public void setBoundsFromLeft(JComponent jComponent) {
|
||||||
setBoundsFromLeft(jComponent, 0);
|
setBoundsFromLeft(jComponent, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBoundsFromLeft(JComponent jComponent, int additionalY) {
|
public void setBoundsFromLeft(JComponent jComponent, int additionalY) {
|
||||||
setBounds(jComponent.getX() + jComponent.getWidth() + SwingUtils.MARGIN,
|
setBounds(jComponent.getX() + jComponent.getWidth() + SwingUtils.MARGIN,
|
||||||
jComponent.getY() + additionalY);
|
jComponent.getY() + additionalY);
|
||||||
@ -110,6 +116,7 @@ public class TTextField extends JTextField implements GetProperty {
|
|||||||
+ jComponent.getHeight()
|
+ jComponent.getHeight()
|
||||||
+ marginCount * SwingUtils.MARGIN);
|
+ marginCount * SwingUtils.MARGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOriginalBackground() {
|
public void setOriginalBackground() {
|
||||||
this.setBackground(originalBackground);
|
this.setBackground(originalBackground);
|
||||||
}
|
}
|
||||||
@ -117,6 +124,7 @@ public class TTextField extends JTextField implements GetProperty {
|
|||||||
public void setOriginalForeground() {
|
public void setOriginalForeground() {
|
||||||
this.setForeground(originalForeground);
|
this.setForeground(originalForeground);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Property getVisibilityProperty() {
|
public Property getVisibilityProperty() {
|
||||||
return visibilityProperty;
|
return visibilityProperty;
|
||||||
@ -126,9 +134,9 @@ public class TTextField extends JTextField implements GetProperty {
|
|||||||
public Property getVisibilitySupportedColoredProperty() {
|
public Property getVisibilitySupportedColoredProperty() {
|
||||||
return visibilitySupportedColoredProperty;
|
return visibilitySupportedColoredProperty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TTime asTTime() {
|
public TTime asTTime() {
|
||||||
return new TTime(valueProperty.getValue());
|
return new TTime(valueProperty.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ package org.nanoboot.utils.timecalc.swing.common;
|
|||||||
* // Show a simple toaster toasterManager.showToaster( new ImageIcon(
|
* // Show a simple toaster toasterManager.showToaster( new ImageIcon(
|
||||||
* "mylogo.gif" ), "A simple toaster with an image" ); } }
|
* "mylogo.gif" ), "A simple toaster with an image" ); } }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
@ -437,8 +436,7 @@ public class Toaster {
|
|||||||
stopYPosition = startYPosition - toasterHeight - 1;
|
stopYPosition = startYPosition - toasterHeight - 1;
|
||||||
if (currentNumberOfToaster > 0) {
|
if (currentNumberOfToaster > 0) {
|
||||||
stopYPosition
|
stopYPosition
|
||||||
=
|
= stopYPosition - (maxToaster % maxToasterInSceen
|
||||||
stopYPosition - (maxToaster % maxToasterInSceen
|
|
||||||
* toasterHeight);
|
* toasterHeight);
|
||||||
} else {
|
} else {
|
||||||
maxToaster = 0;
|
maxToaster = 0;
|
||||||
@ -449,8 +447,7 @@ public class Toaster {
|
|||||||
|
|
||||||
if (currentNumberOfToaster > 0) {
|
if (currentNumberOfToaster > 0) {
|
||||||
stopYPosition
|
stopYPosition
|
||||||
=
|
= stopYPosition + (maxToaster % maxToasterInSceen
|
||||||
stopYPosition + (maxToaster % maxToasterInSceen
|
|
||||||
* toasterHeight);
|
* toasterHeight);
|
||||||
} else {
|
} else {
|
||||||
maxToaster = 0;
|
maxToaster = 0;
|
||||||
|
@ -14,6 +14,7 @@ import java.util.Calendar;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public class WeekStatistics {
|
public class WeekStatistics {
|
||||||
|
|
||||||
private final boolean nowIsWeekend;
|
private final boolean nowIsWeekend;
|
||||||
private final int workDaysDone;
|
private final int workDaysDone;
|
||||||
private final int workDaysTotal;
|
private final int workDaysTotal;
|
||||||
@ -29,8 +30,8 @@ public class WeekStatistics {
|
|||||||
dayOfMonth <= time.asCalendar()
|
dayOfMonth <= time.asCalendar()
|
||||||
.getActualMaximum(Calendar.DAY_OF_MONTH);
|
.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||||
dayOfMonth++) {
|
dayOfMonth++) {
|
||||||
DayOfWeek dayOfWeek =
|
DayOfWeek dayOfWeek
|
||||||
LocalDate.of(analogClock.yearProperty.getValue(),
|
= LocalDate.of(analogClock.yearProperty.getValue(),
|
||||||
analogClock.monthProperty.getValue(),
|
analogClock.monthProperty.getValue(),
|
||||||
dayOfMonth)
|
dayOfMonth)
|
||||||
.getDayOfWeek();
|
.getDayOfWeek();
|
||||||
@ -53,8 +54,8 @@ public class WeekStatistics {
|
|||||||
.toString();
|
.toString();
|
||||||
this.nowIsWeekend = currentDayOfWeekAsString.equals("SATURDAY")
|
this.nowIsWeekend = currentDayOfWeekAsString.equals("SATURDAY")
|
||||||
|| currentDayOfWeekAsString.equals("SUNDAY");
|
|| currentDayOfWeekAsString.equals("SUNDAY");
|
||||||
workDaysTotalTmp =
|
workDaysTotalTmp
|
||||||
workDaysDoneTmp + (nowIsWeekend ? 0 : 1) + workDaysTodoTmp;
|
= workDaysDoneTmp + (nowIsWeekend ? 0 : 1) + workDaysTodoTmp;
|
||||||
this.workDaysDone = workDaysDoneTmp;
|
this.workDaysDone = workDaysDoneTmp;
|
||||||
this.workDaysTotal = workDaysTotalTmp;
|
this.workDaysTotal = workDaysTotalTmp;
|
||||||
// System.out.println("currentDayOfWeekAsString=" + currentDayOfWeekAsString);
|
// System.out.println("currentDayOfWeekAsString=" + currentDayOfWeekAsString);
|
||||||
|
@ -36,8 +36,8 @@ public class Widget extends JPanel implements
|
|||||||
protected static final Font BIG_FONT = new Font("sans", Font.BOLD, 24);
|
protected static final Font BIG_FONT = new Font("sans", Font.BOLD, 24);
|
||||||
protected static final Font MEDIUM_FONT = new Font("sans", Font.BOLD, 16);
|
protected static final Font MEDIUM_FONT = new Font("sans", Font.BOLD, 16);
|
||||||
|
|
||||||
public static final Color CLOSE_BUTTON_FOREGROUND_COLOR =
|
public static final Color CLOSE_BUTTON_FOREGROUND_COLOR
|
||||||
new Color(127, 127, 127);
|
= new Color(127, 127, 127);
|
||||||
public static final Color CLOSE_BUTTON_BACKGROUND_COLOR = Color.LIGHT_GRAY;
|
public static final Color CLOSE_BUTTON_BACKGROUND_COLOR = Color.LIGHT_GRAY;
|
||||||
public static final Color CLOSE_BUTTON_BACKGROUND_COLOR_MOUSE_OVER_CLOSE_ICON = new Color(255, 153, 153);
|
public static final Color CLOSE_BUTTON_BACKGROUND_COLOR_MOUSE_OVER_CLOSE_ICON = new Color(255, 153, 153);
|
||||||
public final BooleanProperty visibilitySupportedColoredProperty
|
public final BooleanProperty visibilitySupportedColoredProperty
|
||||||
@ -203,7 +203,6 @@ public class Widget extends JPanel implements
|
|||||||
// CLOSE_BUTTON_SIDE - 2);
|
// CLOSE_BUTTON_SIDE - 2);
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
brush.fillOval(width - CLOSE_BUTTON_SIDE - 1, 0 + 1, CLOSE_BUTTON_SIDE,
|
brush.fillOval(width - CLOSE_BUTTON_SIDE - 1, 0 + 1, CLOSE_BUTTON_SIDE,
|
||||||
CLOSE_BUTTON_SIDE);
|
CLOSE_BUTTON_SIDE);
|
||||||
brush.setColor(CLOSE_BUTTON_FOREGROUND_COLOR);
|
brush.setColor(CLOSE_BUTTON_FOREGROUND_COLOR);
|
||||||
@ -264,8 +263,8 @@ public class Widget extends JPanel implements
|
|||||||
brush.setColor(Color.BLACK);
|
brush.setColor(Color.BLACK);
|
||||||
}
|
}
|
||||||
Color currentColor = brush.getColor();
|
Color currentColor = brush.getColor();
|
||||||
brush.setColor(visibility.isStronglyColored() ? Color.WHITE :
|
brush.setColor(visibility.isStronglyColored() ? Color.WHITE
|
||||||
BACKGROUND_COLOR);
|
: BACKGROUND_COLOR);
|
||||||
brush.fillRect(
|
brush.fillRect(
|
||||||
x, y,
|
x, y,
|
||||||
20,
|
20,
|
||||||
@ -291,6 +290,7 @@ public class Widget extends JPanel implements
|
|||||||
this.add(smileyIcon);
|
this.add(smileyIcon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean changedInTheLastXMilliseconds(int milliseconds) {
|
protected boolean changedInTheLastXMilliseconds(int milliseconds) {
|
||||||
return (System.nanoTime() - lastUpdate) < milliseconds * 1000000;
|
return (System.nanoTime() - lastUpdate) < milliseconds * 1000000;
|
||||||
}
|
}
|
||||||
|
@ -102,22 +102,27 @@ public class AnalogClock extends Widget {
|
|||||||
-> customCircleColor = SwingUtils.getColorFromString(
|
-> customCircleColor = SwingUtils.getColorFromString(
|
||||||
centreCircleBorderColorProperty.getValue()));
|
centreCircleBorderColorProperty.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int computeStartAngle() {
|
private int computeStartAngle() {
|
||||||
return computeAngle(startHourProperty.getValue(), startMinuteProperty.getValue());
|
return computeAngle(startHourProperty.getValue(), startMinuteProperty.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private int computeEndAngle() {
|
private int computeEndAngle() {
|
||||||
return computeAngle(endHourProperty.getValue(), endMinuteProperty.getValue());
|
return computeAngle(endHourProperty.getValue(), endMinuteProperty.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private int computeAngle(TTime TTime) {
|
private int computeAngle(TTime TTime) {
|
||||||
if (TTime.getHour() > 12) {
|
if (TTime.getHour() > 12) {
|
||||||
TTime.setHour(TTime.getHour() - 12);
|
TTime.setHour(TTime.getHour() - 12);
|
||||||
}
|
}
|
||||||
return computeAngle(TTime.getHour(), TTime.getMinute());
|
return computeAngle(TTime.getHour(), TTime.getMinute());
|
||||||
}
|
}
|
||||||
|
|
||||||
private int computeAngle(int hour, int minute) {
|
private int computeAngle(int hour, int minute) {
|
||||||
return (int) ((hour + minute / 60d) / 12d
|
return (int) ((hour + minute / 60d) / 12d
|
||||||
* 360d);
|
* 360d);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
JFrame window = new JFrame("Analog Clock");
|
JFrame window = new JFrame("Analog Clock");
|
||||||
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
@ -187,7 +192,6 @@ public class AnalogClock extends Widget {
|
|||||||
if ((mouseOver || progressVisibleOnlyIfMouseMovingOverProperty
|
if ((mouseOver || progressVisibleOnlyIfMouseMovingOverProperty
|
||||||
.isDisabled()) && visibility.isStronglyColored()) {
|
.isDisabled()) && visibility.isStronglyColored()) {
|
||||||
|
|
||||||
|
|
||||||
Color currentColor = g2d.getColor();
|
Color currentColor = g2d.getColor();
|
||||||
g2d.setColor(Color.YELLOW);
|
g2d.setColor(Color.YELLOW);
|
||||||
int startAngle = computeStartAngle();
|
int startAngle = computeStartAngle();
|
||||||
@ -239,8 +243,8 @@ public class AnalogClock extends Widget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hourEnabledProperty.isEnabled()) {
|
if (hourEnabledProperty.isEnabled()) {
|
||||||
double hours =
|
double hours
|
||||||
hour / 12.0 + minute / 60.0 / 12 + second / 60 / 60 / 12;
|
= hour / 12.0 + minute / 60.0 / 12 + second / 60 / 60 / 12;
|
||||||
drawHand(g2d, side / 2 - 40,
|
drawHand(g2d, side / 2 - 40,
|
||||||
hours, 4.0f,
|
hours, 4.0f,
|
||||||
Color.BLACK, visibility);
|
Color.BLACK, visibility);
|
||||||
@ -256,8 +260,8 @@ public class AnalogClock extends Widget {
|
|||||||
if (borderOnlyHoursProperty.isEnabled() && minuteI % 5 != 0) {
|
if (borderOnlyHoursProperty.isEnabled() && minuteI % 5 != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
drawBorder(g2d, minuteI, minuteI % 5 == 0 ?
|
drawBorder(g2d, minuteI, minuteI % 5 == 0
|
||||||
(numbersVisibleProperty.isEnabled() ? 2f : 4f) : 1f,
|
? (numbersVisibleProperty.isEnabled() ? 2f : 4f) : 1f,
|
||||||
Color.BLACK, visibility);
|
Color.BLACK, visibility);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,9 +277,9 @@ public class AnalogClock extends Widget {
|
|||||||
Color currentColor = brush.getColor();
|
Color currentColor = brush.getColor();
|
||||||
Visibility visibility
|
Visibility visibility
|
||||||
= Visibility.valueOf(visibilityProperty.getValue());
|
= Visibility.valueOf(visibilityProperty.getValue());
|
||||||
brush.setColor(visibility.isStronglyColored() || mouseOver ?
|
brush.setColor(visibility.isStronglyColored() || mouseOver
|
||||||
(centreCircleBlackProperty.isEnabled() ? Color.BLACK :
|
? (centreCircleBlackProperty.isEnabled() ? Color.BLACK
|
||||||
Color.RED)
|
: Color.RED)
|
||||||
: FOREGROUND_COLOR);
|
: FOREGROUND_COLOR);
|
||||||
brush.fillOval(centerX - 3, centerY - 3, 8, 8);
|
brush.fillOval(centerX - 3, centerY - 3, 8, 8);
|
||||||
brush.setColor(currentColor);
|
brush.setColor(currentColor);
|
||||||
@ -285,13 +289,13 @@ public class AnalogClock extends Widget {
|
|||||||
float stroke, Color color, Visibility visibility) {
|
float stroke, Color color, Visibility visibility) {
|
||||||
double value = ((double) forMinute) / 60d;
|
double value = ((double) forMinute) / 60d;
|
||||||
boolean hourAngle = forMinute % 5 == 0;
|
boolean hourAngle = forMinute % 5 == 0;
|
||||||
int length = side / (numbersVisibleProperty.isEnabled() ? 18 :
|
int length = side / (numbersVisibleProperty.isEnabled() ? 18
|
||||||
(hourAngle ? 12 : 18));
|
: (hourAngle ? 12 : 18));
|
||||||
double angle = Math.PI * 2 * (value - 0.25);
|
double angle = Math.PI * 2 * (value - 0.25);
|
||||||
int startX =
|
int startX
|
||||||
(int) (getWidth() / 2 + (side / 2 - length) * Math.cos(angle));
|
= (int) (getWidth() / 2 + (side / 2 - length) * Math.cos(angle));
|
||||||
int startY =
|
int startY
|
||||||
(int) (getHeight() / 2 + (side / 2 - length) * Math.sin(angle));
|
= (int) (getHeight() / 2 + (side / 2 - length) * Math.sin(angle));
|
||||||
int endX = (int) (getWidth() / 2
|
int endX = (int) (getWidth() / 2
|
||||||
+ (side / 2 - length * 0.50d * (hourAngle ? 0.25 : 1))
|
+ (side / 2 - length * 0.50d * (hourAngle ? 0.25 : 1))
|
||||||
* Math.cos(angle));
|
* Math.cos(angle));
|
||||||
@ -312,8 +316,8 @@ public class AnalogClock extends Widget {
|
|||||||
int endX = (int) (getWidth() / 2 + length * Math.cos(angle));
|
int endX = (int) (getWidth() / 2 + length * Math.cos(angle));
|
||||||
int endY = (int) (getHeight() / 2 + length * Math.sin(angle));
|
int endY = (int) (getHeight() / 2 + length * Math.sin(angle));
|
||||||
|
|
||||||
brush.setColor((visibility.isStronglyColored() || mouseOver) ?
|
brush.setColor((visibility.isStronglyColored() || mouseOver)
|
||||||
(handsColoredProperty.isEnabled() ? color : Color.BLACK)
|
? (handsColoredProperty.isEnabled() ? color : Color.BLACK)
|
||||||
: FOREGROUND_COLOR);
|
: FOREGROUND_COLOR);
|
||||||
brush.setStroke(new BasicStroke(stroke));
|
brush.setStroke(new BasicStroke(stroke));
|
||||||
brush.drawLine(getWidth() / 2, getHeight() / 2, endX, endY);
|
brush.drawLine(getWidth() / 2, getHeight() / 2, endX, endY);
|
||||||
|
@ -39,24 +39,24 @@ public class Battery extends Widget {
|
|||||||
private final double[] randomDoubles
|
private final double[] randomDoubles
|
||||||
= new double[]{1d, 1d, 1d, 1d, 1d, 1d, 1};
|
= new double[]{1d, 1d, 1d, 1d, 1d, 1d, 1};
|
||||||
private final BooleanProperty blinking = new BooleanProperty("blinking");
|
private final BooleanProperty blinking = new BooleanProperty("blinking");
|
||||||
public BooleanProperty wavesVisibleProperty =
|
public BooleanProperty wavesVisibleProperty
|
||||||
new BooleanProperty(TimeCalcProperty.BATTERY_WAVES_VISIBLE
|
= new BooleanProperty(TimeCalcProperty.BATTERY_WAVES_VISIBLE
|
||||||
.getKey(), true);
|
.getKey(), true);
|
||||||
public BooleanProperty circleProgressVisibleProperty =
|
public BooleanProperty circleProgressVisibleProperty
|
||||||
new BooleanProperty(TimeCalcProperty.BATTERY_CIRCLE_PROGRESS_VISIBLE
|
= new BooleanProperty(TimeCalcProperty.BATTERY_CIRCLE_PROGRESS_VISIBLE
|
||||||
.getKey(), true);
|
.getKey(), true);
|
||||||
public BooleanProperty percentProgressVisibleProperty = new BooleanProperty(
|
public BooleanProperty percentProgressVisibleProperty = new BooleanProperty(
|
||||||
TimeCalcProperty.BATTERY_PERCENT_PROGRESS_VISIBLE
|
TimeCalcProperty.BATTERY_PERCENT_PROGRESS_VISIBLE
|
||||||
.getKey(), true);
|
.getKey(), true);
|
||||||
public BooleanProperty chargingCharacterVisibleProperty =
|
public BooleanProperty chargingCharacterVisibleProperty
|
||||||
new BooleanProperty(
|
= new BooleanProperty(
|
||||||
TimeCalcProperty.BATTERY_CHARGING_CHARACTER_VISIBLE
|
TimeCalcProperty.BATTERY_CHARGING_CHARACTER_VISIBLE
|
||||||
.getKey(), true);
|
.getKey(), true);
|
||||||
public BooleanProperty nameVisibleProperty =
|
public BooleanProperty nameVisibleProperty
|
||||||
new BooleanProperty(TimeCalcProperty.BATTERY_NAME_VISIBLE
|
= new BooleanProperty(TimeCalcProperty.BATTERY_NAME_VISIBLE
|
||||||
.getKey(), true);
|
.getKey(), true);
|
||||||
public BooleanProperty labelVisibleProperty =
|
public BooleanProperty labelVisibleProperty
|
||||||
new BooleanProperty(TimeCalcProperty.BATTERY_LABEL_VISIBLE
|
= new BooleanProperty(TimeCalcProperty.BATTERY_LABEL_VISIBLE
|
||||||
.getKey(), true);
|
.getKey(), true);
|
||||||
public BooleanProperty blinkingIfCriticalLowVisibleProperty
|
public BooleanProperty blinkingIfCriticalLowVisibleProperty
|
||||||
= new BooleanProperty(
|
= new BooleanProperty(
|
||||||
@ -139,8 +139,7 @@ public class Battery extends Widget {
|
|||||||
int intX = 1;
|
int intX = 1;
|
||||||
int todoHeight = totalHeight - doneHeight;
|
int todoHeight = totalHeight - doneHeight;
|
||||||
double surfacePower
|
double surfacePower
|
||||||
=
|
= 1;//donePercent < 0.5 ? 0.5 : donePercent;// (donePercent * 100 - ((int)(donePercent * 100)));
|
||||||
1;//donePercent < 0.5 ? 0.5 : donePercent;// (donePercent * 100 - ((int)(donePercent * 100)));
|
|
||||||
int waterSurfaceHeight
|
int waterSurfaceHeight
|
||||||
= (int) (4 * surfacePower);//2 + (int) (Math.random() * 3);
|
= (int) (4 * surfacePower);//2 + (int) (Math.random() * 3);
|
||||||
if (waterSurfaceHeight <= 2 || wavesVisibleProperty.isDisabled() || !changedInTheLastXMilliseconds(1000)) {
|
if (waterSurfaceHeight <= 2 || wavesVisibleProperty.isDisabled() || !changedInTheLastXMilliseconds(1000)) {
|
||||||
@ -250,8 +249,8 @@ public class Battery extends Widget {
|
|||||||
(donePercent == 1 ? 100 : (NumberFormats.FORMATTER_THREE_DECIMAL_PLACES
|
(donePercent == 1 ? 100 : (NumberFormats.FORMATTER_THREE_DECIMAL_PLACES
|
||||||
.format(donePercent * 100))) + "%",
|
.format(donePercent * 100))) + "%",
|
||||||
((int) (totalWidth * 0.15)),
|
((int) (totalWidth * 0.15)),
|
||||||
donePercent > 0.5 ? totalHeight / 4 * 3 :
|
donePercent > 0.5 ? totalHeight / 4 * 3
|
||||||
totalHeight / 4 * 1);
|
: totalHeight / 4 * 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labelVisibleProperty.isEnabled() && label != null && !label
|
if (labelVisibleProperty.isEnabled() && label != null && !label
|
||||||
@ -286,9 +285,9 @@ public class Battery extends Widget {
|
|||||||
private void paintCircleProgress(Graphics2D brush, Visibility visibility) {
|
private void paintCircleProgress(Graphics2D brush, Visibility visibility) {
|
||||||
Color currentColor = brush.getColor();
|
Color currentColor = brush.getColor();
|
||||||
brush.setColor(
|
brush.setColor(
|
||||||
visibility.isStronglyColored() ? HIGH_HIGHLIGHTED :
|
visibility.isStronglyColored() ? HIGH_HIGHLIGHTED
|
||||||
(visibility.isWeaklyColored() ? HIGH :
|
: (visibility.isWeaklyColored() ? HIGH
|
||||||
Color.lightGray));
|
: Color.lightGray));
|
||||||
|
|
||||||
double angleDouble = donePercent * 360;
|
double angleDouble = donePercent * 360;
|
||||||
|
|
||||||
@ -297,9 +296,8 @@ public class Battery extends Widget {
|
|||||||
15, 15, 90, -(int) angleDouble);
|
15, 15, 90, -(int) angleDouble);
|
||||||
brush.setColor(
|
brush.setColor(
|
||||||
visibility.isStronglyColored() ? LIGHT_RED
|
visibility.isStronglyColored() ? LIGHT_RED
|
||||||
:
|
: visibility.isWeaklyColored() ? ULTRA_LIGHT_RED
|
||||||
visibility.isWeaklyColored() ? ULTRA_LIGHT_RED :
|
: BACKGROUND_COLOR);
|
||||||
BACKGROUND_COLOR);
|
|
||||||
brush.fillArc(((int) (totalWidth * 0.45)) + 15,
|
brush.fillArc(((int) (totalWidth * 0.45)) + 15,
|
||||||
totalHeight / 4 * 3 + 28,
|
totalHeight / 4 * 3 + 28,
|
||||||
15, 15, 90, +(int) (360 - angleDouble));
|
15, 15, 90, +(int) (360 - angleDouble));
|
||||||
|
@ -14,8 +14,8 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class ProgressSmileyIcon extends javax.swing.ImageIcon {
|
public class ProgressSmileyIcon extends javax.swing.ImageIcon {
|
||||||
|
|
||||||
private static final Map<ProgressSmiley, ProgressSmileyIcon> cache =
|
private static final Map<ProgressSmiley, ProgressSmileyIcon> cache
|
||||||
new HashMap<>();
|
= new HashMap<>();
|
||||||
@Getter
|
@Getter
|
||||||
private final ProgressSmiley progressSmiley;
|
private final ProgressSmiley progressSmiley;
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -8,6 +8,7 @@ import java.util.Calendar;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class Time extends Thread {
|
public class Time extends Thread {
|
||||||
|
|
||||||
private final IntegerProperty yearReadWriteProperty
|
private final IntegerProperty yearReadWriteProperty
|
||||||
= new IntegerProperty("yearProperty");
|
= new IntegerProperty("yearProperty");
|
||||||
private final IntegerProperty monthReadWriteProperty
|
private final IntegerProperty monthReadWriteProperty
|
||||||
@ -74,6 +75,7 @@ public class Time extends Thread {
|
|||||||
cal.set(Calendar.MILLISECOND, millisecondProperty.getValue());
|
cal.set(Calendar.MILLISECOND, millisecondProperty.getValue());
|
||||||
return cal;
|
return cal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -114,6 +116,7 @@ public class Time extends Thread {
|
|||||||
+ dayOfWeekProperty.getValue() + " "
|
+ dayOfWeekProperty.getValue() + " "
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int returnCustomValueIfNeeded(Calendar cal, int timeUnit,
|
private int returnCustomValueIfNeeded(Calendar cal, int timeUnit,
|
||||||
IntegerProperty custom,
|
IntegerProperty custom,
|
||||||
ReadOnlyProperty<Integer> real) {
|
ReadOnlyProperty<Integer> real) {
|
||||||
|
@ -75,9 +75,9 @@ public class WalkingHumanProgress extends Widget implements
|
|||||||
Visibility visibility
|
Visibility visibility
|
||||||
= Visibility.valueOf(visibilityProperty.getValue());
|
= Visibility.valueOf(visibilityProperty.getValue());
|
||||||
|
|
||||||
brush.setColor(visibility.isStronglyColored() ? Color.BLUE :
|
brush.setColor(visibility.isStronglyColored() ? Color.BLUE
|
||||||
visibility.isWeaklyColored() ? Color.GRAY :
|
: visibility.isWeaklyColored() ? Color.GRAY
|
||||||
Color.LIGHT_GRAY);
|
: Color.LIGHT_GRAY);
|
||||||
// if(mouseOver) {
|
// if(mouseOver) {
|
||||||
// brush.drawRect(1,1,getWidth() - 2, getHeight() - 2);
|
// brush.drawRect(1,1,getWidth() - 2, getHeight() - 2);
|
||||||
// }
|
// }
|
||||||
|
@ -7,18 +7,19 @@ import java.io.File;
|
|||||||
* @since 21.02.2024
|
* @since 21.02.2024
|
||||||
*/
|
*/
|
||||||
public class FileConstants {
|
public class FileConstants {
|
||||||
|
|
||||||
public static final File TC_DIRECTORY = new File(".tc");
|
public static final File TC_DIRECTORY = new File(".tc");
|
||||||
public static final File STARTTIME_TXT =
|
public static final File STARTTIME_TXT
|
||||||
new File(TC_DIRECTORY, "starttime.txt");
|
= new File(TC_DIRECTORY, "starttime.txt");
|
||||||
public static final File OVERTIME_TXT =
|
public static final File OVERTIME_TXT
|
||||||
new File(TC_DIRECTORY, "overtime.txt");
|
= new File(TC_DIRECTORY, "overtime.txt");
|
||||||
public static final File TEST_TXT = new File(TC_DIRECTORY, "test.txt");
|
public static final File TEST_TXT = new File(TC_DIRECTORY, "test.txt");
|
||||||
public static final File TIME_CALC_PROFILES_TXT_FILE =
|
public static final File TIME_CALC_PROFILES_TXT_FILE
|
||||||
new File(TC_DIRECTORY, "time-calc-profiles.txt");
|
= new File(TC_DIRECTORY, "time-calc-profiles.txt");
|
||||||
public static final File TIME_CALC_CURRENT_PROFILE_TXT_FILE =
|
public static final File TIME_CALC_CURRENT_PROFILE_TXT_FILE
|
||||||
new File(TC_DIRECTORY, "time-calc-current-profile.txt");
|
= new File(TC_DIRECTORY, "time-calc-current-profile.txt");
|
||||||
public static final File FILE_WITHOUT_ANY_PROFILE =
|
public static final File FILE_WITHOUT_ANY_PROFILE
|
||||||
new File(TC_DIRECTORY, "timecalc.conf");
|
= new File(TC_DIRECTORY, "timecalc.conf");
|
||||||
public static final File JOKES_TXT = new File(TC_DIRECTORY, "time-calc-jokes.txt");
|
public static final File JOKES_TXT = new File(TC_DIRECTORY, "time-calc-jokes.txt");
|
||||||
|
|
||||||
private FileConstants() {
|
private FileConstants() {
|
||||||
|
@ -74,6 +74,7 @@ public class TTime implements Comparable<TTime> {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TTime of(Calendar cal) {
|
public static TTime of(Calendar cal) {
|
||||||
return new TTime(
|
return new TTime(
|
||||||
cal.get(Calendar.HOUR_OF_DAY),
|
cal.get(Calendar.HOUR_OF_DAY),
|
||||||
@ -81,6 +82,7 @@ public class TTime implements Comparable<TTime> {
|
|||||||
cal.get(Calendar.SECOND),
|
cal.get(Calendar.SECOND),
|
||||||
cal.get(Calendar.MILLISECOND));
|
cal.get(Calendar.MILLISECOND));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TTime of(Duration duration) {
|
public static TTime of(Duration duration) {
|
||||||
return new TTime(
|
return new TTime(
|
||||||
duration.get(ChronoUnit.HOURS),
|
duration.get(ChronoUnit.HOURS),
|
||||||
@ -88,6 +90,7 @@ public class TTime implements Comparable<TTime> {
|
|||||||
duration.get(ChronoUnit.SECONDS),
|
duration.get(ChronoUnit.SECONDS),
|
||||||
duration.get(ChronoUnit.MILLIS));
|
duration.get(ChronoUnit.MILLIS));
|
||||||
}
|
}
|
||||||
|
|
||||||
public TTime(String string) {
|
public TTime(String string) {
|
||||||
this.negative = string.startsWith("-");
|
this.negative = string.startsWith("-");
|
||||||
if (negative) {
|
if (negative) {
|
||||||
@ -99,9 +102,11 @@ public class TTime implements Comparable<TTime> {
|
|||||||
this.second = array.length >= 3 ? ((negative ? (1) : 1) * Integer.valueOf(array[2])) : 0;
|
this.second = array.length >= 3 ? ((negative ? (1) : 1) * Integer.valueOf(array[2])) : 0;
|
||||||
this.millisecond = array.length >= 4 ? ((negative ? (1) : 1) * Integer.valueOf(array[3])) : 0;
|
this.millisecond = array.length >= 4 ? ((negative ? (1) : 1) * Integer.valueOf(array[3])) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TTime(int hourIn, int minuteIn, int secondIn, int millisecondIn) {
|
public TTime(int hourIn, int minuteIn, int secondIn, int millisecondIn) {
|
||||||
this(false, hourIn, minuteIn, secondIn, millisecondIn);
|
this(false, hourIn, minuteIn, secondIn, millisecondIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TTime(boolean negative, int hourIn, int minuteIn, int secondIn, int millisecondIn) {
|
public TTime(boolean negative, int hourIn, int minuteIn, int secondIn, int millisecondIn) {
|
||||||
this.hour = Math.abs(hourIn);
|
this.hour = Math.abs(hourIn);
|
||||||
this.minute = Math.abs(minuteIn);
|
this.minute = Math.abs(minuteIn);
|
||||||
@ -117,6 +122,7 @@ public class TTime implements Comparable<TTime> {
|
|||||||
hour = hour - 1;
|
hour = hour - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TTime remove(TTime tTimeToBeRemoved) {
|
public TTime remove(TTime tTimeToBeRemoved) {
|
||||||
int s1 = this.toTotalMilliseconds();
|
int s1 = this.toTotalMilliseconds();
|
||||||
int s2 = tTimeToBeRemoved.toTotalMilliseconds();
|
int s2 = tTimeToBeRemoved.toTotalMilliseconds();
|
||||||
@ -166,6 +172,7 @@ public class TTime implements Comparable<TTime> {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return (negative ? "-" : "") + (hour < 10 ? "0" : "") + hour + ":" + (minute < 10 ? "0" : "") + minute + ":" + (second < 10 ? "0" : "") + second + ":" + (millisecond < 10 ? "00" : (millisecond < 100 ? "0" : "")) + millisecond;
|
return (negative ? "-" : "") + (hour < 10 ? "0" : "") + hour + ":" + (minute < 10 ? "0" : "") + minute + ":" + (second < 10 ? "0" : "") + second + ":" + (millisecond < 10 ? "00" : (millisecond < 100 ? "0" : "")) + millisecond;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Calendar asCalendar() {
|
public Calendar asCalendar() {
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
cal.set(Calendar.HOUR_OF_DAY, hour);
|
cal.set(Calendar.HOUR_OF_DAY, hour);
|
||||||
@ -174,9 +181,11 @@ public class TTime implements Comparable<TTime> {
|
|||||||
cal.set(Calendar.MILLISECOND, millisecond);
|
cal.set(Calendar.MILLISECOND, millisecond);
|
||||||
return cal;
|
return cal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date asDate() {
|
public Date asDate() {
|
||||||
return asCalendar().getTime();
|
return asCalendar().getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int toTotalMilliseconds() {
|
public int toTotalMilliseconds() {
|
||||||
return ((negative ? (-1) : 1)) * (hour * 60 * 60 * 1000 + minute * 60 * 1000 + second * 1000 + millisecond);
|
return ((negative ? (-1) : 1)) * (hour * 60 * 60 * 1000 + minute * 60 * 1000 + second * 1000 + millisecond);
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,11 @@ public class IntegerProperty extends Property<Integer> {
|
|||||||
this(name, 0);
|
this(name, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void increment() {this.setValue(getValue() + 1);}
|
public void increment() {
|
||||||
public void decrement() {this.setValue(getValue() - 1);}
|
this.setValue(getValue() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrement() {
|
||||||
|
this.setValue(getValue() - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ public class Property<T> {
|
|||||||
private final String name;
|
private final String name;
|
||||||
private final List<InvalidationListener> invalidationListeners
|
private final List<InvalidationListener> invalidationListeners
|
||||||
= new ArrayList<>();
|
= new ArrayList<>();
|
||||||
private final List<ChangeListener<T>> changeListeners =
|
private final List<ChangeListener<T>> changeListeners
|
||||||
new ArrayList<ChangeListener<T>>();
|
= new ArrayList<ChangeListener<T>>();
|
||||||
private boolean valid = true;
|
private boolean valid = true;
|
||||||
private T value;
|
private T value;
|
||||||
private Property<T> boundToProperty = null;
|
private Property<T> boundToProperty = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user