1
2
3
4
5
6
7
8
9
10
11
12 package sk.uniba.euromath.foRenderer.figures;
13 import java.util.List;
14 import org.apache.fop.area.Footnote;
15 import org.eclipse.draw2d.IFigure;
16 import org.eclipse.draw2d.geometry.Dimension;
17 import org.eclipse.draw2d.geometry.Point;
18 import org.eclipse.draw2d.geometry.Rectangle;
19 /***
20 * @author Martin Vysny
21 */
22 public class FootnoteFigure extends BasicFOPFigure {
23 public FootnoteFigure(Footnote footnote) {
24 super(footnote);
25 setLayoutManager(new FootnoteFigureLayout());
26 }
27 public class FootnoteFigureLayout extends BaseFOLayout {
28 public FootnoteFigureLayout() {
29 super();
30 }
31 protected Dimension calculatePreferredSize(IFigure parent, int wHint,
32 int hHint) {
33 preferredSize = new Dimension();
34 List children = parent.getChildren();
35 IFigure child;
36 Dimension size;
37 for (int i = 0; i < children.size(); i++) {
38 child = (IFigure) children.get(i);
39 size = child.getPreferredSize();
40 preferredSize.height += size.height;
41 preferredSize.width = Math.max(preferredSize.width, size.width);
42 }
43 return preferredSize;
44 }
45 public void layout(IFigure parent) {
46 Point origin = getOrigin(parent);
47 IFigure child;
48 Dimension size;
49 List children = parent.getChildren();
50 for (int i = 0; i < children.size(); i++) {
51 child = (IFigure) children.get(i);
52 size = child.getPreferredSize();
53 child.setBounds(new Rectangle(origin, size));
54 origin.y += size.height;
55 }
56 }
57 }
58 }