Session.getInstance().getEventBus().addObserver(GotGadgetDefinitionCategoriesResponseEvent.class,
new Observer<GotGadgetDefinitionCategoriesResponseEvent>()
{
public void update(final GotGadgetDefinitionCategoriesResponseEvent event)
{
gadgetTab.addSet("All", GadgetDefinitionModel.getInstance(), new GadgetMetaDataRenderer(),
new GetGalleryItemsRequest("recent", "", 0, 0), "Recent");
gadgetTab.addSet("All", GadgetDefinitionModel.getInstance(), new GadgetMetaDataRenderer(),
new GetGalleryItemsRequest("popularity", "", 0, 0), "Popular");
for (String category : event.getResponse())
{
gadgetTab.addSet(category, GadgetDefinitionModel.getInstance(),
new GadgetMetaDataRenderer(), new GetGalleryItemsRequest("recent", category, 0, 0),
"Recent");
gadgetTab.addSet(category, GadgetDefinitionModel.getInstance(),
new GadgetMetaDataRenderer(), new GetGalleryItemsRequest("popularity", category, 0,
0), "Popular");
}
Session.getInstance().getEventBus().removeObserver(
GotGadgetDefinitionCategoriesResponseEvent.class, this);