Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Thienel2016-07-13 14:24:58 -0400
committerFlorian Thienel2016-07-13 14:45:29 -0400
commit0cc6c8437bb781cf1b839e2e7b78532603c0c87f (patch)
tree679cdb2aa5085b12e464dfecf2ebff90e613a2e0
parent9c808b4700fa9a3760a4f2f1810b5caaf5ff6097 (diff)
downloadorg.eclipse.mylyn.docs.vex-0cc6c8437bb781cf1b839e2e7b78532603c0c87f.tar.gz
org.eclipse.mylyn.docs.vex-0cc6c8437bb781cf1b839e2e7b78532603c0c87f.tar.xz
org.eclipse.mylyn.docs.vex-0cc6c8437bb781cf1b839e2e7b78532603c0c87f.zip
store references to all rows in the layout grid
Signed-off-by: Florian Thienel <florian@thienel.org>
-rw-r--r--org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/TableLayoutGrid.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/TableLayoutGrid.java b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/TableLayoutGrid.java
index d55a863f..f075bb02 100644
--- a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/TableLayoutGrid.java
+++ b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/TableLayoutGrid.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.vex.core.internal.boxes;
+import java.util.ArrayList;
import java.util.HashMap;
import org.eclipse.vex.core.internal.core.Graphics;
@@ -19,16 +20,16 @@ import org.eclipse.vex.core.internal.core.Graphics;
*/
public class TableLayoutGrid {
- private final TableLayoutGrid parentGrid;
private final TableColumnDefinitions columnDefinitions;
+ private final ArrayList<TableRow> rows = new ArrayList<TableRow>();
private final HashMap<GridPosition, TableCell> grid = new HashMap<GridPosition, TableCell>();
+
private int currentRow = 0;
private int nextColumn = 1;
private int maxColumn = 0;
public static void setupLayoutGrid(final Graphics graphics, final IStructuralBox parent, final TableLayoutGrid layoutGrid) {
- // TODO merge with TableColumnLayout
parent.accept(new DepthFirstBoxTraversal<Object>() {
@Override
public Object visit(final Table box) {
@@ -107,7 +108,6 @@ public class TableLayoutGrid {
}
public TableLayoutGrid(final TableLayoutGrid parentGrid) {
- this.parentGrid = parentGrid;
final TableColumnDefinitions parentColumnDefinitions = parentGrid == null ? null : parentGrid.columnDefinitions;
columnDefinitions = new TableColumnDefinitions(parentColumnDefinitions);
}
@@ -121,7 +121,8 @@ public class TableLayoutGrid {
}
private int addNextRow(final TableRow row) {
- currentRow += 1;
+ rows.add(row);
+ currentRow = rows.size();
row.setRowIndex(currentRow);
nextColumn = 1;
return currentRow;
@@ -171,6 +172,10 @@ public class TableLayoutGrid {
return grid.containsKey(position);
}
+ public TableRow getRow(final int index) {
+ return rows.get(index - 1);
+ }
+
public TableCell getCell(final GridPosition position) {
return grid.get(position);
}

Back to the top