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