Search in sources :

Example 1 with UiHandler

use of com.google.gwt.uibinder.client.UiHandler in project che by eclipse.

the class FindActionViewImpl method handleKeyDown.

@UiHandler("nameField")
void handleKeyDown(KeyDownEvent event) {
    switch(event.getNativeKeyCode()) {
        case KeyCodes.KEY_UP:
            event.stopPropagation();
            event.preventDefault();
            list.getSelectionModel().selectPrevious();
            return;
        case KeyCodes.KEY_DOWN:
            event.stopPropagation();
            event.preventDefault();
            list.getSelectionModel().selectNext();
            return;
        case KeyCodes.KEY_PAGEUP:
            event.stopPropagation();
            event.preventDefault();
            list.getSelectionModel().selectPreviousPage();
            return;
        case KeyCodes.KEY_PAGEDOWN:
            event.stopPropagation();
            event.preventDefault();
            list.getSelectionModel().selectNextPage();
            return;
        case KeyCodes.KEY_ENTER:
            event.stopPropagation();
            event.preventDefault();
            delegate.onActionSelected(list.getSelectionModel().getSelectedItem());
            return;
        case KeyCodes.KEY_ESCAPE:
            event.stopPropagation();
            event.preventDefault();
            hide();
            return;
    }
    Scheduler.get().scheduleDeferred(new Command() {

        @Override
        public void execute() {
            delegate.nameChanged(nameField.getText(), includeNonMenu.getValue());
        }
    });
}
Also used : Command(com.google.gwt.user.client.Command) UiHandler(com.google.gwt.uibinder.client.UiHandler)

Example 2 with UiHandler

use of com.google.gwt.uibinder.client.UiHandler in project che by eclipse.

the class QuickOpenViewImpl method handleKeyDown.

@UiHandler("nameField")
void handleKeyDown(KeyDownEvent event) {
    switch(event.getNativeKeyCode()) {
        case KeyCodes.KEY_UP:
            event.stopPropagation();
            event.preventDefault();
            list.getSelectionModel().selectPrevious();
            run(list.getSelectionModel().getSelectedItem(), false);
            return;
        case KeyCodes.KEY_DOWN:
            event.stopPropagation();
            event.preventDefault();
            list.getSelectionModel().selectNext();
            run(list.getSelectionModel().getSelectedItem(), false);
            return;
        case KeyCodes.KEY_PAGEUP:
            event.stopPropagation();
            event.preventDefault();
            list.getSelectionModel().selectPreviousPage();
            run(list.getSelectionModel().getSelectedItem(), false);
            return;
        case KeyCodes.KEY_PAGEDOWN:
            event.stopPropagation();
            event.preventDefault();
            list.getSelectionModel().selectNextPage();
            run(list.getSelectionModel().getSelectedItem(), false);
            return;
        case KeyCodes.KEY_ENTER:
            event.stopPropagation();
            event.preventDefault();
            run(list.getSelectionModel().getSelectedItem(), true);
            return;
        case KeyCodes.KEY_ESCAPE:
            event.stopPropagation();
            event.preventDefault();
            hide(true);
            return;
    }
    Scheduler.get().scheduleDeferred(new Command() {

        @Override
        public void execute() {
            delegate.valueChanged(nameField.getText());
        }
    });
}
Also used : Command(com.google.gwt.user.client.Command) UiHandler(com.google.gwt.uibinder.client.UiHandler)

Example 3 with UiHandler

use of com.google.gwt.uibinder.client.UiHandler in project jhybrid by Sfeir.

the class Calc method clicButton.

@UiHandler("button")
void clicButton(ClickEvent event) {
    CalcEngineImpl calcEngine = new CalcEngineImpl();
    String expr = text.getText();
    int result = calcEngine.evaluate(expr);
    label.setText("" + result);
}
Also used : CalcEngineImpl(com.sfeir.calc.CalcEngineImpl) UiHandler(com.google.gwt.uibinder.client.UiHandler)

Example 4 with UiHandler

use of com.google.gwt.uibinder.client.UiHandler in project platformlayer by platformlayer.

the class SplashPanelImpl method onGoButtonClick.

@UiHandler("goButton")
public void onGoButtonClick(ClickEvent e) {
    HomePlace root = new HomePlace(parent);
    app.goTo(root);
}
Also used : HomePlace(org.platformlayer.service.dns.client.home.HomePlace) UiHandler(com.google.gwt.uibinder.client.UiHandler)

Example 5 with UiHandler

use of com.google.gwt.uibinder.client.UiHandler 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);
                }
            }
        }
    }
}
Also used : Widget(com.google.gwt.user.client.ui.Widget) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) Method(java.lang.reflect.Method) UiHandler(com.google.gwt.uibinder.client.UiHandler) GwtEvent(com.google.gwt.event.shared.GwtEvent) HashMap(java.util.HashMap) Map(java.util.Map) HasValueChangeHandlers(com.google.gwt.event.logical.shared.HasValueChangeHandlers) DomEvent(com.google.gwt.event.dom.client.DomEvent)

Aggregations

UiHandler (com.google.gwt.uibinder.client.UiHandler)30 GerritUiExtensionPoint (com.google.gerrit.client.GerritUiExtensionPoint)5 CallbackGroup (com.google.gerrit.client.rpc.CallbackGroup)3 Command (com.google.gwt.user.client.Command)3 AccessSection (com.google.gerrit.common.data.AccessSection)2 ProjectAccess (com.google.gerrit.common.data.ProjectAccess)2 Theme (com.google.gerrit.extensions.client.Theme)2 CheckBox (com.gwtmobile.ui.client.widgets.CheckBox)2 RadioButton (com.gwtmobile.ui.client.widgets.RadioButton)2 ErrorDialog (com.google.gerrit.client.ErrorDialog)1 EditPreferences (com.google.gerrit.client.account.EditPreferences)1 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)1 NativeString (com.google.gerrit.client.rpc.NativeString)1 EditPreferencesInfo (com.google.gerrit.extensions.client.EditPreferencesInfo)1 KeyMapType (com.google.gerrit.extensions.client.KeyMapType)1 Change (com.google.gerrit.reviewdb.client.Change)1 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)1 JsArrayString (com.google.gwt.core.client.JsArrayString)1 DomEvent (com.google.gwt.event.dom.client.DomEvent)1 HasValueChangeHandlers (com.google.gwt.event.logical.shared.HasValueChangeHandlers)1