@@ -11,14 +11,15 @@ public class AlignColumn {
11
11
public boolean rightAlign ;
12
12
private boolean forceLineBreakAfter ;
13
13
private boolean overrideWidthWith1 ;
14
+ private int minimumWidth ;
14
15
/** the forced indent of the column, to which the basicIndent is added **/
15
16
private int forceIndent = -1 ;
16
17
17
18
// variables that are updated on .addCell() and may be recalculated with .recalculate()
18
19
private boolean isValid ;
19
20
private int maxMonoLineWidth ;
20
21
private int maxMultiLineWidth ;
21
-
22
+
22
23
// the effective indent is only determined in AlignTable.align()
23
24
private int effectiveIndent ;
24
25
@@ -93,13 +94,13 @@ final void recalculate() {
93
94
final int getMaxMonoLineWidthWithSpaceLeft () {
94
95
if (!isValid )
95
96
recalculate ();
96
- return isEmpty () ? 0 : maxMonoLineWidth + 1 ;
97
+ return isEmpty () ? 0 : Math . max ( minimumWidth , maxMonoLineWidth ) + 1 ;
97
98
}
98
99
99
100
final int getMaxMultiLineWidthWithSpaceLeft () {
100
101
if (!isValid )
101
102
recalculate ();
102
- return isEmpty () ? 0 : maxMultiLineWidth + 1 ;
103
+ return isEmpty () ? 0 : Math . max ( minimumWidth , maxMultiLineWidth ) + 1 ;
103
104
}
104
105
105
106
/**
@@ -209,4 +210,27 @@ public final AlignCell getLastNonEmptyCell() {
209
210
}
210
211
return null ;
211
212
}
213
+
214
+ public final void setMinimumWidth (int minimumWidth ) {
215
+ this .minimumWidth = minimumWidth ;
216
+ }
217
+
218
+ public final boolean isPreviousColumnFixedWidth () {
219
+ if (index == 0 )
220
+ return false ;
221
+
222
+ int minWidth = -1 ;
223
+ int maxWidth = -1 ;
224
+ for (AlignLine line : parentTable .getLines ()) {
225
+ if (line .getCell (index ) == null )
226
+ continue ;
227
+ AlignCell prevCell = line .getCell (index - 1 );
228
+ if (prevCell == null )
229
+ return false ;
230
+ int width = prevCell .getMultiLineWidth ();
231
+ minWidth = (minWidth < 0 ) ? width : Math .min (minWidth , width );
232
+ maxWidth = (maxWidth < 0 ) ? width : Math .max (maxWidth , width );
233
+ }
234
+ return (minWidth >= 0 && minWidth == maxWidth );
235
+ }
212
236
}
0 commit comments