ArcBees/GWTP — pull request #566 by rdwallis (2014-08-28 18:14:56+00:00)
Title: Slots

This extends from my popups branch so it's probably best to finish reviewing that before starting on this.

I haven't tested if it works or added any documentation but it is amazing anyway so I thought I'd share it.

I realized that I could extend my Slot class to mostly solve https://github.com/ArcBees/GWTP/issues/236 and also very cleanly implement an Indexed Slot.

So there are now 3 types of Slot.

SingleSlot - Can only have one Presenter at a time. You can't call addToSlot with this slot.
MultiSlot - Can have multiple slots or one slot you decide.
OrderedSlot - Like MultiSlot but can only contain Presenters that are comparable.

In View there's a new overloaded method `registerSlot` and it will enforce a contract where:

SingleSlots can be registered to any class that implements either the HasWidgets or HasOneWidget interface.
MultiSlots can be registered to any class that implements the HasWidgets interface.
OrderedSlots can be registered to any class that implements the HasWidget & IndexPanel.ForIsWidget interface.

And if you do that then the view will automatically take care of setInSlot, addToSlot and removeFromSlot so no more if else if else if else madness.