Hi:
I finally got around to fixing bug #4006: Right way to select sidebar
entries? I thought it might be of interest to others, especially parcel
writers who need to add collections to the sidebar and select them.
Below is a summary from the bug report. The bug also has a patch if
you'd like to see how much the code can be simplified.
There is an existing event that adds an item to a collection, e.g. the
sidebar
and optionally selects it in a block. So if you replace your event with this
event almost all of your code that deals with your old event can be deleted,
e.g. the controller, the event handler and the routine the event handler
calls.
You can even get rid of the code that creates the CertificateStore and
initializes it if you just create it at repository build time. You also
don't
need to subclass the KindCollection to use it.
So in summary, here's a few rules of thumb:
- If your items should always exist, create them at repository build time.
- Usually you shouldn't subclass to initialize attributes, just assign them
when the object is created.
John
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev