use of jmri.util.swing.XTableColumnModel in project JMRI by JMRI.
the class SensorTableDataModel method showPullUp.
public void showPullUp(boolean show) {
XTableColumnModel columnModel = (XTableColumnModel) table.getColumnModel();
TableColumn column = columnModel.getColumnByModelIndex(PULLUPCOL);
columnModel.setColumnVisible(column, show);
}
use of jmri.util.swing.XTableColumnModel in project JMRI by JMRI.
the class TrackTableModel method setColumnsVisible.
// only show "Load", "Ship", "Road", "Destination", "Planned", "Pool" "Alternate" if they are needed
protected void setColumnsVisible() {
XTableColumnModel tcm = (XTableColumnModel) _table.getColumnModel();
tcm.setColumnVisible(tcm.getColumnByModelIndex(RESTRICTION_COLUMN), _location.hasServiceRestrictions());
tcm.setColumnVisible(tcm.getColumnByModelIndex(LOAD_COLUMN), _location.hasLoadRestrictions());
tcm.setColumnVisible(tcm.getColumnByModelIndex(SHIP_COLUMN), _location.hasShipLoadRestrictions());
tcm.setColumnVisible(tcm.getColumnByModelIndex(ROAD_COLUMN), _location.hasRoadRestrictions());
tcm.setColumnVisible(tcm.getColumnByModelIndex(DESTINATION_COLUMN), _location.hasDestinationRestrictions());
tcm.setColumnVisible(tcm.getColumnByModelIndex(PLANPICKUP_COLUMN), _location.hasPlannedPickups());
tcm.setColumnVisible(tcm.getColumnByModelIndex(POOL_COLUMN), _location.hasPools());
tcm.setColumnVisible(tcm.getColumnByModelIndex(ALT_TRACK_COLUMN), _location.hasAlternateTracks());
tcm.setColumnVisible(tcm.getColumnByModelIndex(MOVES_COLUMN), Setup.isShowTrackMovesEnabled());
}
use of jmri.util.swing.XTableColumnModel in project JMRI by JMRI.
the class EnginesTableModel method setSort.
/**
* Not all columns are visible at the same time.
*
* @param sort which sort is active
*/
public void setSort(int sort) {
_sort = sort;
updateList();
if (sort == SORTBY_MOVES || sort == SORTBY_BUILT || sort == SORTBY_OWNER || sort == SORTBY_VALUE || sort == SORTBY_RFID || sort == SORTBY_LAST) {
XTableColumnModel tcm = (XTableColumnModel) _table.getColumnModel();
tcm.setColumnVisible(tcm.getColumnByModelIndex(MOVES_COLUMN), sort == SORTBY_MOVES);
tcm.setColumnVisible(tcm.getColumnByModelIndex(BUILT_COLUMN), sort == SORTBY_BUILT);
tcm.setColumnVisible(tcm.getColumnByModelIndex(OWNER_COLUMN), sort == SORTBY_OWNER);
tcm.setColumnVisible(tcm.getColumnByModelIndex(VALUE_COLUMN), sort == SORTBY_VALUE);
tcm.setColumnVisible(tcm.getColumnByModelIndex(RFID_COLUMN), sort == SORTBY_RFID);
tcm.setColumnVisible(tcm.getColumnByModelIndex(RFID_WHEN_LAST_SEEN_COLUMN), sort == SORTBY_RFID);
tcm.setColumnVisible(tcm.getColumnByModelIndex(RFID_WHERE_LAST_SEEN_COLUMN), sort == SORTBY_RFID);
tcm.setColumnVisible(tcm.getColumnByModelIndex(LAST_COLUMN), sort == SORTBY_LAST);
} else {
fireTableDataChanged();
}
}
use of jmri.util.swing.XTableColumnModel in project JMRI by JMRI.
the class BeanTableDataModel method makeJTable.
/**
* Create and configure a new table using the given model and row sorter.
*
* @param name the name of the table
* @param model the data model for the table
* @param sorter the row sorter for the table; if null, the table will not
* be sortable
* @return the table
* @throws NullPointerException if name or model are null
*/
public JTable makeJTable(@Nonnull String name, @Nonnull TableModel model, @Nullable RowSorter<? extends TableModel> sorter) {
Objects.requireNonNull(name, "the table name must be nonnull");
Objects.requireNonNull(model, "the table model must be nonnull");
JTable table = new JTable(model);
table.setName(name);
table.setRowSorter(sorter);
table.getTableHeader().setReorderingAllowed(true);
table.setColumnModel(new XTableColumnModel());
table.createDefaultColumnsFromModel();
addMouseListenerToHeader(table);
return table;
}
use of jmri.util.swing.XTableColumnModel in project JMRI by JMRI.
the class BeanTableDataModel method makeJTable.
/**
* Create a new table.
*
* @param sorter the sorter and model for the table
* @return a new table
* @deprecated since 4.5.4; use
* {@link #makeJTable(java.lang.String, javax.swing.table.TableModel, javax.swing.RowSorter)}
* instead.
*/
@Deprecated
public JTable makeJTable(TableSorter sorter) {
JTable table = new JTable(sorter);
table.getTableHeader().setReorderingAllowed(true);
table.setColumnModel(new XTableColumnModel());
table.createDefaultColumnsFromModel();
addMouseListenerToHeader(table);
return table;
}
Aggregations