001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * LGPL Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005-2006 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.ho.server.generic;
032:
033: import java.util.*;
034:
035: import de.ug2t.kernel.*;
036: import de.ug2t.unifiedGui.*;
037: import de.ug2t.unifiedGui.interfaces.*;
038: import de.ug2t.xmlScript.*;
039:
040: public final class HoSrvGenericRadioButton extends
041: AHoSrvGenericComponent implements IUnRadioButton {
042: private String pem_string = null;
043: private IUnImage pem_icon = null;
044: protected UnButtonGroup pdm_group = null;
045: private int pem_accKey = 0;
046:
047: public HoSrvGenericRadioButton(String xName, String xValue,
048: String xString, String xGroup, IUnApplication xAppl,
049: String xClass) throws Exception {
050: super (xName);
051: this .pcmf_setAppl(xAppl);
052: this .pcmf_setLocalValue(xValue);
053: this .pem_string = xString;
054:
055: this .pdm_group = (UnButtonGroup) KeRegisteredObject
056: .pcmf_getObjByName(xGroup);
057: if (this .pdm_group == null) {
058: this .pdm_group = new UnButtonGroup(xGroup);
059: this .pdm_group.pcmf_reRegister(xGroup);
060: }
061:
062: if (xClass == null)
063: pdm_clientClass = "de.ug2t.channel.ho.client.swing.HoSwingRadioButton";
064: else
065: pdm_clientClass = xClass;
066:
067: this .pdm_group.pcmf_attach(this );
068:
069: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
070: "");
071:
072: if (this .pdm_session.pcmf_isInTransaction()) {
073: ScXmlScript.pcmf_createPBody(l_remCall);
074: } else {
075: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
076: ScXmlScript.pcmf_addProc(l_remCall, null);
077: }
078: ;
079: ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
080: this .pdm_clientClass, "global");
081: ScXmlScript.pcmf_addDeclPar(l_remCall, xValue, "false",
082: "java.lang.String");
083: ScXmlScript.pcmf_addDeclPar(l_remCall, xString, "false",
084: "java.lang.String");
085: ScXmlScript.pcmf_addDeclPar(l_remCall, xGroup, "false",
086: "java.lang.String");
087: ScXmlScript.pcmf_addDeclPar(l_remCall,
088: ((HoSrvGenericApplication) xAppl).pcmf_getRemName(),
089: "true", "de.ug2t.unifiedGui.interfaces.IUnApplication");
090:
091: ScXmlScript.pcmf_endAll(l_remCall);
092:
093: this .pdm_session.pcmf_call(l_remCall.toString(), this );
094:
095: return;
096: };
097:
098: public AHoSrvGenericComponent pcmf_buildRefObj() throws Exception {
099: AHoSrvGenericComponent l_obj = new HoSrvGenericRadioButton(this
100: .pcmf_getName(), this .pcmf_getValue().toString(),
101: this .pem_string, this .pdm_group.pcmf_getObjName(), this
102: .pcmf_getAppl(), this .pdm_clientClass);
103: l_obj.pcmf_setGlobal(true);
104: this .pcmf_setGlobal(true);
105: l_obj.pcmf_setAutoEcho(this .pcmf_doAutoEcho());
106: l_obj.pcmf_setRefFrom(this );
107: this .pcmf_addRef(l_obj);
108:
109: return l_obj;
110: };
111:
112: public void pcmf_setIcon(IUnImage xIcon) {
113: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
114: "");
115:
116: if (this .pdm_session.pcmf_isInTransaction()) {
117: ScXmlScript.pcmf_createPBody(l_remCall);
118: } else {
119: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
120: ScXmlScript.pcmf_addProc(l_remCall, null);
121: }
122: ;
123: ScXmlScript.pcmf_addCall(l_remCall, null, this
124: .pcmf_getRemName(), "pcmf_setIcon");
125: ScXmlScript.pcmf_addCallPar(l_remCall, xIcon
126: .pcmf_getUnComponent().pcmf_getRemName(), "true",
127: "de.ug2t.unifiedGui.interfaces.IUnImage");
128: ScXmlScript.pcmf_endAll(l_remCall);
129:
130: this .pdm_session.pcmf_call(l_remCall.toString(), this );
131:
132: if (this .pem_icon != null)
133: this .pem_icon.pcmf_detach();
134:
135: this .pem_icon = xIcon;
136: this .pem_icon.pcmf_attach();
137: }
138:
139: public IUnImage pcmf_getIcon() {
140: return (this .pem_icon);
141: };
142:
143: public void pcmf_setKeyAccess(int xKey) {
144: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
145: "");
146:
147: if (this .pdm_session.pcmf_isInTransaction()) {
148: ScXmlScript.pcmf_createPBody(l_remCall);
149: } else {
150: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
151: ScXmlScript.pcmf_addProc(l_remCall, null);
152: }
153: ;
154: ScXmlScript.pcmf_addCall(l_remCall, null, this
155: .pcmf_getRemName(), "pcmf_setKeyAccess");
156: ScXmlScript.pcmf_addCallPar(l_remCall, Integer.toString(xKey),
157: "false", "int");
158: ScXmlScript.pcmf_endAll(l_remCall);
159:
160: this .pdm_session.pcmf_call(l_remCall.toString(), this );
161:
162: this .pem_accKey = xKey;
163: };
164:
165: public int pcmf_getAccKey() {
166: return (this .pem_accKey);
167: }
168:
169: private boolean pem_readOnly = false;
170:
171: public void pcmf_setReadOnly(boolean xReadOnly) {
172: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
173: "");
174:
175: if (this .pdm_session.pcmf_isInTransaction()) {
176: ScXmlScript.pcmf_createPBody(l_remCall);
177: } else {
178: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
179: ScXmlScript.pcmf_addProc(l_remCall, null);
180: }
181: ;
182: ScXmlScript.pcmf_addCall(l_remCall, null, this
183: .pcmf_getRemName(), "pcmf_setReadOnly");
184: ScXmlScript.pcmf_addCallPar(l_remCall, Boolean
185: .toString(xReadOnly), "false", "boolean");
186: ScXmlScript.pcmf_endAll(l_remCall);
187:
188: this .pdm_session.pcmf_call(l_remCall.toString(), this );
189: this .pem_readOnly = xReadOnly;
190: }
191:
192: public boolean pcmf_isReadOnly() {
193: return (this .pem_readOnly);
194: }
195:
196: public UnButtonGroup pcmf_getGroup() {
197: return (this .pdm_group);
198: }
199:
200: public void pcmf_delete() throws Exception {
201: if (this .pdm_deleted == true)
202: return;
203:
204: if (this .pem_icon != null) {
205: this .pem_icon.pcmf_detach();
206: this .pem_icon.pcmf_getUnComponent().pcmf_delete();
207: }
208:
209: if (this .pdm_group != null) {
210: this .pdm_group.pcmf_detach(this );
211: if (this .pdm_group.pcmf_isInUse() == false) {
212: this .pdm_group.pcmf_delete();
213: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
214: "");
215:
216: if (this .pdm_session.pcmf_isInTransaction()) {
217: ScXmlScript.pcmf_createPBody(l_remCall);
218: } else {
219: ScXmlScript.pcmf_createxScriptString(l_remCall,
220: null);
221: ScXmlScript.pcmf_addProc(l_remCall, null);
222: }
223: ;
224: ScXmlScript.pcmf_addCall(l_remCall, null, this
225: .pcmf_getRemName(), "pcmf_removeGroup");
226: ScXmlScript.pcmf_addCallPar(l_remCall, this .pdm_group
227: .pcmf_getName(), "false", "java.lang.String");
228: ScXmlScript.pcmf_endAll(l_remCall);
229: }
230: }
231:
232: super .pcmf_delete();
233: }
234:
235: public void pcmf_setValue(Object xValue) {
236: if (IUnRadioButton.CHECKED.equals(xValue))
237: this .pdm_group.pcmf_setValue(this .pcmf_getValue());
238: else if (IUnRadioButton.NOTCHECKED.equals(xValue) == false)
239: super .pcmf_setLocalValue(xValue);
240: }
241:
242: public ArrayList pcmf_getListeners() {
243: return (this .pdm_group.pcmf_getListeners());
244: };
245:
246: public void pcmf_addListener(IUnGuiEventListener xListener) {
247: this .pdm_group.pcmf_addListener(xListener);
248: };
249:
250: public void pcmf_remListener(IUnGuiEventListener xListener) {
251: this .pdm_group.pcmf_remListener(xListener);
252: };
253:
254: public void pcmf_addIndirectListener(IUnGuiEventListener xListener) {
255: this .pdm_group.pcmf_addIndirectListener(xListener);
256: };
257:
258: public void pcmf_remIndirectListener(IUnGuiEventListener xListener) {
259: this.pdm_group.pcmf_remIndirectListener(xListener);
260: };
261: }
|