01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
10: //The Original Code is "The Columba Project"
11: //
12: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14: //
15: //All Rights Reserved.
16: package org.columba.core.print;
17:
18: import java.awt.Graphics2D;
19: import java.util.Iterator;
20: import java.util.List;
21: import java.util.Vector;
22:
23: public class cHGroup extends cPrintObject {
24: List members;
25:
26: public cHGroup() {
27: members = new Vector();
28: }
29:
30: public void add(cPrintObject po) {
31: po.setType(cPrintObject.GROUPMEMBER);
32: members.add(po);
33: }
34:
35: public void print(Graphics2D g) {
36: cPrintObject act;
37:
38: computePositionAndSize();
39:
40: for (Iterator it = members.iterator(); it.hasNext();) {
41: act = (cPrintObject) it.next();
42:
43: // for( int i=0; i<members.size(); i++ ) {
44: // act = (cPrintObject) members.get( i );
45: act.setLocation((cPoint) getDrawingOrigin().clone());
46: act.setPage(page);
47: act.print(g);
48: }
49: }
50:
51: public cSize getSize(cUnit width) {
52: cUnit maxHeight = new cCmUnit();
53: cSize act;
54:
55: for (int i = 0; i < members.size(); i++) {
56: act = ((cPrintObject) members.get(i)).getSize(width);
57:
58: if (act.getHeight().getPoints() > maxHeight.getPoints()) {
59: maxHeight = act.getHeight();
60: }
61: }
62:
63: maxHeight.addI(topMargin);
64: maxHeight.addI(bottomMargin);
65:
66: return new cSize(new cCmUnit(), maxHeight);
67: }
68: }
|