001: /* SwingML
002: * Copyright (C) 2002 SwingML Team
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2 of the License, or (at your option) any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the
016: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
017: * Boston, MA 02111-1307, USA.
018: *
019: * Authors:
020: * Ezequiel Cuellar <ecuellar@crosslogic.com>
021: * Bram Stieperaere <bramez@users.sourceforge.net>
022: */
023:
024: package org.swingml.model;
025:
026: import org.swingml.*;
027: import org.swingml.system.*;
028:
029: public class JFrameModel extends SwingMLModel {
030:
031: private int cols = -1;
032: private int height = -1;
033: private int rows = -1;
034: private boolean showStatusBar = false;
035: private int width = -1;
036: private boolean postState;
037: private boolean maximize;
038: private int xOpen = -1;
039: private int yOpen = -1;
040:
041: public JFrameModel() {
042: super ();
043: }
044:
045: public int getCols() {
046: return this .cols;
047: }
048:
049: public int getHeight() {
050: return this .height;
051: }
052:
053: public int getRows() {
054: return this .rows;
055: }
056:
057: public int getWidth() {
058: return this .width;
059: }
060:
061: public void setCols(int aCols) {
062: this .cols = aCols;
063: }
064:
065: public void setHeight(int aHeight) {
066: this .height = aHeight;
067: }
068:
069: public void setRows(int aRows) {
070: this .rows = aRows;
071: }
072:
073: public void setShowStatusBar(boolean b) {
074: showStatusBar = b;
075: }
076:
077: public void setWidth(int aWidth) {
078: this .width = aWidth;
079: }
080:
081: public boolean showStatusBar() {
082: return showStatusBar;
083: }
084:
085: public void validate() {
086: if (this .getLayout().equalsIgnoreCase(Constants.GRIDLAYOUT)) {
087: if (this .rows == 0 || this .cols == 0) {
088: SwingMLLogger
089: .getInstance()
090: .log(
091: "Syntax error: The value of the parameter ROWS or COLS in the element "
092: + super .getName()
093: + " should be numeric and greater than 0");
094: }
095: if (this .rows == -1 || this .cols == -1) {
096: SwingMLLogger
097: .getInstance()
098: .log(
099: "Syntax error: The parameter ROWS or COLS in the element "
100: + super .getName()
101: + " should be used since the parent's layout is GridLayout. Add the parameter ROWS or COLS.");
102: }
103: }
104: if (!this .getLayout().equalsIgnoreCase(Constants.GRIDLAYOUT)) {
105: if (this .rows != -1 || this .cols != -1) {
106: SwingMLLogger
107: .getInstance()
108: .log(
109: "Syntax error: The parameters ROWS or COLS in the element "
110: + super .getName()
111: + " are not allowed since its parent's layout is not GridLayout. Remove the parameter ROWS or COLS.");
112: }
113: }
114: }
115:
116: /**
117: * @return Returns the maximize.
118: */
119: public boolean isMaximize() {
120: return maximize;
121: }
122:
123: /**
124: * @param maximize The maximize to set.
125: */
126: public void setMaximize(boolean maximize) {
127: this .maximize = maximize;
128: }
129:
130: /**
131: * @return Returns the postState.
132: */
133: public boolean isPostState() {
134: return postState;
135: }
136:
137: /**
138: * @param postState The postState to set.
139: */
140: public void setPostState(boolean postState) {
141: this .postState = postState;
142: }
143:
144: /**
145: * @return Returns the xOpen.
146: */
147: public int getXOpen() {
148: return xOpen;
149: }
150:
151: /**
152: * @param open The xOpen to set.
153: */
154: public void setXOpen(int open) {
155: xOpen = open;
156: }
157:
158: /**
159: * @return Returns the yOpen.
160: */
161: public int getYOpen() {
162: return yOpen;
163: }
164:
165: /**
166: * @param open The yOpen to set.
167: */
168: public void setYOpen(int open) {
169: yOpen = open;
170: }
171:
172: }
|