Announcement

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

    smart gwt amd google maps v3 integration issue

    Hi,
    We are using google maps v3 (gwt-maps) to be rendered in smartgwt canvas widget. As gwt-maps can only be rendered in a simple panel or GWT node, we are facing severe issues with content sizing. Whenever the smartgwt canvas size is altered, by browser resize or hiding other elements on web page the map size is not changed accordingly.
    You help on this will be highly appreciated!!


    Thanks!
    Madanji

    #2
    Take a look at the DOM Integration overview for a general explanation of how to handle sizing for a third-party widget you are trying to embed in SmartGWT.

    With so little information, we can't provide any more help than this at the moment. Sample code we can run would allow us to actually investigate.

    Comment


      #3
      smart gwt and google maps v3 integration issue

      Sizing Issue -- On rendering the Google Map using Smart GWT , Map doesn't get completely fit into the Smart GWT Panel due to which Grey bar comes at the bottom .

      Please find the Sample code below.

      Code:
      public class MapPanel extends HLayout {
      
          private MapOptions options = MapOptions.create();
          private GoogleMap gMap;
          private final SimplePanel simplePanel;
      
         
          public final GoogleMap getgMap() {
              return gMap;
          }
      
          public MapPanel() 
      	{
              // this.setID("mapPanel");
              simplePanel = new SimplePanel();
              simplePanel.setWidth("100%");
              simplePanel.setHeight("100%");
              this.addMember(simplePanel);
              this.setOverflow(Overflow.HIDDEN);
      		 
      		 RPCCallback callback = new RPCCallback() {
      
                  @Override
                  public final void execute(RPCResponse response, Object rawData, RPCRequest request) {
      
                      MapDefaults mapDefaults = new MapDefaults();
                      // set map options do draw default map.
                      GWT.log("setting default zoom on map " + mapDefaults.getMapDefaultZoom());
                      options.setZoom(Double.parseDouble(mapDefaults.getMapDefaultZoom()));
                      options.setMapTypeId(MapTypeId.ROADMAP);
                      options.setDraggable(true);
                      options.setMapTypeControl(true);
                      options.setScaleControl(true);
                      MapTypeControlOptions mapTypeControlOptions= MapTypeControlOptions.create();
                      mapTypeControlOptions.setStyle(MapTypeControlStyle.DROPDOWN_MENU);
                      options.setMapTypeControlOptions(mapTypeControlOptions);
                      options.setScrollwheel(true);
                      options.setMinZoom(Double.parseDouble(mapDefaults.getMapMinZoom()));
                      options.setMaxZoom(Double.parseDouble(mapDefaults.getMapMaxZoom()));
                      options.setStreetViewControl(false);
                      options.setPanControl(true);
                      // create map object in the html component simplePanel
                      gMap = GoogleMap.create(simplePanel.getElement(), options);
                    }
      	 }
      }

      Comment


        #4
        Please take a look at the DOM Integration overview (as previously recommended) - it is frequently necessary to manually size content created by third party widgets, as this overview explains.

        Comment


          #5
          smart gwt and google maps v3 integration issue

          Thanks for your response. The issue is resolved now.

          Comment


            #6
            mchoudhary - Could you please post your working example. I'm having difficulty getting this to work. Thanks!

            Comment

            Working...
            X