[aida] Aida Single-Page component library

Jaroslav Havlín jaroslav.havlin at gmail.com
Tue Jun 30 00:10:44 CEST 2009


Hello Nicolas,

> Could you explain how it is more sophisticated? Do you see limits in
> Iliad or Seaside way of doing it?

No, I meant that Iliad's and Seaside's way is more sophisticated :-)
AidaSP implementation
is very simple and it can bring problems when the user uses more than
one browser window.
I hope we will solve this with Janko's contexts.

> So, only modified elements are sent to the client? How do you detect
> modified elements?

There is a simple algorithm for that.
1) Before a request is handled, a snapshot of current state of element
tree is taken. We call this the shadow-tree. It is a structure that
holds only
the hashes of the elements in the real tree.
2) An action is invoked. This can lead to changes in the element tree,
or changes in the model (but this can propagate as change in the
element tree as well).
3) The updated tree is compared to the shadow-tree, and elements that
should be sent to the client via AJAX are detected.
This is quite complicated, because only elements with ID attribute can
be updated. So it is needed to find the deepest possible ancestor with
ID.

The code can than look like this:

e := SPWebElement newDiv.
e id: 'counterControls'.

e addLinkText: '-- ' thatDoes: [self observee decCounter].
valueContainer := SPWebValueWrapper with: [self observee counter asString].
e add: valueContainer.
e addLinkText: ' ++' thatDoes: [self observee incCounter].

> Also, do you use AJAX requests? and if so what will happen if js is
> disable?

AJAX request are used by default. If the browser doesn't support AJAX,
standard requests are used automatically. But this only works in
Firefox now :-(

> You're welcome. I'm working on a squeak port, so Iliad could people not
> familiar with gst will be able to give Iliad a try.

That are really good news. Thank you!

Kind regards,
 Jarda


More information about the Aida mailing list