001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library located in LGPL.txt in the
021: * license directory; if not, write to the
022: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023: * Boston, MA 02111-1307, USA.
024: *
025: * If this agreement does not cover your requirements, please contact us
026: * via email to get detailed information about the commercial license
027: * or our service offerings!
028: *
029: */
030: // @@
031: package de.ug2t.channel.markup.generic;
032:
033: import java.util.*;
034:
035: import de.ug2t.channel.markup.html.renderer.*;
036: import de.ug2t.connector.*;
037: import de.ug2t.kernel.*;
038: import de.ug2t.unifiedGui.*;
039: import de.ug2t.unifiedGui.interfaces.*;
040:
041: public final class MuGenericRadioButton extends MuGenericComponent
042: implements IUnRadioButton, IKePoolable {
043: private String pem_string;
044: protected IUnImage pdm_icon = null;
045: protected UnButtonGroup pdm_group = null;
046: protected char pdm_accKey = ' ';
047: private boolean pem_wrap = true;
048:
049: private IKeView pem_view = new HtmlRadioButtonRenderer();
050:
051: public MuGenericRadioButton(String xName, String xValue,
052: String xString, String xGroup, ACoDataGetter xTplGetter,
053: Object xTplName, MuGenericApplication xAppl)
054: throws Exception {
055: super (xName, xTplGetter, xTplName, xAppl);
056:
057: pem_string = xString;
058:
059: this .pcmf_setView(pem_view);
060: this .pcmf_setValue(xValue);
061:
062: this .pdm_group = (UnButtonGroup) KeRegisteredObject
063: .pcmf_getObjByName(xGroup);
064: if (this .pdm_group == null) {
065: this .pdm_group = new UnButtonGroup(xGroup);
066: this .pdm_group.pcmf_reRegister(xGroup);
067: }
068:
069: this .pdm_group.pcmf_attach(this );
070:
071: return;
072: };
073:
074: // @@
075:
076: public String pcmf_getLabel() {
077: return (pem_string);
078: };
079:
080: public void pcmf_setWrap(boolean xWrap) {
081: this .pem_wrap = xWrap;
082: }
083:
084: public boolean pcmf_getWrap() {
085: return (this .pem_wrap);
086: }
087:
088: public void pcmf_setValue(Object xValue) {
089: if (IUnRadioButton.CHECKED.equals(xValue))
090: this .pdm_group.pcmf_setValue(this .pcmf_getValue());
091: else if (IUnRadioButton.NOTCHECKED.equals(xValue) == false)
092: super .pcmf_setValue(xValue);
093: }
094:
095: public void pcmf_setIcon(IUnImage xIcon) {
096: if (xIcon == this .pdm_icon)
097: return;
098:
099: if (this .pdm_icon != null)
100: this .pdm_icon.pcmf_detach();
101:
102: this .pdm_icon = xIcon;
103: this .pdm_icon.pcmf_attach();
104:
105: this .pcmf_setPropChanged(true);
106: }
107:
108: public IUnImage pcmf_getIcon() {
109: return (this .pdm_icon);
110: }
111:
112: private boolean pem_readOnly = false;
113:
114: public void pcmf_setReadOnly(boolean xReadOnly) {
115: if (this .pem_readOnly == xReadOnly)
116: return;
117:
118: this .pem_readOnly = xReadOnly;
119: this .pcmf_setPropChanged(true);
120: }
121:
122: public boolean pcmf_isReadOnly() {
123: return (this .pem_readOnly);
124: }
125:
126: public UnButtonGroup pcmf_getGroup() {
127: return (this .pdm_group);
128: }
129:
130: public void pcmf_delete() throws Exception {
131: if (this .pdm_deleted == true)
132: return;
133:
134: if (this .pdm_icon != null) {
135: this .pdm_icon.pcmf_detach();
136: this .pdm_icon.pcmf_getUnComponent().pcmf_delete();
137: }
138:
139: if (this .pdm_group != null) {
140: this .pdm_group.pcmf_detach(this );
141: if (this .pdm_group.pcmf_isInUse() == false)
142: this .pdm_group.pcmf_delete();
143: }
144:
145: super .pcmf_delete();
146: }
147:
148: public ArrayList pcmf_getListeners() {
149: return (this .pdm_group.pcmf_getListeners());
150: };
151:
152: public void pcmf_addListener(IUnGuiEventListener xListener) {
153: this .pdm_group.pcmf_addListener(xListener);
154: };
155:
156: public void pcmf_remListener(IUnGuiEventListener xListener) {
157: this .pdm_group.pcmf_remListener(xListener);
158: };
159:
160: public void pcmf_addIndirectListener(IUnGuiEventListener xListener) {
161: this .pdm_group.pcmf_addIndirectListener(xListener);
162: };
163:
164: public void pcmf_remIndirectListener(IUnGuiEventListener xListener) {
165: this .pdm_group.pcmf_remIndirectListener(xListener);
166: };
167:
168: public void pcmf_setKeyAccess(int xKey) {
169: if (this .pdm_accKey == (char) xKey)
170: return;
171:
172: this .pdm_accKey = (char) xKey;
173: this .pcmf_setPropChanged(true);
174: };
175:
176: public int pcmf_getAccKey() {
177: return (this .pdm_accKey);
178: }
179:
180: // @@
181: };
|