help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] seaside problem of understanding


From: Joachim Jaeckel
Subject: [Help-smalltalk] seaside problem of understanding
Date: Wed, 10 Jun 2009 18:12:25 +0200
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

Hello,

maybe one of you could do me a favor...?

I try currently making friends with seaside. And bought the Tutorial book etc. But I have definetly a problem, running the example of the book.

I first tried it in gst, and the most simple thing worked, than I came to step 2 (beginning of chapter 4) and from that point, gst is running wild, if I try to call the web-site of the tutorial app.

After all, I tried it today with pharo, because the book is based on squeak and pharo should be very similiar. But even here, I have the same problem.

Maybe one of you, who has a deeper knowledge of smalltalk and maybe seaside, could point me to the problem in my script. I don't find any mistake...

Would be really great.

The problem comes up, if I use in the STRootComponent the initializeMenuComponent method. If not, everything works. But I can't see any error in this.

(If I use in the STRootComponent a line like "menuComponent: StMenuComponent new;" than everything is fine.

Please see the script attached, I have currently no idea anymore.

Regards,
Joachim.
Namespace current: STTutTodoApp [

    Seaside.WAComponent subclass: StMenuComponent [
        | entries |

        entries [ ^entries ]
        entries: someEntries [ entries := someEntries ]

        initialize [
            super initialize.
            entries := OrderedCollection new.
        ]

        addEntry: aString withAction: aBlock [
            self entries add: aString -> aBlock
        ]

        renderContentOn: html [
            html anchor callback: []; with: 'Pre'.
            html space.
            html anchor callback: []; with: (entries size printString).
            html space.

        ]
    ]

    Seaside.WAComponent subclass: StListComponent [

        renderContentOn: html [
            html table: [
                html
                    tableRow: [ html tableData: [html text: 'Table entry' ]];
                    tableRow: [ html tableData: [html text: 'Table entry' ]]
            ]
        ]
    ]

    Seaside.WAComponent subclass: STRootComponent [
        | menuComponent listComponent |

        STRootComponent class >> canBeRoot [
            ^true
        ]

        menuComponent [ ^menuComponent ]
        menuComponent: aMenu [ menuComponent := aMenu ]

        listComponent [ ^listComponent ]
        listComponent: aList [ listComponent := aList ]

        initialize [
            super initialize.
            self
                menuComponent: self initializeMenuComponent;
                listComponent: StListComponent new.
        ]

        initializeMenuComponent [
            | bla |
            bla := StMenuComponent new.
            bla addEntry: 'All1' withAction: [].
            bla addEntry: 'All2' withAction: [].
            self menuComponent: bla.
        ]

        children [
            ^Array with: (self menuComponent) with: (self listComponent)
        ]

        renderContentOn: html [
            "I render everything by calling html"

            html heading: 'ToDo-List'.
            html div
                class: 'menu';
                with: self menuComponent.
            html div
                class: 'list';
                with: self listComponent.
        ]
    ]

]

STTutTodoApp.STRootComponent registerAsApplication: 'STTutorial'

reply via email to

[Prev in Thread] Current Thread [Next in Thread]