be.ugent.caagt.swirl.logging

Class JListLogCellRenderer


public class JListLogCellRenderer
extends DefaultListCellRenderer

Renders log records for use with a JListLogHandler.

Constructor Summary

JListLogCellRenderer(Formatter formatter)
Create a cell renderer of this type which uses the given formatter.

Method Summary

Component
getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
protected Color
toForeground(LogRecord record)
Determines the foreground color for the text to be displayed.
protected Icon
toIcon(LogRecord record)
Determines the icon to be displayed next to the message.
protected String
toText(LogRecord record)
Determines the text to be displayed.

Constructor Details

JListLogCellRenderer

public JListLogCellRenderer(Formatter formatter)
Create a cell renderer of this type which uses the given formatter.

Method Details

getListCellRendererComponent

public Component getListCellRendererComponent(JList list,
                                              Object value,
                                              int index,
                                              boolean isSelected,
                                              boolean cellHasFocus)

toForeground

protected Color toForeground(LogRecord record)
Determines the foreground color for the text to be displayed.

This implementation uses the standard foreground color for messages that are less than warnings, orange when less than severe and red otherwise


toIcon

protected Icon toIcon(LogRecord record)
Determines the icon to be displayed next to the message.

This implementation always returns null.


toText

protected String toText(LogRecord record)
Determines the text to be displayed.

This implementation uses the formatter to format the message stored in the record.