Package org.openstreetmap.josm.gui.util
Class TableHelper
java.lang.Object
org.openstreetmap.josm.gui.util.TableHelper
The class that provide common JTable customization methods
- Since:
- 5785
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidadaptTo(IEnabledStateUpdating listener, ListSelectionModel listSelectionModel) WireslistenertolistSelectionModelin such a way, thatlistenerreceives aIEnabledStateUpdating.updateEnabledState()on everyListSelectionEvent.static voidadaptTo(IEnabledStateUpdating listener, AbstractTableModel listModel) WireslistenertolistModelin such a way, thatlistenerreceives aIEnabledStateUpdating.updateEnabledState()on everyListDataEvent.static voidadjustColumnWidth(JTable tbl, int col, boolean resizable) adjust the preferred width of column col to the maximum preferred width of the cells (including header)static voidadjustColumnWidth(JTable tbl, int col, int maxColumnWidth) adjust the preferred width of column col to the maximum preferred width of the cells (including header) requires JTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);static voidadjust the table's columns to fit their content best requires JTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);(package private) static intgetColumnHeaderWidth(JTable tbl, int col) (package private) static intgetMaxWidth(JTable tbl, int col) static IntStreamselectedIndices(ListSelectionModel selectionModel) Returns a stream of all of the selected indices in the selection model, in increasing order.static voidSets the table font size based on the font scaling from the preferencesstatic voidsetSelectedIndices(ListSelectionModel selectionModel, IntStream indices) Selects the given indices in the selection model
-
Constructor Details
-
TableHelper
private TableHelper()
-
-
Method Details
-
adaptTo
WireslistenertolistSelectionModelin such a way, thatlistenerreceives aIEnabledStateUpdating.updateEnabledState()on everyListSelectionEvent.- Parameters:
listener- the listenerlistSelectionModel- the source emittingListSelectionEvents- Since:
- 15226
-
adaptTo
WireslistenertolistModelin such a way, thatlistenerreceives aIEnabledStateUpdating.updateEnabledState()on everyListDataEvent.- Parameters:
listener- the listenerlistModel- the source emittingListDataEvents- Since:
- 15226
-
getColumnHeaderWidth
-
getMaxWidth
-
adjustColumnWidth
adjust the preferred width of column col to the maximum preferred width of the cells (including header)- Parameters:
tbl- tablecol- column indexresizable- if true, resizing is allowed- Since:
- 15176
-
adjustColumnWidth
adjust the preferred width of column col to the maximum preferred width of the cells (including header) requires JTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);- Parameters:
tbl- tablecol- column indexmaxColumnWidth- maximum column width
-
computeColumnsWidth
adjust the table's columns to fit their content best requires JTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);- Parameters:
tbl- table- Since:
- 14476
-
selectedIndices
Returns a stream of all of the selected indices in the selection model, in increasing order.- Parameters:
selectionModel- list selection model.- Returns:
- all of the selected indices, in increasing order, or an empty stream if nothing is selected
- Since:
- 17773
-
setSelectedIndices
Selects the given indices in the selection model- Parameters:
selectionModel- list selection model.indices- the indices to select- Since:
- 16601
- See Also:
-
setFont
Sets the table font size based on the font scaling from the preferences- Parameters:
table- the tableparent- the parent component used for determining the preference key- See Also:
-