Java Code Examples for javafx.beans.property.SetProperty#set()

The following examples show how to use javafx.beans.property.SetProperty#set() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SetPropertyExTests.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void changeListenerRegistrationAndDeregistration() {
	SetProperty<Integer> property = propertyProvider.get();

	// register listener
	ChangeExpector<Integer> changeListener = null;
	changeListener = new ChangeExpector<>(property);
	property.addListener(changeListener);

	// add second listener (and remove again)
	ChangeExpector<Integer> changeListener2 = null;
	changeListener2 = new ChangeExpector<>(property);
	property.addListener(changeListener2);
	property.removeListener(changeListener2);

	ObservableSet<Integer> newValue = FXCollections
			.observableSet(new HashSet<Integer>());
	changeListener.addExpectation(property.get(), newValue);
	newValue.add(1);
	property.set(newValue);
	changeListener.check();
}