| 1 | package com.googlecode.lanterna.gui2.table; |
| 2 | |
| 3 | import com.googlecode.lanterna.TerminalSize; |
| 4 | import com.googlecode.lanterna.gui2.TextGUIGraphics; |
| 5 | |
| 6 | /** |
| 7 | * This interface can be implemented if you want to customize how table headers are drawn. |
| 8 | * @param <V> Type of data stored in each table cell |
| 9 | * @author Martin |
| 10 | */ |
| 11 | public interface TableHeaderRenderer<V> { |
| 12 | /** |
| 13 | * Called by the table when it wants to know how big a particular table header should be |
| 14 | * @param table Table containing the header |
| 15 | * @param label Label for this header |
| 16 | * @param columnIndex Column index of the header |
| 17 | * @return Size this renderer would like the header to have |
| 18 | */ |
| 19 | TerminalSize getPreferredSize(Table<V> table, String label, int columnIndex); |
| 20 | |
| 21 | /** |
| 22 | * Called by the table when it's time to draw a header, you can see how much size is available by checking the size |
| 23 | * of the {@code textGUIGraphics}. The top-left position of the graphics object is the top-left position of this |
| 24 | * header. |
| 25 | * @param table Table containing the header |
| 26 | * @param label Label for this header |
| 27 | * @param index Column index of the header |
| 28 | * @param textGUIGraphics Graphics object to header with |
| 29 | */ |
| 30 | void drawHeader(Table<V> table, String label, int index, TextGUIGraphics textGUIGraphics); |
| 31 | } |