use of ch.cyberduck.ui.cocoa.datasource.TransferTableDataSource in project cyberduck by iterate-ch.
the class TransferController method setQueueTable.
public void setQueueTable(NSTableView view) {
this.transferTable = view;
this.transferTable.setRowHeight(new CGFloat(82));
{
NSTableColumn c = tableColumnsFactory.create(TransferColumn.progress.name());
c.setMinWidth(80f);
c.setWidth(300f);
c.setResizingMask(NSTableColumn.NSTableColumnAutoresizingMask);
this.transferTable.addTableColumn(c);
}
this.transferTable.setDataSource((transferTableModel = new TransferTableDataSource()).id());
this.transferTable.setDelegate((transferTableDelegate = new AbstractTableDelegate<Transfer, TransferColumn>(transferTable.tableColumnWithIdentifier(TransferColumn.progress.name())) {
@Override
public String tooltip(final Transfer t, final TransferColumn column) {
return t.getName();
}
@Override
public void enterKeyPressed(final ID sender) {
this.tableRowDoubleClicked(sender);
}
@Override
public void deleteKeyPressed(final ID sender) {
deleteButtonClicked(sender);
}
@Override
public void tableColumnClicked(NSTableView view, NSTableColumn tableColumn) {
//
}
@Override
public void tableRowDoubleClicked(final ID sender) {
reloadButtonClicked(sender);
}
@Override
public void selectionIsChanging(final NSNotification notification) {
updateHighlight();
}
@Override
public void selectionDidChange(final NSNotification notification) {
updateHighlight();
updateSelection();
transferTable.noteHeightOfRowsWithIndexesChanged(NSIndexSet.indexSetWithIndexesInRange(NSRange.NSMakeRange(new NSUInteger(0), new NSUInteger(transferTable.numberOfRows()))));
}
public NSView tableView_viewForTableColumn_row(final NSTableView view, final NSTableColumn column, final NSInteger row) {
final ProgressController controller = transferTableModel.getController(row.intValue());
return controller.view();
}
@Override
public boolean isTypeSelectSupported() {
return true;
}
public String tableView_typeSelectStringForTableColumn_row(final NSTableView view, final NSTableColumn column, final NSInteger row) {
return transferTableModel.getSource().get(row.intValue()).getName();
}
}).id());
// receive drag events from types
// in fact we are not interested in file promises, but because the browser model can only initiate
// a drag with tableView.dragPromisedFilesOfTypes(), we listens for those events
// and then use the private pasteboard instead.
this.transferTable.registerForDraggedTypes(NSArray.arrayWithObjects(NSPasteboard.StringPboardType, // Accept file promises made myself
NSPasteboard.FilesPromisePboardType));
// No grid lines until list is loaded
this.transferTable.setGridStyleMask(NSTableView.NSTableViewGridNone);
// Set sselection properties
this.transferTable.setAllowsMultipleSelection(true);
this.transferTable.setAllowsEmptySelection(true);
this.transferTable.setAllowsColumnReordering(false);
this.transferTable.sizeToFit();
}
Aggregations