GeoLocalizableBeans = {}
//GeoLocalizable bean
GeoLocalizableBeans.GeoLocalizeBean = function(id) {
this.id = id;
}
GeoLocalizableBeans.GeoLocalizeBean.prototype.init = function(type, latitude, longitude, label, address1, address2, address3, zipCode, city, country, htmlToolTip, updatePositionAction, onMapBoundsChangeAction) {
if (!this._initialized) {
this.type = type;
this.latitude = latitude;
this.longitude = longitude;
this.label = label;
this.address1 = address1;
this.address2 = address2;
this.address3 = address3;
this.zipCode = zipCode;
this.city = city;
this.country = country;
this.htmlToolTip = htmlToolTip;
this.updatePositionAction = updatePositionAction;
this.onMapBoundsChangeAction = onMapBoundsChangeAction;
this.gMapFormattedAddress = formatGMapAddress(this.address1, this.address2, this.address3, this.zipCode, this.city, this.country); //don't forget to add the country when :Val wil be fixed !!!!!!!!!!!!
this._initialized = true;
}
}
GeoLocalizableBeans.GeoLocalizeBean.prototype.isPositionComputed = function() {
if (this.latitude && this.latitude != "") {
return "1";
} else {
return "0";
}
}
/*GeoLocalizableBeans.GeoLocalizeBean.prototype.getHtml = function() {
var toReturn;
toReturn = this.label;
if (this.address1 && this.address1 != "") {
toReturn += "
";
toReturn += this.address1;
}
if (this.address2 && this.address2 != "") {
toReturn += "
";
toReturn += this.address2;
}
if (this.address3 && this.address3 != "") {
toReturn += "
";
toReturn += this.address2;
}
if (this.zipCode && this.zipCode != "") {
toReturn += "
";
toReturn += this.zipCode;
}
if (this.city && this.city != "") {
toReturn += " ";
toReturn += this.city;
}
if (this.country && this.country != "") {
toReturn += ", ";
toReturn += this.country;
}
return toReturn;
}
*/
function formatGMapAddress(address1, address2, address3, zipCode, city, country) {
var toReturn = "";
if (address1) toReturn += address1 + " ";
if (address2) toReturn += address2 + " ";
if (address3) toReturn += address3 + " ";
if (zipCode) toReturn += zipCode + " ";
if (city) toReturn += city + " ";
if (country) toReturn += country;
return toReturn.replace(/ /g, " ");
}