/**
* Show a feed entry.
*/
private AjaxResponse showEntry(AjaxActionEvent event) {
AjaxResponse response = new AjaxResponseImpl("UTF-8");
String subscriptionName = event.getParameters().get("subscription");
if (subscriptionName != null) {
try {
// Get the feed from user's subscriptions:
Feed feed = this.getFeedFromSubscriptionName(subscriptionName);
if (feed != null) {
// Get the feed entry at the corresponding index:
int entryIndex = Integer.parseInt(event.getParameters().get("entryIndex"));
Entry entry = (Entry) feed.getEntries().get(entryIndex);
// Set the entry object in the request:
event.getHttpRequest().setAttribute("entry", entry);
// Render the entry via external JSP content:
JspComponent jsp = new JspComponent(event.getHttpRequest(), "/personal/includes/entryPanel.page");
// Change the class of the web element that fired the event:
SetAttributeAction action1 = new SetAttributeAction(event.getElementId(), "class", "expanded");
// Construct the CSS selector identifying the web page part that will be updated with the JSP content:
String selector = new StringBuilder("#").append(event.getElementId()).append("~").append("div.entryBody").toString();
ElementMatcher matcher = new SelectorMatcher(Arrays.asList(selector));
// Replace the content of the web page part identified by the selector:
ReplaceContentAction action2 = new ReplaceContentAction(matcher, jsp);
// Call a client-side javascript function:
Map<String, Object> params = new HashMap<String, Object>();
params.put("selector", selector);
ExecuteJavascriptFunctionAction action3 = new ExecuteJavascriptFunctionAction("showEntryEffect", params);
// Add actions to response:
response.addAction(action1);
response.addAction(action2);
response.addAction(action3);
} else {
this.renderErrorMessage(event, response, "message.error.feed.not.found", "No feed found.");
}
} catch (UserNotExistentException ex) {
logger.warn(ex.getMessage(), ex.getCause());