Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Defining Java method on a JavaScript instance

    Hi,


    I create a ListGrid instance via JavaScript in my own MyListGrid implementation.
    But how can I tell the JS instance to use my own overriden getHeaderContextMenuItems method (written in Java) or pass that in some way?


    Code:
    class MyListGrid extends ListGrid {
      public MyListGrid(JavaScriptObject js) {
        super(js);
      }
    
     @Override
      protected MenuItem[] getHeaderContextMenuItems(Integer fieldNum) {
         ...
       }
    
       public static MyListGrid createMY() {
           return new MyListGrid(_createFromJS() ); 
       }
    
      private static native JavaScriptObject _createFromJS() /*- {
        return $wnd.isc.ListGrid.create({ 
            autoFetchData: false,
             ...
        });
       }-*/;
    }

    thanks,

    #2
    You are headed down a path that is tantamount to re-implementing SmartGWT's wrapping of SmartClient. Why?

    Comment


      #3
      Yeah, I needed it to create the ListGrid with a predefined set of defaultFields coming from a DataSource wrapped as JSObject (can't use setDataSource).

      I've built around that so that I now can instantiate the Java class, which now uses the override methods.

      Comment


        #4
        I'm curious to know what your code looks like, if you don't mind sharing. I have been thinking about using pure Javascript for most of the UI and keeping some logic code in Java/GWT. Still not sure it is pretty.

        http://code.google.com/webtoolkit/do...I.html#calling

        http://code.google.com/p/gwt-exporter/

        Comment

        Working...
        X