01: /* SwingML
02: * Copyright (C) 2002 Bram Stieperaere.
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: * Bram Stieperaere <bramez@users.sourceforge.net>
21: * Ezequiel Cuellar <ecuellar@crosslogic.com>
22: *
23: */
24:
25: package org.swingml.model;
26:
27: import org.swingml.*;
28: import org.swingml.system.*;
29:
30: public class JRadioButtonModel extends SwingMLModel {
31:
32: private String align;
33: private boolean checked;
34: private boolean enabled = true;
35:
36: public JRadioButtonModel() {
37: super ();
38: }
39:
40: public String getAlign() {
41: return align;
42: }
43:
44: public boolean isChecked() {
45: return checked;
46: }
47:
48: public boolean isEnabled() {
49: return enabled;
50: }
51:
52: public void setAlign(final String s) {
53: align = s;
54: }
55:
56: public void setChecked(final boolean b) {
57: checked = b;
58: }
59:
60: public void setEnabled(final boolean b) {
61: enabled = b;
62: }
63:
64: public void validate() {
65: if (null != getParent().getLayout()) {
66: if (getParent().getLayout().equalsIgnoreCase(
67: Constants.BORDERLAYOUT)) {
68: if (getOrientation() == null) {
69: SwingMLLogger
70: .getInstance()
71: .log(
72: "Syntax error: The parameter ORIENTATION in the element "
73: + getName()
74: + " is required since its parent's LAYOUT is BorderLayout. Add the parameter ORIENTATION to the element "
75: + getName()
76: + " or change its parent's LAYOUT to other than BorderLayout.");
77: }
78: } else if (getOrientation() != null) {
79: SwingMLLogger
80: .getInstance()
81: .log(
82: "Syntax error: The parameter ORIENTATION in the element "
83: + getName()
84: + " 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 "
85: + getName() + ".");
86: }
87: }
88: }
89: }
|