Class SwingMessageTable<D>

Type Parameters:
D - the type of document identifiers
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, RowSorterListener, TableColumnModelListener, TableModelListener, Scrollable

public class SwingMessageTable<D> extends JTable
Multi-line rendering for message text. See e.g. https://coderanch.com/t/341698/java/TableRenderer-multiple-lines-text
"setLineWrap(true)" thanks to https://www.experts-exchange.com/questions/21475798/jtable-line-wrap.html
See Also:
  • Field Details

    • COLNUM_LOCATION

      protected static final int COLNUM_LOCATION
      Number of the message location column
      See Also:
    • COLNUM_TEXT

      protected static final int COLNUM_TEXT
      Number of the message text column
      See Also:
    • standardColor_warn

      public static final Color standardColor_warn
      Background color for warning messages
    • standardColor_error

      public static final Color standardColor_error
      Background color for error messages
    • standardColor_neutral

      public static final Color standardColor_neutral
      Background color for all other messages
    • standardColor_hint

      public static final Color standardColor_hint
      Background color for hint messages
    • colorWarn

      protected Color colorWarn
      Background color for warning messages
    • colorError

      protected Color colorError
      Background color for error messages
    • colorNeutral

      protected Color colorNeutral
      Background color for all other messages
    • colorHint

      protected Color colorHint
      Background color for hint messages
    • separatorColor

      protected Color separatorColor
      Background color for separator line.
    • separatorKey

      @Opt protected @Opt String separatorKey
      Message text which makes a bold horizontal line, nothing else.
    • translate

      protected Function<? super SimpleMessage<D>,String> translate
      Renders the message text and the arguments. (Kind, Location, Cause, etc. do not need MuLi support)
    • indentString

      protected String indentString
      The string prepended n times before the text to indicate the nesting of logg messages.
  • Constructor Details

    • SwingMessageTable

      public SwingMessageTable(MessageStore_<SimpleMessage<D>>.TableModel model)
      Only constructor, needs an instance of a table model.
      (Please note that DnD is disabled since no Handler is explicitly set.)
  • Method Details

    • setColorWarn

      public Color setColorWarn(Color nc)
      Evident. @return the overwritten value
    • setColorError

      public Color setColorError(Color nc)
      Evident. @return the overwritten value
    • setColorHint

      public Color setColorHint(Color nc)
      Evident. @return the overwritten value
    • setSeparatorKey

      public String setSeparatorKey(String separatorKey)
      Sets the message text which causes the message to be shown simply as one big grey separating block.
      Returns:
      the overwritten value.
    • setTranslate

      public void setTranslate(Function<? super SimpleMessage<D>,String> fun)
      Renders the message text and the arguments. (Kind, Location, Cause, etc. do not need MuLi support)
    • setIndentString

      public void setIndentString(String s)
      Evident
    • makePref

      protected String makePref(int i, String s)
      Prepend the prefix i-times to the string.
    • getMessageAt

      protected SimpleMessage<D> getMessageAt(int row)
    • prepareRenderer

      public Component prepareRenderer(TableCellRenderer renderer, int row, int column)
      Filters for separatorKey and draws a thick line instead. (Thanks to Robert Camick Table Row Rendering.)
      Overrides:
      prepareRenderer in class JTable
      Parameters:
      row - the row in the current view. Is the same as in the TableModel as long as columns are not re-arranged.
      col - the column in the current view. Is the same as in the TableModel as long as rows are not re-sorted.
    • setwidth_minpref

      protected void setwidth_minpref(int colnum, int width)
      Sets minimal und preferred width.