public void onClick(final ClickEvent event)
{
StreamBookmarksModel.getInstance().insert(currentScopeId);
addBookmark.setVisible(false);
EventBus.getInstance().notifyObservers(
new ShowNotificationEvent(new Notification("You have bookmarked this stream.")));
}
});
subscribeViaEmail.addClickHandler(new ClickHandler()
{
public void onClick(final ClickEvent event)
{
if (!isSubscribed)
{
if (currentStream.getScopeType().equals(ScopeType.GROUP))
{
Dialog.showCentered(new GroupEmailSubscribeOptionsDialogContent(currentStream.getUniqueKey()));
}
else if (currentStream.getScopeType().equals(ScopeType.PERSON))
{
PersonActivitySubscriptionModel.getInstance().insert(currentStream.getUniqueKey());
setSubscribeStatus(true);
}
}
else
{
Deletable<String> deletable = null;
if (currentStream.getScopeType().equals(ScopeType.GROUP))
{
deletable = GroupActivitySubscriptionModel.getInstance();
}
else if (currentStream.getScopeType().equals(ScopeType.PERSON))
{
deletable = PersonActivitySubscriptionModel.getInstance();
}
if (deletable != null)
{
deletable.delete(currentStream.getUniqueKey());
setSubscribeStatus(false);
}
}
}
});
addToStartPage.addClickHandler(new ClickHandler()
{
public void onClick(final ClickEvent event)
{
// For the app's location, use the current URL minus a few parameters we know we don't want. (They are
// used by other lists, but get left in the URL when switching tabs.)
// We don't build the URL from the stream id, since that doesn't take search terms into account.
HashMap<String, String> params = new HashMap<String, String>();
params.put("listId", null);
params.put("listFilter", null);
params.put("listSort", null);
params.put("startIndex", null);
params.put("endIndex", null);
String url = Session.getInstance().generateUrl(new CreateUrlRequest(params));
// make a version of the query that doesn't have the exclusion list
JSONObject request = currentRequestObj;
if (request.containsKey("exclude"))
{
request = new JSONObject();
for (String key : currentRequestObj.keySet())
{
if (!"exclude".equals(key))
{
request.put(key, currentRequestObj.get(key));
}
}
}
// TODO: get correct title from somewhere.
String prefs = "{\"streamQuery\":"
+ makeJsonString(STREAM_URL_TRANSFORMER.getUrl(null, request.toString()))
+ ",\"gadgetTitle\":" + makeJsonString(currentDisplayName) + ",\"streamLocation\":"
+ makeJsonString(url) + "}";
GadgetModel.getInstance().insert(
new AddGadgetToStartPageRequest("{d7a58391-5375-4c76-b5fc-a431c42a7555}", null, prefs));
EventBus.getInstance()
.notifyObservers(
new ShowNotificationEvent(new Notification(
"This stream will now show up on your start page.")));
}
});
createFilter.addClickHandler(new ClickHandler()