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