return WebElement or not?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

return WebElement or not?

Chris Muller-3
Am I supposed to return (^) the WebElement I create in various view... methods?

I have a #viewMain that tries to render a set of tabs, as in:

viewMain
        | e |
        e := WebElement newId: #content.
        e addTextH1: 'My Page'.
        e addBreak.
        e add: self viewTabs.
        "Main view composition goes here"
        self style
                pageFrameWith: e
                title: self title.

and, I discovered, if I _don't_ put  "^e" on the lsat line then I get
a page with the Aida banner and side bar (which I don't want), but the
tabs are rendered (which I do want).

If, however, I add "^e" to my viewMain, then I don't get the Aida
banner and side bar, however the tabs are rendered merely as links.

I tried to discern the answer by looking at the code:
WebApplication>>#printWebView:for: checks the return value of the
viewMethod with a #isApplication (which means I didn't ^e) and, if so,
registerFormElements.  But if I don't return the page, then how can it
render the content of the tab?

Thanks,
  Chris
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: return WebElement or not?

Janko Mivšek
Hi Chris,

On 09. 05. 2011 03:07, Chris Muller wrote:

> Am I supposed to return (^) the WebElement I create in various view... methods?

No, usual way is to add this element to this app instead, because
instance of app is (ok, was historically) actually a page, or delegates
to a page where this element should render at the end. So, you example
would look like:

viewMain
  | e |
  e := WebElement newId: #content.
  e addTextH1: 'My Page'.
        ...
        self add: e

The "self style pageFrameWith: e title: self title" is additional (but
default) way to make a default layout of your page with help of separate
Style class. By making your own style class subclassing from WebStyle
(or even better DefaultWebStyle) you can make your own layout and CSS
design of the same content. This is unique Aida way of webpage design
and enables you to run many websites each with its own design from the
same image.

Best regards
Janko

>
> I have a #viewMain that tries to render a set of tabs, as in:
>
> viewMain
> | e |
> e := WebElement newId: #content.
> e addTextH1: 'My Page'.
> e addBreak.
> e add: self viewTabs.
> "Main view composition goes here"
> self style
> pageFrameWith: e
> title: self title.
>
> and, I discovered, if I _don't_ put  "^e" on the lsat line then I get
> a page with the Aida banner and side bar (which I don't want), but the
> tabs are rendered (which I do want).
>
> If, however, I add "^e" to my viewMain, then I don't get the Aida
> banner and side bar, however the tabs are rendered merely as links.
>
> I tried to discern the answer by looking at the code:
> WebApplication>>#printWebView:for: checks the return value of the
> viewMethod with a #isApplication (which means I didn't ^e) and, if so,
> registerFormElements.  But if I don't return the page, then how can it
> render the content of the tab?
>
> Thanks,
>   Chris


--
Janko Mivšek
Aida/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida