{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mapList = [\n", " [a:1, b:2, c:3],\n", " [a:4, b:5, c:6],\n", " [a:7, b:8, c:5]\n", "]\n", "display1 = new TableDisplay(mapList)\n", "display1.addContextMenuItem(\"plusOne\") { row, col, tableDisplay ->\n", " tableDisplay.values[row][col]++;\n", "}\n", "display1.addContextMenuItem(\"tag1ByStr\", \"tag1\");\n", "display1.addContextMenuItem(\"tag1ByClosure\") { row, col, tableDisplay ->\n", " beakerx.runByTag(\"tag1\"); \n", "}\n", "display1" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "tag1" ] }, "outputs": [], "source": [ "details = display1.details\n", "print(details.row + \":\" + details.col + \"=\" + display1.values[details.row][details.col])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "display2 = new TableDisplay(mapList)\n", "display2.setDoubleClickAction { row, col, tableDisplay ->\n", " tableDisplay.values[row][col]++;\n", "}\n", "display2" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "display3 = new TableDisplay(mapList)\n", "display3.setDoubleClickAction(\"tag3\")\n", "display3" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "tag3" ] }, "outputs": [], "source": [ "details = display3.details\n", "print(details.row + \":\" + details.col + \"=\" + display3.values[details.row][details.col])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "display4 = new TableDisplay(mapList)\n", "display4.setDoubleClickAction{ row, col, tableDisplay ->\n", " beakerx.runByTag(\"tag4\");\n", "}\n", "display4" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "tag4" ] }, "outputs": [], "source": [ "details = display4.details\n", "print(details.row + \":\" + details.col + \"=\" + display4.values[details.row][details.col])" ] } ], "metadata": { "celltoolbar": "Tags", "kernelspec": { "display_name": "Groovy", "language": "groovy", "name": "groovy" }, "language_info": { "codemirror_mode": "groovy", "file_extension": ".groovy", "mimetype": "", "name": "Groovy", "nbconverter_exporter": "", "version": "2.4.3" } }, "nbformat": 4, "nbformat_minor": 2 }