31 |
public class SimpleBreaker extends AbstractMonoVob |
public class SimpleBreaker extends AbstractMonoVob |
32 |
implements Sequence { |
implements Sequence { |
33 |
|
|
34 |
protected Sequence lineType; |
/** The sequence lines are put into. */ |
35 |
protected Sequence lineHolder; |
protected Sequence lineHolder; |
36 |
|
|
37 |
|
/** The width of each line. */ |
38 |
protected float lineWidth; |
protected float lineWidth; |
39 |
|
|
40 |
|
/** The axis along which to do breaking: |
41 |
|
* X is for left-to-right line, Y for |
42 |
|
* top-to-bottom lines. |
43 |
|
*/ |
44 |
protected Axis axis; |
protected Axis axis; |
45 |
|
|
46 |
protected Sequence line; |
|
47 |
|
/** The current line. */ |
48 |
|
protected Box line; |
49 |
|
|
50 |
|
/** The width of the vobs currently put into the current line. */ |
51 |
protected float currentWidth; |
protected float currentWidth; |
52 |
|
|
53 |
public SimpleBreaker(Sequence lineType, |
|
54 |
Sequence lineHolder, |
public SimpleBreaker(Sequence lineHolder, |
55 |
float lineWidth, |
float lineWidth, |
56 |
Axis axis) { |
Axis axis) { |
57 |
super(lineHolder); |
super(lineHolder); |
58 |
|
|
|
this.lineType = lineType; |
|
59 |
this.lineHolder = lineHolder; |
this.lineHolder = lineHolder; |
60 |
this.lineWidth = lineWidth; |
this.lineWidth = lineWidth; |
61 |
this.axis = axis; |
this.axis = axis; |
65 |
|
|
66 |
protected void newline() { |
protected void newline() { |
67 |
if(line != null) lineHolder.add(line); |
if(line != null) lineHolder.add(line); |
68 |
line = lineType.cloneEmpty(); |
line = new Box(axis); |
69 |
currentWidth = 0; |
currentWidth = 0; |
70 |
} |
} |
71 |
|
|
72 |
public Sequence cloneEmpty() { |
public Sequence cloneEmpty() { |
73 |
return new SimpleBreaker(lineType, |
return new SimpleBreaker(lineHolder.cloneEmpty(), |
|
lineHolder.cloneEmpty(), |
|
74 |
lineWidth, axis); |
lineWidth, axis); |
75 |
} |
} |
76 |
|
|