Fix broken accordion widget

Also added a `displayed` event to the model and clean-up the code some while visiting this file.
The displayed event was requested in the mailing list by Nikolas Tezak, it helps make this implementation cleaner, and it will also help me with the D3 widgets.

closes #5397