List<Message> messages = new ArrayList<Message>();
for (int i = 0; i < allMessages.size(); i++) {
if (messages.size() == itemsToDisplay) {
break;
}
Message message = allMessages.get(i);
messages.add(message);
// add link to item
// Add link to jump to course node
Link nodeLink = LinkFactory.createLink("nodeLink_" + message.getKey(), peekviewVC, this);
nodeLink.setCustomDisplayText(message.getTitle());
nodeLink.setCustomEnabledLinkCSS("b_with_small_icon_left o_forum_message_icon o_gotoNode");
nodeLink.setUserObject(Long.toString(message.getKey()));
}
peekviewVC.contextPut("messages", messages);
// Add link to show all items (go to node)
Link allItemsLink = LinkFactory.createLink("peekview.allItemsLink", peekviewVC, this);
allItemsLink.setCustomEnabledLinkCSS("b_float_right");