use of de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon in project dolphin-platform by canoo.
the class LogListView method update.
private void update() {
final LogMessage message = logMessage.get();
if (message == null) {
messageLabel.setText(null);
levelIconView.setIcon(FontAwesomeIcon.QUESTION);
levelIconView.setFill(Color.TRANSPARENT);
timestampLabel.setText(null);
detailsLabel.setText(null);
detailsLabel.setVisible(false);
detailsLabel.setManaged(false);
} else {
messageLabel.setText(message.getMessage());
final FontAwesomeIcon icon = Optional.ofNullable(message.getLevel()).map(l -> {
if (l.equals(Level.INFO)) {
return FontAwesomeIcon.INFO_CIRCLE;
} else if (l.equals(Level.DEBUG)) {
return FontAwesomeIcon.BUG;
} else if (l.equals(Level.ERROR)) {
return FontAwesomeIcon.TIMES_CIRCLE;
} else if (l.equals(Level.TRACE)) {
return FontAwesomeIcon.MINUS_CIRCLE;
} else if (l.equals(Level.WARN)) {
return FontAwesomeIcon.WARNING;
} else {
return FontAwesomeIcon.QUESTION;
}
}).orElse(FontAwesomeIcon.QUESTION);
levelIconView.setIcon(icon);
final Paint iconFill = Optional.ofNullable(message.getLevel()).map(l -> {
if (l.equals(Level.INFO)) {
return Color.LIGHTBLUE;
} else if (l.equals(Level.DEBUG)) {
return Color.LIGHTBLUE;
} else if (l.equals(Level.ERROR)) {
return Color.RED;
} else if (l.equals(Level.TRACE)) {
return Color.LIGHTBLUE;
} else if (l.equals(Level.WARN)) {
return Color.ORANGE;
} else {
return Color.LIGHTBLUE;
}
}).orElse(Color.LIGHTBLUE);
levelIconView.setFill(iconFill);
final String timestamp = Optional.ofNullable(message.getTimestamp()).map(t -> DateTimeFormatter.ofPattern("dd/MM/yyyy - hh:mm:ss.SSS").format(t)).orElse("unknown");
timestampLabel.setText(timestamp);
detailsLabel.setText(message.getExceptionDetail());
if (Optional.ofNullable(detailsLabel.getText()).orElse("").length() == 0) {
detailsLabel.setVisible(false);
detailsLabel.setManaged(false);
} else {
detailsLabel.setVisible(true);
detailsLabel.setManaged(true);
}
}
}
Aggregations