[aida] 6.5 news: Convenience with auto subelements

Janko Mivšek janko.mivsek at eranova.si
Wed Aug 8 12:13:02 CEST 2012

Hi guys,

First please find me naming and explanation of this feature better.

It is like you can work with tables easily just by using e cell, e
newCell, e newRow etc. See example here: http://www.aidaweb.si/tables .

Namely, I just introduced the same convenient composing for all
structural tags from divs and spans to new HTML5 headers, footers etc.

Most common subdivs can be now created with:

	e newDiv

Until you create a new one with another e newDiv, the current one can be
referenced simply by:

	e div

You can nest more divs simply by nesting those calls. Two level divs:

	e newDiv newDiv

And because div is automatically created at first #div call this can
become simply as:

	e div div

Now your typical page with ordered list included would look like:

  | e |
  e := WebElement new.

  e newHeader
     id: #header;
     addTextH1: 'My page'.

  e newSection
     id: #content;
     addText: 'Here comes my list'.

  e section newList ordered
     addText: 'First in list';
     addText: 'Second in list'.

  e newFooter
     id: #footer;
     addText: 'My footer'.

  self add e.

Old way looks much uglier, specially list part:

  | e content list |
  e := WebElement new

  (e add: (WebElement newHeader id: #header))
    addTextH1: 'My page'.

  content := e add: (WebElement newSection id: #content).
  content addText: 'Here comes my list'.

  list := content add: WebList newOrdered.
    addText: 'First in list';
    addText: 'Second in list'.

  (e newFooter id: #footer))
    addText: 'My footer'.

  self add e.

Best regards

Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565

More information about the Aida mailing list