siteUrl = inSiteUrl;
siteTitle = inSiteTitle;
StreamScope streamScope = new StreamScope(ScopeType.RESOURCE, resourceId);
final StreamPanel streamPanel = new StreamPanel(ShowRecipient.NO,
new CommentWidgetStreamMessageItemRenderer(),
new CommentWidgetPostToStreamComposite(streamScope));
streamPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().embeddedWidget());
streamPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectCommentWidget());
initWidget(streamPanel);
EventBus.getInstance().addObserver(GotStreamResponseEvent.class, new Observer<GotStreamResponseEvent>()
{
public void update(final GotStreamResponseEvent event)
{
// hide everything but the post box if the stream is empty
// but distinguish between an empty stream and no search results
boolean emptyStream = Session.getInstance().getParameterValue("search") == null
&& event.getStream().getPagedSet().isEmpty();
if (emptyStream)
{
streamPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().emptyStream());
}
else
{
streamPanel.removeStyleName(StaticResourceBundle.INSTANCE.coreCss().emptyStream());
}
}
});
String jsonRequest = StreamJsonRequestFactory.addRecipient(EntityType.RESOURCE, resourceId,
StreamJsonRequestFactory.getEmptyRequest()).toString();
EventBus.getInstance().notifyObservers(new StreamRequestEvent("", jsonRequest));
streamPanel.setStreamScope(streamScope, true);
}