KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > gumby > widgets > Tr


1 package org.sapia.gumby.widgets;
2
3 import java.awt.GridBagConstraints JavaDoc;
4 import java.util.ArrayList JavaDoc;
5 import java.util.List JavaDoc;
6
7 import org.sapia.util.xml.confix.ConfigurationException;
8 import org.sapia.util.xml.confix.ObjectCreationCallback;
9
10 /**
11  * @author Yanick Duchesne
12  *
13  * <dl>
14  * <dt><b>Copyright: </b>
15  * <dd>Copyright &#169; 2002-2005 <a HREF="http://www.sapia-oss.org">Sapia Open
16  * Source Software </a>. All Rights Reserved.</dd>
17  * </dt>
18  * <dt><b>License: </b>
19  * <dd>Read the license.txt file of the jar or visit the <a
20  * HREF="http://www.sapia-oss.org/license.html">license page </a> at the Sapia
21  * OSS web site</dd>
22  * </dt>
23  * </dl>
24  */

25 public class Tr implements ObjectCreationCallback {
26
27   private TablePanel _owner;
28   private int _rowspan = 1;
29   private double _weight;
30   private List JavaDoc _cols = new ArrayList JavaDoc();
31   private int _rowCount;
32
33   Tr(TablePanel owner, int rowCount) {
34     _owner = owner;
35     _rowCount = rowCount;
36   }
37
38   public Td createTd() {
39     Td td = new Td();
40     _cols.add(td);
41     return td;
42   }
43
44   public void setRowspan(int rowspan) {
45     _rowspan = rowspan;
46   }
47
48   public void setWeight(double weight) {
49     _weight = weight;
50   }
51
52   public void addTd(Td td) {
53     _cols.add(td);
54   }
55
56   /**
57    * @see org.sapia.util.xml.confix.ObjectCreationCallback#onCreate()
58    */

59   public Object JavaDoc onCreate() throws ConfigurationException {
60     for(int i = 0; i < _cols.size(); i++) {
61       Td td;
62       GridBagConstraints JavaDoc cons;
63       td = (Td) _cols.get(i);
64       if(td.getComponent() != null) {
65         cons = td.getConstraints();
66         cons.fill = GridBagConstraints.HORIZONTAL;
67         cons.weighty = _weight;
68         cons.gridheight = _rowspan;
69         cons.gridx = i;
70         cons.gridy = _rowCount;
71         _owner.add(td.getComponent(), cons);
72       }
73     }
74     return this;
75   }
76 }
77
Popular Tags