javafx.event.EventDispatcher Java Examples

The following examples show how to use javafx.event.EventDispatcher. 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: FXCanvasEx.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void setScene(Scene newScene) {
	Scene oldScene = getScene();
	if (oldScene != null) {
		// restore original event dispatcher
		EventDispatcher eventDispatcher = oldScene.getEventDispatcher();
		if (eventDispatcher instanceof EventDispatcherEx) {
			oldScene.setEventDispatcher(
					((EventDispatcherEx) eventDispatcher).dispose());
			// TODO: add listener to property to keep track of changes to
			// event dispatcher that removes our delegate?? (throw an
			// exception?)
		}
		if (JAVA_8) {
			oldScene.cursorProperty().removeListener(cursorChangeListener);
		}
	}
	super.setScene(newScene);
	if (newScene != null) {
		// wrap event dispatcher
		newScene.setEventDispatcher(
				new EventDispatcherEx(newScene.getEventDispatcher()));
		if (JAVA_8) {
			newScene.cursorProperty().addListener(cursorChangeListener);
		}
	}
}
 
Example #2
Source File: FXCanvasEx.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
protected EventDispatcherEx(EventDispatcher delegate) {
	this.delegate = delegate;
}
 
Example #3
Source File: FXCanvasEx.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
protected EventDispatcher dispose() {
	EventDispatcher d = delegate;
	delegate = null;
	return d;
}
 
Example #4
Source File: WebEventDispatcher.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
public WebEventDispatcher(EventDispatcher oldDispatcher) {
    this.oldDispatcher = oldDispatcher;
}
 
Example #5
Source File: GoogleMapView.java    From GMapsFX with Apache License 2.0 4 votes vote down vote up
public MyEventDispatcher(EventDispatcher originalDispatcher) {
    this.originalDispatcher = originalDispatcher;
}