JSONValue jv = jo.get("news:news");
jo = jv.isObject();
jv = jo.get("entry");
RootPanel panel = RootPanel.get("news");
panel.clear();
// last index reached
String title = "";
String date = "";
String summary = "";
String text = "";
if(jv == null) {
title = "No additional news found!";
} else {
jo = jv.isObject();
title = jo.get("title").toString();
date = jo.get("date").toString();
summary = jo.get("summary").toString();
text = jo.get("text").toString();
}
HTML html = new HTML("<div class='nukeNewsEntry'>"
+ "<span class='nukeNewsDate'>" + date + "</span>"
+ "<span class='nukeNewsTitle'>" + title + "</span>"
+ "<div class='nukeNewsSummary'>" + summary + "</div>"
+ "<div class='nukeNewsText'>" + text + "</div>"
+ "</div>");
panel.add(html);
Hyperlink href = new Hyperlink("Previous Entry", "news"+(mNewsIndex.intValue()-1));
if(mNewsIndex.intValue() > 1) href.setVisible(true);
else href.setVisible(false);
href.addStyleName("nukeNewsPrevHref");
panel.add(href);
href.addClickListener(new ClickListener() {
public void onClick(Widget pSender) {
mNewsIndex = new Integer(mNewsIndex.intValue()-1);
run();
}
});
href = new Hyperlink("Next Entry", "news"+(mNewsIndex.intValue()+1));
if(jv == null) href.setVisible(false);
else href.setVisible(true);
href.addStyleName("nukeNewsNextHref");
panel.add(href);
href.addClickListener(new ClickListener() {
public void onClick(Widget pSender) {
mNewsIndex = new Integer(mNewsIndex.intValue()+1);
run();