01: /*
02: JSmooth: a VM wrapper toolkit for Windows
03: Copyright (C) 2003 Rodrigo Reyes <reyes@charabia.net>
04:
05: This program is free software; you can redistribute it and/or modify
06: it under the terms of the GNU General Public License as published by
07: the Free Software Foundation; either version 2 of the License, or
08: (at your option) any later version.
09:
10: This program is distributed in the hope that it will be useful,
11: but WITHOUT ANY WARRANTY; without even the implied warranty of
12: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13: GNU General Public License for more details.
14:
15: You should have received a copy of the GNU General Public License
16: along with this program; if not, write to the Free Software
17: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18:
19: */
20:
21: package net.charabia.jsmoothgen.application.gui.editors;
22:
23: import net.charabia.jsmoothgen.skeleton.*;
24: import net.charabia.jsmoothgen.application.*;
25: import net.charabia.jsmoothgen.application.gui.*;
26: import net.charabia.jsmoothgen.application.gui.util.*;
27: import javax.swing.*;
28: import java.awt.*;
29: import java.util.*;
30: import java.io.File;
31: import com.l2fprod.common.swing.*;
32: import com.l2fprod.common.propertysheet.*;
33:
34: public class EmbeddedJar extends Editor {
35: private JCheckBox m_checker = new JCheckBox();
36: private FileSelectionTextField m_selector = new FileSelectionTextField();
37:
38: public EmbeddedJar() {
39: setLayout(new PanelLayout());
40: add(m_checker);
41: add(m_selector);
42:
43: m_checker.setAction(new AbstractAction(Main
44: .local("EMBEDDEDJAR_CHECKBOX")) {
45: public void actionPerformed(java.awt.event.ActionEvent e) {
46: // System.out.println("Embedded jar, checkbox action");
47: m_selector.setEnabled(m_checker.isSelected());
48: updateModel();
49: }
50: });
51:
52: m_selector
53: .addListener(new FileSelectionTextField.FileSelected() {
54: public void fileSelected(String filename) {
55: updateModel();
56: }
57: });
58: }
59:
60: public void dataChanged() {
61: m_checker.setSelected(m_model.getEmbeddedJar());
62: m_selector.setBaseDir(getBaseDir());
63:
64: if (m_model.getJarLocation() != null)
65: m_selector.setFile(new File(m_model.getJarLocation()));
66: else
67: m_selector.setFile(null);
68:
69: if (m_checker.isSelected())
70: m_selector.setEnabled(true);
71: else
72: m_selector.setEnabled(false);
73: }
74:
75: public void updateModel() {
76: m_model.setEmbeddedJar(m_checker.isSelected());
77: if (m_selector.getFile() != null)
78: m_model.setJarLocation(m_selector.getFile().toString());
79: else
80: m_model.setJarLocation(null);
81: }
82:
83: public String getLabel() {
84: return "EMBEDDEDJAR_LABEL";
85: }
86:
87: public String getDescription() {
88: return "EMBEDDEDJAR_HELP";
89: }
90:
91: }
|