-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates to colored group indicator for cited entries (#7173)
- Loading branch information
1 parent
7f26a3a
commit 4d8e4f0
Showing
13 changed files
with
179 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/main/java/org/jabref/gui/util/uithreadaware/UiThreadBinding.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package org.jabref.gui.util.uithreadaware; | ||
|
||
import javafx.beans.InvalidationListener; | ||
import javafx.beans.binding.Binding; | ||
import javafx.beans.value.ChangeListener; | ||
import javafx.collections.ObservableList; | ||
|
||
/** | ||
* This class can be used to wrap a {@link Binding} inside it. When wrapped, any Listener listening for updates to the wrapped {@link Binding} (for example because of a binding to it) is ensured to be notified on the JavaFX Application Thread. It should be used to implement bindings where updates come in from a background thread but should be reflected in the UI where it is necessary that changes to the UI are performed on the JavaFX Application thread. | ||
*/ | ||
public class UiThreadBinding<T> implements Binding<T> { | ||
|
||
private final Binding<T> delegate; | ||
|
||
public UiThreadBinding(Binding<T> delegate) { | ||
this.delegate = delegate; | ||
} | ||
|
||
@Override | ||
public void addListener(InvalidationListener listener) { | ||
delegate.addListener(new UiThreadInvalidationListener(listener)); | ||
} | ||
|
||
@Override | ||
public void removeListener(InvalidationListener listener) { | ||
delegate.removeListener(listener); | ||
} | ||
|
||
@Override | ||
public void addListener(ChangeListener<? super T> listener) { | ||
delegate.addListener(new UiThreadChangeListener<>(listener)); | ||
} | ||
|
||
@Override | ||
public void removeListener(ChangeListener<? super T> listener) { | ||
delegate.removeListener(listener); | ||
} | ||
|
||
@Override | ||
public T getValue() { | ||
return delegate.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean isValid() { | ||
return delegate.isValid(); | ||
} | ||
|
||
@Override | ||
public void invalidate() { | ||
delegate.invalidate(); | ||
} | ||
|
||
@Override | ||
public ObservableList<?> getDependencies() { | ||
return delegate.getDependencies(); | ||
} | ||
|
||
@Override | ||
public void dispose() { | ||
delegate.dispose(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.