}
lModelTable.getTable().setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
final BaseRenderer baseRenderer = new BaseRenderer();
final TableColumnModel columnModel = lModelTable.getTable().getColumnModel();
final RightAlignRenderer rightAlignRenderer = new RightAlignRenderer();
int columnCounter = 0;
mapCurrentColumntToPossibleColumn = new HashMap<Integer, Integer>();
// Column "Enabled"
columnModel.getColumn(columnCounter).setCellEditor(BooleanCell.EDITOR);
setColumnEditable(columnCounter, true);
columnModel.getColumn(columnCounter).setMinWidth(20);
columnModel.getColumn(columnCounter).setMaxWidth(20);
columnModel.getColumn(columnCounter).setPreferredWidth(20);
columnModel.getColumn(columnCounter).setCellRenderer(new IsEnabledRenderer());
mapCurrentColumntToPossibleColumn.put(columnCounter++, Columns.ENABLED.ordinal());
if( fileSharingDisabled == false ) {
// hard set sizes of icon column - Shared file
columnModel.getColumn(columnCounter).setMinWidth(20);
columnModel.getColumn(columnCounter).setMaxWidth(20);
columnModel.getColumn(columnCounter).setPreferredWidth(20);
columnModel.getColumn(columnCounter).setCellRenderer(new IsSharedRenderer());
mapCurrentColumntToPossibleColumn.put(columnCounter++, Columns.SHARED_FILE.ordinal());
// hard set sizes of icon column - File requested
columnModel.getColumn(columnCounter).setMinWidth(20);
columnModel.getColumn(columnCounter).setMaxWidth(20);
columnModel.getColumn(columnCounter).setPreferredWidth(20);
columnModel.getColumn(columnCounter).setCellRenderer(new IsRequestedRenderer());
mapCurrentColumntToPossibleColumn.put(columnCounter++, Columns.FILE_REQUESTED.ordinal());
}
// fileName
columnModel.getColumn(columnCounter).setCellRenderer(new ShowNameTooltipRenderer());
columnModel.getColumn(columnCounter).setPreferredWidth(150);
mapCurrentColumntToPossibleColumn.put(columnCounter++, Columns.FILE_NAME.ordinal());
// size
columnModel.getColumn(columnCounter).setCellRenderer(rightAlignRenderer);
columnModel.getColumn(columnCounter).setPreferredWidth(30);
mapCurrentColumntToPossibleColumn.put(columnCounter++, Columns.SIZE.ordinal());
// state
columnModel.getColumn(columnCounter).setCellRenderer(new ShowStateContentTooltipRenderer()); // state
columnModel.getColumn(columnCounter).setPreferredWidth(30);
mapCurrentColumntToPossibleColumn.put(columnCounter++, Columns.STATE.ordinal());
if( fileSharingDisabled == false ) {
// lastSeen
columnModel.getColumn(columnCounter).setCellRenderer(baseRenderer); // last
columnModel.getColumn(columnCounter).setPreferredWidth(20);
mapCurrentColumntToPossibleColumn.put(columnCounter++, Columns.LAST_SEEN.ordinal());
// lastUloaded
columnModel.getColumn(columnCounter).setCellRenderer(baseRenderer); // lastUploaded
columnModel.getColumn(columnCounter).setPreferredWidth(20);
mapCurrentColumntToPossibleColumn.put(columnCounter++, Columns.LAST_UPLOADED.ordinal());
}
// blocks
columnModel.getColumn(columnCounter).setCellRenderer(new BlocksProgressRenderer()); // blocks
columnModel.getColumn(columnCounter).setPreferredWidth(70);
mapCurrentColumntToPossibleColumn.put(columnCounter++, Columns.BLOCKS.ordinal());
// tries
columnModel.getColumn(columnCounter).setCellRenderer(rightAlignRenderer); // tries
columnModel.getColumn(columnCounter).setPreferredWidth(10);
mapCurrentColumntToPossibleColumn.put(columnCounter++, Columns.TRIES.ordinal());
// key
columnModel.getColumn(columnCounter).setCellRenderer(new ShowContentTooltipRenderer()); // key
columnModel.getColumn(columnCounter).setPreferredWidth(60);
mapCurrentColumntToPossibleColumn.put(columnCounter++, Columns.KEY.ordinal());
// download dir
columnModel.getColumn(columnCounter).setCellRenderer(baseRenderer); // download dir
columnModel.getColumn(columnCounter).setPreferredWidth(60);
mapCurrentColumntToPossibleColumn.put(columnCounter++, Columns.DOWNLOAD_DIRECTORY.ordinal());
if( PersistenceManager.isPersistenceEnabled() ) {
// IsDDA
columnModel.getColumn(columnCounter).setMinWidth(20);
columnModel.getColumn(columnCounter).setMaxWidth(20);
columnModel.getColumn(columnCounter).setPreferredWidth(20);
columnModel.getColumn(columnCounter).setCellRenderer(new IsDDARenderer());
mapCurrentColumntToPossibleColumn.put(columnCounter++, Columns.DDA.ordinal());
// priority
columnModel.getColumn(columnCounter).setMinWidth(20);
columnModel.getColumn(columnCounter).setMaxWidth(20);
columnModel.getColumn(columnCounter).setPreferredWidth(20);
columnModel.getColumn(columnCounter).setCellRenderer(rightAlignRenderer); // prio
mapCurrentColumntToPossibleColumn.put(columnCounter++, Columns.PRIORITY.ordinal());
}
loadTableLayout(columnModel);
}