``class pInfoViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate
{
@IBOutlet var infoTable : NSTableView!
var artists = artistModel()
@IBAction func tableViewDoubleAction(sender: AnyObject)
{
let r = infoTable.clickedRow
aPainterWindow = painterWindow(windowNibName: "painterWindow")
aPainterWindow.setPainter(ID:artists.patienterNID(index:r))
aPainterWindow.showWindow(self)
}
@IBAction func painterClicked(sender : Any)
{
let r = infoTable.clickedRow
let painterID = artists.patienterNID(index: r)
print("load paintings for painterID = (painterID).")
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "loadPaintingsForPainter"), object: painterID )
}
func reloadDataAndTable()
{
artists.loadAllPainters()
self.infoTable.reloadData()
}
override func viewDidLoad()
{
super.viewDidLoad()
reloadDataAndTable()
}
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView?
{
let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "Painter"), owner: self) as? NSTableCellView
cell?.textField?.stringValue = artists.itemN(index:row)
print("piv row=(row). value= (artists.itemN(index:row)).")
return cell
}
func numberOfRows(in aTableView: NSTableView) -> Int
{
return artists.nItems()
}
}.`
`