You can initialize your instance variable in an initialize method

WAComponent subclass: #PrintHtml
        instanceVariableNames: 'tasks'
        classVariableNames: ''
        poolDictionaries: ''
        category: 'KillerApp-Web-UI'


Then a method to initialize on the instance side PrintHtml>>initialize:

    initialize
        "initialize the receiver"  
        super initialize.
        tasks := #('read' 'before' 'you' 'try')


If you send #new to a class this #initialize method is automatically called. If 
you do not want it use #basicNew.

So if you enter

     PrintHtml new 

in a workspace and select "Inspect it" to open an inspector on the new object
this method gets called and therfore you will see that the instance variable 
should have the collection as contents.

Side note: Do not forget the "super initialize" in this method - otherwise 
           superclass initialization for seaside components is not done.


Then use a normal rendering method to display the ivar in the browser

      renderContentOn: html
           html orderedList list: tasks

If I understand you correctly you want to know how you acces the 
Seaside generated code for a WAComponent subclass also in a workspace.
This is easy:

  |component|
   component := PrintHtml new.  "your seaside component"
   WARenderCanvas builder
     render: [ :html | html render: component ]

which should return the generated HTML: 

   '<ol><li>read</li><li>before</li><li>you</li><li>try</li></ol>' now.


That is one way. The preferred way for Seasiders is to directly look at 
the generated HTML code in the webbrowser. Just go to your app:

  http://localhost:8080/killerapp

Down at the bottom you will find the seaside development toolbar (only visible
when developing) and then click on "Halo". Now Seaside renders a rectangle
around each component and you can click on "Source" to Switch to the source
of a component. Also try the other buttons there.

For sure you should read one of the introduction stuff on Seaside, I would
recommend the online Seaside book:
 
   http://book.seaside.st/book

Bye
T.

Reply via email to