'Complex' Content on the Timeline (not in the Bubble) and a Events ..

19 views
Skip to first unread message

uli

unread,
Jul 4, 2008, 10:21:33 PM7/4/08
to SIMILE Widgets
Hi there,

I've just started digging into the Simile Widgets, especially
Timeline, and have a few questions I'm unable to solve with the
documentation. I have to admit, and sorry for that, that I haven't
complety understood the code Architecture so these questions may be
very trivial ...

1. Is there a Callback Event when Data from an event Node is added to
the DOM?
I would like to add a piece of html for an event like this:

<event start="Jul 03 2008 22:19:04 GMT+0200" title="Test" link="http://
localhost/similie-test/?p=5" color="#58A0DC">
<![CDATA[
<h4>Headline</h4>
<img src='schnitzel.jpg />
]]>
</event>

Basically it should add the whole Node Content instead of event.title
to the disaplay. Is that stupid, not possible or maybe both?


2. Can I change the default behaviour for Clicks on Events? So it
doesn't open the bubble but calls a js function for example ...


Any help or hint in the right direction would be nice.
Thanks a lot

uli

David Erickson

unread,
Jul 4, 2008, 11:21:21 PM7/4/08
to simile-...@googlegroups.com
On Fri, Jul 4, 2008 at 7:21 PM, uli <uli.sc...@gmail.com> wrote:
>
> Hi there,
>
> I've just started digging into the Simile Widgets, especially
> Timeline, and have a few questions I'm unable to solve with the
> documentation. I have to admit, and sorry for that, that I haven't
> complety understood the code Architecture so these questions may be
> very trivial ...
>
> 1. Is there a Callback Event when Data from an event Node is added to
> the DOM?
> I would like to add a piece of html for an event like this:
>
> <event start="Jul 03 2008 22:19:04 GMT+0200" title="Test" link="http://
> localhost/similie-test/?p=5" color="#58A0DC">
> <![CDATA[
> <h4>Headline</h4>
> <img src='schnitzel.jpg />
> ]]>
> </event>
>
> Basically it should add the whole Node Content instead of event.title
> to the disaplay. Is that stupid, not possible or maybe both?

Definitely possible, and this is a very interesting idea as I was
thinking of ways to make the current painters more generic and
extendable. You could code this up pretty quickly, you would just need
to modify the Timeline.OriginalEventPainter in original-painter.js,
specifically the paintPrecise* and paintImprecise* methods. If you
decide to do this please do contribute your code back to the
repository.


> 2. Can I change the default behaviour for Clicks on Events? So it
> doesn't open the bubble but calls a js function for example ...

Yes, the event registration for clicks occurs in the previously
mentioned methods.

-David

uli

unread,
Jul 5, 2008, 2:52:36 PM7/5/08
to SIMILE Widgets
Thanks for the quick reply and the hint! I successfully edited the
detailedPainter to render Html encapsuled in CDATA but that of course
brings in a whole bunch of problems with calculating the position of
the timeline entries as one entry could be of generic size
(overlappings ..). I'm now trying to add a width and a height
parameter to theme.event.label (default values) and to
Timeline.DefaultEventSource.Event so it can be read from the content.
This is more like brute force than smart as I think it may be possible
to do at least some kind of dynamic placement with elements of generic
width and height. I'm very sure it will revolve around
this._frc.computeSize but I just can't figure out where it is defined
and what it does exactly .... Any Ideas :)

And for the other issue I had, how can I prevent the Bubble from
opening altogether without doing strange things in the api source ..
Currently I use the onSelect event, but that is fired after the bubble
is opened, so it flickers through.

This really is a neat and solid piece of work, would be so great if
there was more noob documentation and you don't have to discover all
the goodies in the code.

Btw. I'm working with the Wordpress Plugin from Tim Isenheim (http://
www.freshlabs.de/journal/archives/2006/10/wordpress-plugin-simile-timeline/)
and am now able to have full exerpts of blog entries directly on the
timeline, with the above mentioned limitations of course. I will try
to make it clean enough for a commit if I should handle it ...

best
uli




On Jul 5, 5:21 am, "David Erickson" <halcyon1...@gmail.com> wrote:

David Erickson

unread,
Jul 5, 2008, 6:36:42 PM7/5/08
to simile-...@googlegroups.com
On Sat, Jul 5, 2008 at 11:52 AM, uli <uli.sc...@gmail.com> wrote:
>
> Thanks for the quick reply and the hint! I successfully edited the
> detailedPainter to render Html encapsuled in CDATA but that of course
> brings in a whole bunch of problems with calculating the position of
> the timeline entries as one entry could be of generic size
> (overlappings ..). I'm now trying to add a width and a height
> parameter to theme.event.label (default values) and to
> Timeline.DefaultEventSource.Event so it can be read from the content.
> This is more like brute force than smart as I think it may be possible
> to do at least some kind of dynamic placement with elements of generic
> width and height. I'm very sure it will revolve around
> this._frc.computeSize but I just can't figure out where it is defined
> and what it does exactly .... Any Ideas :)

this._frc = SimileAjax.Graphics.getFontRenderingContext(eventLabelPrototype);

It is all defined in the ajax apis in graphics.js. Essentially all it
does is actually inserts the element into a track (hidden), and
extracts its actual width and height when its in the page, and returns
that so it can be placed into a track. You should be able to use it
unmodified, although you may need to wrap a div around your content
because it takes one parent element as an argument, this would allow
you to not need to specify width and height beforetime, which would be
terribly inaccurate anyway.

> And for the other issue I had, how can I prevent the Bubble from
> opening altogether without doing strange things in the api source ..
> Currently I use the onSelect event, but that is fired after the bubble
> is opened, so it flickers through.

I believe the bubble is shown by default on every click to an event
and there isn't currently an override option.. you would need to
subclass the painter or override the following methods:
Timeline.OriginalEventPainter.prototype._onClickInstantEvent
Timeline.OriginalEventPainter.prototype._onClickDurationEvent

>
> This really is a neat and solid piece of work, would be so great if
> there was more noob documentation and you don't have to discover all
> the goodies in the code.

The wiki has some pretty good documentation, however I'm not sure how
up to date it is with the current code in the repository.

>
> Btw. I'm working with the Wordpress Plugin from Tim Isenheim (http://
> www.freshlabs.de/journal/archives/2006/10/wordpress-plugin-simile-timeline/)
> and am now able to have full exerpts of blog entries directly on the
> timeline, with the above mentioned limitations of course. I will try
> to make it clean enough for a commit if I should handle it ...

Great.. feel free to send me a patch at some point if you'd like and I
can take a look.

-David

Reply all
Reply to author
Forward
0 new messages