@Override public Host itemForIndex(final NSInteger index) { return collection.get(index.intValue()); }
final Host host = this.getSource().get(row.intValue()); if(identifier.equals(BookmarkColumn.icon.name())) { return IconCacheFactory.<NSImage>get().iconNamed(host.getProtocol().disk(),
@Override public Host itemForIndex(final NSInteger row) { return collection.get(row.intValue() - (index + 3)); }
@Override public NSObject comboBox_objectValueForItemAtIndex(final NSComboBox sender, final NSInteger row) { return NSString.stringWithString( BookmarkNameProvider.toString(bookmarks.get(row.intValue())) ); } }
@Action public String tableView_typeSelectStringForTableColumn_row(NSTableView view, NSTableColumn tableColumn, NSInteger row) { return BookmarkNameProvider.toString(bookmarkModel.getSource().get(row.intValue())); }
final List<Host> selected = new ArrayList<Host>(); for(NSUInteger index = iterator.firstIndex(); !index.equals(NSIndexSet.NSNotFound); index = iterator.indexGreaterThanIndex(index)) { selected.add(bookmarkModel.getSource().get(index.intValue()));
@Action public void connectBookmarkButtonClicked(final ID sender) { if(bookmarkTable.numberOfSelectedRows().intValue() == 1) { final Host selected = bookmarkModel.getSource().get(bookmarkTable.selectedRow().intValue()); this.mount(selected); } }
@Action public void editBookmarkButtonClicked(final ID sender) { final BookmarkController c = BookmarkControllerFactory.create(bookmarks, bookmarkModel.getSource().get(bookmarkTable.selectedRow().intValue()) ); c.window().makeKeyAndOrderFront(null); }
@Action public void duplicateBookmarkButtonClicked(final ID sender) { final Host selected = bookmarkModel.getSource().get(bookmarkTable.selectedRow().intValue()); this.selectBookmarks(BookmarkSwitchSegement.bookmarks); final Host duplicate = new HostDictionary().deserialize(selected.serialize(SerializerFactory.get())); // Make sure a new UUID is asssigned for duplicate duplicate.setUuid(null); this.addBookmark(duplicate); }
final Host h = source.get(row.intValue()); if(null == host) { host = h;
/** * @param rowIndexes is the list of row numbers that will be participating in the drag. * @return To refuse the drag, return false. To start a drag, return true and place * the drag data onto pboard (data, owner, and so on). * @see NSTableView.DataSource * Invoked by view after it has been determined that a drag should begin, but before the drag has been started. * The drag image and other drag-related information will be set up and provided by the table view once this call * returns with true. */ @Override public boolean tableView_writeRowsWithIndexes_toPasteboard(final NSTableView view, final NSIndexSet rowIndexes, final NSPasteboard pboard) { for(NSUInteger index = rowIndexes.firstIndex(); !index.equals(NSIndexSet.NSNotFound); index = rowIndexes.indexGreaterThanIndex(index)) { pasteboard.add(this.getSource().get(index.intValue())); } NSEvent event = NSApplication.sharedApplication().currentEvent(); if(event != null) { NSPoint dragPosition = view.convertPoint_fromView(event.locationInWindow(), null); NSRect imageRect = new NSRect(new NSPoint(dragPosition.x.doubleValue() - 16, dragPosition.y.doubleValue() - 16), new NSSize(32, 32)); // Writing a promised file of the host as a bookmark file to the clipboard view.dragPromisedFilesOfTypes(NSArray.arrayWithObject("duck"), imageRect, this.id(), true, event); return true; } return false; }