aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas L. Delmelle <adelmelle@apache.org>2015-06-19 16:46:08 +0000
committerAndreas L. Delmelle <adelmelle@apache.org>2015-06-19 16:46:08 +0000
commitafe48a3bdc97d156879789bfd6fb87c1888d48db (patch)
tree3c46da3d412c34b217a485913d0e5f9858d0b5b3 /src
parentde3d77870e5a82489148229014839cb435978c71 (diff)
downloadxmlgraphics-fop-afe48a3bdc97d156879789bfd6fb87c1888d48db.tar.gz
xmlgraphics-fop-afe48a3bdc97d156879789bfd6fb87c1888d48db.zip
Minor tweaks, more generics
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1686451 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java b/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
index 529a6acc2..aa7e27c5a 100644
--- a/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
+++ b/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
@@ -46,7 +46,7 @@ public class PrimaryGridUnit extends GridUnit {
private int colIndex;
/** Links to the spanned grid units. (List of GridUnit arrays, one array represents a row) */
- private List rows;
+ private List<GridUnit[]> rows;
/** The calculated size of the cell's content. (cached value) */
private int contentLength = -1;
@@ -95,11 +95,13 @@ public class PrimaryGridUnit extends GridUnit {
}
/** {@inheritDoc} */
+ @Override
public PrimaryGridUnit getPrimary() {
return this;
}
/** {@inheritDoc} */
+ @Override
public boolean isPrimary() {
return true;
}
@@ -171,10 +173,9 @@ public class PrimaryGridUnit extends GridUnit {
}
} else {
int width = 0;
- GridUnit[] row = (GridUnit[]) rows.get(rowIndex);
- for (int i = 0; i < row.length; i++) {
+ for (GridUnit gu : rows.get(rowIndex)) {
width = Math.max(width,
- row[i].getBorderBefore(which).getRetainedWidth());
+ gu.getBorderBefore(which).getRetainedWidth());
}
return width / 2;
}
@@ -217,10 +218,10 @@ public class PrimaryGridUnit extends GridUnit {
}
} else {
int width = 0;
- GridUnit[] row = (GridUnit[]) rows.get(rowIndex);
- for (int i = 0; i < row.length; i++) {
+ GridUnit[] row = rows.get(rowIndex);
+ for (GridUnit gu : row) {
width = Math.max(width,
- row[i].getBorderAfter(which).getRetainedWidth());
+ gu.getBorderAfter(which).getRetainedWidth());
}
return width / 2;
}
@@ -238,7 +239,7 @@ public class PrimaryGridUnit extends GridUnit {
return getAfterBorderWidth(getCell().getNumberRowsSpanned() - 1, which);
}
- /** @return the length of the cell content. */
+ /** @return the length of the cell content */
public int getContentLength() {
if (contentLength < 0) {
contentLength = ElementListUtils.calcContentLength(elements);
@@ -251,7 +252,7 @@ public class PrimaryGridUnit extends GridUnit {
*
* @return a list of GridUnit[], each array corresponds to a row
*/
- public List getRows() {
+ public List<GridUnit[]> getRows() {
return this.rows;
}
@@ -261,7 +262,7 @@ public class PrimaryGridUnit extends GridUnit {
*/
public void addRow(GridUnit[] row) {
if (rows == null) {
- rows = new java.util.ArrayList();
+ rows = new java.util.ArrayList<GridUnit[]>();
}
rows.add(row);
}
@@ -306,8 +307,7 @@ public class PrimaryGridUnit extends GridUnit {
widths[0] = getCell().getCommonBorderPaddingBackground().getBorderStartWidth(false);
widths[1] = getCell().getCommonBorderPaddingBackground().getBorderEndWidth(false);
} else {
- for (int i = 0; i < rows.size(); i++) {
- GridUnit[] gridUnits = (GridUnit[])rows.get(i);
+ for (GridUnit[] gridUnits : rows) {
widths[0] = Math.max(widths[0],
gridUnits[0].borderStart.getBorderInfo().getRetainedWidth());
widths[1] = Math.max(widths[1], gridUnits[gridUnits.length - 1].borderEnd
@@ -319,7 +319,7 @@ public class PrimaryGridUnit extends GridUnit {
/** {@inheritDoc} */
public String toString() {
- StringBuffer sb = new StringBuffer(super.toString());
+ StringBuilder sb = new StringBuilder(super.toString());
sb.append(" rowIndex=").append(rowIndex);
sb.append(" colIndex=").append(colIndex);
return sb.toString();