use of com.google.gwt.user.client.ui.Widget in project rstudio by rstudio.
the class FocusTransitionManager method register.
private void register(final Widget widget) {
if (registration_.contains(widget))
return;
registration_.add(widget);
widget.addDomHandler(new KeyDownHandler() {
@Override
public void onKeyDown(KeyDownEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_TAB) {
boolean forward = !event.isShiftKeyDown();
Widget target = get(widget, forward);
if (target == null)
return;
if (target instanceof CanFocus) {
event.stopPropagation();
event.preventDefault();
focus((CanFocus) target);
} else if (target instanceof Focusable) {
event.stopPropagation();
event.preventDefault();
focus((Focusable) target);
}
}
}
}, KeyDownEvent.getType());
}
use of com.google.gwt.user.client.ui.Widget in project rstudio by rstudio.
the class AutoHidingSplitLayoutPanel method setWidgetHidden.
@Override
public void setWidgetHidden(Widget widget, boolean hidden) {
LayoutData layoutData = (LayoutData) widget.getLayoutData();
if (layoutData.direction != Direction.CENTER) {
Widget splitter = getAssociatedSplitter(widget);
super.setWidgetHidden(splitter, hidden);
}
super.setWidgetHidden(widget, hidden);
}
use of com.google.gwt.user.client.ui.Widget in project gwt-test-utils by gwt-test-utils.
the class UiBinderInvocationHandler method addHandlers.
@SuppressWarnings("unchecked")
private <H extends EventHandler> void addHandlers(Object owner) {
Map<Method, UiHandler> uiHandlerMethods = GwtReflectionUtils.getAnnotatedMethod(owner.getClass(), UiHandler.class);
for (Map.Entry<Method, UiHandler> entry : uiHandlerMethods.entrySet()) {
for (String uiFieldName : entry.getValue().value()) {
Widget uiField = GwtReflectionUtils.getPrivateFieldValue(owner, uiFieldName);
GwtEvent.Type<H> eventType = (GwtEvent.Type<H>) getEventType(entry.getKey());
H handler = (H) createHandler(uiField, entry.getKey(), owner);
if (eventType instanceof DomEvent.Type) {
uiField.addDomHandler(handler, (DomEvent.Type<H>) eventType);
} else {
if (uiField instanceof HasValueChangeHandlers && handler instanceof ValueChangeHandler) {
((HasValueChangeHandlers<Object>) uiField).addValueChangeHandler((ValueChangeHandler<Object>) handler);
} else {
uiField.addHandler(handler, eventType);
}
}
}
}
}
use of com.google.gwt.user.client.ui.Widget in project gwt-test-utils by gwt-test-utils.
the class ButtonTest method click_ClickListener.
@Test
public void click_ClickListener() {
// Given
b.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
b.setHTML("clicked");
}
});
// Preconditions
assertThat(b.getHTML()).isEqualTo("");
// When
b.click();
// Then
assertThat(b.getHTML()).isEqualTo("clicked");
}
use of com.google.gwt.user.client.ui.Widget in project gerrit by GerritCodeReview.
the class LinkMenuBar method add.
public void add(final Widget i) {
if (body.getWidgetCount() > 0) {
final Widget p = body.getWidget(body.getWidgetCount() - 1);
p.addStyleName(Gerrit.RESOURCES.css().linkMenuItemNotLast());
}
body.add(i);
}
Aggregations