Skip to content

Commit

Permalink
added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
r0light committed Sep 9, 2019
1 parent 3001c84 commit 4592dca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;

/**
* This class can be used to wrap an @see ObservableList inside it. When wrapped, any Listener listening for updates to the wrapped ObservableList (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.
*
* @param <E> the type of the elements of the wrapped ObservableList.
*/
public class UiThreadObservableList<E> implements ObservableList<E> {

private final ObservableList<E> delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;

/**
* This class can be used to wrap a @see StringProperty inside it. When wrapped, any Listener listening for updates to the wrapped StringProperty (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 UiThreadStringProperty extends StringProperty {

private final StringProperty delegate;
Expand Down Expand Up @@ -45,7 +49,7 @@ public String get() {

@Override
public void set(String value) {
UiThreadHelper.ensureUiThreadExecution(() -> delegate.set(value));
delegate.set(value);
}

@Override
Expand Down

0 comments on commit 4592dca

Please sign in to comment.