{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell1\n",
"[\"x\" : 1, \"y\" : 2]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell1 expected result\n",
"Image(\"../../resources/img/groovy/mapLikeTable/cell1_case1.png\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell2\n",
"List list = new ArrayList();\n",
"list.add([\"x\" : 1, \"y\" : 2]);\n",
"list.add([\"x\" : 3, \"y\" : 4]);\n",
"list"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell2 expected result\n",
"Image(\"../../resources/img/groovy/mapLikeTable/cell2_case1.png\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell3\n",
"Map[] map = new Map[2];\n",
"map[0] = [\"x\" : 1, \"y\" : 2]\n",
"map[1] = [\"x\" : 3, \"y\" : 4]\n",
"map"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell3 expected result\n",
"Image(\"../../resources/img/groovy/mapLikeTable/cell3_case1.png\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell4\n",
"def listOfMap = []\n",
"1.upto(3){\n",
" listOfMap += [\"test\": it, \"test2\": 2 * it]\n",
"}\n",
"listOfMap"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell4 expected result\n",
"Image(\"../../resources/img/groovy/mapLikeTable/cell4_case1.png\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell5\n",
"def myMap = [:]\n",
"def myList = []\n",
"myList << [1, 2, 3]\n",
"myList << [2, 3, 4]\n",
"myMap.put(1, myList)\n",
"myMap"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell5 expected result\n",
"Image(\"../../resources/img/groovy/mapLikeTable/cell5_case1.png\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell6\n",
"def myMap = [:]\n",
"def myList = [num1:1, num2:2]\n",
"myMap.put(1, myList)\n",
"myMap"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell6 expected result\n",
"Image(\"../../resources/img/groovy/mapLikeTable/cell6_case1.png\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell7\n",
"new TableDisplay([[col1: \"This & that\", col2: \"This / that\", col3: \"This > that\"]]);"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell7 expected result\n",
"Image(\"../../resources/img/groovy/mapLikeTable/cell7_case1.png\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell8\n",
"class MyClass {\n",
" def value;\n",
" public MyClass(String value) {\n",
" this.value = value\n",
" }\n",
" \n",
" public String toString() {\n",
" return this.value;\n",
" }\n",
"}\n",
"\n",
"def clz = new MyClass(\"print this\")\n",
"def tableData = [\n",
" [myclass: clz]\n",
"]\n",
"displayObject = new TableDisplay(tableData);\n",
"displayObject"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell8 expected result\n",
"Image(\"../../resources/img/groovy/mapLikeTable/cell8_case1.png\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"//cell19\n",
"tbl = new TableDisplay([x: 'italic red',\n",
" y: 'bold blue',\n",
" z: 'multiline strings
work fine too']);\n",
"tbl.setStringFormatForColumn(\"Value\", TableDisplayStringFormat.getHTMLFormat())\n",
"tbl"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// cell9 expected result\n",
"Image(\"../../resources/img/groovy/mapLikeTable/cell9_case1.png\")"
]
}
],
"metadata": {
"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
}