renggli at iam.unibe.ch
Thu Apr 14 23:30:28 MEST 2005
> 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:
> | comp |
> comp := self context componentFor: self structure.
> ^(comp asComponent)
> "addValidatedForm: #( save cancel );"
> addDecoration: (MAFormDecoration buttons: #( save cancel ));
> addDecoration: (SW2ValidationDecoration new);
> This works until I press the save button. Then somehow my Seaside2
> 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
In general: Never write to the model directly, always use the command
pattern, else your changes will be lost.
More information about the SmallWiki