001: /*
002: * ToolBarConstraints.java
003: *
004: * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis
005: *
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU General Public License
008: * as published by the Free Software Foundation; either version 2
009: * of the License, or any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
019: *
020: */
021:
022: package org.underworldlabs.swing.toolbar;
023:
024: import java.io.Serializable;
025:
026: /* ----------------------------------------------------------
027: * CVS NOTE: Changes to the CVS repository prior to the
028: * release of version 3.0.0beta1 has meant a
029: * resetting of CVS revision numbers.
030: * ----------------------------------------------------------
031: */
032:
033: /**
034: *
035: * @author Takis Diakoumis
036: * @version $Revision: 1.4 $
037: * @date $Date: 2006/05/14 06:56:07 $
038: */
039: public class ToolBarConstraints implements Cloneable, Serializable {
040:
041: private int row;
042: private int position;
043: private int locX;
044: private int resizeOffsetX;
045: private int minimumWidth;
046: private int preferredWidth;
047: private int currentWidth;
048:
049: public ToolBarConstraints() {
050: resizeOffsetX = -1;
051: minimumWidth = -1;
052: preferredWidth = -1;
053: }
054:
055: public ToolBarConstraints(int row, int position) {
056: resizeOffsetX = -1;
057: minimumWidth = -1;
058: preferredWidth = -1;
059: locX = -1;
060: this .row = row;
061: this .position = position;
062: }
063:
064: public ToolBarConstraints(int row, int position, int minimumWidth) {
065: resizeOffsetX = -1;
066: preferredWidth = -1;
067: locX = -1;
068: this .minimumWidth = minimumWidth;
069: this .row = row;
070: this .position = position;
071: }
072:
073: public ToolBarConstraints(int row, int position, int minimumWidth,
074: int preferredWidth) {
075: resizeOffsetX = -1;
076: locX = -1;
077: this .minimumWidth = minimumWidth;
078: this .row = row;
079: this .position = position;
080: this .preferredWidth = preferredWidth;
081: }
082:
083: public void reset() {
084: resizeOffsetX = -1;
085: minimumWidth = -1;
086: preferredWidth = -1;
087: locX = -1;
088: row = -1;
089: position = -1;
090: }
091:
092: public void setCurrentWidth(int currentWidth) {
093: this .currentWidth = currentWidth;
094: }
095:
096: public int getCurrentWidth() {
097: return currentWidth;
098: }
099:
100: public void setPreferredWidth(int preferredWidth) {
101: this .preferredWidth = preferredWidth;
102: }
103:
104: public int getPreferredWidth() {
105: return preferredWidth;
106: }
107:
108: public void setLocX(int locX) {
109: this .locX = locX;
110: }
111:
112: public int getLocX() {
113: return locX == -1 ? position : locX;
114: }
115:
116: public void setPosition(int position) {
117: this .position = position;
118: }
119:
120: public int getPosition() {
121: return position;
122: }
123:
124: public int getRow() {
125: return row;
126: }
127:
128: public void setRow(int row) {
129: this .row = row;
130: }
131:
132: public void setMinimumWidth(int minimumWidth) {
133: this .minimumWidth = minimumWidth;
134: }
135:
136: public int getMinimumWidth() {
137: return minimumWidth;
138: }
139:
140: public void setResizeOffsetX(int resizeOffsetX) {
141: this .resizeOffsetX = resizeOffsetX;
142: }
143:
144: public int getResizeOffsetX() {
145: return resizeOffsetX;
146: }
147:
148: public void setConstraints(int row, int position) {
149: this .row = row;
150: this .position = position;
151: }
152:
153: public Object clone() {
154:
155: try {
156: ToolBarConstraints c = (ToolBarConstraints) super .clone();
157: return c;
158: } catch (CloneNotSupportedException e) {
159: throw new InternalError();
160: }
161:
162: }
163:
164: public String toString() {
165: return "ToolBarConstraints[row: " + row + ", position: "
166: + position + ", resizeOffsetX: " + resizeOffsetX
167: + ", minimumWidth: " + minimumWidth
168: + ", preferredWidth: " + preferredWidth
169: + ", currentWidth: " + currentWidth + "]";
170: }
171:
172: }
|