Grid grid = new Grid();
grid.add("Address", "921 Thompson St");
grid.add("Phone Number", "865-555-9843");
grid.newRow();
grid.add("Address", "923 Thompson St");
grid.add("Phone Number", "918-555-8340");
grid.add(0, "First Name", "Michael");
grid.add(1, "First Name", "James");
grid.add(0, "Last Name", "Johnson");
grid.add(1, "Last Name", "Smith");
grid.setGridRow(0);
grid.add("Misc", "Misc Data");
grid.setGridRowNext();
grid.add("Misc", "Misc Data");
grid.setGridRowPrev();
grid.add("Misc2", "Misc Data");
grid.setGridRowNext();
grid.add("Misc2", "Misc Data");
grid.toString();
+-----+-----------------+--------------+------------+-----------+-----------+-----------+
| Row | Address | Phone Number | First Name | Last Name | Misc | Misc2 |
+-----+-----------------+--------------+------------+-----------+-----------+-----------+
| 0 | 921 Thompson St | 865-555-9843 | Michael | Johnson | Misc Data | Misc Data |
+-----+-----------------+--------------+------------+-----------+-----------+-----------+
| 1 | 923 Thompson St | 865-555-8340 | James | Smith | Misc Data | Misc Data |
+-----+-----------------+--------------+------------+-----------+-----------+-----------+
2 of 2
grid.getListOfLists();
[[Row, Address, Phone Number, First Name, Last Name, Misc, Misc2], [0, 921 Thompson St, 865-555-9843, Michael, Johnson, Misc Data, Misc Data], [1, 923 Thompson St, 865-555-8340, James, Smith, Misc Data, Misc Data]]
grid.getColumnData("Phone Number");
[865-555-9843, 865-555-8340]
grid.resetIteratorNext();
while(grid.hasIteratorNext())
{
Map<String, Object> map = grid.getIteratorCurrentRow();
int index = grid.getIteratorPosition();
if (!map.isEmpty())
{
System.out.print(index + ": ");
System.out.println(map);
}
grid.getIteratorNext();
}
0: {Address=921 Thompson St, Phone Number=865-555-9843, First Name=Michael, Last Name=Johnson, Misc=Misc Data, Misc2=Misc Data}
1: {Address=923 Thompson St, Phone Number=865-555-8340, First Name=James, Last Name=Smith, Misc=Misc Data, Misc2=Misc Data}
grid.getIteratorSearchFull("Address", "923 Thompson St")
1: {Address=923 Thompson St, Phone Number=865-555-8340, First Name=James, Last Name=Smith, Misc=Misc Data, Misc2=Misc Data}
grid.getIteratorSearchFullCaseInsensitive("Address", "923 thompson st");
1: {Address=923 Thompson St, Phone Number=865-555-8340, First Name=James, Last Name=Smith, Misc=Misc Data, Misc2=Misc Data}
grid.getIteratorSearchPartial("Address", "Thom");
0: {Address=921 Thompson St, Phone Number=865-555-9843, First Name=Michael, Last Name=Johnson, Misc=Misc Data, Misc2=Misc Data}
1: {Address=923 Thompson St, Phone Number=865-555-8340, First Name=James, Last Name=Smith, Misc=Misc Data, Misc2=Misc Data}
grid.getIteratorSearchPartialCaseInsensitive("Address", "thom");
0: {Address=921 Thompson St, Phone Number=865-555-9843, First Name=Michael, Last Name=Johnson, Misc=Misc Data, Misc2=Misc Data}
1: {Address=923 Thompson St, Phone Number=865-555-8340, First Name=James, Last Name=Smith, Misc=Misc Data, Misc2=Misc Data}
List<Map<String, Object>> search1 = grid.getListSearchPartialCaseInsensitive("Address", "thom");
search1.toString();
[{Address=921 Thompson St, Phone Number=865-555-9843, First Name=Michael, Last Name=Johnson, Misc=Misc Data, Misc2=Misc Data}, {Address=923 Thompson St, Phone Number=865-555-8340, First Name=James, Last Name=Smith, Misc=Misc Data, Misc2=Misc Data}]
List<Map<String, Object>> search2 = grid.getObjectSearchPartialCaseInsensitive("Address", "thom");
System.out.println(search2.toString());
+-----+-----------------+--------------+------------+-----------+-----------+-----------+
| Row | Address | Phone Number | First Name | Last Name | Misc | Misc2 |
+-----+-----------------+--------------+------------+-----------+-----------+-----------+
| 0 | 921 Thompson St | 865-555-9843 | Michael | Johnson | Misc Data | Misc Data |
+-----+-----------------+--------------+------------+-----------+-----------+-----------+
| 1 | 923 Thompson St | 865-555-8340 | James | Smith | Misc Data | Misc Data |
+-----+-----------------+--------------+------------+-----------+-----------+-----------+
2 of 2
grid.getTotalRowCount();
2
grid.getRowByNumber(0);
{Address=921 Thompson St, Phone Number=865-555-9843, First Name=Michael, Last Name=Johnson, Misc=Misc Data, Misc2=Misc Data}
grid.getValueByRowAndColumn(0, "Phone Number");
865-555-9843
grid.getColumns();
[Address, Phone Number, First Name, Last Name, Misc, Misc2]
grid.removeColumn("Misc");
grid.removeColumn("Misc2");
grid.getColumns()
[Address, Phone Number, First Name, Last Name]
grid.toString();
+-----+-----------------+--------------+------------+-----------+
| Row | Address | Phone Number | First Name | Last Name |
+-----+-----------------+--------------+------------+-----------+
| 0 | 921 Thompson St | 865-555-9843 | Michael | Johnson |
+-----+-----------------+--------------+------------+-----------+
| 1 | 923 Thompson St | 865-555-8340 | James | Smith |
+-----+-----------------+--------------+------------+-----------+
2 of 2