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 JVMBundle extends Editor {
35: private JCheckBox m_checker = new JCheckBox();
36: private FileSelectionTextField m_selector = new FileSelectionTextField();
37:
38: public JVMBundle() {
39: setLayout(new PanelLayout());
40: add(m_checker);
41: add(m_selector);
42:
43: m_selector.setFileChooser(new JDirectoryChooser());
44:
45: m_checker.setAction(new AbstractAction(Main
46: .local("JVMBUNDLE_CHECKBOX")) {
47: public void actionPerformed(java.awt.event.ActionEvent e) {
48: m_selector.setEnabled(m_checker.isSelected());
49: }
50: });
51:
52: if (m_model != null)
53: dataChanged();
54: }
55:
56: public void dataChanged() {
57: String bundle = m_model.getBundledJVMPath();
58: if (bundle == null) {
59: m_checker.setSelected(false);
60: m_selector.setBaseDir(getBaseDir());
61: m_selector.setFile(null);
62: m_selector.setEnabled(false);
63: } else {
64: m_checker.setSelected(true);
65: m_selector.setBaseDir(getBaseDir());
66: m_selector.setFile(new java.io.File(bundle));
67: m_selector.setEnabled(true);
68: }
69: }
70:
71: public void updateModel() {
72: if (m_checker.isSelected()) {
73: File f = m_selector.getFile();
74: if (f != null)
75: m_model.setBundledJVMPath(f.toString());
76: else
77: m_model.setBundledJVMPath("");
78: } else {
79: m_model.setBundledJVMPath(null);
80: }
81: }
82:
83: public String getLabel() {
84: return "JVMBUNDLE_LABEL";
85: }
86:
87: public String getDescription() {
88: return "JVMBUNDLE_HELP";
89: }
90:
91: }
|