01: /*
02: * Copyright (c) 2004 JETA Software, Inc. All rights reserved.
03: *
04: * Redistribution and use in source and binary forms, with or without modification,
05: * are permitted provided that the following conditions are met:
06: *
07: * o Redistributions of source code must retain the above copyright notice,
08: * this list of conditions and the following disclaimer.
09: *
10: * o Redistributions in binary form must reproduce the above copyright notice,
11: * this list of conditions and the following disclaimer in the documentation
12: * and/or other materials provided with the distribution.
13: *
14: * o Neither the name of JETA Software nor the names of its contributors may
15: * be used to endorse or promote products derived from this software without
16: * specific prior written permission.
17: *
18: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21: * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22: * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23: * INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24: * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25: * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26: * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28: */
29:
30: package com.jeta.forms.gui.form;
31:
32: import com.jgoodies.forms.layout.CellConstraints;
33:
34: /**
35: * A <code>ComponentInfo</code> maintains an assocation between a
36: * GridComponent and its constraints. This is currently required by the designer
37: * for undo/redo commands such as deleting a component. The
38: * <code>ComponentInfo</code> is declared in the runtime hierarchy because it
39: * might be useful to other classes in the future.
40: *
41: * @author Jeff Tassin
42: */
43: public class ComponentInfo {
44: private CellConstraints m_cc;
45: private GridComponent m_gc;
46:
47: /**
48: * Creates a <code>ComponentInfo</code> object with the specified grid
49: * compoent and cell constraints.
50: *
51: * @param gc
52: * the grid component associated this this object
53: * @param cc
54: * the cell constraints for the grid component.
55: */
56: public ComponentInfo(GridComponent gc, CellConstraints cc) {
57: m_gc = gc;
58: m_cc = cc;
59: }
60:
61: /**
62: * Returns the cell constraints associated with the grid component.
63: */
64: public CellConstraints getCellConstraints() {
65: return m_cc;
66: }
67:
68: /**
69: * Returns the grid component.
70: */
71: public GridComponent getGridComponent() {
72: return m_gc;
73: }
74:
75: /**
76: * Returns the column where the grid component is located in the form.
77: *
78: * @return the column where the grid component is located in the form.
79: */
80: public int getColumn() {
81: return m_cc.gridX;
82: }
83:
84: /**
85: * Returns the row where the grid component is located in the form.
86: *
87: * @return the row where the grid component is located in the form.
88: */
89: public int getRow() {
90: return m_cc.gridY;
91: }
92: }
|