blob: 51e4319c2c4aacbbe6e499af350aee7b24ba937e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
package prefs.editors;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.border.*;
import javax.swing.filechooser.*;
import java.util.*;
import java.io.File;
import simulator.*;
import utils.*;
import core.*;
import protocols.*;
import events.*;
import prefs.VSPrefs;
public class VSProcessEditor extends VSBetterEditor {
private VSProcess process;
public static boolean TAKEOVER_BUTTON;
public VSProcessEditor(VSPrefs prefs, VSProcess process) {
super(prefs, process, prefs.getString("lang.name") + " - " + prefs.getString("lang.prefs.process"));;
this.process = process;
disposeFrameWithParentIfExists();
makeProtocolVariablesEditable();
}
protected void addToButtonPanelFront(JPanel buttonPanel) {
JButton takeoverButton = new JButton(
prefs.getString("lang.takeover"));
takeoverButton.setMnemonic(prefs.getInteger("keyevent.takeover"));
takeoverButton.addActionListener(this);
buttonPanel.add(takeoverButton);
}
protected void makeProtocolVariablesEditable() {
ArrayList<String> editableProtocolsClassnames =
VSRegisteredEvents.getEditableProtocolsClassnames();
String protocolString = " " + prefs.getString("lang.protocol");
for (String protocolClassname : editableProtocolsClassnames) {
String protocolShortname = VSRegisteredEvents.getShortname(protocolClassname);
VSProtocol protocol = process.getProtocolObject(protocolClassname);
addToEditor(protocolShortname + protocolString, protocolShortname, protocol);
}
}
public void actionPerformed(ActionEvent e) {
String actionCommand = e.getActionCommand();
if (actionCommand.equals(prefs.getString("lang.ok"))) {
savePrefs();
process.updateFromVSPrefs();
} else if (actionCommand.equals(prefs.getString("lang.takeover"))) {
savePrefs();
process.updateFromVSPrefs();
} else {
super.actionPerformed(e);
}
}
}
|