groupPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().listItem());
groupPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().pendingGroup());
// -- buttons panel (left side) --
final Panel buttonsPanel = new FlowPanel();
buttonsPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().pendingGroupButtons());
groupPanel.add(buttonsPanel);
final Label confirmButton = new Label("Confirm");
confirmButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().approveButton());
buttonsPanel.add(confirmButton);
final Label denyButton = new Label("Deny");
denyButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().denyButton());
buttonsPanel.add(denyButton);
// -- group info (right side) --
FlowPanel groupAbout = new FlowPanel();
groupAbout.addStyleName(StaticResourceBundle.INSTANCE.coreCss().description());
groupPanel.add(groupAbout);
Label groupName = new Label(group.getName());
groupName.addStyleName(StaticResourceBundle.INSTANCE.coreCss().displayName());
groupAbout.add(groupName);
Label groupDescription = new Label(group.getDescription());
groupDescription.addStyleName(StaticResourceBundle.INSTANCE.coreCss().pendingGroupDescription());
groupAbout.add(groupDescription);
FlowPanel groupMetaData = new FlowPanel();
groupMetaData.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectionItemFollowers());
groupMetaData.add(new InlineLabel(new DateFormatter().timeAgo(group.getDateAdded(), true)));
insertActionSeparator(groupMetaData);
groupMetaData.add(new InlineLabel("By: "));
String url =
Session.getInstance().generateUrl(
new CreateUrlRequest(Page.PEOPLE, group.getPersonCreatedByAccountId()));
groupMetaData.add(new InlineHyperlink(group.getPersonCreatedByDisplayName(), url));
// Display Business Area (BA) information
insertActionSeparator(groupMetaData);
groupMetaData.add(new InlineLabel("BA: "));
Label baLabel = new InlineLabel(group.getPersonCreatedByCompanyName());
baLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectionItemFollowersData());
groupMetaData.add(baLabel);
insertActionSeparator(groupMetaData);
groupMetaData.add(new InlineLabel("Privacy Setting: "));
Label label = new InlineLabel(group.isPublic() ? "Public" : "Private");
label.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectionItemFollowersData());
groupMetaData.add(label);
groupAbout.add(groupMetaData);
// -- actions --
confirmButton.addClickHandler(new ClickHandler()
{
public void onClick(final ClickEvent event)
{
buttonsPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().waitActive());
PendingGroupsModel.getInstance().update(new ReviewPendingGroupRequest(group.getShortName(), true));
}
});
denyButton.addClickHandler(new ClickHandler()
{
public void onClick(final ClickEvent event)
{
if (new WidgetJSNIFacadeImpl().confirm("Are you sure you want to deny creation of this group?"))
{
buttonsPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().waitActive());
PendingGroupsModel.getInstance()
.update(new ReviewPendingGroupRequest(group.getShortName(), false));
}
}