-
Bug
-
Resolution: Fixed
-
P5
-
1.3.0
-
beta
-
x86
-
windows_98
Name: mc57594 Date: 12/09/99
java version "1.3beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3beta-O)
Java(TM) HotSpot Client VM (build 1.3beta-O, mixed mode)
One would assume that FlowView would allow flowing on either the X or Y axis.
Most of the FlowView implementation in JDK 1.3beta allows this. However,
FlowView.FlowStrategy.layoutRow() and FlowView.FlowStrategy.adjustRow() appear
to have been written especially for ParagraphView (which uses the default
FlowView.FlowStrategy) and in places assume flow along the X axis. This is
undesired and unnecessary.
FlowView.FlowStrategy.layoutRow():
if (v instanceof TabableView) {
chunkSpan = (int) ((TabableView)v).getTabbedSpan(x, te);
} else {
chunkSpan = (int) v.getPreferredSpan(View.X_AXIS);
}
// If a forced break is necessary, break
if (v.getBreakWeight(View.X_AXIS, pos, spanLeft) >= ForcedBreakWeight) {
[cut]
v = v.breakView(X_AXIS, pos, x, spanLeft);
This should be re-implemented something like this:
if (v instanceof TabableView && getFlowAxis()==View.X_AXIS)
chunkSpan = (int) ((TabableView)v).getTabbedSpan(x, te);
else
chunkSpan = (int) v.getPreferredSpan(getFlowAxis());
// If a forced break is necessary, break
if (v.getBreakWeight(getFlowAxis(), pos, spanLeft) >= ForcedBreakWeight) {
[cut]
v = v.breakView(getFlowAxis(), pos, x, spanLeft);
if (v != null) {
(change this section to reflect the axis as will, similar to above)
FlowView.FlowStrategy.adjustRow():
int w = v.getBreakWeight(X_AXIS, x + span, spanLeft);
[cut]
span += v.getPreferredSpan(X_AXIS);
[cut]
v = v.breakView(X_AXIS, v.getStartOffset(), x + bestSpan, spanLeft);
These should be rewritten to something like this:
int w = v.getBreakWeight(getFlowAxis(), x + span, spanLeft);
[cut]
span += v.getPreferredSpan(getFlowAxis());
[cut]
v = v.breakView(getFlowAxis(), v.getStartOffset(), x + bestSpan, spanLeft);
(This is just an example of a fix; it would be better, of course, to have a
final int flowAxis=getFlowAxis() variable at the beginning of each function and
simply use that instead of calling getFlowAxis() each time.)
(Review ID: 98745)
======================================================================