Context Menu Action


In [ ]:
mapList = [
   [a:1, b:2, c:3],
   [a:4, b:5, c:6],
   [a:7, b:8, c:5]
]
display1 = new TableDisplay(mapList)
display1.addContextMenuItem("plusOne") { row, col, tableDisplay ->
   tableDisplay.values[row][col]++;
}
display1.addContextMenuItem("tag1ByStr", "tag1");
display1.addContextMenuItem("tag1ByClosure") { row, col, tableDisplay ->
   beakerx.runByTag("tag1"); 
}
display1

In [ ]:
details = display1.details
print(details.row + ":" + details.col + "=" + display1.values[details.row][details.col])

In [ ]:
// cell1 expected result
Image("../../resources/img/groovy/tableActions/cell1_case1.png")

In [ ]:
// cell1 expected result after menu action
Image("../../resources/img/groovy/tableActions/cell1_case2.png")

DoubleClick Action


In [ ]:
mapList = [
   [a:1, b:2, c:3],
   [a:4, b:5, c:6],
   [a:7, b:8, c:5]
]
display2 = new TableDisplay(mapList)
display2.setDoubleClickAction { row, col, tableDisplay ->
   tableDisplay.values[row][col]++;
}
display2

In [ ]:
// cell2 expected result
Image("../../resources/img/groovy/tableActions/cell2_case1.png")

In [ ]:
// cell2 expected result after doubleClick action
Image("../../resources/img/groovy/tableActions/cell2_case2.png")

run tag by string parameter


In [ ]:
display3 = new TableDisplay(mapList)
display3.setDoubleClickAction("tag3")
display3

In [ ]:
details = display3.details
print(details.row + ":" + details.col + "=" + display3.values[details.row][details.col])

In [ ]:
// cell3 expected result
Image("../../resources/img/groovy/tableActions/cell3_case1.png")

run tag by closure


In [ ]:
display4 = new TableDisplay(mapList)
display4.setDoubleClickAction{ row, col, tableDisplay ->
   beakerx.runByTag("tag4");
}
display4

In [ ]:
details = display4.details
print(details.row + ":" + details.col + "=" + display4.values[details.row][details.col])

In [ ]:
// cell4 expected result
Image("../../resources/img/groovy/tableActions/cell4_case1.png")

In [ ]: