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.interfaces.*;
037: import de.ug2t.xmlScript.*;
038:
039: public final class HoSrvGenericTabbedPane extends
040: AHoSrvGenericComponent implements IUnTabbedPane {
041: boolean pem_tabDown = false;
042: private HashMap pem_tabComponents = null;
043:
044: public HoSrvGenericTabbedPane(String xName, IUnApplication xAppl,
045: String xClass) throws Exception {
046: super (xName);
047: this .pcmf_setAppl(xAppl);
048:
049: this .pcmf_setLocalValue("");
050:
051: if (xClass == null)
052: pdm_clientClass = "de.ug2t.channel.ho.client.swing.HoSwingTabbedPane";
053: else
054: pdm_clientClass = xClass;
055:
056: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
057: "");
058:
059: if (this .pdm_session.pcmf_isInTransaction()) {
060: ScXmlScript.pcmf_createPBody(l_remCall);
061: } else {
062: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
063: ScXmlScript.pcmf_addProc(l_remCall, null);
064: }
065: ;
066: ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
067: this .pdm_clientClass, "global");
068: ScXmlScript.pcmf_addDeclPar(l_remCall, xName, "false",
069: "java.lang.String");
070: ScXmlScript.pcmf_addDeclPar(l_remCall,
071: ((HoSrvGenericApplication) xAppl).pcmf_getRemName(),
072: "true", "de.ug2t.unifiedGui.interfaces.IUnApplication");
073:
074: ScXmlScript.pcmf_endAll(l_remCall);
075:
076: this .pdm_session.pcmf_call(l_remCall.toString(), this );
077:
078: return;
079: };
080:
081: public HoSrvGenericTabbedPane(String xName, boolean xTabsDown,
082: IUnApplication xAppl, String xClass) throws Exception {
083: super (xName);
084: this .pcmf_setAppl(xAppl);
085:
086: this .pcmf_setLocalValue("");
087: this .pem_tabDown = xTabsDown;
088:
089: if (xClass == null)
090: pdm_clientClass = "de.ug2t.channel.ho.client.swing.HoSwingTabbedPane";
091: else
092: pdm_clientClass = xClass;
093:
094: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
095: "");
096:
097: if (this .pdm_session.pcmf_isInTransaction()) {
098: ScXmlScript.pcmf_createPBody(l_remCall);
099: } else {
100: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
101: ScXmlScript.pcmf_addProc(l_remCall, null);
102: }
103: ;
104: ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
105: this .pdm_clientClass, "global");
106: ScXmlScript.pcmf_addDeclPar(l_remCall, xName, "false",
107: "java.lang.String");
108: ScXmlScript.pcmf_addDeclPar(l_remCall, Boolean
109: .toString(xTabsDown), "false", "boolean");
110: ScXmlScript.pcmf_addDeclPar(l_remCall,
111: ((HoSrvGenericApplication) xAppl).pcmf_getRemName(),
112: "true", "de.ug2t.unifiedGui.interfaces.IUnApplication");
113:
114: ScXmlScript.pcmf_endAll(l_remCall);
115:
116: this .pdm_session.pcmf_call(l_remCall.toString(), this );
117:
118: return;
119: };
120:
121: public AHoSrvGenericComponent pcmf_buildRefObj() throws Exception {
122: AHoSrvGenericComponent l_obj = new HoSrvGenericTabbedPane(this
123: .pcmf_getName(), this .pcmf_getAppl(),
124: this .pdm_clientClass);
125:
126: l_obj.pcmf_setGlobal(true);
127: l_obj.pcmf_setRefFrom(this );
128: l_obj.pcmf_setAutoEcho(this .pcmf_doAutoEcho());
129: this .pcmf_setGlobal(true);
130: this .pcmf_addRef(l_obj);
131:
132: return (l_obj);
133: };
134:
135: public void pcmf_commitTabs() {
136: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
137: "");
138:
139: if (this .pdm_session.pcmf_isInTransaction()) {
140: ScXmlScript.pcmf_createPBody(l_remCall);
141: } else {
142: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
143: ScXmlScript.pcmf_addProc(l_remCall, null);
144: }
145: ;
146: ScXmlScript.pcmf_addCall(l_remCall, null, this
147: .pcmf_getRemName(), "pcmf_commitTabs");
148: ScXmlScript.pcmf_endAll(l_remCall);
149:
150: this .pdm_session.pcmf_call(l_remCall.toString(), this );
151:
152: if (this .pcmf_getChildCount() > 0)
153: this .pcmf_setValue(this .pcmf_getAllSubNames().get(0));
154: };
155:
156: public void pcmf_addTab(String xName, IUnForm xForm) {
157: this .pcmf_addNode(xName, xForm.pcmf_getUnComponent());
158: }
159:
160: public void pcmf_removeTab(String xName) {
161: this .pcmf_removeNode(xName);
162: }
163:
164: private boolean pem_readOnly = false;
165:
166: public void pcmf_setReadOnly(boolean xReadOnly) {
167: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
168: "");
169:
170: if (this .pdm_session.pcmf_isInTransaction()) {
171: ScXmlScript.pcmf_createPBody(l_remCall);
172: } else {
173: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
174: ScXmlScript.pcmf_addProc(l_remCall, null);
175: }
176: ;
177: ScXmlScript.pcmf_addCall(l_remCall, null, this
178: .pcmf_getRemName(), "pcmf_setReadOnly");
179: ScXmlScript.pcmf_addCallPar(l_remCall, Boolean
180: .toString(xReadOnly), "false", "boolean");
181: ScXmlScript.pcmf_endAll(l_remCall);
182:
183: this .pdm_session.pcmf_call(l_remCall.toString(), this );
184: this .pem_readOnly = xReadOnly;
185: }
186:
187: public boolean pcmf_isReadOnly() {
188: return (this .pem_readOnly);
189: }
190:
191: public boolean pcmf_isTabDown() {
192: return (this .pem_tabDown);
193: }
194:
195: public void pcmf_reorgTabComponents() {
196: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
197: "");
198:
199: if (this .pdm_session.pcmf_isInTransaction()) {
200: ScXmlScript.pcmf_createPBody(l_remCall);
201: } else {
202: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
203: ScXmlScript.pcmf_addProc(l_remCall, null);
204: }
205: ;
206: ScXmlScript.pcmf_addCall(l_remCall, null, this
207: .pcmf_getRemName(), "pcmf_reorgTabComponents");
208: ScXmlScript.pcmf_endAll(l_remCall);
209:
210: this .pdm_session.pcmf_call(l_remCall.toString(), this );
211: }
212:
213: public void pcmf_setTabComponent(int xIdx, IUnComponent xComp) {
214: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
215: "");
216:
217: if (this .pdm_session.pcmf_isInTransaction()) {
218: ScXmlScript.pcmf_createPBody(l_remCall);
219: } else {
220: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
221: ScXmlScript.pcmf_addProc(l_remCall, null);
222: }
223: ;
224: ScXmlScript.pcmf_addCall(l_remCall, null, this
225: .pcmf_getRemName(), "pcmf_setTabComponent");
226: ScXmlScript.pcmf_addCallPar(l_remCall, Integer.toString(xIdx),
227: "false", "int");
228: ScXmlScript.pcmf_addCallPar(l_remCall, xComp
229: .pcmf_getUnComponent().pcmf_getRemName(), "true",
230: "de.ug2t.unifiedGui.interfaces.IUnComponent");
231: ScXmlScript.pcmf_endAll(l_remCall);
232:
233: this .pdm_session.pcmf_call(l_remCall.toString(), this );
234:
235: if (this .pem_tabComponents == null)
236: this .pem_tabComponents = new HashMap();
237:
238: this .pem_tabComponents.put(new Integer(xIdx), xComp);
239: }
240:
241: public void pcmf_removeTabComponent(int xIdx) {
242: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
243: "");
244:
245: if (this .pdm_session.pcmf_isInTransaction()) {
246: ScXmlScript.pcmf_createPBody(l_remCall);
247: } else {
248: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
249: ScXmlScript.pcmf_addProc(l_remCall, null);
250: }
251: ;
252: ScXmlScript.pcmf_addCall(l_remCall, null, this
253: .pcmf_getRemName(), "pcmf_removeTabComponent");
254: ScXmlScript.pcmf_addCallPar(l_remCall, Integer.toString(xIdx),
255: "false", "int");
256: ScXmlScript.pcmf_endAll(l_remCall);
257:
258: this .pdm_session.pcmf_call(l_remCall.toString(), this );
259:
260: if (this .pem_tabComponents != null) {
261: this .pem_tabComponents.remove(new Integer(xIdx));
262: if (this .pem_tabComponents.size() == 0)
263: this .pem_tabComponents = null;
264: }
265: }
266:
267: public void pcmf_delete() throws Exception {
268: if (this .pem_tabComponents != null)
269: this .pem_tabComponents.clear();
270:
271: super .pcmf_delete();
272: }
273:
274: public void pcmf_activateFirst() {
275: KeTreeNode l_node = this .pcmf_getNodeAt(0);
276:
277: this .pcmf_setValue(l_node.pcmf_getName());
278: }
279:
280: public void pcmf_activateNext() {
281: int l_idx = this .pcmf_indexOf(this .pcmf_getSubNode(this
282: .pcmf_getValue().toString()));
283: KeTreeNode l_node = this .pcmf_getNodeAt(l_idx + 1);
284:
285: this .pcmf_setValue(l_node.pcmf_getName());
286: }
287:
288: public void pcmf_activatePrev() {
289: int l_idx = this .pcmf_indexOf(this .pcmf_getSubNode(this
290: .pcmf_getValue().toString()));
291: KeTreeNode l_node = this .pcmf_getNodeAt(l_idx - 1);
292:
293: this .pcmf_setValue(l_node.pcmf_getName());
294: }
295:
296: public void pcmf_activateLast() {
297: KeTreeNode l_node = this .pcmf_getNodeAt(this
298: .pcmf_getChildCount() - 1);
299:
300: this .pcmf_setValue(l_node.pcmf_getName());
301: }
302:
303: public int pcmf_getActivatedIndex() {
304: return (this .pcmf_indexOf(this .pcmf_getSubNode(this
305: .pcmf_getValue().toString())));
306: }
307:
308: public void pcmf_setActivatedIndex(int xIdx) {
309: this.pcmf_setValue(this.pcmf_getNodeAt(xIdx).pcmf_getName());
310: }
311: }
|