[deepamehta-devel] custom renderer question

Jörg Richter jri at deepamehta.de
Mi Sep 4 18:14:22 CEST 2013

Hi Torsten,

thanks for kind feedback and questions!

On Sep 3, 2013, at 13:59, Torsten Ziegler wrote:

> I have one question in regard to custom renderers,
> not in the detail panel but on the (left hand) canvas.

First, you could implement and register a custom topicmap renderer. You have full control over rendering and interaction of the left panel then.

As a reference you could investigate the 3 topicmap renderer implementations existing so far:
1) The default HTML5 Canvas based renderer included in the standard distro:
2) The OpenLayers based Geomap renderer included in the standard distro:
3) The 3rd-party SVG based topicmap renderer (unfinished) developed by Jörn:

However, implementing a custom topicmap renderer is possibly overkill in your situation. As I understand your goals you rather want to do only selective changes to the default renderer (and not to reimplement all its rendering and interaction functionality).
Probably the way to go is to equip the default renderer with extension points...

> Is it still so, that the rendering is done by the
> deepamehta-client only without interaction of the
> topics or topicmaps except for the icon and custom title field ?
> I would like to adjust the rendering of just some topictypes,
> so I would prefer to not replace the client completly
> to easily stay up with future changes in the deepamehta-client.

Generally, DM strives for enabling external developers (like you) to extend/adapt the DM standard distro by developing plugins, that is without changing the standard distro itself. For that you rely on the extension points (hooks, events) provided by the standard distro. If the existing extension points are not sufficient we will identify/conceptualize further ones. The new extension points are implemented by the standard distro developers then.

> Where (in which modules) would I have to look for hooks
> or to rewrite code to implement some of the following:
> - custon rendering of a topic on the canvas (e.g. no icon, frame around title)

Currently there is no way for a plugin to modify the topic rendering of the default topicmap renderer. I could equip the default renderer with a mechanism that allows you to hook in a custom topic renderer. This way you could override the default topic rendering (icon + label). Do you want me to do so?

> - custom automatic placement of topics on a special type of topicmap (triggered by a function call in the topicmaps detail pane)

Just to clarify: do your plugin want
1) interfere with the **standard placement strategy** that is applied when a) the user creates a new topic via the standard menu or b) when she reveals a topic via a standard detail panel link? Or
2) place topics with explicit coordinates as response to a **custom command** provided by your plugin?

In case of 1) I would have to equip the default renderer with a further extension point.

In case of 2) -- that is when **your plugin** explicitly initiates the topic display -- your plugin could simply call
	dm4c.do_create_topic() -- to create a topic in the DB and display it, or
	dm4c.show_topic() -- to display a topic which already exists in the DB
and pass x/y coordinates repectively.

See dm4-webclient/src/main/resources/web/script/webclient.js

Or (still another case) are the topics already displayed and you want move them programmatically?

> - custom rendering of mouse menu (right click on topic) for one topictype to add new functions

To place additional commands in the topic context menu or detail panel (to appear as buttons below the content) your plugin can register a listener to the "topic_commands" event.

	dm4c.add_listener("topic_commands", function(topic) {

The "topic_commands" event is fired every time the context menu is displayed. Your handler could investigate the topic's type or add commands for all types.

For examples see:

> - adding custom keyboard shortcuts

Currently there is no special support for keyboard shortcuts.
Lets talk about this later.

So far for a first reply.
Lets stay in touch to go more into the details.

Unfortunately I can respond to your other mail not before friday.


Mehr Informationen über die Mailingliste devel