diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-18 04:21:44 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-18 04:21:44 +0000 |
| commit | 34595bc248660a6cd9c51f2b7a18ed33ae31cce4 (patch) | |
| tree | f75cc0844410079f9503d8aff2ec2281d7468d75 /sources/simulator/VSSimulation.java | |
| parent | 09b4f130a62ba5e05cef367f2d5adb357936d28b (diff) | |
Some cleanup in the VSDefaultPrefs.
Initial ProtocolEvent, which is for protocol activation/deactivation
Diffstat (limited to 'sources/simulator/VSSimulation.java')
| -rw-r--r-- | sources/simulator/VSSimulation.java | 84 |
1 files changed, 44 insertions, 40 deletions
diff --git a/sources/simulator/VSSimulation.java b/sources/simulator/VSSimulation.java index 12b154a..0b84685 100644 --- a/sources/simulator/VSSimulation.java +++ b/sources/simulator/VSSimulation.java @@ -7,8 +7,9 @@ import javax.swing.*; import javax.swing.event.*; import javax.swing.border.*; -import prefs.*; import core.*; +import prefs.*; +import protocols.*; import utils.*; public class VSSimulation extends VSFrame implements ActionListener { @@ -304,7 +305,7 @@ public class VSSimulation extends VSFrame implements ActionListener { splitPane2.setTopComponent(comboBox); splitPane2.setBottomComponent(splitPane1); - return splitPane2; + return splitPane2; } private JPanel createLabelPanel(String text) { @@ -327,7 +328,7 @@ public class VSSimulation extends VSFrame implements ActionListener { JScrollPane scrollPane = new JScrollPane(createTaskTable(localTasks)); panel.add(scrollPane); - initAddPanel(panel); + initAddPanel(panel); return panel; } @@ -350,44 +351,47 @@ public class VSSimulation extends VSFrame implements ActionListener { return table; } - private void initAddPanel(JPanel panel) { - JPanel panel1 = new JPanel(); + private void initAddPanel(JPanel panel) { + JPanel panel1 = new JPanel(); panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS)); - - panel1.add(new JTextField()); - panel1.add(new JLabel(" ms ")); - JButton takeoverButton = new JButton(prefs.getString("lang.takeover")); - panel1.add(takeoverButton); - - JComboBox comboBox = new JComboBox(); - comboBox.addItem("-- Prozessereignisse --"); - comboBox.addItem("Prozessabsturz"); - comboBox.addItem("Prozesswiederbelebung"); - comboBox.addItem("-- Protokollereignisse --"); - comboBox.addItem("BerkelyTime Client aktivieren"); - comboBox.addItem("BerkelyTime Client deaktivieren"); - comboBox.addItem("BerkelyTime Server aktivieren"); - comboBox.addItem("BerkelyTime Server deaktivieren"); - comboBox.addItem("ExternalTimeSync Client aktivieren"); - comboBox.addItem("ExternalTimeSync Client deaktivieren"); - comboBox.addItem("ExternalTimeSync Server aktivieren"); - comboBox.addItem("ExternalTimeSync Server deaktivieren"); - comboBox.addItem("InternalTimeSync Client aktivieren"); - comboBox.addItem("InternalTimeSync Client deaktivieren"); - comboBox.addItem("InternalTimeSync Server aktivieren"); - comboBox.addItem("InternalTimeSync Server deaktivieren"); - comboBox.addItem("PingPong Client aktivieren"); - comboBox.addItem("PingPong Client deaktivieren"); - comboBox.addItem("PingPong Server aktivieren"); - comboBox.addItem("PingPong Server deaktivieren"); - comboBox.addItem("-- Anfragen --"); - comboBox.addItem("BerkelyTime Anfrage starten"); - comboBox.addItem("ExternalTimeSync Anfrage starten"); - comboBox.addItem("InternalTimeSync Anfrage starten"); - comboBox.addItem("PingPong Anfrage starten"); - panel.add(comboBox); - panel.add(panel1); - } + + panel1.add(new JTextField()); + panel1.add(new JLabel(" ms ")); + JButton takeoverButton = new JButton(prefs.getString("lang.takeover")); + panel1.add(takeoverButton); + + JComboBox comboBox = new JComboBox(); + comboBox.addItem("-- " + prefs.getString("lang.events.process") + " --"); + comboBox.addItem("Prozessabsturz"); + comboBox.addItem("Prozesswiederbelebung"); + + comboBox.addItem("-- " + prefs.getString("lang.events.protocol") + " --"); + + Vector<String> protocolClassnames = VSRegisteredProtocols.getProtocolClassnames(); + String activate = prefs.getString("lang.activate"); + String deactivate = prefs.getString("lang.deactivate"); + String client = prefs.getString("lang.client"); + String server = prefs.getString("lang.server"); + + for (String protocolClassname : protocolClassnames) { + String protocolShortname = VSRegisteredProtocols.getProtocolShortname(protocolClassname); + comboBox.addItem(protocolShortname + " " + client + " " + activate); + comboBox.addItem(protocolShortname + " " + client + " " + deactivate); + comboBox.addItem(protocolShortname + " " + server + " " + activate); + comboBox.addItem(protocolShortname + " " + server + " " + deactivate); + } + + comboBox.addItem("-- " + prefs.getString("lang.requests") + " --"); + String clientrequest = prefs.getString("lang.clientrequest.start"); + + for (String protocolClassname : protocolClassnames) { + String protocolShortname = VSRegisteredProtocols.getProtocolShortname(protocolClassname); + comboBox.addItem(protocolShortname + " " + clientrequest); + } + + panel.add(comboBox); + panel.add(panel1); + } public int getSplitSize() { return splitPaneH.getDividerLocation(); |
