dennisjzh / GwtMobile

GWT Mobile is a cross-platform mobile development tool using Google Web Toolkit technology. It provides a set of UI widgets optimized for mobile devices, a ORM module to persist objects to the browser database, and a wrapper to access PhoneGap functions from GWT.
160 stars 41 forks source link

DragController cannot be abstract #1

Closed gcauchon closed 12 years ago

gcauchon commented 13 years ago

I'm trying to setup a poc project using GWT 2.3 and Gwt-Mobile, somehow I get this generic error:

Compiling module com.test.Checkin [ERROR] Errors in 'jar:file:/D:/workspace/trunk/java/CheckIn/war/WEB-INF/lib/gwtmobile-1.0.jar!/com/gwtmobile/ui/client/event/DragController.java' [ERROR] Line 54: Rebind result 'com.gwtmobile.ui.client.event.DragController' cannot be abstract [ERROR] Cannot proceed due to previous errors

Is GwtMobile 1.0 compatible with 2.3 or should I build it from the trunk?

Thanks

dennisjzh commented 13 years ago

Did you put the following in your .gwt.xml file? GWT Mobile only supports webkit browsers at this point. (supporting ie9 is in the plan)

<set-property name="user.agent" value="safari"/>
gcauchon commented 13 years ago

No because I wanted to use deferred binding to activate/deactivate features based on the user agent... Do I absolutely have to force the property to safari?

dennisjzh commented 13 years ago

If you do have need to support other user agents, you will need to specify which DragController to use for each of those user agents. Currently GWT Mobile only has deferred binding for the "safari" user agent. Below is an excerpt of gwtmobile_ui.gwt.xml

<replace-with class="com.gwtmobile.ui.client.event.DragControllerMobile">
    <when-type-is class="com.gwtmobile.ui.client.event.DragController"/>
    <all>
        <when-property-is name="user.agent" value="safari"/>
        <when-property-is name="mobile.user.agent" value="mobilesafari"/>
    </all>
</replace-with>

<replace-with class="com.gwtmobile.ui.client.event.DragControllerDesktop">
    <when-type-is class="com.gwtmobile.ui.client.event.DragController"/>
    <all>
        <when-property-is name="user.agent" value="safari"/>
        <when-property-is name="mobile.user.agent" value="none"/>
    </all>
</replace-with>
gcauchon commented 12 years ago

I added the missing directive and it did fix the compilation issue!

However, I now have a runtime exception when I try to invoke PhoneGap features:

java.lang.Throwable: One or more exceptions caught, see full set in UmbrellaException#getCauses
        at Unknown.java_lang_RuntimeException_RuntimeException__Ljava_lang_String_2Ljava_lang_Throwable_2V(Unknown Source)
        at Unknown.com_google_web_bindery_event_shared_UmbrellaException_UmbrellaException__Ljava_util_Set_2V(Unknown Source)
        at Unknown.com_google_gwt_event_shared_UmbrellaException_UmbrellaException__Ljava_util_Set_2V(Unknown Source)
        at Unknown.com_google_gwt_event_shared_HandlerManager_$fireEvent__Lcom_google_gwt_event_shared_HandlerManager_2Lcom_google_gwt_event_shared_GwtEvent_2V(Unknown Source)
        at Unknown.com_google_gwt_user_client_ui_Widget_$fireEvent__Lcom_google_gwt_user_client_ui_Widget_2Lcom_google_gwt_event_shared_GwtEvent_2V(Unknown Source)
        at Unknown.com_google_gwt_event_dom_client_DomEvent_fireNativeEvent__Lcom_google_gwt_dom_client_NativeEvent_2Lcom_google_gwt_event_shared_HasHandlers_2Lcom_google_gwt_dom_client_Element_2V(Unknown Source)
        at Unknown.com_google_gwt_user_client_ui_Widget_$onBrowserEvent__Lcom_google_gwt_user_client_ui_Widget_2Lcom_google_gwt_user_client_Event_2V(Unknown Source)
        at Unknown.com_google_gwt_user_client_ui_Widget_onBrowserEvent__Lcom_google_gwt_user_client_Event_2V(Unknown Source)
        at Unknown.com_google_gwt_user_client_DOM_dispatchEvent__Lcom_google_gwt_user_client_Event_2Lcom_google_gwt_user_client_Element_2Lcom_google_gwt_user_client_EventListener_2V(Unknown Source)
        at Unknown.anonymous(Unknown Source)
        at Unknown.com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(Unknown Source)
        at Unknown.com_google_gwt_core_client_impl_Impl_entry0__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(Unknown Source)
        at Unknown.anonymous(Unknown Source)
Caused by: java.lang.Throwable: (TypeError): Result of expression '$wnd.navigator.notification' [undefined] is not an object.
 line: 11209
 sourceId: 116092048
 sourceURL: http://192.168.41.34:8080/checkin/checkin/249261ADCAA28CA261638C874C2E1E53.cache.html
 expressionBeginOffset: 9278
 expressionCaretOffset: 9305
 expressionEndOffset: 9311
dennisjzh commented 12 years ago

PhoneGap APIs exercise native phone features. They rely on a phone/emulator for them to work correctly. They will not function properly on a desktop browser.

There is a phonegap emulator though that enables phonegap APIs on the desktop browser. I have not tried it but you can give it a shot if you want. http://blogs.nitobi.com/andre/index.php/2011/03/02/looking-for-a-browser-based-emulator-for-phonegap-try-ripple/

gcauchon commented 12 years ago

I know PhoneGap only work on mobile devices (and maybe emulator, but I haven't tried any either...)!

I'm running my GWT/GwtMobile webapp on my iPhone4 (iOs 4.2.3). I have similar errors for every PhoneGap code I invoke. I first saw the exception in the Safari Debug Console, then I enabled remote logging in my webapp and compiled with the style option set to DETAILLED.

dennisjzh commented 12 years ago

Try this app on your iphone. http://itunes.apple.com/us/app/gwt-mobile-phonegap-showcase/id419032500?mt=8

If it works for you, you can find its source code here: https://github.com/dennisjzh/GwtMobile-PhoneGap/tree/master/kitchensink

If it does not work, let me know what is not working.

gcauchon commented 12 years ago

The webapp from the app store works, but when I deploy kitchensink on my jboss server, it doesn't even if there are no resources missing...