Search in sources :

Example 1 with NSTableView

use of ch.cyberduck.binding.application.NSTableView in project cyberduck by iterate-ch.

the class ActivityController method setTable.

public void setTable(NSTableView table) {
    this.table = table;
    this.table.setRowHeight(new CGFloat(42));
    {
        final NSTableColumn c = tableColumnsFactory.create(ActivityColumn.single.name());
        c.setMinWidth(80f);
        c.setWidth(300f);
        c.setResizingMask(NSTableColumn.NSTableColumnAutoresizingMask);
        this.table.addTableColumn(c);
    }
    this.table.setDataSource((model = new ListDataSource() {

        @Override
        public NSObject tableView_objectValueForTableColumn_row(final NSTableView view, final NSTableColumn tableColumn, final NSInteger row) {
            return null;
        }

        @Override
        public NSInteger numberOfRowsInTableView(NSTableView view) {
            return new NSInteger(tasks.size());
        }
    }).id());
    this.table.setDelegate((delegate = new AbstractTableDelegate<TaskController, ActivityColumn>(table.tableColumnWithIdentifier("Default")) {

        @Override
        public void enterKeyPressed(final ID sender) {
        }

        @Override
        public void deleteKeyPressed(final ID sender) {
        }

        @Override
        public String tooltip(final TaskController c, final ActivityColumn column) {
            return null;
        }

        @Override
        public boolean tableView_shouldSelectRow(final NSTableView view, final NSInteger row) {
            return false;
        }

        @Override
        public void tableColumnClicked(final NSTableView view, final NSTableColumn tableColumn) {
        }

        @Override
        public void tableRowDoubleClicked(final ID sender) {
        }

        @Override
        public void selectionDidChange(final NSNotification notification) {
        }

        @Override
        protected boolean isTypeSelectSupported() {
            return false;
        }

        public NSView tableView_viewForTableColumn_row(final NSTableView view, final NSTableColumn column, final NSInteger row) {
            final TaskController controller = getController(row);
            return controller.view();
        }
    }).id());
    this.table.sizeToFit();
}
Also used : NSInteger(org.rococoa.cocoa.foundation.NSInteger) NSTableColumn(ch.cyberduck.binding.application.NSTableColumn) NSTableView(ch.cyberduck.binding.application.NSTableView) NSNotification(ch.cyberduck.binding.foundation.NSNotification) AbstractTableDelegate(ch.cyberduck.binding.AbstractTableDelegate) ID(org.rococoa.ID) ListDataSource(ch.cyberduck.binding.ListDataSource) CGFloat(org.rococoa.cocoa.CGFloat)

Aggregations

AbstractTableDelegate (ch.cyberduck.binding.AbstractTableDelegate)1 ListDataSource (ch.cyberduck.binding.ListDataSource)1 NSTableColumn (ch.cyberduck.binding.application.NSTableColumn)1 NSTableView (ch.cyberduck.binding.application.NSTableView)1 NSNotification (ch.cyberduck.binding.foundation.NSNotification)1 ID (org.rococoa.ID)1 CGFloat (org.rococoa.cocoa.CGFloat)1 NSInteger (org.rococoa.cocoa.foundation.NSInteger)1