Announcement

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

    ViewLoader and Google Maps Canvas (beta 7.0)

    I load a js file using ViewLoader.
    In this js file I have the definition of a GoogleMap canvas as you suggest (
    Code:
    isc.defineClass("GoogleMap","Canvas").addProperties({...etc
    ).

    In the same js I create an istance of GoogleMap Canvas and set as a member of VLayout.

    When tha main page load the js file using a ViewLoader I see gray flash on a GoogleMaps Canvas position and then the canvas become transparent and no maps are showed.

    If I use the same GoogleMaps Canvas directly in main page without use ViewLoader it works.

    There is a workaround to use ViewLoader and GoogleMaps Canvas. Can you explain the cause please.

    Thanks.

    #2
    No idea without seeing code or finding out what JavaScript errors, if any, that you are seeing, and what warnings are appearing in your Developer Console. You should always post this information.

    Please note also that, as mentioned in the docs, the ViewLoader is usually the wrong approach in most applications. Read the SmartClient Architecture topic in the SmartClient Reference to understand the right approach.

    Comment


      #3
      This is js loaded via ViewLoader

      Code:
      isc.defineClass("GoogleMap","Canvas").addProperties({
      	overflow: "visible",
          redrawOnResize:false,
          zIndex:0,
          getInnerHTML : function () {
              return "<DIV STYLE='width:100%;height:100%' ID=" + this.getID() + "_gmap></DIV>";
          },
      	draw: function() {
      		 this.Super("draw",arguments);			
      		 this.loadMap();
      		 return this;
      	},
      	loadMap: function() {
      		if (window.GBrowserIsCompatible != null && GBrowserIsCompatible())
      		{
      			var div = document.getElementById(this.getID() + "_gmap");
      			this.gmap = new GMap2(div);
      			this.gmap.addControl(new GSmallMapControl());
      			this.gmap.setCenter(new GLatLng(39.739167, -104.984167), 10);
      		}
      	}	
      });
      isc.Calendar.create({
          ID: "eventCalendar"
      });
      isc.VLayout.create({
      	ID: "firstRow",
      	width: "300",
      	height: "100%",
      	showEdges: true
      });
      isc.VLayout.create({
      	ID: "secondRow",
      	width: "*",
      	height: "100%",
      	showEdges: true
      });
      isc.GoogleMap.create({
      	ID: "maps123",
      	width: "200",
      	height: "200",
      	showEdges: true
      });
      isc.HLayout.create({
      	ID: "playerConsole",
      	width: "100%",
      	height: "100%"
      });
      firstRow.addMembers(maps123);
      playerConsole.addMembers(firstRow);
      playerConsole.addMembers(secondRow);

      Comment


        #4
        This is the code that call ViewLoader

        Code:
        ...
        
        mainTabSet.addTab({
        						ID:  "tab"+index,
        						title:  requestedTab.title,
        						pane: isc.ViewLoader.create({
        							autoDraw: false,
        							httpMethod: "POST",
        							viewURL: requestedTab.url,
        							loadingMessage: "<s:text name='prompt.loading'/>"
        						})
        					}, index);
        
        ...

        Comment


          #5
          This is my Debug console message

          23:52:46.851:DEBUG:layout:isc_HLayout_2:centering wrt visible breadth: 222
          23:52:46.851:INFO:layout:isc_HLayout_2:layoutChildren (reason: initial draw):
          layout specified size: 1280w x 222h
          drawn size: 1280w x 222h
          available size: 1280w (length) x 222h
          [VLayout ID:rightPanel]
          160 drawn length (resizeLength: 160) (policyLength: 160px) (explicit size)
          222 drawn breadth (breadth policy: fill)
          [MyTabSet ID:mainTabSet]
          1120 drawn length (resizeLength: 1120) (policyLength: 100%) (explicit size)
          222 drawn breadth (breadth policy: fill)

          23:52:46.855:DEBUG:layout:isc_VLayout_3:centering wrt visible breadth: 1280
          23:52:46.856:INFO:layout:isc_VLayout_3:layoutChildren (reason: initial draw):
          layout specified size: 1280w x 332h
          drawn size: 1280w x 332h
          available size: 1280w x 332h (length)
          [HLayout ID:banner]
          80 drawn length (resizeLength: 80) (policyLength: 80px) (explicit size)
          1280 drawn breadth (breadth policy: fill)
          [HLayout ID:isc_HLayout_2]
          222 drawn length (resizeLength: 222) (policyLength: *) (explicit size)
          1280 drawn breadth (breadth policy: fill)
          [HTMLPane ID:isc_HTMLPane_1]
          30 drawn length (resizeLength: 30) (policyLength: 30px) (explicit size)
          1280 drawn breadth (breadth policy: fill)

          23:52:46.859:WARN:IButton:playerButton:setImage: image 'start' couldn't be found
          23:52:46.859:WARN:IButton:playerButton:setImage: image 'stretch' couldn't be found
          23:52:46.860:WARN:IButton:playerButton:setImage: image 'end' couldn't be found
          23:52:46.860:INFO:layout:mainTabSet_paneContainer:adding newMembers: [ViewLoader ID:isc_ViewLoader_4]
          23:52:46.860:DEBUG:layout:mainTabSet_paneContainer:resizing [ViewLoader ID:isc_ViewLoader_4]: 1108w
          23:52:46.899:INFO:layout:mainTabSet_tabBar:adding newMembers: [ImgTab ID:tab0] at position: 0
          23:52:46.900:DEBUG:layout:mainTabSet_tabBar:resizing [ImgTab ID:tab0]: 20h
          23:52:46.925:INFO:layout:mainTabSet_paneContainer:adding newMembers: [ViewLoader ID:isc_ViewLoader_5]
          23:52:46.925:DEBUG:layout:mainTabSet_paneContainer:resizing [ViewLoader ID:isc_ViewLoader_5]: 1108w
          23:52:46.952:INFO:layout:mainTabSet_tabBar:adding newMembers: [ImgTab ID:tab1] at position: 1
          23:52:46.953:DEBUG:layout:mainTabSet_tabBar:resizing [ImgTab ID:tab1]: 20h
          23:52:46.965:TMR2:DEBUG:layout:mainTabSet_paneContainer:resizing [ViewLoader ID:isc_ViewLoader_4]: 1108w 191h
          23:52:46.966:TMR2:DEBUG:layout:mainTabSet_paneContainer:centering wrt visible breadth: 1108
          23:52:46.967:TMR2:INFO:layout:mainTabSet_paneContainer:layoutChildren (reason: membersAdded):
          layout specified size: 1120w x 203h
          drawn size: 1120w x 203h
          available size: 1118w x 201h (length)
          [ViewLoader ID:isc_ViewLoader_4]
          191 drawn length (resizeLength: 191) (policyLength: *) (no length specified)
          1108 drawn breadth (breadth policy: fill)
          [ViewLoader ID:isc_ViewLoader_5]
          undefined drawn length (policyLength: 0) (hidden)
          undefined drawn breadth (undefined)

          23:52:46.968:TMR2[E]:DEBUG:layout:mainTabSet_tabBar:centering wrt visible breadth: 20
          23:52:46.968:TMR2[E]:INFO:layout:mainTabSet_tabBar:layoutChildren (reason: membersAdded):
          layout specified size: 1120w x 20h
          drawn size: 1120w x 20h
          available size: 1120w (length) x 20h
          [ImgTab ID:tab0]
          96 drawn length (policyLength: 96) (inherent size)
          20 drawn breadth (breadth policy: fill)
          [ImgTab ID:tab1]
          80 drawn length (policyLength: 80) (inherent size)
          20 drawn breadth (breadth policy: fill)

          23:52:46.975:INFO:Log:isc.Page is loaded
          23:52:47.012:TMR1:DEBUG:layout:banner:centering wrt visible breadth: 80
          23:52:47.013:TMR1:INFO:layout:banner:layoutChildren (reason: pageResize):
          layout specified size: 1280w x 80h
          drawn size: 1280w x 80h
          available size: 1280w (length) x 80h
          [Img ID:isc_Img_0]
          880 drawn length (resizeLength: 880) (policyLength: *) (explicit size)
          70 drawn breadth (explicit size)
          [HLayout ID:commonElements]
          400 drawn length (resizeLength: 400) (policyLength: 400) (explicit size)
          70 drawn breadth (explicit size)

          23:52:47.013:TMR1[E]:DEBUG:layout:rightPanel:centering wrt visible breadth: 150
          23:52:47.014:TMR1[E]:INFO:layout:rightPanel:layoutChildren (reason: pageResize):
          layout specified size: 160w x 222h
          drawn size: 160w x 222h
          available size: 160w x 222h (length)
          [IButton ID:playerButton]
          50 drawn length (resizeLength: 50) (policyLength: 50) (explicit size)
          150 drawn breadth (explicit size)
          [IButton ID:officialButton]
          24 drawn length (resizeLength: 24) (policyLength: 24) (explicit size)
          150 drawn breadth (explicit size)
          [IButton ID:teamButton]
          24 drawn length (resizeLength: 24) (policyLength: 24) (explicit size)
          150 drawn breadth (explicit size)
          [IButton ID:centerButton]
          24 drawn length (resizeLength: 24) (policyLength: 24) (explicit size)
          150 drawn breadth (explicit size)
          [IButton ID:tournamentButton]
          24 drawn length (resizeLength: 24) (policyLength: 24) (explicit size)
          150 drawn breadth (explicit size)

          23:52:47.015:TMR1[E]:DEBUG:layout:mainTabSet_tabBar:centering wrt visible breadth: 20
          23:52:47.015:TMR1[E]:INFO:layout:mainTabSet_tabBar:layoutChildren (reason: pageResize):
          layout specified size: 1120w x 20h
          drawn size: 1120w x 20h
          available size: 1120w (length) x 20h
          [ImgTab ID:tab0]
          96 drawn length (policyLength: 96) (inherent size)
          20 drawn breadth (breadth policy: fill)
          [ImgTab ID:tab1]
          80 drawn length (policyLength: 80) (inherent size)
          20 drawn breadth (breadth policy: fill)

          23:52:47.015:TMR1[E]:DEBUG:layout:isc_HLayout_2:centering wrt visible breadth: 222
          23:52:47.016:TMR1[E]:INFO:layout:isc_HLayout_2:layoutChildren (reason: pageResize):
          layout specified size: 1280w x 222h
          drawn size: 1280w x 222h
          available size: 1280w (length) x 222h
          [VLayout ID:rightPanel]
          160 drawn length (resizeLength: 160) (policyLength: 160px) (explicit size)
          222 drawn breadth (breadth policy: fill)
          [MyTabSet ID:mainTabSet]
          1120 drawn length (resizeLength: 1120) (policyLength: 100%) (explicit size)
          222 drawn breadth (breadth policy: fill)

          23:52:47.016:TMR1[E]:DEBUG:layout:isc_VLayout_3:centering wrt visible breadth: 1280
          23:52:47.017:TMR1[E]:INFO:layout:isc_VLayout_3:layoutChildren (reason: pageResize):
          layout specified size: 1280w x 332h
          drawn size: 1280w x 332h
          available size: 1280w x 332h (length)
          [HLayout ID:banner]
          80 drawn length (resizeLength: 80) (policyLength: 80px) (explicit size)
          1280 drawn breadth (breadth policy: fill)
          [HLayout ID:isc_HLayout_2]
          222 drawn length (resizeLength: 222) (policyLength: *) (explicit size)
          1280 drawn breadth (breadth policy: fill)
          [HTMLPane ID:isc_HTMLPane_1]
          30 drawn length (resizeLength: 30) (policyLength: 30px) (explicit size)
          1280 drawn breadth (breadth policy: fill)

          23:52:47.026:XRP7:INFO:layout:eventCalendar_mainView_paneContainer:adding newMembers: [DaySchedule ID:eventCalendar_dayView]
          23:52:47.026:XRP7:DEBUG:layout:eventCalendar_mainView_paneContainer:resizing [DaySchedule ID:eventCalendar_dayView]: 88w
          23:52:47.026:XRP7:INFO:layout:eventCalendar_mainView_paneContainer:adding newMembers: [DaySchedule ID:eventCalendar_weekView]
          23:52:47.026:XRP7:DEBUG:layout:eventCalendar_mainView_paneContainer:resizing [DaySchedule ID:eventCalendar_weekView]: 88w
          23:52:47.026:XRP7:INFO:layout:eventCalendar_mainView_paneContainer:adding newMembers: [MonthSchedule ID:eventCalendar_monthView]
          23:52:47.026:XRP7:DEBUG:layout:eventCalendar_mainView_paneContainer:resizing [MonthSchedule ID:eventCalendar_monthView]: 88w
          23:52:47.042:XRP7:INFO:layout:firstRow:adding newMembers: [GoogleMap ID:maps123]
          23:52:47.042:XRP7:INFO:layout:playerConsole:adding newMembers: [VLayout ID:firstRow]
          23:52:47.042:XRP7:INFO:layout:playerConsole:adding newMembers: [VLayout ID:secondRow]
          23:52:47.042:XRP7:WARN:Log:firing the callback from global eval with...
          23:52:47.042:XRP7:WARN:Log:viewLoader is:[ViewLoader ID:isc_ViewLoader_4]
          23:52:47.043:XRP7:DEBUG:layout:playerConsole:resizing [VLayout ID:firstRow]: 191h
          23:52:47.043:XRP7:DEBUG:layout:playerConsole:resizing [VLayout ID:secondRow]: 191h
          23:52:47.044:XRP7:DEBUG:layout:playerConsole:resizing [VLayout ID:secondRow]: 191h 808w
          23:52:47.096:XRP7:DEBUG:layout:firstRow:centering wrt visible breadth: 288
          23:52:47.098:XRP7:INFO:layout:firstRow:layoutChildren (reason: initial draw):
          layout specified size: 300w x 191h
          drawn size: 300w x 212h
          available size: 288w x 179h (length)
          [GoogleMap ID:maps123]
          200 drawn length (policyLength: 200) (inherent size)
          200 drawn breadth (explicit size)

          23:52:47.102:XRP7:DEBUG:layout:secondRow:centering wrt visible breadth: 796
          23:52:47.102:XRP7:INFO:layout:secondRow:layoutChildren (reason: initial draw):
          layout specified size: 808w x 191h
          drawn size: 808w x 191h
          available size: 796w x 179h (length)
          [No members]
          23:52:47.105:XRP7:DEBUG:layout:playerConsole:centering wrt visible breadth: 212
          23:52:47.108:XRP7:INFO:layout:playerConsole:layoutChildren (reason: initial draw):
          layout specified size: 1108w x 191h
          drawn size: 1108w x 212h
          available size: 1108w (length) x 191h
          [VLayout ID:firstRow]
          300 drawn length (resizeLength: 300) (policyLength: 300) (explicit size)
          191 drawn breadth (breadth policy: fill)
          [VLayout ID:secondRow]
          808 drawn length (resizeLength: 808) (policyLength: *) (explicit size)
          191 drawn breadth (breadth policy: fill)

          Comment

          Working...
          X