f@0
|
1 /*
|
f@0
|
2 CCmI Editor - A Collaborative Cross-Modal Diagram Editing Tool
|
f@0
|
3
|
f@0
|
4 Copyright (C) 2011 Queen Mary University of London (http://ccmi.eecs.qmul.ac.uk/)
|
f@0
|
5
|
f@0
|
6 This program is free software: you can redistribute it and/or modify
|
f@0
|
7 it under the terms of the GNU General Public License as published by
|
f@0
|
8 the Free Software Foundation, either version 3 of the License, or
|
f@0
|
9 (at your option) any later version.
|
f@0
|
10
|
f@0
|
11 This program is distributed in the hope that it will be useful,
|
f@0
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
f@0
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
f@0
|
14 GNU General Public License for more details.
|
f@0
|
15
|
f@0
|
16 You should have received a copy of the GNU General Public License
|
f@0
|
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
|
f@0
|
18 */
|
f@0
|
19
|
f@0
|
20 package uk.ac.qmul.eecs.ccmi.simpletemplate;
|
f@0
|
21
|
f@0
|
22 import java.awt.Frame;
|
f@0
|
23 import java.awt.event.ActionEvent;
|
f@0
|
24 import java.awt.event.KeyEvent;
|
f@0
|
25 import java.util.ResourceBundle;
|
f@0
|
26
|
f@0
|
27 import javax.swing.AbstractAction;
|
f@0
|
28 import javax.swing.JButton;
|
f@0
|
29 import javax.swing.JComponent;
|
f@0
|
30 import javax.swing.JRootPane;
|
f@0
|
31 import javax.swing.KeyStroke;
|
f@0
|
32 import javax.swing.event.ChangeEvent;
|
f@0
|
33
|
f@0
|
34 import jwizardcomponent.dialog.SimpleJWizardDialog;
|
f@0
|
35
|
f@0
|
36 /*
|
f@0
|
37 * The dialog where the template wizard is displayed
|
f@0
|
38 *
|
f@0
|
39 * @see Wizard
|
f@0
|
40 *
|
f@0
|
41 */
|
f@0
|
42 @SuppressWarnings("serial")
|
f@0
|
43 public class SpeechWizardDialog extends SimpleJWizardDialog {
|
f@0
|
44 public SpeechWizardDialog(Frame owner){
|
f@0
|
45 super(owner,true);
|
f@0
|
46 finished = false;
|
f@0
|
47
|
f@0
|
48 ResourceBundle resources = ResourceBundle.getBundle(getClass().getName());
|
f@0
|
49 setSize(350, 200);
|
f@0
|
50 setTitle(resources.getString("dialog.wizard.title"));
|
f@0
|
51 setLocationRelativeTo(owner);
|
f@0
|
52
|
f@0
|
53 JButton button;
|
f@0
|
54 button = getWizardComponents().getNextButton();
|
f@0
|
55 button.setText(resources.getString("button.next.label"));
|
f@0
|
56 button.getAccessibleContext().setAccessibleName(resources.getString("button.next.speech"));
|
f@0
|
57
|
f@0
|
58 button = getWizardComponents().getBackButton();
|
f@0
|
59 button.setText(resources.getString("button.previous.label"));
|
f@0
|
60 button.getAccessibleContext().setAccessibleName(resources.getString("button.previous.speech"));
|
f@0
|
61
|
f@0
|
62 button = getWizardComponents().getCancelButton();
|
f@0
|
63 button.setText(resources.getString("button.cancel.label"));
|
f@0
|
64
|
f@0
|
65 button = getWizardComponents().getFinishButton();
|
f@0
|
66 button.setText(resources.getString("button.finish.label"));
|
f@0
|
67 button.addChangeListener(new javax.swing.event.ChangeListener(){
|
f@0
|
68 @Override
|
f@0
|
69 public void stateChanged(ChangeEvent e) {
|
f@0
|
70 ((JButton)e.getSource()).setEnabled(finished);
|
f@0
|
71 }
|
f@0
|
72 });
|
f@0
|
73 JRootPane rootPane = getRootPane();
|
f@0
|
74 rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0), "close");
|
f@0
|
75 rootPane.getActionMap().put("close", new AbstractAction(){
|
f@0
|
76 @Override
|
f@0
|
77 public void actionPerformed(ActionEvent arg0) {
|
f@0
|
78 dispose();
|
f@0
|
79 }
|
f@0
|
80 });
|
f@0
|
81 }
|
f@0
|
82
|
f@0
|
83 /**
|
f@0
|
84 * Enables or disables the finish button.
|
f@0
|
85 * @param enabled {@code true} to enable the button, {@code false} to disable
|
f@0
|
86 */
|
f@0
|
87 public void setFinishButtonEnabled(boolean enabled){
|
f@0
|
88 finished = enabled;
|
f@0
|
89 getWizardComponents().getFinishButton().setEnabled(true);
|
f@0
|
90 }
|
f@0
|
91
|
f@0
|
92 private boolean finished;
|
f@0
|
93 }
|
f@0
|
94
|