[aida] Elements nesting/composition
janko.mivsek at eranova.si
Mon Jan 5 20:10:14 CET 2009
I hope you didn't give up waiting for an answer so long. Sorry!
Answers are below.
Esteban A. Maringolo wrote:
> I have some assorted questions about the WebElement hierarchy and how
> to use it properly.
> As far as I understand, every domain object that want to be displayed
> through a RESTful URI must have a corresponding WebApplication
> subclass (e.g. MyModelApp).
> But what happens if I want to factorize my views, so I can have an
> "embeddable" view of MyModelApp?
> Can I do this?
Not a view embeddable into another view, but any element can of course
be embedded into another element, on the same App.
For reusable cross-app elements you subclass a WebComponent. Prime
example for such reusable, standalone, highly useful component is WebGrid.
> Should I build a subclass of WebElement, and then use such WebElement
> in MyModelApp?
Exactly. Even better: subclass a WebComponent, because you'll get even
more standalone and Ajax-ified component at the end. And WebComponents
will be greatly enhanced in the future. See again WebGrid for example.
> Each object will have a RESTful URI, and will end being redirected to
> its corresponding App, let's say ContainerModelApp, which will include
> a site navigation bar, other stuff, and the ContainerModel view
In this case you better make an App class hierarchy accordingly:
> What I want to do is:
> A. Factorize the raw view of the ContainerModel, in order to be able
> to embed it in another App.
> B. Embed a small/different view of ElementModelApp in
> ContainerModelApp (e.g. a table row view, or some tile-like view).
> I don't see a clear distinction between WebElement and WebApplication,
> except for the fact that WebApplication includes some methods to
> define page title and stuff at a "page" level.
This is the distinction, yes. WebApplication is for a whole web page, it
is therefore a root of a whole element hierarchy of that page. You
couldn't therefore embed a whole page in another page (but even that
works:). As said the standalone subclasses of WebElement/WebComponent
are meant for such embedding as you'd like to achieve. Another way is
WebApp subclass hierarchy. Yet another way is iframe inside a page, but
this sounds a bit hacky for your case.
Smalltalk Web Application Server
More information about the Aida