Adding GMap to wicket TabbedPanel

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Adding GMap to wicket TabbedPanel

shrm
Hi,
     I have a tabbed panel where I am trying to add gmap to one of the tab but havent been successful in launching map from the tab.


public class SimpleMap extends GMap
{
  private static final long serialVersionUID = 1L;
  final static String API_KEY = "MY_API_KEY";
    public SimpleMap(String id,TabbedPanelPage parent)
    {
       super(id, new GMapHeaderContributor(API_KEY));
 this.setMarkupId("tabs:panel.panel");
       this.setStreetViewControlEnabled(false);
       this.setScaleControlEnabled(true);
       this.setScrollWheelZoomEnabled(true);
       this.setCenter(new GLatLng(52.47649, 13.228573));    
}
}
SimpleMap.html
<html xmlns="http://www.w3.org/1999/xhtml"
                xmlns:wicket="http://wicket.sourceforge.net/" xml:lang="en"
                lang="en">
                 
                <head>
<title>Host Location Map</title>
<script type='text/javascript' src='https://maps-api-ssl.google.com/maps/api/js?v=3.3&sensor=false'></script></head>
<body> 

<wicket:panel>
    <div wicket:id="panel" class="panel"  style="height: 4000px"> 
    </div> 
     </wicket:panel> 
 <script type='text/javascript' src=' https://maps.googleapis.com/maps/api/js?key=<MY_API_KEY>callback=initMap'></script> 
       
</body> 


In My tabbedPanel class,

 I am adding instance of SimpleMap
tabs.add(new AbstractTab(new Model("third tab"))
            {
            public Panel getPanel(String panelId)
            {
            System.out.println("Adding GMap Panl *** ");
            return new SimpleMap(panelId,TabbedPanelPage.this);
});
 add(new AjaxTabbedPanel("tabs", tabs)

I keep getting the error below

 ERROR [org.apache.wicket.MarkupContainer.renderNext(1472)] Unable to find component with id 'panel' in [SimpleMap [Component id = panel]]
        Expected: 'tabs:panel.panel'.
        Found with similar names: 'tabs:panel'

Appreciate your help. I am quite new to UI and wicket