use of com.google.gwt.event.shared.HandlerRegistration in project kie-wb-common by kiegroup.
the class ContainerListGroupItemTest method setup.
@Before
public void setup() throws Exception {
text.clear();
child = null;
beforeIndex = -1;
customGroupItem = new ContainerListGroupItem("item", command) {
public void setText(final String value) {
text.add(value);
}
public String getText() {
return text.get(0);
}
public void insert(final Widget _child, final int _beforeIndex) {
child = _child;
beforeIndex = _beforeIndex;
}
public HandlerRegistration addClickHandler(final ClickHandler handler) {
clickHandler = handler;
return new HandlerRegistration() {
@Override
public void removeHandler() {
}
};
}
};
}
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;
}
use of com.google.gwt.event.shared.HandlerRegistration in project lienzo-core by ahome-it.
the class WiresLayoutContainer method add.
@Override
public WiresLayoutContainer add(final IPrimitive<?> child, final LayoutContainer.Layout layout) {
if (null == child) {
throw new NullPointerException("Child cannot be null.");
}
if (null == child.getID()) {
child.setID(UUID.uuid());
}
addChild(child);
if (null != layout) {
final ChildEntry entry = new ChildEntry(child.getID(), layout);
children.add(entry);
for (final Attribute attribute : child.getTransformingAttributes()) {
final HandlerRegistration reg = child.addAttributesChangedHandler(attribute, ShapeAttributesChangedHandler);
registrations.put(new ObjectAttribute(child, attribute), reg);
attrHandlerRegs.register(reg);
}
doPositionChild(child, true);
}
return this;
}
use of com.google.gwt.event.shared.HandlerRegistration in project gwt-material by GwtMaterialDesign.
the class MaterialCollectionItem method onLoad.
@Override
protected void onLoad() {
super.onLoad();
HandlerRegistration handlerRegistration = addClickHandler(event -> {
// been clicked to avoid duplicate events.
if (Element.as(event.getNativeEvent().getEventTarget()) != getElement()) {
if (getType() == CollectionType.CHECKBOX) {
event.stopPropagation();
event.preventDefault();
}
}
for (Widget w : MaterialCollectionItem.this) {
if (w instanceof MaterialCollectionSecondary) {
for (Widget a : (MaterialCollectionSecondary) w) {
if (a instanceof HasValue) {
try {
@SuppressWarnings("unchecked") HasValue<Boolean> cb = (HasValue<Boolean>) a;
if (cb.getValue()) {
cb.setValue(false);
} else {
cb.setValue(true);
}
} catch (ClassCastException ex) {
// Ignore non-boolean has value handlers.
}
}
}
}
}
});
registerHandler(handlerRegistration);
JsMaterialElement.initDismissableCollection();
}
use of com.google.gwt.event.shared.HandlerRegistration in project ovirt-engine by oVirt.
the class BaseListModelSuggestBox method addValueChangeHandler.
@Override
public HandlerRegistration addValueChangeHandler(final ValueChangeHandler<T> handler) {
HandlerRegistration handlerRegistration = asSuggestBox().addValueChangeHandler(event -> {
try {
T value = asEntity(event.getValue());
handler.onValueChange(new ValueChangeEvent<T>(value) {
});
} catch (IllegalArgumentException e) {
// ignore - the user entered an incorrect string. Just do not notify the listeners
}
});
handlerRegistrations.add(handlerRegistration);
return handlerRegistration;
}
Aggregations