01: /* SwingML
02: * Copyright (C) 2002 Robert Morris.
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the
16: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17: * Boston, MA 02111-1307, USA.
18: *
19: * Authors:
20: * Robert Morris <robertj@morris.net>
21: *
22: */
23:
24: package org.swingml.model;
25:
26: import java.awt.*;
27: import java.util.*;
28: import java.util.List;
29:
30: public class GridBagRowModel extends GridBagBaseModel {
31:
32: private Vector m_children = null;
33: private int m_currentCol = 0;
34: private int m_row = -1;
35:
36: public GridBagRowModel() {
37: super ();
38: }
39:
40: /**
41: * @see swingml.model.ContainerModel#addChild(Object)
42: */
43: public void addChild(Object aChild) {
44: // Make sure that those values set for this parent
45: // object are passed on the contained child object,
46: // if it is an instance of the GridBagBaseModel class.
47: if (aChild instanceof GridBagCellModel) {
48: GridBagCellModel theCellModel = (GridBagCellModel) aChild;
49: theCellModel.setValues(this );
50: theCellModel.setColumn(this .m_currentCol);
51: theCellModel.setRow(this .m_row);
52: this .m_currentCol++;
53: }
54: this .getChildren().add(aChild);
55: }
56:
57: /**
58: * @see swingml.model.ContainerModel#getChildren()
59: */
60: public List getChildren() {
61: if (this .m_children == null) {
62: this .m_children = new Vector();
63: }
64: return this .m_children;
65: }
66:
67: public GridBagConstraints getConstraints() {
68: GridBagConstraints theCon = super .getConstraints();
69: theCon.gridy = this .m_row;
70: return theCon;
71: }
72:
73: /**
74: * @see swingml.model.ContainerModel#getLayout()
75: */
76: public String getLayout() {
77: return null;
78: }
79:
80: public void setRow(int aRow) {
81: this .m_row = aRow;
82: }
83:
84: public void validate() {
85: super.validate();
86: }
87: }
|