@Override
public void render(Listitem item, Object data) throws Exception {
final SecLoginlog log = (SecLoginlog) data;
Listcell lc;
final LoginStatus loginStatus = getLoginLoggingService().getTypById(log.getLglStatusid());
lc = new Listcell(getDateTime(log.getLglLogtime()));
if (log.getLglStatusid() == 0) {
lc.setStyle("color:red");
}
lc.setParent(item);
lc = new Listcell(log.getLglLoginname());
if (log.getLglStatusid() == 0) {
lc.setStyle("color:red");
}
lc.setParent(item);
lc = new Listcell(loginStatus.getStpTypname());
if (log.getLglStatusid() == 0) {
lc.setStyle("color:red");
}
lc.setParent(item);
// lc = new Listcell(log.getLglIp());
// truncate the IP for privacy
lc = new Listcell(truncateIPForPrivacy(log.getLglIp()));
if (log.getLglStatusid() == 0) {
lc.setStyle("color:red");
}
lc.setParent(item);
/* Country Code / Flag+Short+Provider-City */
final String currentIp = log.getLglIp();
final Ip2Country ip2 = log.getIp2Country();
if (ip2 != null) {
lc = new Listcell();
final Hbox hbox = new Hbox();
hbox.setParent(lc);
// Fill with the related data for CountryCode
final CountryCode cc = ip2.getCountryCode();
if (cc != null) {
/* Flag-image */
final Image img = new Image();
final String path = "/images/countrycode_flags/";
final String flag = StringUtils.lowerCase(cc.getCcdCode2()) + ".gif";
img.setSrc(path + flag);
hbox.appendChild(img);
final Separator sep = new Separator();
hbox.appendChild(sep);
/* Country */
final Label label = new Label();
label.setValue(cc.getCcdCode2());
hbox.appendChild(label);
// show other stuff from the Ip2Country
/* Provider-City */
final Label label2 = new Label();
if (StringUtils.isNotBlank(ip2.getI2cCity())) {
label2.setValue("(" + ip2.getI2cCity() + ")");
} else {
label2.setValue("");
}
hbox.appendChild(label2);
}
lc.setParent(item);
} else {
lc = new Listcell();
final Hbox hbox = new Hbox();
hbox.setParent(lc);
/* Flag-image */
final Image img = new Image();
final String path = "/images/countrycode_flags/";
final String flag = "xx.gif";
img.setSrc(path + flag);
hbox.appendChild(img);
final Label label = new Label();
label.setValue("Unknown");
hbox.appendChild(label);
lc.setParent(item);
}
/* Session-ID */
lc = new Listcell(log.getLglSessionid());
if (log.getLglStatusid() == 0) {
lc.setStyle("color:red");
}
lc.setParent(item);
item.setAttribute("data", data);
// ComponentsCtrl.applyForward(img, "onClick=onImageClicked");
// ComponentsCtrl.applyForward(item, "onClick=onClicked");
// ComponentsCtrl.applyForward(item, "onDoubleClick=onDoubleClicked");