Plugin dev: more flexible Topicmap creation
Why using a framework?
For maptype implementers DMX provides a framework that abstracts technical cross-cutting concerns away from the developer, aspects like caching, state management (GUI consistency), route management, and client-sync.
Maptype implementers are supposed to make use of this framework for 2 reasons:
- consistent application state and user experience is guaranteed
- implementing is much more economic, provided the developer is already familiar with the framework
Existing topicmap type framework
The server-side endpoint for topicmap creation is /topicmap
. All topicmaps, regardless of type, are created by posting to this endpoint. A maptype implementer is not supposed to establish her own endpoint for topicmap creation.
At client-side for topicmap creation the Webclient provides the createTopicmap()
action. All topicmaps, regardless of type, are created by dispatching this action. It is responsible for talking to the /topicmap
endpoint, updating the Webclient state (e.g. the topicmap selector), and controlling the router (so that the browsers updates the address bar). A maptype implementer must not talk directly to the backend for topicmap creation.
At server-side when a topicmap is created the maptype implementer is responsible for setting the topicmap's initial state (by defining initTopicmapState()
in her TopicmapType
implementation), e.g. "pan" and "zoom" values. At the moment maptype implementers can set constant initial state by the means of DB props. For the existing 2 maptypes (Topicmap, Geomap) this was sufficient.
Required extension
Now (in the face of the Tableview maptype, dmx-plugins/dmx-tableview#47 (closed)) more flexible init mechanics is required, so that the maptype implementer is able to:
- pass arbitrary config data (originating from e.g. an Options Component) to the
createTopicmap()
action (client-side) - operate on this config data in the
initTopicmapState()
method (server-side) - store config data as arbitrary topics and associations (not only as DB props) and associate the config to the created Topicmap topic (server-side)