V
- Type of data stored in each table cellComponentRenderer<V>
, InteractableRenderer<V>
, TableRenderer<V>
public class DefaultTableRenderer<V> extends Object implements TableRenderer<V>
TableRenderer
Constructor | Description |
---|---|
DefaultTableRenderer() |
Default constructor
|
Modifier and Type | Method | Description |
---|---|---|
void |
drawComponent(TextGUIGraphics graphics,
Table<V> table) |
Using the supplied graphics object, draws the component passed in.
|
boolean |
getAllowPartialColumn() |
|
TerminalPosition |
getCursorLocation(Table<V> component) |
|
TerminalSize |
getPreferredSize(Table<V> table) |
Given the supplied component, how large does this renderer want the component to be?
|
int |
getViewLeftColumn() |
Returns the index of the first visible column with the renderers current state
|
int |
getViewTopRow() |
Returns the index of the first visible row with the renderers current state
|
int |
getVisibleRowsOnLastDraw() |
Returns the number of rows that could be drawn on the last draw operation.
|
boolean |
isScrollBarsHidden() |
|
void |
setAllowPartialColumn(boolean allowPartialColumn) |
|
void |
setCellHorizontalBorderStyle(TableCellBorderStyle cellHorizontalBorderStyle) |
Sets the style to be used when horizontally separating table cells from each other.
|
void |
setCellVerticalBorderStyle(TableCellBorderStyle cellVerticalBorderStyle) |
Sets the style to be used when vertically separating table cells from each other.
|
void |
setExpandableColumns(Collection<Integer> expandableColumns) |
Sets the list of columns (by index, where 0 is the first column) that can be expanded, should the drawable area
be larger than the table is requesting.
|
void |
setHeaderHorizontalBorderStyle(TableCellBorderStyle headerHorizontalBorderStyle) |
Sets the style to be used when separating the table header labels from each other.
|
void |
setHeaderVerticalBorderStyle(TableCellBorderStyle headerVerticalBorderStyle) |
Sets the style to be used when separating the table header row from the actual "data" cells below.
|
void |
setScrollBarsHidden(boolean scrollBarsHidden) |
|
void |
setViewLeftColumn(int viewLeftColumn) |
Modifies which column is the first visible, this may be overwritten depending on the circumstances when drawing the
table.
|
void |
setViewTopRow(int viewTopRow) |
Modifies which row is the first visible, this may be overwritten depending on the circumstances when drawing the
table.
|
public void setHeaderVerticalBorderStyle(TableCellBorderStyle headerVerticalBorderStyle)
TableCellBorderStyle.None
.headerVerticalBorderStyle
- Style to use to separate Table header from bodypublic void setHeaderHorizontalBorderStyle(TableCellBorderStyle headerHorizontalBorderStyle)
TableCellBorderStyle.None
.headerHorizontalBorderStyle
- Style to use when separating header columns horizontallypublic void setCellVerticalBorderStyle(TableCellBorderStyle cellVerticalBorderStyle)
TableCellBorderStyle.None
.cellVerticalBorderStyle
- Style to use to separate table cells verticallypublic void setCellHorizontalBorderStyle(TableCellBorderStyle cellHorizontalBorderStyle)
TableCellBorderStyle.None
.cellHorizontalBorderStyle
- Style to use to separate table cells horizontallypublic void setExpandableColumns(Collection<Integer> expandableColumns)
expandableColumns
- Collection of indexes for expandable columnspublic boolean isScrollBarsHidden()
isScrollBarsHidden
in interface TableRenderer<V>
public void setScrollBarsHidden(boolean scrollBarsHidden)
setScrollBarsHidden
in interface TableRenderer<V>
public int getVisibleRowsOnLastDraw()
Table.setVisibleRows(int)
, this is the only way to find out exactly how large the
table ended up. But even if you did set the number of visible rows explicitly, due to terminal size constraints
the actually drawn size might have been different.getVisibleRowsOnLastDraw
in interface TableRenderer<V>
public int getViewTopRow()
TableRenderer
getViewTopRow
in interface TableRenderer<V>
public void setViewTopRow(int viewTopRow)
TableRenderer
setViewTopRow
in interface TableRenderer<V>
viewTopRow
- First row to be displayed when drawing the tablepublic int getViewLeftColumn()
TableRenderer
getViewLeftColumn
in interface TableRenderer<V>
public void setViewLeftColumn(int viewLeftColumn)
TableRenderer
setViewLeftColumn
in interface TableRenderer<V>
viewLeftColumn
- First column to be displayed when drawing the tablepublic void setAllowPartialColumn(boolean allowPartialColumn)
setAllowPartialColumn
in interface TableRenderer<V>
allowPartialColumn
- when not all columns fit on the screen, whether to render part of a column, or skip rendering that column entirelypublic boolean getAllowPartialColumn()
getAllowPartialColumn
in interface TableRenderer<V>
TableRenderer.setAllowPartialColumn(boolean)
public TerminalSize getPreferredSize(Table<V> table)
ComponentRenderer
getPreferredSize
in interface ComponentRenderer<V>
getPreferredSize
in interface TableRenderer<V>
table
- Component to calculate the preferred size ofpublic TerminalPosition getCursorLocation(Table<V> component)
getCursorLocation
in interface InteractableRenderer<V>
public void drawComponent(TextGUIGraphics graphics, Table<V> table)
ComponentRenderer
drawComponent
in interface ComponentRenderer<V>
drawComponent
in interface TableRenderer<V>
graphics
- Graphics object to use for drawingtable
- Component to drawCopyright © 2020. All rights reserved.