| 110 | | Item item = table.getItem(coordinates); |
|---|
| 111 | | if (item is null) { |
|---|
| 112 | | Rectangle area = table.getClientArea(); |
|---|
| 113 | | if (area.contains(coordinates)) { |
|---|
| 114 | | // Scan across the width of the table. |
|---|
| 115 | | for (int x1 = area.x; x1 < area.x + area.width; x1++) { |
|---|
| 116 | | Point pt = new Point(x1, coordinates.y); |
|---|
| 117 | | item = table.getItem(pt); |
|---|
| 118 | | if (item !is null) { |
|---|
| 119 | | break; |
|---|
| 120 | | } |
|---|
| 121 | | } |
|---|
| 122 | | } |
|---|
| | 110 | TableItem item = table.getItem(coordinates); |
|---|
| | 111 | if (item !is null) return item; |
|---|
| | 112 | Rectangle area = table.getClientArea(); |
|---|
| | 113 | int tableBottom = area.y + area.height; |
|---|
| | 114 | int itemCount = table.getItemCount(); |
|---|
| | 115 | for (int i=table.getTopIndex(); i<itemCount; i++) { |
|---|
| | 116 | item = table.getItem(i); |
|---|
| | 117 | Rectangle rect = item.getBounds(); |
|---|
| | 118 | rect.x = area.x; |
|---|
| | 119 | rect.width = area.width; |
|---|
| | 120 | if (rect.contains(coordinates)) return item; |
|---|
| | 121 | if (rect.y > tableBottom) break; |
|---|
| 133 | | if (area.contains(coordinates)) { |
|---|
| 134 | | // Scan across the width of the tree. |
|---|
| 135 | | for (int x1 = area.x; x1 < area.x + area.width; x1++) { |
|---|
| 136 | | Point pt = new Point(x1, coordinates.y); |
|---|
| 137 | | item = tree.getItem(pt); |
|---|
| 138 | | if (item !is null) { |
|---|
| 139 | | break; |
|---|
| 140 | | } |
|---|
| | 132 | if (area.contains(point)) { |
|---|
| | 133 | int treeBottom = area.y + area.height; |
|---|
| | 134 | item = tree.getTopItem(); |
|---|
| | 135 | while (item !is null) { |
|---|
| | 136 | Rectangle rect = item.getBounds(); |
|---|
| | 137 | int itemBottom = rect.y + rect.height; |
|---|
| | 138 | if (rect.y <= point.y && point.y < itemBottom) return item; |
|---|
| | 139 | if (itemBottom > treeBottom) break; |
|---|
| | 140 | item = nextItem(tree, item); |
|---|