Plugin: Google Map Dashboard

363 views
Skip to first unread message

norber...@multimageweb.com

unread,
Apr 23, 2014, 5:46:44 AM4/23/14
to idem...@googlegroups.com
Hi,

ours first commit.

enjoy. please share feedback
norbert

This e-mail is confidential and may contain legally privileged information. It is intended only for the addressees and may not be reviewed or used in any way by other recipients. If you have received this e-mail in error, kindly notify us immediately by telephone or e-mail and delete the message and any attachments thereto from your system.

Hiep Lq

unread,
Apr 23, 2014, 9:10:54 AM4/23/14
to idem...@googlegroups.com
Hi Norbert, many thanks for share.

I see it's for EE license (but i setup your plug-in with ce library success). it make me confuse.

+ about 
  • Handle Marker click events
  • Reopen Marker text is not possible

I have some idea.
1+ make toggle button as demo of zkoss
2+ listen event click of Gmaps object
at oneven, compare location of event with locator of markers (+- width, height of marker), 
if same => click on markers
3+ listen event double click of gmap
in onevent save zoom level of gmap  and fire a echo event.
in echo event if old zoom level = new zoom level => click to markers.

Hiep Lq

unread,
Apr 23, 2014, 12:37:48 PM4/23/14
to idem...@googlegroups.com
I'm find a correct way.

correct event you listen is list in this document

ok. some modified 
1. remove old listen 
2. add gmaps.addEventListener("onMapClick", DPGoogleMap.this); to init
3. modified onEvent
         public void onEvent(Event e) {
if (e instanceof MapMouseEvent) {
MapMouseEvent mapEvent = (MapMouseEvent)e;
Gmarker markerClick = mapEvent.getGmarker();
if (markerClick != null){
boolean isOpen = "true".equals(markerClick.getAttribute("openDialog"));
if (isOpen){
markerClick.setOpen(false);
markerClick.setAttribute("openDialog", "false");
}else{
markerClick.setOpen(true);
markerClick.setAttribute("openDialog", "true");
}
}
}
}//onEvent


have a two issue.
+ if set marker.setDraggingEnabled(true); mapEvent.getGmarker() always return null
+ markerClick.isOpen () always return true (because when make marker set it is true, i don't test for case false when make marker)
because use setAttribute("openDialog") to track status.

Tomáš Švikruha

unread,
Apr 24, 2014, 7:35:28 AM4/24/14
to idem...@googlegroups.com
Thanks, works great!

But I have one important problem. When I deplyed plugin via felix console, i had to refresh org.adempiere.ui.zk plugin to start gmaps plugin. Then the gmaps was working, BUT when i stopped and started whole server again, log in into system was not possible. I attached log and screen. Do you have som ideas what should be the problem? i had to uninstal plugin and restart server because log in into iDempiere was not possible. Here is similar topic>


adempiere is not defined (ReferenceError) [22]
16:50:15.570===========> zkoss.service:725: [Desktop z_d2b:/index.zul] client error: Failed to process 
script
adempiere is not defined (ReferenceError) [23]
16:50:19.305===========> zkoss.getResponses:1423:  [20]
org.zkoss.zk.ui.UiException: Widget class required for <Keylistener zJxPf> with default
at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:1816)
at org.zkoss.zk.ui.impl.UiVisualizer.redraw(UiVisualizer.java:975)
at org.zkoss.zk.ui.impl.UiVisualizer.redrawComponents(UiVisualizer.java:987)
at org.zkoss.zk.ui.impl.UiVisualizer.addResponsesForCreatedPerSiblings(UiVisualizer.java:842)
at org.zkoss.zk.ui.impl.UiVisualizer.getResponses(UiVisualizer.java:706)
at org.zkoss.zk.ui.impl.UiEngineImpl.getResponses(UiEngineImpl.java:1416)
at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1228)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:600)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:482)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:491)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)



Dňa streda, 23. apríla 2014 18:37:48 UTC+2 Hiep Lq napísal(-a):

norber...@multimageweb.com

unread,
Apr 24, 2014, 9:40:28 AM4/24/14
to idem...@googlegroups.com
hi Hiep


2 issues was resolved from your suggestions: 

+ about 
  • Handle Marker click events
  • Reopen Marker text is not possible

and also 2 issues from known issues from WIKI:

Bitbucket was updated too (source, installable plugin too)

i will review also your ideas and put my future plans this week.
norbert

Hiep Lq

unread,
Apr 24, 2014, 2:46:22 PM4/24/14
to idem...@googlegroups.com
Your step redo is a bit difference from your link.
in link, when restart server or refresh reload zk, every think is ok.

I run project direct from eclipse, because I can't redo flow you, when i rerun in server, every install plug-in is loss.
my step:
1. run project, config database as wiki (add system config)
2. rerun project.
3. open flex install gmap plug-in 
4. login to idempiere, no new dashboad display
5. go to flex, refresh zk plug-in
6. login to idempiere without error, new dashboad display ok.
because fragment plug-in is can't start, refresh zk to make new plug-in work is normal.
of course error you encounter is not acceptable.

you can retest with run from eclipse?

@norber
When user use customize theme, maybe plug-in is not work.
I think add remark for this. 
to work with customize theme, must duplicate folder /theme/default and rename to name of customize theme 

Tomáš Švikruha

