Added new improvements
This commit is contained in:
parent
2f7f070c80
commit
b9f27fb1c4
@ -16,7 +16,7 @@ import java.io.IOException;
|
||||
public class TimeCalcApp {
|
||||
|
||||
public StringProperty visibilityProperty =
|
||||
new StringProperty("timeCalcApp.visibilityReadWriteProperty",
|
||||
new StringProperty("timeCalcApp.visibilityProperty",
|
||||
Visibility.WEAKLY_COLORED.name());
|
||||
private long startNanoTime = 0l;
|
||||
|
||||
|
@ -56,7 +56,6 @@ public class TimeCalcManager {
|
||||
private final TimeHM startTime;
|
||||
private final TimeHM overtime;
|
||||
private final TimeHM endTime;
|
||||
private final TimeCalcApp timeCalcApp;
|
||||
private boolean stopBeforeEnd = false;
|
||||
private final Time time = new Time();
|
||||
private final TimeCalcConfiguration timeCalcConfiguration =
|
||||
@ -64,7 +63,6 @@ public class TimeCalcManager {
|
||||
|
||||
public TimeCalcManager(String startTimeIn, String overTimeIn,
|
||||
TimeCalcApp timeCalcApp) {
|
||||
this.timeCalcApp = timeCalcApp;
|
||||
timeCalcConfiguration
|
||||
.setFromTimeCalcProperties(TimeCalcProperties.getInstance());
|
||||
// Utils.everythingHidden
|
||||
@ -101,6 +99,10 @@ public class TimeCalcManager {
|
||||
//window.add(weatherButton);
|
||||
window.addAll(configButton, commandButton, jokeButton, restartButton,
|
||||
exitButton);
|
||||
boolean onlyGreyOrNone = timeCalcConfiguration.visibilityOnlyGreyOrNoneEnabledProperty.isEnabled();
|
||||
if(onlyGreyOrNone) {
|
||||
timeCalcApp.visibilityProperty.setValue(Visibility.GRAY.name());
|
||||
}
|
||||
window.addKeyListener(new KeyAdapter() {
|
||||
// Key Pressed method
|
||||
public void keyPressed(KeyEvent e) {
|
||||
@ -108,7 +110,7 @@ public class TimeCalcManager {
|
||||
.valueOf(timeCalcApp.visibilityProperty.getValue());
|
||||
if (e.getKeyCode() == KeyEvent.VK_UP) {
|
||||
timeCalcApp.visibilityProperty
|
||||
.setValue(Visibility.STRONGLY_COLORED.name());
|
||||
.setValue(onlyGreyOrNone ? Visibility.GRAY.name() : Visibility.STRONGLY_COLORED.name());
|
||||
}
|
||||
if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
||||
timeCalcApp.visibilityProperty
|
||||
@ -117,14 +119,14 @@ public class TimeCalcManager {
|
||||
if (e.getKeyCode() == KeyEvent.VK_H) {
|
||||
if (visibility.isNone()) {
|
||||
timeCalcApp.visibilityProperty
|
||||
.setValue(Visibility.STRONGLY_COLORED.name());
|
||||
.setValue(onlyGreyOrNone ? Visibility.GRAY.name() : Visibility.STRONGLY_COLORED.name());
|
||||
} else {
|
||||
timeCalcApp.visibilityProperty
|
||||
.setValue(Visibility.NONE.name());
|
||||
}
|
||||
}
|
||||
if (e.getKeyCode() == KeyEvent.VK_G) {
|
||||
if (visibility.isGray()) {
|
||||
if (visibility.isGray() && !onlyGreyOrNone) {
|
||||
timeCalcApp.visibilityProperty
|
||||
.setValue(Visibility.WEAKLY_COLORED.name());
|
||||
} else {
|
||||
@ -134,18 +136,25 @@ public class TimeCalcManager {
|
||||
}
|
||||
|
||||
if (e.getKeyCode() == KeyEvent.VK_C) {
|
||||
if (visibility.isStronglyColored()) {
|
||||
timeCalcApp.visibilityProperty
|
||||
.setValue(Visibility.WEAKLY_COLORED.name());
|
||||
} else {
|
||||
timeCalcApp.visibilityProperty
|
||||
.setValue(Visibility.STRONGLY_COLORED.name());
|
||||
if(!onlyGreyOrNone) {
|
||||
if (visibility.isStronglyColored()) {
|
||||
timeCalcApp.visibilityProperty
|
||||
.setValue(Visibility.WEAKLY_COLORED.name());
|
||||
} else {
|
||||
timeCalcApp.visibilityProperty
|
||||
.setValue(
|
||||
Visibility.STRONGLY_COLORED.name());
|
||||
}
|
||||
}
|
||||
else {
|
||||
timeCalcApp.visibilityProperty.setValue(Visibility.GRAY
|
||||
.name());
|
||||
}
|
||||
}
|
||||
if (e.getKeyCode() == KeyEvent.VK_V) {
|
||||
if (visibility.isNone()) {
|
||||
timeCalcApp.visibilityProperty
|
||||
.setValue(Visibility.STRONGLY_COLORED.name());
|
||||
.setValue(onlyGreyOrNone ? Visibility.GRAY.name() : Visibility.STRONGLY_COLORED.name());
|
||||
} else {
|
||||
timeCalcApp.visibilityProperty
|
||||
.setValue(Visibility.NONE.name());
|
||||
@ -154,7 +163,7 @@ public class TimeCalcManager {
|
||||
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
|
||||
if (visibility.isStronglyColored()) {
|
||||
timeCalcApp.visibilityProperty
|
||||
.setValue(Visibility.WEAKLY_COLORED.name());
|
||||
.setValue(onlyGreyOrNone ? Visibility.GRAY.name() : Visibility.WEAKLY_COLORED.name());
|
||||
}
|
||||
if (visibility.isWeaklyColored()) {
|
||||
timeCalcApp.visibilityProperty
|
||||
@ -166,7 +175,7 @@ public class TimeCalcManager {
|
||||
}
|
||||
if (visibility.isNone()) {
|
||||
timeCalcApp.visibilityProperty
|
||||
.setValue(Visibility.STRONGLY_COLORED.name());
|
||||
.setValue(onlyGreyOrNone ? Visibility.GRAY.name() : Visibility.STRONGLY_COLORED.name());
|
||||
}
|
||||
}
|
||||
if (e.getKeyCode() == KeyEvent.VK_R) {
|
||||
|
@ -20,6 +20,7 @@ public class Property<T> {
|
||||
new ArrayList<>();
|
||||
private final List<ChangeListener<T>>
|
||||
changeListeners = new ArrayList<ChangeListener<T>>();
|
||||
private ChangeListener<T> boundChangeListener = null;
|
||||
|
||||
public Property(String name, T valueIn) {
|
||||
this.name = name;
|
||||
@ -43,17 +44,21 @@ public class Property<T> {
|
||||
throw new TimeCalcException("No bound property");
|
||||
}
|
||||
this.value = boundToProperty.value;
|
||||
this.boundToProperty.removeListener(this.boundChangeListener);
|
||||
this.boundChangeListener = null;
|
||||
this.boundToProperty = null;
|
||||
}
|
||||
|
||||
public void bindTo(Property<T> anotherProperty) {
|
||||
this.boundToProperty = anotherProperty;
|
||||
this.boundToProperty
|
||||
.addListener((Property<T> p, T oldValue, T newValue) -> {
|
||||
this.boundChangeListener =
|
||||
(Property<T> p, T oldValue, T newValue) -> {
|
||||
this.markInvalid();
|
||||
this.fireValueChangedEvent(oldValue);
|
||||
//System.out.println("bindTo markInvalid " + p.getName() + " " + p.getValue());
|
||||
});
|
||||
};
|
||||
this.boundToProperty
|
||||
.addListener(boundChangeListener);
|
||||
}
|
||||
|
||||
public T getValue() {
|
||||
@ -101,4 +106,8 @@ public class Property<T> {
|
||||
this.changeListeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeListener(ChangeListener<T> listener) {
|
||||
this.changeListeners.remove(listener);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ clock.hands.second.enabled=true
|
||||
clock.hands.millisecond.enabled=false
|
||||
battery.waves.enabled=true
|
||||
default-visibility=STRONGLY_COLORED
|
||||
visibility.only-grey-or-none.enabled=false
|
||||
visibility.only-grey-or-none.enabled=true
|
||||
jokes.enabled=true
|
||||
commands.enabled=true
|
||||
toasts.enabled=true
|
||||
|
Loading…
x
Reference in New Issue
Block a user