use of com.google.gwt.event.shared.HandlerRegistration in project rstudio by rstudio.
the class AceEditorBackgroundLinkHighlighter method onAttachOrDetach.
// Event Handlers ---
@Override
public void onAttachOrDetach(AttachEvent event) {
if (event.isAttached()) {
previewHandler_ = Event.addNativePreviewHandler(new NativePreviewHandler() {
@Override
public void onPreviewNativeEvent(NativePreviewEvent preview) {
int type = preview.getTypeInt();
if (type == Event.ONKEYDOWN) {
int modifier = KeyboardShortcut.getModifierValue(preview.getNativeEvent());
beginDetectClickTarget(mouseTracker_.getLastMouseX(), mouseTracker_.getLastMouseY(), modifier);
} else if (type == Event.ONKEYUP) {
endDetectClickTarget();
}
}
});
} else {
for (HandlerRegistration handler : handlers_) handler.removeHandler();
handlers_.clear();
if (previewHandler_ != null) {
previewHandler_.removeHandler();
previewHandler_ = null;
}
}
}
use of com.google.gwt.event.shared.HandlerRegistration in project rstudio by rstudio.
the class EventBus method addHandler.
/**
* Similar to 2-arg form of addHandler, but automatically removes handler
* when the HasAttachHandlers object detaches.
*
* If the HasAttachHandlers object detaches and reattaches, the handler
* will NOT automatically resubscribe.
*/
public <H extends EventHandler> void addHandler(HasAttachHandlers removeWhenDetached, Type<H> type, H handler) {
final HandlerRegistration reg = addHandler(type, handler);
removeWhenDetached.addAttachHandler(new Handler() {
@Override
public void onAttachOrDetach(AttachEvent event) {
if (!event.isAttached())
reg.removeHandler();
}
});
}
use of com.google.gwt.event.shared.HandlerRegistration in project opennms by OpenNMS.
the class LocationPanel method setEventBus.
/**
* <p>setEventBus</p>
*
* @param eventBus a {@link com.google.gwt.event.shared.HandlerManager} object.
*/
public void setEventBus(final HandlerManager eventBus) {
// Remove any existing handler registrations
for (HandlerRegistration registration : eventRegistrations) {
registration.removeHandler();
}
m_eventBus = eventBus;
m_eventBus.addHandler(TagResizeEvent.TYPE, this);
filterPanel.setEventBus(eventBus);
tagPanel.setEventBus(eventBus);
applicationList.setEventBus(eventBus);
// eventRegistrations.add(m_eventBus.addHandler(MapPanelBoundsChangedEvent.TYPE, this));
// eventRegistrations.add(m_eventBus.addHandler(LocationsUpdatedEvent.TYPE, this));
}
use of com.google.gwt.event.shared.HandlerRegistration in project kie-wb-common by kiegroup.
the class AbstractGroupItem method registerMouseEnterHandler.
protected HandlerRegistration registerMouseEnterHandler(final NodeMouseEnterHandler handler) {
assert null != handler;
HandlerRegistration reg = getPrimitive().setListening(true).addNodeMouseEnterHandler(handler);
register(reg);
return reg;
}
use of com.google.gwt.event.shared.HandlerRegistration in project activityinfo by bedatadriven.
the class FilterPanelSet method ensureHandlers.
private HandlerManager ensureHandlers() {
if (manager == null) {
manager = new HandlerManager(this);
myRegistrations = new ArrayList<HandlerRegistration>();
for (FilterPanel panel : panels) {
HandlerRegistration registration = panel.addValueChangeHandler(new ValueChangeHandler<Filter>() {
@Override
public void onValueChange(ValueChangeEvent<Filter> event) {
// or indicator (reports) is selected
if (event.getSource() instanceof ActivityFilterPanel || event.getSource() instanceof IndicatorFilterPanel) {
clearAttributeAndPartnerFilters();
}
Filter value = composeFilter(new Filter(), null);
Log.debug("FilterPanelSet: Filter changed = " + value);
ValueChangeEvent.fire(FilterPanelSet.this, value);
}
});
myRegistrations.add(registration);
}
}
return manager;
}
Aggregations