Announcement

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

  • mathias
    replied
    Well, since it works in 5.0, something has obviously changed. Thought a barebones standalone test-case like the one provided would help, but ok. I'm not super-great at javascript debugging, but i guess i'll have to figure something out.

    Leave a comment:


  • Isomorphic
    replied
    Sorry, we can't look into a problem with a third-party library with so little information.

    Try getting through basics like whether the third-party library is loading at all, whether it's loading it's data, etc. Try multiple browsers to see if you can get one of the to tell you what error is occurring. Inspect the DOM and see if the maps library has drawn something that just isn't showing up. See if there is a way for the maps libraries to give you any diagnostics or logging at all about what's going on (it would be pathetic if it can't).

    Basically try to get to a point where you can see what kind of failure is going on and there's at least a suggestion that SmartGWT could do something different in order to help the maps library not fail.

    Leave a comment:


  • mathias
    started a topic GWT v3 Maps libraries work in 5.0, broken in 5.1

    GWT v3 Maps libraries work in 5.0, broken in 5.1

    Hi there,

    our service is maps heavy. We show maps in all sorts of places - layout, popups, form items, etc. We've done this for years, in all versions. Since there's no map components at all in smartGWT, we use a third-party library, branflake, to provide GWT bindings for Google's maps v3 javascript library. (github here: https://github.com/branflake2267/GWT-Maps-V3-Api)

    However, we recently tried to upgrade from 5.0 to 5.1, more specifically from smartgwt pro 5.0-p20160409 to 5.1-p20160428, and just now 5.1-p20160514 (the issue is still there).

    Basically what happens is that the gwt maps widget is totally blank, it doesn't draw anything, even though i can see that calls are being made to google to fetch data to display. There are no errors in the console that i can see.

    This is totally crucial for us upgrading, so it would be super-great if someone could help out with this.

    I have made a test-project to illustrate below. By just switching out the smartgwt jars, this project shows, or doesn't show, the actual map we're trying to display.

    Thanks in advance.


    Code:
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.core.client.GWT;
    import com.google.gwt.maps.client.LoadApi;
    import com.google.gwt.maps.client.MapWidget;
    import com.google.gwt.maps.client.base.LatLng;
    import com.google.gwt.maps.client.base.Point;
    import com.google.gwt.maps.client.overlays.Marker;
    import com.google.gwt.maps.client.overlays.MarkerImage;
    import com.google.gwt.maps.client.overlays.MarkerOptions;
    import com.smartgwt.client.types.Alignment;
    import com.smartgwt.client.widgets.events.ResizedEvent;
    import com.smartgwt.client.widgets.events.ResizedHandler;
    import com.smartgwt.client.widgets.layout.HLayout;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    import java.util.ArrayList;
    
    public class Test implements EntryPoint {
    
        public void onModuleLoad() {
            Runnable onLoad = new Runnable() {
                @Override
                public void run() {
                    initLayout();
                }
            };
            loadMapApi(onLoad);
        }
    
        public void initLayout() {
            try {
                VLayout mainLayout = new VLayout();
                mainLayout.setWidth100();
                mainLayout.setMembersMargin(30);
                mainLayout.setLayoutAlign(Alignment.CENTER);
                mainLayout.setLayoutTopMargin(20);
    
                MapLayoutWithWidget mapLayout = new MapLayoutWithWidget();
    
    
                mainLayout.setDefaultLayoutAlign(Alignment.CENTER);
    
                mapLayout.setBorder("1px solid black");
                mapLayout.setVisible(true);
                mapLayout.setHeight(200);
                mapLayout.setWidth(200);
                mapLayout.getWidget().setZoom(10);
    
    
                mainLayout.addMember(mapLayout);
                mainLayout.draw();
                LatLng sweden = LatLng.newInstance(63.049649, 16.347656);
                mapLayout.createMarker(sweden, "hello", null, 0, 0, true, false, true);
            } catch (Exception e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
        }
    
        public class MapLayoutWithWidget extends HLayout {
    
            private MapWidget map;
    
            public MapLayoutWithWidget() {
                //we want to make sure that the map always takes up the entire layout, since it doesn't scale automatically.
                addResizedHandler(new ResizedHandler() {
                    public void onResized(ResizedEvent e) {
                        map.setSize(getWidth().toString(), getHeight().toString());
                        map.triggerResize();
                    }
                });
                setRedrawOnResize(true);
                setWidth100();
                setHeight100();
    
                this.setMargin(0);
                this.setPadding(0);
                this.setMembersMargin(0);
    
    
                map = new MapWidget(null);
                map.setZoom(10);
                map.setWidth(getWidthAsString());
                map.setHeight(getHeightAsString());
                addMember(map);
            }
    
            /**
             * sets the position as a marker on the map, plus sets the title if it's not null.
             * We return the marker so that it later is possible to move it if desirable.
             *
             * [USER="45788"]param[/USER] location
             * [USER="45788"]param[/USER] hovertext
             * @return
             */
            private Marker createMarker(LatLng location, String hovertext, String iconUrl, int iconAnchorX, int iconAnchorY,
                                        boolean setCenter, boolean draggable, boolean addToMap) {
                
                MarkerOptions options = MarkerOptions.newInstance();
                options.setTitle(hovertext);
                options.setDraggable(draggable);
    
                if (iconUrl != null) {
                    MarkerImage icon = MarkerImage.newInstance(iconUrl);
                    icon.setAnchor(Point.newInstance(iconAnchorX, iconAnchorY));
                    options.setIcon(icon);
                }
                Marker m = Marker.newInstance(options);
                m.setPosition(location);
    
                if (addToMap) {
                    m.setMap(map);
                }
                if (setCenter) {
                    map.setCenter(location);
                }
                return m;
            }
    
    
            public MapWidget getWidget() {
                return map;
            }
        }
    
        public static boolean loadMapApi(Runnable runnable) {
    
            GWT.log("loadMapApi!");
    
            boolean sensor = true;
            // load all the libs for use in the maps
            ArrayList<LoadApi.LoadLibrary> loadLibraries = new ArrayList<LoadApi.LoadLibrary>();
            loadLibraries.add(LoadApi.LoadLibrary.DRAWING);
            loadLibraries.add(LoadApi.LoadLibrary.GEOMETRY);
            loadLibraries.add(LoadApi.LoadLibrary.PLACES);
    
    
            LoadApi.go(runnable, loadLibraries, sensor);
            return true;
        }
    }
Working...
X