Design Questions...

28 views
Skip to first unread message

jlmi...@kahalawai.com

unread,
Feb 21, 2014, 8:26:44 PM2/21/14
to mont...@googlegroups.com
Hi,

I'll need to interact with a Google map by periodically updating the markers I place on it.  So I'm wondering if this would be a good practice.

1. Subclass Application with my own MapApplication.
2. Create a global variable in my application class that points to my map singleton.  // Is it possible to define a global variable in the application class?  Or should I just place it in the header in index.html? 

Another item I'm pondering is I will need to load UI based upon links I embed in the marker's map tip i.e. inspect this marker should load the inspect marker panel.

Since Montage doesn't have the "router" is this an example of where I should be using custom events?  i.e. capture the selection event in the application object and then have that set some variables that can be bound to my components?  I know components support @owner and @controller bindings but can you also have an @application binding?

Sorry for kind of thinking out loud here.

Best,

Johnny

Benoit Marchant

unread,
Feb 21, 2014, 8:52:46 PM2/21/14
to Johnny Miller, Benoit Marchant, mont...@googlegroups.com
Johnny,


Let’s assume for a second that the Map is a component and you have the MarkerInspector Component. These 2 components would be side by side, instantiated in the template of one component called “GeoDataVisualization”. It would be the role of the GeoDataVisualization to keep track of what happens in the Map component and feed something to the MarkerInspector. That might be done with data bindings in the declaration, through code, or event handling, but it happens within the GeoDataVisualization component. If the rest of the app may need to know about what is selected for other reason, then the GeoDataVisualization should expose an api that update the model object selected by the marker so that other part of your app can get access to it.

Exposing all that at the app level would certainly work, but it wouldn’t make the most of keeping data flowing in a more encapsulated way.

Does that help?

Benoit
--
You received this message because you are subscribed to the Google Groups "Montage JS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to montagejs+...@googlegroups.com.
Visit this group at http://groups.google.com/group/montagejs.
For more options, visit https://groups.google.com/groups/opt_out.

jlmi...@kahalawai.com

unread,
Feb 23, 2014, 11:43:43 PM2/23/14
to mont...@googlegroups.com, Johnny Miller, Benoit Marchant
Hi Benoit,

Indeed it does.  The one part that I don't quite get, yet, is the section about:

...GeoDataVisualization should expose an api that update the model object selected by the marker so that other part of your app can get access to it.

Is there documentation on how to set up a data model?  I see the API on binders and blueprints.  Would that be a good place to start?

Thanks a million.


Suppose I have an object: selectedMarker.  

Benoit Marchant

unread,
Feb 24, 2014, 1:44:36 AM2/24/14
to Johnny Miller, mont...@googlegroups.com
Johnny,

I assume that the marker themselves are a way to represent some “data object” as in pure JS objects holding information. So when a marker is clicked by the user, it would become the “selectedMarker”  which make the object that was associated with it the “selectedData”. The “selectedMarker” might be useful for the inner working of the GeoDataVisualization component, but shouldn’t be exposed outside of it, what should be exposed if needed by the rest of your app is the “selectedData” property. That way the internal representation of GeoDataVisualization stays encapsulated.

Our whole data layer, as in EOF/CoreData like, isn’t complete. The binders and blueprints that you’ve seen are part of it, but for the scope of our conversation, that’s not really needed as it would really be the same wether you got a JSON object from a REST XHR call or wether you had fetched a model object through our data layer.

Benoit
Reply all
Reply to author
Forward
0 new messages