summaryrefslogtreecommitdiff
path: root/javax/swing/text/html/TableView.java
diff options
context:
space:
mode:
Diffstat (limited to 'javax/swing/text/html/TableView.java')
-rw-r--r--javax/swing/text/html/TableView.java43
1 files changed, 34 insertions, 9 deletions
diff --git a/javax/swing/text/html/TableView.java b/javax/swing/text/html/TableView.java
index 971d54cb6..90b3ecc4f 100644
--- a/javax/swing/text/html/TableView.java
+++ b/javax/swing/text/html/TableView.java
@@ -140,6 +140,7 @@ class TableView
protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets,
int spans[])
{
+ updateGrid();
int numCols = offsets.length;
int realColumn = 0;
for (int i = 0; i < numCols; i++)
@@ -255,6 +256,11 @@ class TableView
Length[] columnWidths;
/**
+ * The table width.
+ */
+ private Length width;
+
+ /**
* Indicates if the grid setup is ok.
*/
boolean gridValid;
@@ -358,13 +364,11 @@ class TableView
r = super.calculateMinorAxisRequirements(axis, r);
// Try to set the CSS width if it fits.
- AttributeSet atts = getAttributes();
- Length l = (Length) atts.getAttribute(CSS.Attribute.WIDTH);
- if (l != null)
+ if (width != null)
{
- int width = (int) l.getValue();
- if (r.minimum < width)
- r.minimum = width;
+ int w = (int) width.getValue();
+ if (r.minimum < w)
+ r.minimum = w;
}
// Adjust requirements when we have cell spacing.
@@ -373,6 +377,7 @@ class TableView
r.preferred += adjust;
// Apply the alignment.
+ AttributeSet atts = getAttributes();
Object o = atts.getAttribute(CSS.Attribute.TEXT_ALIGN);
r.alignment = 0.0F;
if (o != null)
@@ -660,11 +665,17 @@ class TableView
/**
* Updates the arrays that contain the row and column data in response
* to a change to the table structure.
+ *
+ * Package private to avoid accessor methods.
*/
- private void updateGrid()
+ void updateGrid()
{
if (! gridValid)
{
+ AttributeSet atts = getAttributes();
+ StyleSheet ss = getStyleSheet();
+ float emBase = ss.getEMBase(atts);
+ float exBase = ss.getEXBase(atts);
int maxColumns = 0;
int numRows = getViewCount();
for (int r = 0; r < numRows; r++)
@@ -697,7 +708,10 @@ class TableView
cv.getAttributes().getAttribute(CSS.Attribute.WIDTH);
if (o != null && columnWidths[colIndex] == null
&& o instanceof Length)
- columnWidths[colIndex]= (Length) o;
+ {
+ columnWidths[colIndex]= (Length) o;
+ columnWidths[colIndex].setFontBases(emBase, exBase);
+ }
colIndex += cv.colSpan;
}
}
@@ -741,12 +755,23 @@ class TableView
private void setPropertiesFromAttributes()
{
// Fetch and parse cell spacing.
- Object o = getAttributes().getAttribute(CSS.Attribute.BORDER_SPACING);
+ AttributeSet atts = getAttributes();
+ StyleSheet ss = getStyleSheet();
+ float emBase = ss.getEMBase(atts);
+ float exBase = ss.getEXBase(atts);
+ Object o = atts.getAttribute(CSS.Attribute.BORDER_SPACING);
if (o != null && o instanceof Length)
{
Length l = (Length) o;
+ l.setFontBases(emBase, exBase);
cellSpacing = (int) l.getValue();
}
+ o = atts.getAttribute(CSS.Attribute.WIDTH);
+ if (o != null && o instanceof Length)
+ {
+ width = (Length) o;
+ width.setFontBases(emBase, exBase);
+ }
}
/**