From 3be49d2f64932596ddcfe7ef6e20bab4bb711cfa Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 13 Feb 2012 18:20:45 -0500 Subject: [PATCH] IDEMPIERE-147 GoogleMap to show Locators http://jira.idempiere.com/browse/IDEMPIERE-147 Proper authorship accreditation, as requested http://forum.kenos.com.br/viewtopic.php?f=1&t=810&p=3765#p3758 --- .../src/org/compiere/model/MLocation.java | 9 ++++----- .../org/compiere/grid/ed/VLocationDialog.java | 17 +++++++++++------ .../adempiere/webui/window/WLocationDialog.java | 13 ++++++------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MLocation.java b/org.adempiere.base/src/org/compiere/model/MLocation.java index 9f518b6a75..046f670a34 100644 --- a/org.adempiere.base/src/org/compiere/model/MLocation.java +++ b/org.adempiere.base/src/org/compiere/model/MLocation.java @@ -49,9 +49,9 @@ public class MLocation extends X_C_Location implements Comparator /** * */ - private static final long serialVersionUID = 7655032871533297438L; + private static final long serialVersionUID = 8332515185354248079L; - //BEGIN fernandinho/ricardo - http://jira.idempiere.com/browse/IDEMPIERE-147 + // http://jira.idempiere.com/browse/IDEMPIERE-147 public static String LOCATION_MAPS_URL_PREFIX = MSysConfig.getValue("LOCATION_MAPS_URL_PREFIX"); public static String LOCATION_MAPS_ROUTE_PREFIX = MSysConfig.getValue("LOCATION_MAPS_ROUTE_PREFIX"); public static String LOCATION_MAPS_SOURCE_ADDRESS = MSysConfig.getValue("LOCATION_MAPS_SOURCE_ADDRESS"); @@ -658,12 +658,11 @@ public class MLocation extends X_C_Location implements Comparator } // afterSave /** - * Get edited Value (MLocation) for GoogleMaps - * @author Fernandinho/Ricardo + * Get edited Value (MLocation) for GoogleMaps / IDEMPIERE-147 * @param MLocation location * @return String address */ - public String getGoogleMapsLocation() { + public String getMapsLocation() { MRegion region = new MRegion(Env.getCtx(), getC_Region_ID(), get_TrxName()); String address = ""; diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocationDialog.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocationDialog.java index b885867839..6926d2c89f 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocationDialog.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocationDialog.java @@ -68,9 +68,14 @@ import com.akunagroup.uk.postcode.Postcode; *
  • FR [ 1741222 ] - Webservice connector for address lookups * @author Cristina Ghita, www.arhipac.ro *
  • FR [ 2794312 ] Location AutoComplete - * @contributors - Ricardo Santana (KENOS), Fernandinho (FAIRE) - BRAZIL vs GERMANY 2-0 - * - Show GoogleMap on Location Dialog - * - http://jira.idempiere.com/browse/IDEMPIERE-147 + * + * http://jira.idempiere.com/browse/IDEMPIERE-147 - Show GoogleMap on Location Dialog + * @author Fernando Lucktemberg (Faire, www.faire.com.br) + *
  • seeded the Map button + * @author Mario Grigioni (Kenos, www.kenos.com.br) + *
  • expanded to add Route button + * @author Alvaro Montenegro (Kenos, www.kenos.com.br) + *
  • BF: Check URL before open the Browser */ public class VLocationDialog extends CDialog implements ActionListener @@ -482,7 +487,7 @@ public class VLocationDialog extends CDialog //BEGIN fernandinho/ricardo else if (e.getSource() == toLink) { - String urlString = MLocation.LOCATION_MAPS_URL_PREFIX + m_location.getGoogleMapsLocation(); + String urlString = MLocation.LOCATION_MAPS_URL_PREFIX + m_location.getMapsLocation(); String message = null; try @@ -503,8 +508,8 @@ public class VLocationDialog extends CDialog MLocation orgLocation = new MLocation(Env.getCtx(),orgInfo.getC_Location_ID(),null); String urlString = MLocation.LOCATION_MAPS_ROUTE_PREFIX + - MLocation.LOCATION_MAPS_SOURCE_ADDRESS + orgLocation.getGoogleMapsLocation() + //org - MLocation.LOCATION_MAPS_DESTINATION_ADDRESS + m_location.getGoogleMapsLocation(); //partner + MLocation.LOCATION_MAPS_SOURCE_ADDRESS + orgLocation.getMapsLocation() + //org + MLocation.LOCATION_MAPS_DESTINATION_ADDRESS + m_location.getMapsLocation(); //partner String message = null; try { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java index 2239feba28..afe5b6d93c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java @@ -21,7 +21,6 @@ package org.adempiere.webui.window; -import java.net.URI; import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; @@ -44,7 +43,6 @@ import org.compiere.model.MRegion; import org.compiere.util.CLogger; import org.compiere.util.Env; import org.compiere.util.Msg; -import org.zkoss.zhtml.A; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; @@ -62,8 +60,9 @@ import org.zkoss.zk.ui.event.Events; * https://sourceforge.net/tracker/?func=detail&aid=2995212&group_id=176962&atid=955896 * * @TODO: Implement fOnline button present in swing client - * @contributors - Carlos Ruiz / globalqss - * - Show GoogleMap on Location Dialog (integrate approach from Fernandinho) + * + * @contributors - Carlos Ruiz / globalqss + * - Show GoogleMap on Location Dialog (integrate approach from LBR) * - http://jira.idempiere.com/browse/IDEMPIERE-147 **/ public class WLocationDialog extends Window implements EventListener @@ -530,7 +529,7 @@ public class WLocationDialog extends Window implements EventListener } else if (toLink.equals(event.getTarget())) { - String urlString = MLocation.LOCATION_MAPS_URL_PREFIX + m_location.getGoogleMapsLocation(); + String urlString = MLocation.LOCATION_MAPS_URL_PREFIX + m_location.getMapsLocation(); String message = null; try { Executions.getCurrent().sendRedirect(urlString, "_blank"); @@ -548,8 +547,8 @@ public class WLocationDialog extends Window implements EventListener MLocation orgLocation = new MLocation(Env.getCtx(),orgInfo.getC_Location_ID(),null); String urlString = MLocation.LOCATION_MAPS_ROUTE_PREFIX + - MLocation.LOCATION_MAPS_SOURCE_ADDRESS + orgLocation.getGoogleMapsLocation() + //org - MLocation.LOCATION_MAPS_DESTINATION_ADDRESS + m_location.getGoogleMapsLocation(); //partner + MLocation.LOCATION_MAPS_SOURCE_ADDRESS + orgLocation.getMapsLocation() + //org + MLocation.LOCATION_MAPS_DESTINATION_ADDRESS + m_location.getMapsLocation(); //partner String message = null; try { Executions.getCurrent().sendRedirect(urlString, "_blank");