Now that we can add arbitrary Seaside2 components in
SmallWiki2, I'd
like to
be able to edit them. I initially though that'd be quite simple. Just
add a
description to my components and do something like this:
MyCommand>>asComponent
| comp |
comp := self context componentFor: self structure.
^(comp asComponent)
"addValidatedForm: #( save cancel );"
addDecoration: (MAFormDecoration buttons: #( save cancel ));
addDecoration: (SW2ValidationDecoration new);
yourself.
This works until I press the save button. Then somehow my Seaside2
component
ends up as structure in the context.
I don't really understand what you try to do :-/
After all the component instance you are requesting by calling
#componentFor: is only existing during the current session. Don't you
want to have something more persistent?
In my opinion the properties of the Seaside component should be stored
in the structure. The description for this could be built from the
command object (SW2EditComponentCommand) that is dynamically enhanced
with the description of the currently selected component class.
Another thing I don't like in your code is that you don't store the
modifications in the command object. This means that the changes won't
be logged.
In general: Never write to the model directly, always use the command
pattern, else your changes will be lost.
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch