Search in sources :

Example 26 with PatchMethod

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

the class SafeHtmlUtilsPatcher method fromSafeConstant.

@PatchMethod
public static SafeHtml fromSafeConstant(String s) {
    // PatchMethod to avoid gwt-dev dependency.. See SafeHtmlHostedModeUtils
    Class<?> clazz;
    try {
        clazz = Class.forName("com.google.gwt.safehtml.shared.SafeHtmlString");
        Constructor<?> cons = clazz.getDeclaredConstructor(String.class);
        return (SafeHtml) GwtReflectionUtils.instantiateClass(cons, s);
    } catch (Exception e) {
        throw new GwtTestPatchException("Error while instanciate a SafeHtmlString instance", e);
    }
}
Also used : GwtTestPatchException(com.googlecode.gwt.test.exceptions.GwtTestPatchException) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) GwtTestPatchException(com.googlecode.gwt.test.exceptions.GwtTestPatchException) 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