This type of event is generated when a layer is created, deleted, selected or moved.
Event registration can be done as follows, where this is the class that implements IEventSubscriber<ViewerWindowEvent>
EventBroadcaster.getInstance().subscribe(ViewerWindowEvent.class, this);In the example below, we want to be notified if a certain layer is deleted. We do this in method onEvent which implements the IEventSubscriber<ViewerWindowEvent> interface:
private IVisual myLayer; // the layer we want to keep track of public void onEvent(ViewerWindowEvent event) { if (event.getEventType().equals(ViewerWindowEvent.VISUALS_REMOVED_EVENT_TYPE)) { IVisual[] layers = event.getVisuals(); for (IVisual layer: layers) { if (layer == myLayer) { // do some cleanup EventBroadcaster.getInstance().unsubscribe(ViewerWindowEvent.class, this); myLayer = null; .... } } } }