in src/main/java/org/apache/log4j/chainsaw/LogPanel.java [3512:3559]
private void updateDetailPane(boolean force) {
/*
* Don't bother doing anything if it's not visible. Note: the isVisible() method on
* Component is not really accurate here because when the button to toggle display of
* the detail pane is triggered it still appears as 'visible' for some reason.
*/
if (!preferenceModel.isDetailPaneVisible()) {
return;
}
LoggingEventWrapper loggingEventWrapper = null;
if (force || (selectedRow != -1 && (lastRow != selectedRow))) {
loggingEventWrapper = tableModel.getRow(selectedRow);
if (loggingEventWrapper != null) {
final StringBuilder buf = new StringBuilder();
buf.append(detailLayout.format(loggingEventWrapper.getLoggingEvent()));
if (buf.length() > 0) {
try {
final Document doc = detail.getEditorKit().createDefaultDocument();
detail.getEditorKit().read(new StringReader(buf.toString()), doc, 0);
SwingHelper.invokeOnEDT(() -> {
detail.setDocument(doc);
JTextComponentFormatter.applySystemFontAndSize(detail);
detail.setCaretPosition(0);
lastRow = selectedRow;
});
} catch (Exception e) {
}
}
}
}
if (loggingEventWrapper == null && (lastRow != selectedRow)) {
try {
final Document doc = detail.getEditorKit().createDefaultDocument();
detail.getEditorKit().read(new StringReader("<html>Nothing selected</html>"), doc, 0);
SwingHelper.invokeOnEDT(() -> {
detail.setDocument(doc);
JTextComponentFormatter.applySystemFontAndSize(detail);
detail.setCaretPosition(0);
lastRow = selectedRow;
});
} catch (Exception e) {
}
}
}