01: /*
02: * JSStubsJUnitOptionPane.java - JavaStyle option pane for JavaDoc JUnit stubs
03: * Copyright (C) 2001 Dirk Moebius
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License
07: * as published by the Free Software Foundation; either version 2
08: * of the License, or 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18: */
19:
20: package org.acm.seguin.ide.common.options;
21:
22: import java.util.Hashtable;
23: import javax.swing.JTextField;
24:
25: /**
26: *@author Mike Atkinson (<a href="mailto:javastyle@ladyshot.demon.co.uk">
27: * Mike@ladyshot.demon.co.uk</a> )
28: *@author Dirk Moebius (<a href="mailto:dmoebius@gmx.net">dmoebius@gmx.net
29: * </a>)
30: *@created 04 September 2003
31: *@version $Version: $
32: *@since 1.0
33: */
34: public class JSStubsJUnitOptionPane extends JSHelpOptionPane {
35:
36: private final static String[] STUBS = { "junit.test",
37: "junit.setUp", "junit.tearDown", "junit.suite",
38: "junit.suite.return", };
39:
40: private Hashtable components = new Hashtable();
41:
42: /**
43: * Constructor for the JSStubsJUnitOptionPane object
44: *
45: *@param project Description of the Parameter
46: */
47: public JSStubsJUnitOptionPane(String project) {
48: super ("javastyle.stubs_junit", "pretty", project);
49: }
50:
51: /**
52: * Description of the Method
53: */
54: public void _init() {
55: for (int i = 0; i < STUBS.length; i++) {
56: components.put(STUBS[i], addStub(STUBS[i]));
57: }
58: addHelpArea();
59: }
60:
61: /**
62: * Called when the options dialog's `OK' button is pressed. This should
63: * save any properties saved in this option pane.
64: */
65: public void _save() {
66: for (int i = 0; i < STUBS.length; i++) {
67: ((SelectedPanel) components.get(STUBS[i])).save();
68: }
69: }
70:
71: /**
72: * Adds a feature to the Stub attribute of the JSStubsJUnitOptionPane
73: * object
74: *
75: *@param compName The feature to be added to the Stub attribute
76: *@return Description of the Return Value
77: */
78: private SelectedPanel addStub(String compName) {
79: return addComponent(compName + ".descr", "stubs." + compName,
80: new JTextField());
81: }
82:
83: }
|