[Seaside] Object Model in Seaside
orichards at mail.ru
Fri Aug 24 04:10:05 UTC 2007
First of all i would like to say thank you to everybody, who helped
evaluation expression suggestions.
My next question is model - view separation. This night i have found
one solution, but
i would like to know your opinion, guys. So here is it:
I have a reporting application. So i have model Report Template. This
report template consists of
different rows. Every row is defined by each own class, inherited
from BaseRow for example.
Now i need to render template. In my TemplateComponent i should go
through each row and render it, but
every type of row looks different. If i will add a big if - it will
be procedure code. I dont want it and i don't want
to write code to this if, if i need to add more rows. Another way is
to add rendering code to row model itself. But this
will break model - view separation. So what do you recommend to me?
I found this solution: Create one more class (Should it be inherited
from WAComponent ?) - RowComponent or RowVisual.
And create a subclasses for it, which will represent every type of my
row. Then i just should go through every row in my
TemplateComponent and look up at dictionary which will find a proper
Component renderer for me. With such way i can also
make additional functionality. I can create subclass of
SpecificRowComponent for different application modes - for example
Editing, Viewing, e.t.c.
So what do you think about it? Is there a better way to accomplish it?
More information about the seaside