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.unifiedGui.listener;
032:
033: import de.ug2t.kernel.*;
034: import de.ug2t.unifiedGui.*;
035: import de.ug2t.unifiedGui.interfaces.*;
036:
037: public class UnFilePickListener implements IUnGuiEventListener {
038: protected UnComponent pdm_target = null;
039: private IUnFileChooser pem_fc = null;
040: protected String pdm_prefix = "file:///";
041: private String pem_pickMode = "READ_FILE";
042:
043: class UnFilePickHelper implements IUnGuiEventListener {
044: public void pcmf_execListener(UnComponent xParam)
045: throws Exception {
046: String l_val = UnFilePickListener.this .pdm_prefix
047: + xParam.pcmf_getValue();
048: UnFilePickListener.this .pdm_target.pcmf_setValue(l_val
049: .replace('\\', '/'));
050:
051: return;
052: }
053: }
054:
055: /**
056: *
057: */
058: public UnFilePickListener(UnComponent xCopy, IUnFileChooser xFc,
059: String xPrefix) {
060: this .pdm_target = xCopy;
061: this .pem_fc = xFc;
062: this .pdm_prefix = xPrefix;
063: xFc.pcmf_getUnComponent().pcmf_addListener(
064: new UnFilePickHelper());
065: }
066:
067: public UnFilePickListener(UnComponent xCopy, IUnFileChooser xFc,
068: String xPrefix, String xMode) {
069: this .pdm_target = xCopy;
070: this .pem_fc = xFc;
071: this .pdm_prefix = xPrefix;
072: this .pem_pickMode = xMode;
073: xFc.pcmf_getUnComponent().pcmf_addListener(
074: new UnFilePickHelper());
075: }
076:
077: /**
078: *
079: */
080: public UnFilePickListener(UnComponent xCopy, IUnFileChooser xFc) {
081: this .pdm_target = xCopy;
082: this .pem_fc = xFc;
083: xFc.pcmf_getUnComponent().pcmf_addListener(
084: new UnFilePickHelper());
085: }
086:
087: /**
088: * <p>
089: * Does...
090: * </p>
091: * <p>
092: *
093: * @return a Type with
094: * </p>
095: * <p>
096: * @param
097: * </p>
098: */
099: public void pcmf_execListener(UnComponent xParam) throws Exception {
100: if (this .pem_pickMode.equals("DIR_FILE"))
101: this .pem_fc.pcmf_selectFile();
102: else if (this .pem_pickMode.equals("READ_FILE"))
103: this .pem_fc.pcmf_selectReadFile();
104: else if (this .pem_pickMode.equals("WRITE_FILE"))
105: this .pem_fc.pcmf_selectWriteFile();
106: else {
107: KeLog.pcmf_log("ug2t", "no valid mode: "
108: + this.pem_pickMode, this, KeLog.MESSAGE);
109: this.pem_fc.pcmf_selectFile();
110: }
111: }
112: }
|