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 de.ug2t.kernel.*;
034: import de.ug2t.unifiedGui.*;
035: import de.ug2t.unifiedGui.interfaces.*;
036: import de.ug2t.xmlScript.*;
037:
038: public final class HoSrvGenericFileCooser extends
039: AHoSrvGenericComponent implements IUnFileChooser,
040: IUnGuiEventListener {
041: /**
042: * @param xName
043: * @param xSess
044: * @throws Exception
045: */
046: public HoSrvGenericFileCooser(String xName, String xValue,
047: IUnApplication xAppl, String xClass) throws Exception {
048: super (xName);
049: this .pcmf_setAppl(xAppl);
050: this .pcmf_setEventOnChange(true);
051:
052: if (xClass == null)
053: pdm_clientClass = "de.ug2t.channel.ho.client.swing.HoSwingFileCooser";
054: else
055: pdm_clientClass = xClass;
056:
057: if (xValue == null)
058: xValue = KeEnvironment.pcmf_getRootDir();
059:
060: this .pcmf_setLocalValue(xValue);
061:
062: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
063: "");
064:
065: if (this .pdm_session.pcmf_isInTransaction()) {
066: ScXmlScript.pcmf_createPBody(l_remCall);
067: } else {
068: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
069: ScXmlScript.pcmf_addProc(l_remCall, null);
070: }
071: ;
072: ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
073: this .pdm_clientClass, "global");
074: ScXmlScript.pcmf_addDeclPar(l_remCall, xName, "false",
075: "java.lang.String");
076: ScXmlScript.pcmf_addDeclPar(l_remCall, xValue, "false",
077: "java.lang.String");
078: ScXmlScript.pcmf_addDeclPar(l_remCall,
079: ((HoSrvGenericApplication) xAppl).pcmf_getRemName(),
080: "true", "de.ug2t.unifiedGui.interfaces.IUnApplication");
081:
082: ScXmlScript.pcmf_endAll(l_remCall);
083:
084: this .pdm_session.pcmf_call(l_remCall.toString(), this );
085:
086: return;
087: }
088:
089: public void pcmf_setUploadReadFile(boolean xUpload) {
090: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
091: "");
092:
093: if (this .pdm_session.pcmf_isInTransaction()) {
094: ScXmlScript.pcmf_createPBody(l_remCall);
095: } else {
096: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
097: ScXmlScript.pcmf_addProc(l_remCall, null);
098: }
099: ;
100: ScXmlScript.pcmf_addCall(l_remCall, null, this
101: .pcmf_getRemName(), "pcmf_setUploadReadFile");
102: ScXmlScript.pcmf_addDeclPar(l_remCall, xUpload ? "true"
103: : "false", "false", "boolean");
104: ScXmlScript.pcmf_endAll(l_remCall);
105:
106: this .pdm_session.pcmf_call(l_remCall.toString(), this );
107:
108: return;
109: }
110:
111: /**
112: * <p>
113: * Does...
114: * </p>
115: * <p>
116: *
117: * @return a Type with
118: * </p>
119: * <p>
120: * @param
121: * </p>
122: */
123: public AHoSrvGenericComponent pcmf_buildRefObj() throws Exception {
124: AHoSrvGenericComponent l_obj = new HoSrvGenericFileCooser(this
125: .pcmf_getName(), this .pcmf_getValue().toString(), this
126: .pcmf_getAppl(), this .pdm_clientClass);
127: l_obj.pcmf_setGlobal(true);
128: l_obj.pcmf_setRefFrom(this );
129: l_obj.pcmf_setAutoEcho(this .pcmf_doAutoEcho());
130: this .pcmf_setGlobal(true);
131: this .pcmf_addRef(l_obj);
132:
133: return l_obj;
134: }
135:
136: /**
137: * <p>
138: * Does...
139: * </p>
140: * <p>
141: *
142: * @return a Type with
143: * </p>
144: * <p>
145: * @param
146: * </p>
147: */
148: public void pcmf_selectReadFile() {
149: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
150: "");
151:
152: if (this .pdm_session.pcmf_isInTransaction()) {
153: ScXmlScript.pcmf_createPBody(l_remCall);
154: } else {
155: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
156: ScXmlScript.pcmf_addProc(l_remCall, null);
157: }
158: ;
159: ScXmlScript.pcmf_addCall(l_remCall, null, this
160: .pcmf_getRemName(), "pcmf_selectReadFile");
161: ScXmlScript.pcmf_endAll(l_remCall);
162:
163: this .pdm_session.pcmf_call(l_remCall.toString(), this );
164:
165: return;
166: }
167:
168: /**
169: * <p>
170: * Does...
171: * </p>
172: * <p>
173: *
174: * @return a Type with
175: * </p>
176: * <p>
177: * @param
178: * </p>
179: */
180: public void pcmf_selectWriteFile() {
181: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
182: "");
183:
184: if (this .pdm_session.pcmf_isInTransaction()) {
185: ScXmlScript.pcmf_createPBody(l_remCall);
186: } else {
187: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
188: ScXmlScript.pcmf_addProc(l_remCall, null);
189: }
190: ;
191: ScXmlScript.pcmf_addCall(l_remCall, null, this
192: .pcmf_getRemName(), "pcmf_selectWriteFile");
193: ScXmlScript.pcmf_endAll(l_remCall);
194:
195: this .pdm_session.pcmf_call(l_remCall.toString(), this );
196:
197: return;
198: }
199:
200: /**
201: * <p>
202: * Does...
203: * </p>
204: * <p>
205: *
206: * @return a Type with
207: * </p>
208: * <p>
209: * @param
210: * </p>
211: */
212: public void pcmf_selectFile() {
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, null);
220: ScXmlScript.pcmf_addProc(l_remCall, null);
221: }
222: ;
223: ScXmlScript.pcmf_addCall(l_remCall, null, this
224: .pcmf_getRemName(), "pcmf_selectFile");
225: ScXmlScript.pcmf_endAll(l_remCall);
226:
227: this .pdm_session.pcmf_call(l_remCall.toString(), this );
228:
229: return;
230: }
231:
232: public char pcmf_getMode() {
233: return (this .pdm_Element.toString().toCharArray()[0]);
234: };
235:
236: public Object pcmf_getValue() {
237: String l_value = super .pcmf_getValue().toString();
238:
239: if (l_value == null || l_value.equals(""))
240: return (l_value);
241:
242: l_value = l_value.substring(1, l_value.length());
243:
244: return (l_value);
245: }
246:
247: public void pcmf_execListener(UnComponent xParam) throws Exception {
248: this.pcmf_selectFile();
249: }
250: }
|