Search in sources :

Example 11 with PatchMethod

use of com.googlecode.gwt.test.patchers.PatchMethod in project gwt-test-utils by gwt-test-utils.

the class XMLParserImplPatcher method setAttribute.

@PatchMethod
static void setAttribute(JavaScriptObject o, String name, String value) {
    PropertyContainer properties = JsoUtils.getDomProperties(o.<Element>cast());
    properties.put(name, value);
}
Also used : PropertyContainer(com.googlecode.gwt.test.internal.utils.PropertyContainer) PatchMethod(com.googlecode.gwt.test.patchers.PatchMethod)

Example 12 with PatchMethod

use of com.googlecode.gwt.test.patchers.PatchMethod in project gwt-test-utils by gwt-test-utils.

the class AutomaticPatcher method findPatchMethod.

private CtMethod findPatchMethod(CtMethod m) throws Exception {
    for (CtMethod patchMethod : patchMethods) {
        PatchMethod annotation = (PatchMethod) patchMethod.getAnnotation(PatchMethod.class);
        String methodName = (annotation.value().length() > 0) ? annotation.value() : patchMethod.getName();
        if (m.getName().equals(methodName) && hasCompatibleSignature(m, patchMethod)) {
            return patchMethod;
        }
    }
    return null;
}
Also used : PatchMethod(com.googlecode.gwt.test.patchers.PatchMethod) CtMethod(javassist.CtMethod)

Example 13 with PatchMethod

use of com.googlecode.gwt.test.patchers.PatchMethod in project gwt-test-utils by gwt-test-utils.

the class FormPanelPatcher method submit.

@PatchMethod
static void submit(FormPanel formPanel) {
    FormPanel.SubmitEvent event = new FormPanel.SubmitEvent();
    formPanel.fireEvent(event);
    if (!event.isCanceled()) {
        FormPanelImpl impl = GwtReflectionUtils.getPrivateFieldValue(formPanel, "impl");
        Element synthesizedFrame = GwtReflectionUtils.getPrivateFieldValue(formPanel, "synthesizedFrame");
        FormPanel.SubmitCompleteEvent completeEvent = createCompleteSubmitEvent(getResultsHtml(impl, synthesizedFrame));
        formPanel.fireEvent(completeEvent);
    }
}
Also used : FormPanel(com.google.gwt.user.client.ui.FormPanel) SubmitCompleteEvent(com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent) FormPanelImpl(com.google.gwt.user.client.ui.impl.FormPanelImpl) Element(com.google.gwt.dom.client.Element) PatchMethod(com.googlecode.gwt.test.patchers.PatchMethod)

Example 14 with PatchMethod

use of com.googlecode.gwt.test.patchers.PatchMethod in project gwt-test-utils by gwt-test-utils.

the class TimerPatcher method scheduleRepeating.

@PatchMethod
static void scheduleRepeating(final Timer timer, int periodMillis) throws Exception {
    if (periodMillis <= 0) {
        throw new IllegalArgumentException("must be positive");
    }
    TIMER_HOLDER.cancel(timer);
    java.util.Timer impl = new java.util.Timer();
    TIMER_HOLDER.hold(timer, impl);
    impl.scheduleAtFixedRate(new TimerTask() {

        @Override
        public void run() {
            timer.run();
        }
    }, periodMillis, periodMillis);
}
Also used : Timer(com.google.gwt.user.client.Timer) TimerTask(java.util.TimerTask) PatchMethod(com.googlecode.gwt.test.patchers.PatchMethod)

Example 15 with PatchMethod

use of com.googlecode.gwt.test.patchers.PatchMethod in project gwt-test-utils by gwt-test-utils.

the class TimerPatcher method schedule.

@PatchMethod
static void schedule(final Timer timer, int delayMillis) throws Exception {
    if (delayMillis <= 0) {
        throw new IllegalArgumentException("must be positive");
    }
    TIMER_HOLDER.cancel(timer);
    java.util.Timer impl = new java.util.Timer();
    TIMER_HOLDER.hold(timer, impl);
    impl.schedule(new TimerTask() {

        @Override
        public void run() {
            timer.run();
        }
    }, delayMillis);
}
Also used : Timer(com.google.gwt.user.client.Timer) TimerTask(java.util.TimerTask) PatchMethod(com.googlecode.gwt.test.patchers.PatchMethod)

Aggregations

PatchMethod (com.googlecode.gwt.test.patchers.PatchMethod)26 Element (com.google.gwt.dom.client.Element)8 Event (com.google.gwt.user.client.Event)3 PotentialElement (com.google.gwt.user.client.ui.PotentialElement)3 TableRowElement (com.google.gwt.dom.client.TableRowElement)2 Timer (com.google.gwt.user.client.Timer)2 GwtTestException (com.googlecode.gwt.test.exceptions.GwtTestException)2 GwtTestPatchException (com.googlecode.gwt.test.exceptions.GwtTestPatchException)2 TimerTask (java.util.TimerTask)2 CtClass (javassist.CtClass)2 CtMethod (javassist.CtMethod)2 GWT (com.google.gwt.core.client.GWT)1 BodyElement (com.google.gwt.dom.client.BodyElement)1 IFrameElement (com.google.gwt.dom.client.IFrameElement)1 Node (com.google.gwt.dom.client.Node)1 AutoDirectionHandler (com.google.gwt.i18n.client.AutoDirectionHandler)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 EventListener (com.google.gwt.user.client.EventListener)1 FormPanel (com.google.gwt.user.client.ui.FormPanel)1 SubmitCompleteEvent (com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent)1