1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.devaki.nextobjects.ui.main;
16
17 import java.awt.Dimension;
18 import java.awt.GridBagConstraints;
19 import java.awt.GridBagLayout;
20 import java.awt.Insets;
21 import javax.swing.JDialog;
22 import javax.swing.JButton;
23 import javax.swing.JLabel;
24 import java.awt.event.ActionEvent;
25 import java.awt.event.ActionListener;
26 import org.devaki.nextobjects.NextObjects;
27 import org.devaki.nextobjects.ui.components.CustomTextField;
28 import org.devaki.nextobjects.util.TorqueWrapper;
29 import org.devaki.nextobjects.util.ModelMan;
30 import org.devaki.nextobjects.workspace.models.PhysicalModel;
31 /***
32 * This class is responsible for setting up the torque template at first use of
33 * this project It will create the projects repository and unzip templates from
34 * the torque-gen archive
35 *
36 * @author eflorent
37 * @created December 23, 2003
38 */
39 public class TaskChooser extends JDialog
40 {
41
42 /*** The setup template progress bar */
43 private CustomTextField jTxtTask =
44 new CustomTextField("", "Choose a Torque-gen task to run", true);
45
46 /*** Main label */
47 private JLabel jLabel = new JLabel("Choose a task to run");
48 /*** Main label */
49 private JButton jButton = new JButton("Run ...");
50
51
52 /*** Create a new 'InitHome' object */
53 public TaskChooser()
54 {
55 super(NextObjects.getReference(), "Custom task");
56
57 this.setSize(new Dimension(350, 70));
58
59 this.setLocationRelativeTo(null);
60
61 this.setModal(true);
62
63 this.setResizable(false);
64
65
66
67
68 this.getContentPane().setLayout(new GridBagLayout());
69
70
71
72
73
74
75
76 this.getContentPane().add(
77 this.jLabel,
78 new GridBagConstraints(
79 0,
80 0,
81 1,
82 1,
83 0.0,
84 0.0,
85 GridBagConstraints.CENTER,
86 GridBagConstraints.NONE,
87 new Insets(3, 3, 0, 3),
88 0,
89 0));
90 this.getContentPane().add(
91 this.jTxtTask,
92 new GridBagConstraints(
93 0,
94 1,
95 1,
96 1,
97 1.0,
98 1.0,
99 GridBagConstraints.CENTER,
100 GridBagConstraints.BOTH,
101 new Insets(3, 3, 3, 3),
102 0,
103 0));
104 this.getContentPane().add(
105 this.jButton,
106 new GridBagConstraints(
107 1,
108 1,
109 1,
110 1,
111 0.0,
112 1.0,
113 GridBagConstraints.EAST,
114 GridBagConstraints.NONE,
115 new Insets(3, 3, 3, 3),
116 0,
117 0));
118
119 jButton.addActionListener(
120 new ActionListener()
121 {
122 public void actionPerformed(ActionEvent e)
123 {
124 TorqueWrapper tw= new TorqueWrapper();
125 tw.runTask(
126 (PhysicalModel) ModelMan.getCurrentModel(),
127 jTxtTask.getText());
128 tw=null;
129 dispose();
130 }
131 });
132 }
133
134 }
135