1 package org.sapia.gumby.widgets; 2 3 import java.awt.GridBagConstraints ; 4 import java.util.ArrayList ; 5 import java.util.List ; 6 7 import org.sapia.util.xml.confix.ConfigurationException; 8 import org.sapia.util.xml.confix.ObjectCreationCallback; 9 10 25 public class Tr implements ObjectCreationCallback { 26 27 private TablePanel _owner; 28 private int _rowspan = 1; 29 private double _weight; 30 private List _cols = new ArrayList (); 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 59 public Object onCreate() throws ConfigurationException { 60 for(int i = 0; i < _cols.size(); i++) { 61 Td td; 62 GridBagConstraints 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 |