001: /*
002: * SwingML Copyright (C) 2002 SwingML Team
003: *
004: * This library is free software; you can redistribute it and/or modify it under
005: * the terms of the GNU Lesser General Public License as published by the Free
006: * Software Foundation; either version 2 of the License, or (at your option) any
007: * later version.
008: *
009: * This library is distributed in the hope that it will be useful, but WITHOUT
010: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011: * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012: * details.
013: *
014: * You should have received a copy of the GNU Lesser General Public License
015: * along with this library; if not, write to the Free Software Foundation, Inc.,
016: * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
017: *
018: * Authors: Ezequiel Cuellar <ecuellar@crosslogic.com> Alessandro Dibella
019: * <alessandro.dibella@fuurou.org>
020: */
021: package org.swingml.model;
022:
023: import org.swingml.*;
024: import org.swingml.system.*;
025:
026: public class JTextAreaModel extends SwingMLModel {
027:
028: private int cols;
029: private boolean editable = true;
030: private boolean lineWrap;
031: private int rows;
032: private boolean wrapStyleWord;
033:
034: public JTextAreaModel() {
035: super ();
036: }
037:
038: public int getCols() {
039: return this .cols;
040: }
041:
042: public boolean getLineWrap() {
043: return this .lineWrap;
044: }
045:
046: public int getRows() {
047: return this .rows;
048: }
049:
050: public boolean getWrapStyleWord() {
051: return wrapStyleWord;
052: }
053:
054: public boolean isEditable() {
055: return editable;
056: }
057:
058: public void setCols(int aCols) {
059: this .cols = aCols;
060: }
061:
062: public void setEditable(boolean editable) {
063: this .editable = editable;
064: }
065:
066: public void setLineWrap(boolean aLineWrap) {
067: this .lineWrap = aLineWrap;
068: }
069:
070: public void setRows(int aRows) {
071: this .rows = aRows;
072: }
073:
074: public void setWrapStyleWord(boolean wrapStyleWord) {
075: this .wrapStyleWord = wrapStyleWord;
076: }
077:
078: public void validate() {
079: if (super .getParent().getLayout() != null
080: && super .getParent().getLayout().equalsIgnoreCase(
081: Constants.BORDERLAYOUT)) {
082: if (super .getOrientation() == null) {
083: SwingMLLogger
084: .getInstance()
085: .log(
086: "Syntax error: The parameter ORIENTATION in the element "
087: + super .getName()
088: + " is required since its parent's LAYOUT is BorderLayout. Add the parameter ORIENTATION to the element "
089: + super .getName()
090: + " or change its parent's LAYOUT to other than BorderLayout.");
091: }
092: }
093: if (super .getParent().getLayout() != null
094: && !super .getParent().getLayout().equalsIgnoreCase(
095: Constants.BORDERLAYOUT)) {
096: if (super .getOrientation() != null) {
097: SwingMLLogger
098: .getInstance()
099: .log(
100: "Syntax error: The parameter ORIENTATION in the element "
101: + super .getName()
102: + " should be used only when its parent's LAYOUT is BorderLayout. Change its parent's LAYOUT to BorderLayout or delete the parameter ORIENTATION from the element "
103: + super .getName() + ".");
104: }
105: }
106: }
107: }
|