use of com.googlecode.gwt.test.patchers.InitMethod in project gwt-test-utils by gwt-test-utils.
the class WidgetPatcher method initClass.
@InitMethod
static void initClass(CtClass c) throws CannotCompileException, NotFoundException {
// add behavior to Widget.onAttach method
CtMethod onAttach = c.getMethod("onAttach", "()V");
onAttach.insertBefore(GwtFinder.class.getName() + ".onAttach(this);");
// add behavior to RadioButton.setName method
CtMethod onDetach = c.getMethod("onDetach", "()V");
onDetach.insertBefore(GwtFinder.class.getName() + ".onDetach(this);");
}
use of com.googlecode.gwt.test.patchers.InitMethod in project gwt-test-utils by gwt-test-utils.
the class DomEventPatcher method initClass.
@InitMethod
static void initClass(CtClass c) throws CannotCompileException, NotFoundException {
CtMethod fireNativeEvent = c.getMethod("fireNativeEvent", "(Lcom/google/gwt/dom/client/NativeEvent;Lcom/google/gwt/event/shared/HasHandlers;Lcom/google/gwt/dom/client/Element;)V");
// fire browser event loop first because some command or async callback may modify the DOM
// structure + fire NativePreviewHandler
fireNativeEvent.insertBefore(BrowserSimulatorImpl.class.getName() + ".get().fireLoopEnd(); " + DomEventPatcher.class.getName() + ".triggerNativeEvent($1, $3);");
// fire browser event loop at the end because some command may have been scheduled or RPC call
// made when the event was dispatched.
fireNativeEvent.insertAfter(BrowserSimulatorImpl.class.getName() + ".get().fireLoopEnd();");
}
use of com.googlecode.gwt.test.patchers.InitMethod in project gwt-test-utils by gwt-test-utils.
the class GwtDotCreateProviderPatcher method initClass.
@InitMethod
static void initClass(CtClass ctClass) throws CannotCompileException {
CtField field = CtField.make("private Class " + BINDED_CLASS_FIELD + ";", ctClass);
ctClass.addField(field);
}
use of com.googlecode.gwt.test.patchers.InitMethod in project gwt-test-utils by gwt-test-utils.
the class RadioButtonPatcher method initClass.
@InitMethod
static void initClass(CtClass c) throws CannotCompileException, NotFoundException {
// add overrided RadioButton.setValue method
CtMethod setValue = CtMethod.make("public void setValue(Boolean value, boolean fireEvents) { super.setValue($1, $2); " + RadioButtonManager.class.getName() + ".onRadioGroupChanged(this, $1, $2); }", c);
c.addMethod(setValue);
// add behavior to RadioButton.setName method
CtMethod setName = c.getMethod("setName", "(Ljava/lang/String;)V");
setName.insertBefore(RadioButtonManager.class.getName() + ".beforeSetName(this, $1);");
// Add overrided RadioButton.onLoad method
CtMethod onLoad = CtMethod.make("protected void onLoad() { super.onLoad(); " + RadioButtonManager.class.getName() + ".onLoad(this); }", c);
c.addMethod(onLoad);
// Add overrided RadioButton.onUnLoad method
CtMethod onUnload = CtMethod.make("protected void onUnLoad() { super.onUnload(); " + RadioButtonManager.class.getName() + ".onUnload(this); }", c);
c.addMethod(onUnload);
}
use of com.googlecode.gwt.test.patchers.InitMethod in project gwt-test-utils by gwt-test-utils.
the class ValueBoxBasePatcher method initClass.
@InitMethod
static void initClass(CtClass c) throws CannotCompileException {
CtConstructor cons = JavassistUtils.findConstructor(c, Element.class, Renderer.class, Parser.class);
cons.insertAfter("setText(\"\");");
}
Aggregations