1 |
mojays |
2 |
package appl.parallel.plugin.event; |
2 |
|
|
|
3 |
alfonx |
60 |
import java.awt.Button; |
4 |
|
|
import java.awt.Dimension; |
5 |
|
|
import java.awt.GridBagConstraints; |
6 |
|
|
import java.awt.GridBagLayout; |
7 |
|
|
import java.awt.Insets; |
8 |
|
|
|
9 |
|
|
import javax.swing.BoxLayout; |
10 |
|
|
import javax.swing.JCheckBox; |
11 |
mojays |
2 |
import javax.swing.JPanel; |
12 |
|
|
import javax.swing.JScrollPane; |
13 |
alfonx |
60 |
import javax.swing.JTabbedPane; |
14 |
mojays |
2 |
import javax.swing.JTable; |
15 |
alfonx |
60 |
import javax.swing.JTextPane; |
16 |
mojays |
2 |
|
17 |
|
|
import edu.bonn.xulu.gui.XuluInternalFrame; |
18 |
|
|
|
19 |
|
|
/** |
20 |
|
|
* Provides a GUI for the {@link SimpleCommEventMonitorEngine} |
21 |
|
|
* |
22 |
|
|
* @author Dominik Appl |
23 |
|
|
*/ |
24 |
|
|
public class SimpleCommEventMonitor extends XuluInternalFrame { |
25 |
|
|
|
26 |
|
|
private static final long serialVersionUID = 1L; |
27 |
|
|
|
28 |
|
|
JPanel jContentPane = null; |
29 |
|
|
|
30 |
|
|
JScrollPane jScrollPane = null; |
31 |
|
|
|
32 |
|
|
JTable timeEventTable = null; |
33 |
|
|
|
34 |
|
|
JPanel optionsPanel = null; |
35 |
|
|
|
36 |
|
|
JCheckBox timeEventEnabled = null; |
37 |
|
|
|
38 |
|
|
JCheckBox transferEventEnabled = null; |
39 |
|
|
|
40 |
|
|
SimpleCommEventMonitorEngine engine; |
41 |
|
|
|
42 |
|
|
JTabbedPane jTabbedPane = null; |
43 |
|
|
|
44 |
|
|
Button clearButton = null; |
45 |
|
|
|
46 |
|
|
JScrollPane jScrollPane1 = null; |
47 |
|
|
|
48 |
|
|
JTable transferEventTable = null; |
49 |
|
|
|
50 |
|
|
private JTextPane jTextPane = null; |
51 |
|
|
|
52 |
|
|
/** |
53 |
|
|
* This method initializes jScrollPane |
54 |
|
|
* |
55 |
|
|
* @return javax.swing.JScrollPane |
56 |
|
|
*/ |
57 |
|
|
private JScrollPane getJScrollPane() { |
58 |
|
|
if (jScrollPane == null) { |
59 |
|
|
jScrollPane = new JScrollPane(); |
60 |
|
|
jScrollPane.setViewportView(getTimeEventTable()); |
61 |
|
|
} |
62 |
|
|
return jScrollPane; |
63 |
|
|
} |
64 |
|
|
|
65 |
|
|
/** |
66 |
|
|
* This method initializes timeEventTable |
67 |
|
|
* |
68 |
|
|
* @return javax.swing.JTable |
69 |
|
|
*/ |
70 |
|
|
private JTable getTimeEventTable() { |
71 |
|
|
if (timeEventTable == null) { |
72 |
|
|
timeEventTable = new JTable(); |
73 |
|
|
timeEventTable.setDoubleBuffered(true); |
74 |
|
|
} |
75 |
|
|
return timeEventTable; |
76 |
|
|
} |
77 |
|
|
|
78 |
|
|
/** |
79 |
|
|
* This method initializes optionsPanel |
80 |
|
|
* |
81 |
|
|
* @return javax.swing.JPanel |
82 |
|
|
*/ |
83 |
|
|
private JPanel getOptionsPanel() { |
84 |
|
|
if (optionsPanel == null) { |
85 |
|
|
GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); |
86 |
|
|
gridBagConstraints8.fill = GridBagConstraints.BOTH; |
87 |
|
|
gridBagConstraints8.gridy = 0; |
88 |
|
|
gridBagConstraints8.weightx = 1.0; |
89 |
|
|
gridBagConstraints8.weighty = 0.0; |
90 |
|
|
gridBagConstraints8.gridwidth = 1; |
91 |
|
|
gridBagConstraints8.gridheight = 1; |
92 |
|
|
gridBagConstraints8.anchor = GridBagConstraints.EAST; |
93 |
|
|
gridBagConstraints8.insets = new Insets(0, 0, 0, 0); |
94 |
|
|
gridBagConstraints8.ipadx = 1; |
95 |
|
|
gridBagConstraints8.ipady = 0; |
96 |
|
|
gridBagConstraints8.gridx = 9; |
97 |
|
|
GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); |
98 |
|
|
gridBagConstraints6.insets = new Insets(5, 5, 5, 5); |
99 |
|
|
gridBagConstraints6.gridy = 0; |
100 |
|
|
gridBagConstraints6.anchor = GridBagConstraints.WEST; |
101 |
|
|
gridBagConstraints6.fill = GridBagConstraints.HORIZONTAL; |
102 |
|
|
gridBagConstraints6.gridx = 8; |
103 |
|
|
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
104 |
|
|
gridBagConstraints5.insets = new Insets(5, 5, 5, 2); |
105 |
|
|
gridBagConstraints5.gridy = 0; |
106 |
|
|
gridBagConstraints5.anchor = GridBagConstraints.WEST; |
107 |
|
|
gridBagConstraints5.fill = GridBagConstraints.NONE; |
108 |
|
|
gridBagConstraints5.gridwidth = 1; |
109 |
|
|
gridBagConstraints5.gridx = 7; |
110 |
|
|
GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
111 |
|
|
gridBagConstraints4.insets = new Insets(5, 5, 5, 5); |
112 |
|
|
gridBagConstraints4.gridy = 0; |
113 |
|
|
gridBagConstraints4.anchor = GridBagConstraints.WEST; |
114 |
|
|
gridBagConstraints4.gridwidth = 1; |
115 |
|
|
gridBagConstraints4.gridheight = 1; |
116 |
|
|
gridBagConstraints4.gridx = 1; |
117 |
|
|
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
118 |
|
|
gridBagConstraints.gridx = 0; |
119 |
|
|
gridBagConstraints.gridy = 0; |
120 |
|
|
optionsPanel = new JPanel(); |
121 |
|
|
optionsPanel.setLayout(new GridBagLayout()); |
122 |
|
|
optionsPanel.add(getTimeEventEnabled(), gridBagConstraints4); |
123 |
|
|
optionsPanel.add(getTransferEventEnabled(), gridBagConstraints5); |
124 |
|
|
optionsPanel.add(getClearButton(), gridBagConstraints6); |
125 |
|
|
optionsPanel.add(getJTextPane(), gridBagConstraints8); |
126 |
|
|
} |
127 |
|
|
return optionsPanel; |
128 |
|
|
} |
129 |
|
|
|
130 |
|
|
/** |
131 |
|
|
* This method initializes timeEventEnabled |
132 |
|
|
* |
133 |
|
|
* @return javax.swing.JCheckBox |
134 |
|
|
*/ |
135 |
|
|
private JCheckBox getTimeEventEnabled() { |
136 |
|
|
if (timeEventEnabled == null) { |
137 |
|
|
timeEventEnabled = new JCheckBox(); |
138 |
|
|
timeEventEnabled.setText("log time events"); |
139 |
|
|
timeEventEnabled.setName("timeEventEnabled"); |
140 |
|
|
timeEventEnabled.addActionListener(engine); |
141 |
|
|
} |
142 |
|
|
return timeEventEnabled; |
143 |
|
|
} |
144 |
|
|
|
145 |
|
|
/** |
146 |
|
|
* This method initializes transferEventEnabled |
147 |
|
|
* |
148 |
|
|
* @return javax.swing.JCheckBox |
149 |
|
|
*/ |
150 |
|
|
private JCheckBox getTransferEventEnabled() { |
151 |
|
|
if (transferEventEnabled == null) { |
152 |
|
|
transferEventEnabled = new JCheckBox(); |
153 |
|
|
transferEventEnabled.setText("log transferEvents"); |
154 |
|
|
transferEventEnabled.setName("transferEventEnabled"); |
155 |
|
|
transferEventEnabled.addActionListener(engine); |
156 |
|
|
} |
157 |
|
|
return transferEventEnabled; |
158 |
|
|
} |
159 |
|
|
|
160 |
|
|
/** |
161 |
|
|
* This is the default constructor |
162 |
|
|
* @param engine the engine responsible for event handling |
163 |
|
|
*/ |
164 |
|
|
public SimpleCommEventMonitor(SimpleCommEventMonitorEngine engine) { |
165 |
|
|
super("Simple Communication Event Monitor"); |
166 |
|
|
this.setClosable(true); |
167 |
|
|
this.setDefaultCloseOperation(HIDE_ON_CLOSE); |
168 |
|
|
this.engine = engine; |
169 |
|
|
initialize(); |
170 |
|
|
} |
171 |
|
|
|
172 |
|
|
/** |
173 |
|
|
* This method initializes this class |
174 |
|
|
* |
175 |
|
|
*/ |
176 |
|
|
private void initialize() { |
177 |
|
|
this.setSize(608, 326); |
178 |
|
|
this.setContentPane(getJContentPane()); |
179 |
|
|
this.setTitle("Communication Monitor"); |
180 |
|
|
} |
181 |
|
|
|
182 |
|
|
/** |
183 |
|
|
* This method initializes jContentPane |
184 |
|
|
* |
185 |
|
|
* @return javax.swing.JPanel |
186 |
|
|
*/ |
187 |
|
|
private JPanel getJContentPane() { |
188 |
|
|
if (jContentPane == null) { |
189 |
|
|
jContentPane = new JPanel(); |
190 |
|
|
jContentPane.setLayout(new BoxLayout(getJContentPane(), |
191 |
|
|
BoxLayout.Y_AXIS)); |
192 |
|
|
jContentPane.add(getJTabbedPane(), null); |
193 |
|
|
jContentPane.add(getOptionsPanel(), null); |
194 |
|
|
} |
195 |
|
|
return jContentPane; |
196 |
|
|
} |
197 |
|
|
|
198 |
|
|
/* (non-Javadoc) |
199 |
|
|
* @see edu.bonn.xulu.gui.XuluInternalFrame#refresh() |
200 |
|
|
*/ |
201 |
|
|
@Override |
202 |
|
|
public void refresh() { |
203 |
|
|
// TODO Auto-generated method stub |
204 |
|
|
|
205 |
|
|
} |
206 |
|
|
|
207 |
|
|
/** |
208 |
|
|
* This method initializes jTabbedPane |
209 |
|
|
* |
210 |
|
|
* @return javax.swing.JTabbedPane |
211 |
|
|
*/ |
212 |
|
|
private JTabbedPane getJTabbedPane() { |
213 |
|
|
if (jTabbedPane == null) { |
214 |
|
|
jTabbedPane = new JTabbedPane(); |
215 |
|
|
jTabbedPane.addTab("Time Events", null, getJScrollPane(), null); |
216 |
|
|
jTabbedPane |
217 |
|
|
.addTab("Transfer Events", null, getJScrollPane1(), null); |
218 |
|
|
} |
219 |
|
|
return jTabbedPane; |
220 |
|
|
} |
221 |
|
|
|
222 |
|
|
/** |
223 |
|
|
* This method initializes clearButton |
224 |
|
|
* |
225 |
|
|
* @return java.awt.Button |
226 |
|
|
*/ |
227 |
|
|
private Button getClearButton() { |
228 |
|
|
if (clearButton == null) { |
229 |
|
|
clearButton = new Button(); |
230 |
|
|
clearButton.setLabel("Clear all"); |
231 |
|
|
clearButton.setMinimumSize(new Dimension(100, 20)); |
232 |
|
|
clearButton.setName("clearButton"); |
233 |
|
|
clearButton.addActionListener(engine); |
234 |
|
|
} |
235 |
|
|
return clearButton; |
236 |
|
|
} |
237 |
|
|
|
238 |
|
|
/** |
239 |
|
|
* This method initializes jScrollPane1 |
240 |
|
|
* |
241 |
|
|
* @return javax.swing.JScrollPane |
242 |
|
|
*/ |
243 |
|
|
private JScrollPane getJScrollPane1() { |
244 |
|
|
if (jScrollPane1 == null) { |
245 |
|
|
jScrollPane1 = new JScrollPane(); |
246 |
|
|
jScrollPane1.setViewportView(getTransferEventTable()); |
247 |
|
|
} |
248 |
|
|
return jScrollPane1; |
249 |
|
|
} |
250 |
|
|
|
251 |
|
|
/** |
252 |
|
|
* This method initializes transferEventTable |
253 |
|
|
* |
254 |
|
|
* @return javax.swing.JTable |
255 |
|
|
*/ |
256 |
|
|
private JTable getTransferEventTable() { |
257 |
|
|
if (transferEventTable == null) { |
258 |
|
|
transferEventTable = new JTable(); |
259 |
|
|
transferEventTable.setDoubleBuffered(true); |
260 |
|
|
} |
261 |
|
|
return transferEventTable; |
262 |
|
|
} |
263 |
|
|
|
264 |
|
|
/** |
265 |
|
|
* This method initializes jTextPane |
266 |
|
|
* |
267 |
|
|
* @return javax.swing.JTextPane |
268 |
|
|
*/ |
269 |
|
|
private JTextPane getJTextPane() { |
270 |
|
|
if (jTextPane == null) { |
271 |
|
|
jTextPane = new JTextPane(); |
272 |
|
|
jTextPane |
273 |
|
|
.setText("Hint: Hold CTRL while clicking on a table header for secondary sorting"); |
274 |
|
|
jTextPane.setMaximumSize(new Dimension(100, 50)); |
275 |
|
|
} |
276 |
|
|
return jTextPane; |
277 |
|
|
} |
278 |
|
|
|
279 |
|
|
} // @jve:decl-index=0:visual-constraint="10,10" |