private void loadContent(boolean initial) {
String text = "";
Object userValue = cell.getUserValue();
if (userValue instanceof LazyLoadedValue) {
LazyLoadedValue lazyLoadedValue = (LazyLoadedValue) userValue;
try {
text = initial ?
lazyLoadedValue.loadValue(INITIAL_MAX_SIZE) :
lazyLoadedValue.loadValue();
if (text == null) {
text = "";
}
long contentSize = lazyLoadedValue.size();
if (initial && contentSize > INITIAL_MAX_SIZE) {
contentInfoText = getNumberOfLines(text) + " lines, " + INITIAL_MAX_SIZE + " characters (partially loaded)";
loadContentVisible = true;
loadContentCaption = "Load entire content";
} else {
contentInfoText = getNumberOfLines(text) + " lines, " + text.length() + " characters";
loadContentVisible = false;
}
} catch (SQLException e) {
contentInfoText = "Could not load " + lazyLoadedValue.getDisplayValue() + " content. Cause: " + e.getMessage();
loadContentCaption = "Reload content";
}
} else {
text = userValue.toString();
contentInfoText = getNumberOfLines(text) + " lines, " + text.length() + " characters";