unread,
Apr 25, 2014, 3:08:45 AM4/25/14
to idem...@googlegroups.com
When I test t Google Maps from Eclipse everything is fine, no error. Only on server is problem. But when i restart the server, plugin is still installed, it is not lost as you wrote.

Nicolas Micoud

unread,
Dec 3, 2015, 3:47:20 AM12/3/15
to iDempiere
Hi,

I've started to play with your plugin. It's a killer feature ! Thanks a lot.

Question : is it possible to display the toolbar which allow to control Zoom on the dashboard (see screenshot).
Because when zooming/unzooming using the mouse wheel is not precise.


Another thing : reading https://developers.google.com/maps/documentation/geocoding/usage-limits, it says that we can't display more than 10 markers at a time (and this is also documented in your code). But I was able to select 15 bpartners and displays them.
Did I miss something ?

Regards,


Nicolas
2015-12-03 09_23_06-Google Maps.png

Nicolas Micoud

unread,
Dec 3, 2015, 4:16:40 AM12/3/15
to iDempiere
Hi again,

Wondering if your plugin could be used with mine : http://wiki.idempiere.org/en/Plugin:_GPS_GoogleMaps
As I'm retrieving gps coordinates and storing them in the C_Location table, there is no need to use the GeoLatLng object.
Will try to combine 2.

And will upload somethin if interested

Regards,

Nicolas

Carlos Antonio Ruiz Gomez

unread,
Dec 3, 2015, 8:09:35 AM12/3/15
to idem...@googlegroups.com
Nicolas, FWIW, I made a review of the two plugins some time ago, and these were my notes:

Both plugins are awesome!  Thanks for sharing.
______________

Nicolas Micoud / GPS GoogleMaps:

* Potential improvement: process that geolocate the whole C_Location table

* this plugin geolocates using an http call to http://maps.googleapis.com/maps/api/geocode/json
______________

Norbert Bede / Google Map Dashboard:

--> this answers your first question:
in gmap_mini.zul you can define attributes of the <gmaps>
http://www.w3schools.com/googleapi/google_maps_controls.asp
example add scale, rotate, overview controls
or disable/enable the default controls - change size - change type - position control
create custom control (i.e. back to my location)

* replace insert.sql with META-INF/2Pack.zip

* include also the other potential sysconfig keys:
** C GMAP_ASSET_MARKER = Equipment16px.png
** C GMAP_BPARTNER_MARKER =  BPartner24.png
** C GMAP_START_MARKER = pin_a.png
** C GMAP_END_MARKER = pin_b.png
** C GMAP_SHOW_BPARTNER_ASSET = true

* consider making it available for oracle, just works for postgresql -> FETCH FIRST 10 ROWS ONLY

* gmaps it uses library geocoding.jar from http://gglgeo.codeplex.com/

* suggestion to show a list on the right for the locations that cannot be resolved by the geocoding

* code is not taking into account the address 2
______________

Suggestion to integrate both plugins:

* The first plugin can geolocate and second plugin can just reuse the coordinates instead of calling everytime the gelocation service (same finding as your suggestion)

* Second plugin uses gllgeo library - first uses call to googleapis - which is better?


Regards,

Carlos Ruiz



On 03/12/15 a las 04:16, Nicolas Micoud wrote:

Nicolas Micoud

unread,
Dec 3, 2015, 9:17:58 AM12/3/15
to iDempiere
Hi Carlos,

For GPS :
#1 : I thought about creating process but as GoogleMaps allow only 2500 request/day, that could be hard. Or perhaps I should add a parameter to say "how many location should be processed" ?


For both
I'm modifying GoogleMaps plugin this way : "if latitude and longitude are filled, then no call to geocoding". So if you register coordinates when creating/updating locations you should never exceed limits (if you create less than 2500 locations/day).

Using gllgeo or googleapi seems to give same results. So not sure what is the best. Perhaps using googleapi ; as you don't need to put the library in your plugin.


Regards,

Nicolas

Nicolas Micoud

unread,
Dec 4, 2015, 10:15:43 AM12/4/15
to iDempiere
Here's the code which don't need call to geocoding.jar

MLocation loc = new MLocation(Env.getCtx(), locID, null);

// check if latitude and longitude are stored ; otherwise, we get them using GPS coordinates plugin and save them
   
if (Util.isEmpty(loc.get_ValueAsString("Latitude")) || Util.isEmpty(loc.get_ValueAsString("Longitude"))) {
   
GoogleMaps adr = new GoogleMaps(Util.deleteAccents(loc.getMapsLocation()));
    loc
.set_ValueNoCheck("Latitude", adr.getLatitude());
    loc
.set_ValueNoCheck("Longitude", adr.getLongitude());
    loc
.saveEx();
}

String lat = loc.get_ValueAsString("Latitude");
String lon = loc.get_ValueAsString("Longitude");

if (Util.isEmpty(lat) || Util.isEmpty(lat)) {
   
System.out.println("Error - no coordinates");
}
else {
   
String markerText = "<b>" + user.getName() + "</b><br><br>" + "YOUR_DESCRIPTION" + "<br><i> "+ address+"</i>";
   
String imagePath = bPartner_Marker;

   
double latit = Double.parseDouble(lat);
   
double longi = Double.parseDouble(lon);

   
Gmarker marker = new Gmarker(markerText, latit, longi);
   
[...]

}


Regards,

Nicolas
Reply all
Reply to author
Forward
0 new messages