Custom map marker opening to dynamic content
ZeeForge developed all code for “ZeeGuide™”, an application
of the Hex™ platform that provides a “Facebook for neighborhoods”. The location of the owner
of a specific ZeeGuide is displayed as a branded marker on an interactive
Google map that opens to a “ZeeWindow” in response to a mouse click on the
custom marker. The development challenge was to provide end-to-end code that
determines and supplies the html content of the ZeeWindow dynamically, based
on merchant profile information stored in the database, so that the user sees
the most recent custom content supplied and frequently updated by the owner.
In the browser, the "openZeeWindow" method of an instance of ZeeMarker (a Javascript class provided by
the browser binding of the Hex framework) is invoked in response to the click handler
of the Google marker. The receiver contains an instance of ZeeCommand (another Hex
framework class), created during initialization of the receiver, that reifies
the AJAX interaction with the server that will ultimately supply the html. This
ZeeCommand instance (an application of the "Command Object" software design pattern)
holds a reference to the ZeeMarker, the intended method selector for the server
operation ("homeWindowHTML" in this example), and a URL for the server that will
handle the request (http://red.dev.zeetix.net/zorb/17125/homeWindowHtml?isDirect=true). After validating that the receiver is enabled, the openZeeWindow method invokes
the "get" method of the command object. This, in turn, invokes an AJAX exchange with
the server and calls the "openInfoWindowHtml" Google Map api method with the result.
On the server, an object broker (supplied by the server binding of Hex and coded in Python)
handles the browser request. That request includes the persistent object ID of a receiver ("17125"), a
method selector to be invoked ("homeWindowHTML"), and any arguments ("isDirect=true").
The request is ultimately dispatched by the server object broker to the
server-side instance of the same object (in this case, a ZeeMarker
with objectID of 17125). The object broker retrieves the contents of this object from
the persistent object store (implemented in MySql), caching records as needed, and
invokes its homeWindowHtml method (written in Python).
Since ZeeMarker is a presentation object, the homeWindowHtml method is delegated to
a descendant of ZeePage through presentation logic that identifies the owner of the ZeeMarker, queries a
user profile associated with that party, and returns a ZeeWindow descendant (in this case,
an instance of PremiumZeeWindow) that displays a ZeeView that ultimately references
(through a ZeePage instance kept as an instance variable of the ZeeView) the business
data associated with the owner of the ZeeMarker.
Having been dynamically bound to the appropriate ZeePage instance (supplied
with the owner of the original ZeeMarker), the homeWindowHtml method is ultimately
implemented by an instance of ZeeWindowRenderer (an application of the "Strategy" software
design pattern). The ZeeWindowRenderer expands template objects provided by the
Hex presentation framework with business data associated with the owner and kept in the
persistent object store, and constructs the requested HTML. The careful separation
of presentation and business logic maximizes the ability of each to be independently
varied, a foundation of mature software design.
The resulting html is then serialized, using a Python implementation of JSON (with a
C-language accelerator added to eliminate a major bottleneck identified during earlier
benchmarking), and wrapped in an object for delivery to the browser.
This response, received asynchronously by the browser in its AJAX handler, is
unwrapped in Javascript and the resulting html is then passed to the openInfoWindowHtml
method of the Google API. The desired window then pops up in the interactive map
of the user's browser
ZeeForge is eager to share
more information about this example. We are still preparing that information
for publication. Please use the form below to request our pre-publication
material.