-/*!
- * Ext JS Library 3.3.1
- * Copyright(c) 2006-2010 Sencha Inc.
- * licensing@sencha.com
- * http://www.sencha.com/license
- */
/**
* @class Ext.ux.GMapPanel
* @extends Ext.Panel
* @author Shea Frederick
*/
-Ext.ux.GMapPanel = Ext.extend(Ext.Panel, {
+Ext.define('Ext.ux.GMapPanel', {
+ extend: 'Ext.Panel',
+
+ alias: 'widget.gmappanel',
+
+ requires: ['Ext.window.MessageBox'],
+
initComponent : function(){
var defConfig = {
Ext.applyIf(this,defConfig);
- Ext.ux.GMapPanel.superclass.initComponent.call(this);
-
+ this.callParent();
},
+
afterRender : function(){
- var wh = this.ownerCt.getSize();
+ var wh = this.ownerCt.getSize(),
+ point;
+
Ext.applyIf(this, wh);
- Ext.ux.GMapPanel.superclass.afterRender.call(this);
+ this.callParent();
if (this.gmapType === 'map'){
this.gmap = new GMap2(this.body.dom);
this.geoCodeLookup(this.setCenter.geoCodeAddr);
}else{
if (this.gmapType === 'map'){
- var point = new GLatLng(this.setCenter.lat,this.setCenter.lng);
+ point = new GLatLng(this.setCenter.lat,this.setCenter.lng);
this.gmap.setCenter(point, this.zoomLevel);
}
if (typeof this.setCenter.marker === 'object' && typeof point === 'object'){
this.addMapControls();
this.addOptions();
},
- onResize : function(w, h){
+ afterComponentLayout : function(w, h){
if (typeof this.getMap() == 'object') {
this.gmap.checkResize();
}
- Ext.ux.GMapPanel.superclass.onResize.call(this, w, h);
+ this.callParent(arguments);
},
setSize : function(width, height, animate){
this.gmap.checkResize();
}
- Ext.ux.GMapPanel.superclass.setSize.call(this, width, height, animate);
+ this.callParent(arguments);
},
getMap : function(){
},
addMarker : function(point, marker, clear, center, listeners){
-
+ var evt;
Ext.applyIf(marker,G_DEFAULT_ICON);
if (clear === true){
var mark = new GMarker(point,marker);
if (typeof listeners === 'object'){
for (evt in listeners) {
+ if (!listeners.hasOwnProperty(evt)) {
+ continue;
+ }
GEvent.bind(mark, evt, this, listeners[evt]);
}
}
if (this.gmapType === 'map') {
if (Ext.isArray(this.mapControls)) {
- for(i=0;i<this.mapControls.length;i++){
+ for(var i=0;i<this.mapControls.length;i++){
this.addMapControl(this.mapControls[i]);
}
}else if(typeof this.mapControls === 'string'){
addOptions : function(){
if (Ext.isArray(this.mapConfOpts)) {
- var mc;
- for(i=0;i<this.mapConfOpts.length;i++){
+ for(var i=0;i<this.mapConfOpts.length;i++){
this.addOption(this.mapConfOpts[i]);
}
}else if(typeof this.mapConfOpts === 'string'){
geoCodeLookup : function(addr) {
this.geocoder = new GClientGeocoder();
- this.geocoder.getLocations(addr, this.addAddressToMap.createDelegate(this));
+ this.geocoder.getLocations(addr, Ext.Function.bind(this.addAddressToMap, this));
},
addAddressToMap : function(response) {
-
+ var place, addressinfo, accuracy, point;
if (!response || response.Status.code != 200) {
Ext.MessageBox.alert('Error', 'Code '+response.Status.code+' Error Returned');
}else{
}
});
-
-Ext.reg('gmappanel', Ext.ux.GMapPanel);
\ No newline at end of file