[deepamehta-devel] Fwd: custom renderer question

Jörn Weißenborn joern.weissenborn at gmail.com
Mi Sep 4 21:02:41 CEST 2013


Hi Thorsten,

I had the same questions also, so let me share what I found out:

2013/9/3 Torsten Ziegler <torsten at ziegi.de>

> Hi Jörg et al,
>
> thanks for the good work on the new 4.1.1 release.
>
> I have one question in regard to custom renderers,
> not in the detail panel but on the (left hand) canvas.
>
> 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.
>

First thing: there is a quite useful model of the topicmap working behind
the scences. you can get it by a curl on the topicmaps url. Its basically a
json containing all topics and associations displayed on the topicmap. you
can work on it in a custom plugin. changes will automatically be reflected
by the webpage renderer. Manipulating these is the only way to avoid
writing an own topicmaprenderer.


> 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)
>

no icon is easy since the webclient expects you to provide a png ressource,
which could be just empty. Frames around the title? Not with the buildin
renderer...



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

This yould be done by be writing a plugin which is hooked up to the topic
service (or whatever it is called), which tells you when a topic is
created. A topics initial position is chosen on a function depending on
proximity to where the last action happened and where is space left. You
would need to react every time a new topic is created, lookup the
associated topicmap and then you must apply your own x and y coordinates.


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

At the Moment the DM provides no way to achieve this other then writing
your own renderer. Maybe its possible to make a descendent of the default
renderer and override the contextmenu, but that would be ugly since the
context menu is buried deep inside the webclients controller. Even in an
own renderer there is no elegant way to achieve this.


> - adding custom keyboard shortcuts
>

Only in an own renderer since those bindings needed to  be declared in the
renderers scriptfile. See how javascript eventhandling works (e.g. on
w3school.org).


>
> thanks,
> Torsten
>

Sorry, but right now you would either need to do some heavy and non trivial
development to achieve your task or wait for a better Webframework. I for
my self think that at moment the easiest thing is to use a framework wich
can directly bind to REST like ember.js. Since DM Provides the Topicmap via
REST, its very easy to write an own implementation. If you are interested,
I think it would be easy to transform my SVG renderer Plugin (
https://github.com/joernweissenborn/dm4-svgrenderer) in a way that instead
of beeing part of the webclient, it would just bind its datamodel to
DeepaMehta's REST API. That way you are free from the limiting webclient.
Actually I will do this anyway. Starting from there, it should be
relatively easy for you then implement the things you want.

Alternatively, copy and paste either mine or jri's tompicmaprenderer,
rename it and adjust it as you want. That would be straightforward, I can
be of help, just write an e-mail!

Best,

Jörn
-------------- nächster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: <http://lists.deepamehta.de/mailman/private/devel-lists.deepamehta.de/attachments/20130904/d2cc6b7e/attachment.html>


Mehr Informationen über die Mailingliste devel