orderedGroups.addAll(groups.getPagedSet());
// display groups
for (final DomainGroupModelView group : orderedGroups)
{
GroupPanel groupWidget = new GroupPanel(group, false, true, false);
final Label subscribeButton = new Label();
subscribeButtons.put(group.getUniqueId(), subscribeButton);
final Label unsubscribeButton = new Label();
unsubscribeButtons.put(group.getUniqueId(), unsubscribeButton);
subscribeButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().groupNotifSubscribeButton());
unsubscribeButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().groupNotifUnsubscribeButton());
subscribeButton.addClickHandler(new ClickHandler()
{
public void onClick(final ClickEvent inArg0)
{
GroupActivitySubscriptionModel.getInstance().insert(group.getUniqueId());
}
});
unsubscribeButton.addClickHandler(new ClickHandler()
{
public void onClick(final ClickEvent inArg0)
{
GroupActivitySubscriptionModel.getInstance().delete(group.getUniqueId());
}
});
boolean subscribed = subscribedGroupIds.contains(group.getUniqueId());
subscribeButton.setVisible(!subscribed);
unsubscribeButton.setVisible(subscribed);
groupWidget.insert(subscribeButton, 0);
groupWidget.insert(unsubscribeButton, 1);
listPanel.add(groupWidget);
}
}