IDEMPIERE-319 - Enhancement for Map and Route buttons

This commit is contained in:
Nicolas Micoud 2012-07-30 16:51:09 +02:00
parent 7863ff524c
commit 5827730776
2 changed files with 44 additions and 4 deletions

View File

@ -498,7 +498,7 @@ public class VLocationDialog extends CDialog
//BEGIN fernandinho/ricardo
else if (e.getSource() == toLink)
{
String urlString = MLocation.LOCATION_MAPS_URL_PREFIX + m_location.getMapsLocation();
String urlString = MLocation.LOCATION_MAPS_URL_PREFIX + getFullAdress();
String message = null;
try
@ -520,7 +520,7 @@ public class VLocationDialog extends CDialog
String urlString = MLocation.LOCATION_MAPS_ROUTE_PREFIX +
MLocation.LOCATION_MAPS_SOURCE_ADDRESS + orgLocation.getMapsLocation() + //org
MLocation.LOCATION_MAPS_DESTINATION_ADDRESS + m_location.getMapsLocation(); //partner
MLocation.LOCATION_MAPS_DESTINATION_ADDRESS + getFullAdress(); //partner
String message = null;
try
{
@ -803,4 +803,25 @@ public class VLocationDialog extends CDialog
}
/** returns a string that contains all fields of current form */
String getFullAdress()
{
MRegion region = null;
if (fRegion.getSelectedItem()!=null)
region = new MRegion(Env.getCtx(), ((MRegion)fRegion.getSelectedItem()).getC_Region_ID(), null);
MCountry c = (MCountry)fCountry.getSelectedItem();
String address = "";
address = address + (fAddress1.getText() != null ? fAddress1.getText() + ", " : "");
address = address + (fAddress2.getText() != null ? fAddress2.getText() + ", " : "");
address = address + (fCity.getText() != null ? fCity.getText() + ", " : "");
if (region != null)
address = address + (region.getName() != null ? region.getName() + ", " : "");
address = address + (c.getName() != null ? c.getName() : "");
return address.replace(" ", "+");
}
} // VLocationDialog

View File

@ -540,7 +540,7 @@ public class WLocationDialog extends Window implements EventListener
}
else if (toLink.equals(event.getTarget()))
{
String urlString = MLocation.LOCATION_MAPS_URL_PREFIX + m_location.getMapsLocation();
String urlString = MLocation.LOCATION_MAPS_URL_PREFIX + getFullAdress();
String message = null;
try {
Executions.getCurrent().sendRedirect(urlString, "_blank");
@ -559,7 +559,7 @@ public class WLocationDialog extends Window implements EventListener
String urlString = MLocation.LOCATION_MAPS_ROUTE_PREFIX +
MLocation.LOCATION_MAPS_SOURCE_ADDRESS + orgLocation.getMapsLocation() + //org
MLocation.LOCATION_MAPS_DESTINATION_ADDRESS + m_location.getMapsLocation(); //partner
MLocation.LOCATION_MAPS_DESTINATION_ADDRESS + getFullAdress(); //partner
String message = null;
try {
Executions.getCurrent().sendRedirect(urlString, "_blank");
@ -700,5 +700,24 @@ public class WLocationDialog extends Window implements EventListener
}
super.dispose();
}
/** returns a string that contains all fields of current form */
String getFullAdress()
{
MRegion region = null;
if (lstRegion.getSelectedItem()!=null)
region = new MRegion(Env.getCtx(), ((MRegion)lstRegion.getSelectedItem().getValue()).getC_Region_ID(), null);
MCountry c = (MCountry)lstCountry.getSelectedItem().getValue();
String address = "";
address = address + (txtAddress1.getText() != null ? txtAddress1.getText() + ", " : "");
address = address + (txtAddress2.getText() != null ? txtAddress2.getText() + ", " : "");
address = address + (txtCity.getText() != null ? txtCity.getText() + ", " : "");
if (region != null)
address = address + (region.getName() != null ? region.getName() + ", " : "");
address = address + (c.getName() != null ? c.getName() : "");
return address.replace(" ", "+");
}
}