final JTweet tweet = model.getObject();
if (tweet == null) {
setVisible(false);
return this;
}
final JUser user = tweet.getFromUser();
if (showUser) {
LabeledLink userNameLink = new LabeledLink("userNameLink", user.getScreenName() + ":", false) {
@Override
public void onClick(AjaxRequestTarget target) {
onUserClick(user.getScreenName());
}
};
add(userNameLink);
} else
add(new Label("userNameLink", ""));
WebMarkupContainer spamIndicator = new WebMarkupContainer("spamIndicator");
spamIndicator.setVisible(tweet.isSpam());
add(spamIndicator);
// final DialogUtilsBehavior dialogUtilsBehavior = new DialogUtilsBehavior();
// add(dialogUtilsBehavior);
final Label label = new Label("tweetText", new Model<String>() {
int counter = 0;
@Override
public String getObject() {
return new Extractor() {
@Override
public String createTagMarkup(String tag, String cleanTag) {
// String url = Helper.TSURL + cleanTag;
return "<a class=\"i-tw-link tw-tag\" "
+ "clean=\"" + cleanTag + "\" "
+ "tag=\"" + tag + " \" "
+ ">" + tag + "</a>";
}
}.setTweet(tweet).setText(translate(tweet)).run().toString();
}
});
label.setEscapeModelStrings(false);
label.setOutputMarkupId(true);
add(label);
ExternalLink dateLink = new ExternalLink("tweetDate",
Helper.toTwitterHref(user.getScreenName(), tweet.getTwitterId()));
String str = "status";
if (tweet.getCreatedAt() != null)
str = Helper.toSimpleDateTime(tweet.getCreatedAt());
Label dateLabel = new Label("tweetDateLabel", str);