String filename = dco.getDisplayString(index);
filename = filename.replaceAll(" ", "%20");
value = "<a " + Utilities.getHtmlStyle() + " href=\"file:///" + filename + "\">" + new File(dco.getDisplayString(index)).getName() + "</a>";
} else if (dco.getField(index).getFieldType() == ComponentFactory._PICTUREFIELD) {
Picture p = (Picture) dco.getValue(index);
value = "<p><img src=\"file:///" + DataCrow.imageDir + "/" + p.getScaledFilename() + "\" alt=\"" + dco.getLabel(index) + "\"><p>";
} else if (dco.getField(index).getFieldType() == ComponentFactory._URLFIELD) {
value = "<a " + Utilities.getHtmlStyle() + " href=\"" + dco.getValue(index) + "\">" + DcResources.getText("lblLink") + "</a>";
} else if (dco.getField(index).getReferenceIdx() > 0 &&
dco.getField(index).getReferenceIdx() != dco.getModule().getIndex()) {
if (dco.getField(index).getValueType() == DcRepository.ValueTypes._DCOBJECTCOLLECTION) {
int i = 0;
List<DcObject> references = (List<DcObject>) dco.getValue(index);
for (DcObject reference : references) {
if (i > 0 && horizontal)
value += " ";
if (reference instanceof DcMapping)
reference = ((DcMapping) reference).getReferencedObject();
if (reference == null)
continue;
value += descriptionPane.createLink(reference, reference.toString());
if (!horizontal)
value += "<br>";
i++;
}
} else {
Object o = dco.getValue(index);
DcObject reference = o instanceof DcObject ? (DcObject) o : DataManager.getItem(dco.getField(index).getReferenceIdx(), (String) o);
reference = reference == null && o instanceof String ? DataManager.getObjectForString(dco.getField(index).getReferenceIdx(), (String) o) : reference;
value += descriptionPane.createLink(reference, reference.toString());
}
} else { // Add simple value
value = dco.getDisplayString(index);
if (dco.getField(index).getValueType() == DcRepository.ValueTypes._STRING) {
value = value.replaceAll("[\r\n]", "<br>");
value = value.replaceAll("[\t]", " ");
}
if (maxLength > 0)
value = StringUtils.concatUserFriendly(value, maxLength);
if (font.getStyle() == Font.BOLD)
value = "<b>" + value + "</b>";
}
table += value;
table += "</td></tr>";
} else if (dco.getField(index).getValueType() == DcRepository.ValueTypes._PICTURE) {
Picture picture = (Picture) dco.getValue(index);
pictures.add(picture);
}
}
return table;