diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-18 19:29:30 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-18 19:29:30 +0000 |
| commit | 2d45de18df35f6d3ba4ca0b86ec1188e49637413 (patch) | |
| tree | 6c84c8cd14a89a6dabeada811c6477d1e5459767 /sources/prefs/editors | |
| parent | c46ed2242876bfb267ed0b6823c8a3e99ac62dd6 (diff) | |
The TaskManager works partly.
Diffstat (limited to 'sources/prefs/editors')
| -rw-r--r-- | sources/prefs/editors/VSProcessEditor.java | 17 | ||||
| -rw-r--r-- | sources/prefs/editors/VSProtocolEditor.java | 22 |
2 files changed, 20 insertions, 19 deletions
diff --git a/sources/prefs/editors/VSProcessEditor.java b/sources/prefs/editors/VSProcessEditor.java index 8392bdb..dcbe376 100644 --- a/sources/prefs/editors/VSProcessEditor.java +++ b/sources/prefs/editors/VSProcessEditor.java @@ -13,6 +13,7 @@ import simulator.*; import utils.*; import core.*; import protocols.*; +import events.*; import prefs.VSPrefs; public class VSProcessEditor extends VSEditorFrame { @@ -65,7 +66,7 @@ public class VSProcessEditor extends VSEditorFrame { private JPanel createProtocolSelector() { JPanel panel = new JPanel(new GridBagLayout()); panel.setBorder(BorderFactory.createLineBorder(Color.black)); - Vector<String> registeredProtocols = VSRegisteredProtocols.getProtocolNames(); + Vector<String> registeredProtocols = VSRegisteredEvents.getProtocolNames(); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.HORIZONTAL; @@ -82,18 +83,18 @@ public class VSProcessEditor extends VSEditorFrame { button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (ae.getActionCommand().equals(prefs.getString("lang.edit"))) { - String protocolName = (String) comboBox.getSelectedItem(); - String protocolClassname = VSRegisteredProtocols.getProtocolClassname(protocolName); + String eventName = (String) comboBox.getSelectedItem(); + String eventClassname = VSRegisteredEvents.getClassname(eventName); VSProtocol protocol = null; - if (process.objectExists(protocolClassname)) { - Object object = process.getObject(protocolClassname); + if (process.objectExists(eventClassname)) { + Object object = process.getObject(eventClassname); if (object instanceof VSProtocol) - protocol = (VSProtocol) process.getObject(protocolClassname); + protocol = (VSProtocol) process.getObject(eventClassname); else return; } else { - protocol = VSRegisteredProtocols.getProtocolInstanceByName(protocolName, process); - process.setObject(protocolClassname, protocol); + protocol = (VSProtocol) VSRegisteredEvents.createEventInstanceByName(eventName, process); + process.setObject(eventClassname, protocol); } new VSProtocolEditor(prefs, frame, protocol); } diff --git a/sources/prefs/editors/VSProtocolEditor.java b/sources/prefs/editors/VSProtocolEditor.java index 1cf5059..d0762a3 100644 --- a/sources/prefs/editors/VSProtocolEditor.java +++ b/sources/prefs/editors/VSProtocolEditor.java @@ -27,7 +27,7 @@ public class VSProtocolEditor extends VSEditorFrame { public VSProtocolEditor(VSPrefs prefs, Component relativeTo, VSProtocol protocol) { super(prefs, relativeTo, protocol, prefs.getString("name") + " - " - + protocol.getProtocolName() + " " + prefs.getString("lang.editor"), ALL_PREFERENCES); + + protocol.getName() + " " + prefs.getString("lang.editor"), ALL_PREFERENCES); this.protocol = protocol; this.taskManager = protocol.getProcess().getSimulationPanel().getTaskManager(); @@ -130,12 +130,12 @@ public class VSProtocolEditor extends VSEditorFrame { } private void initClientServerCheckboxes() { - final String protocolName = protocol.getProtocolName(); + final String eventName = protocol.getName(); final VSProcess process = protocol.getProcess(); - String protocolKey = "sim."+protocolName.toLowerCase()+".client.enabled!"; + String protocolKey = "sim."+eventName.toLowerCase()+".client.enabled!"; clientCheckBox.setSelected(process.getBoolean(protocolKey)); - protocolKey = "sim."+protocolName.toLowerCase()+".server.enabled!"; + protocolKey = "sim."+eventName.toLowerCase()+".server.enabled!"; serverCheckBox.setSelected(process.getBoolean(protocolKey)); } @@ -235,10 +235,10 @@ public class VSProtocolEditor extends VSEditorFrame { resetTaskManager(); final VSProcess process = protocol.getProcess(); - final String protocolName = protocol.getProtocolName(); - String protocolKey = "sim."+protocolName.toLowerCase()+".client.enabled!"; + final String eventName = protocol.getName(); + String protocolKey = "sim."+eventName.toLowerCase()+".client.enabled!"; clientCheckBox.setSelected(process.getBoolean(protocolKey)); - protocolKey = "sim."+protocolName.toLowerCase()+".server.enabled!"; + protocolKey = "sim."+eventName.toLowerCase()+".server.enabled!"; serverCheckBox.setSelected(process.getBoolean(protocolKey)); takeOverButton.setEnabled(clientCheckBox.isSelected()); @@ -269,7 +269,7 @@ public class VSProtocolEditor extends VSEditorFrame { numItems = clientComboBox.getItemCount(); for (int i = 0; i < numItems; ++i) { long taskTime = VSTools.getStringTime((String) clientComboBox.getItemAt(i)); - VSTask task = new VSTask(taskTime, protocol.getProcess(), protocol); + VSTask task = new VSTask(taskTime, protocol.getProcess(), protocol, VSTask.LOCAL); task.isProgrammed(true); tasks.addLast(task); } @@ -277,12 +277,12 @@ public class VSProtocolEditor extends VSEditorFrame { taskManager.modifyProtocolTasks(protocol, tasks); final VSProcess process = protocol.getProcess(); - final String protocolName = protocol.getProtocolName(); - String protocolKey = "sim."+protocolName.toLowerCase()+".client.enabled!"; + final String eventName = protocol.getName(); + String protocolKey = "sim."+eventName.toLowerCase()+".client.enabled!"; process.setBoolean(protocolKey, clientCheckBox.isSelected()); protocol.isClient(clientCheckBox.isSelected()); - protocolKey = "sim."+protocolName.toLowerCase()+".server.enabled!"; + protocolKey = "sim."+eventName.toLowerCase()+".server.enabled!"; process.setBoolean(protocolKey, serverCheckBox.isSelected()); protocol.isServer(serverCheckBox.isSelected()); |
