code formatting and more debugging output at radio medium failure
This commit is contained in:
parent
0f4a25c8ff
commit
3ace4c55cd
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: CreateSimDialog.java,v 1.6 2007/08/21 08:54:48 fros4943 Exp $
|
* $Id: CreateSimDialog.java,v 1.7 2007/09/30 12:03:49 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.dialogs;
|
package se.sics.cooja.dialogs;
|
||||||
|
@ -48,25 +48,25 @@ import se.sics.cooja.*;
|
||||||
public class CreateSimDialog extends JDialog {
|
public class CreateSimDialog extends JDialog {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static Logger logger = Logger.getLogger(CreateSimDialog.class);
|
private static Logger logger = Logger.getLogger(CreateSimDialog.class);
|
||||||
|
|
||||||
private AddSimEventHandler myEventHandler = new AddSimEventHandler();
|
private AddSimEventHandler myEventHandler = new AddSimEventHandler();
|
||||||
|
|
||||||
private final static int LABEL_WIDTH = 170;
|
private final static int LABEL_WIDTH = 170;
|
||||||
private final static int LABEL_HEIGHT = 15;
|
private final static int LABEL_HEIGHT = 15;
|
||||||
|
|
||||||
private Simulation mySimulation = null;
|
private Simulation mySimulation = null;
|
||||||
private GUI myGUI = null;
|
private GUI myGUI = null;
|
||||||
|
|
||||||
private CreateSimDialog myDialog;
|
private CreateSimDialog myDialog;
|
||||||
|
|
||||||
private JFormattedTextField delayTime, simulationTime, tickTime;
|
private JFormattedTextField delayTime, simulationTime, tickTime;
|
||||||
private JFormattedTextField randomSeed, tickLists, delayedStartup;
|
private JFormattedTextField randomSeed, tickLists, delayedStartup;
|
||||||
|
|
||||||
private JTextField title;
|
private JTextField title;
|
||||||
private JComboBox radioMediumBox;
|
private JComboBox radioMediumBox;
|
||||||
|
|
||||||
private JButton cancelButton;
|
private JButton cancelButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows a dialog for configuring a simulation.
|
* Shows a dialog for configuring a simulation.
|
||||||
*
|
*
|
||||||
|
@ -124,11 +124,11 @@ public class CreateSimDialog extends JDialog {
|
||||||
|
|
||||||
// Select radio medium
|
// Select radio medium
|
||||||
if (simulationToConfigure.getRadioMedium() != null) {
|
if (simulationToConfigure.getRadioMedium() != null) {
|
||||||
Class<? extends RadioMedium> radioMediumClass =
|
Class<? extends RadioMedium> radioMediumClass =
|
||||||
simulationToConfigure.getRadioMedium().getClass();
|
simulationToConfigure.getRadioMedium().getClass();
|
||||||
|
|
||||||
String currentDescription = GUI.getDescriptionOf(radioMediumClass);
|
String currentDescription = GUI.getDescriptionOf(radioMediumClass);
|
||||||
|
|
||||||
for (int i=0; i < myDialog.radioMediumBox.getItemCount(); i++) {
|
for (int i=0; i < myDialog.radioMediumBox.getItemCount(); i++) {
|
||||||
String menuDescription = (String) myDialog.radioMediumBox.getItemAt(i);
|
String menuDescription = (String) myDialog.radioMediumBox.getItemAt(i);
|
||||||
if (menuDescription.equals(currentDescription)) {
|
if (menuDescription.equals(currentDescription)) {
|
||||||
|
@ -147,7 +147,7 @@ public class CreateSimDialog extends JDialog {
|
||||||
// Set delayed mote startup time
|
// Set delayed mote startup time
|
||||||
myDialog.delayedStartup.setValue(new Integer(simulationToConfigure.getDelayedMoteStartupTime()));
|
myDialog.delayedStartup.setValue(new Integer(simulationToConfigure.getDelayedMoteStartupTime()));
|
||||||
|
|
||||||
|
|
||||||
// Set position and focus of dialog
|
// Set position and focus of dialog
|
||||||
myDialog.setLocationRelativeTo(parentFrame);
|
myDialog.setLocationRelativeTo(parentFrame);
|
||||||
myDialog.title.requestFocus();
|
myDialog.title.requestFocus();
|
||||||
|
@ -160,26 +160,26 @@ public class CreateSimDialog extends JDialog {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
myDialog.cancelButton.doClick();
|
myDialog.cancelButton.doClick();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
myDialog.getRootPane().getActionMap().put("dispose", cancelAction);
|
myDialog.getRootPane().getActionMap().put("dispose", cancelAction);
|
||||||
|
|
||||||
myDialog.setVisible(true);
|
myDialog.setVisible(true);
|
||||||
|
|
||||||
if (myDialog.mySimulation != null) {
|
if (myDialog.mySimulation != null) {
|
||||||
// Simulation configured correctly
|
// Simulation configured correctly
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CreateSimDialog(Frame frame, GUI gui) {
|
private CreateSimDialog(Frame frame, GUI gui) {
|
||||||
super(frame, "Create new simulation", true);
|
super(frame, "Create new simulation", true);
|
||||||
|
|
||||||
myDialog = this;
|
myDialog = this;
|
||||||
myGUI = gui;
|
myGUI = gui;
|
||||||
|
|
||||||
Box vertBox = Box.createVerticalBox();
|
Box vertBox = Box.createVerticalBox();
|
||||||
|
|
||||||
JLabel label;
|
JLabel label;
|
||||||
JTextField textField;
|
JTextField textField;
|
||||||
Box horizBox;
|
Box horizBox;
|
||||||
|
@ -187,97 +187,97 @@ public class CreateSimDialog extends JDialog {
|
||||||
JComboBox comboBox;
|
JComboBox comboBox;
|
||||||
JFormattedTextField numberField;
|
JFormattedTextField numberField;
|
||||||
NumberFormat integerFormat = NumberFormat.getIntegerInstance();
|
NumberFormat integerFormat = NumberFormat.getIntegerInstance();
|
||||||
|
|
||||||
|
|
||||||
// BOTTOM BUTTON PART
|
// BOTTOM BUTTON PART
|
||||||
Box buttonBox = Box.createHorizontalBox();
|
Box buttonBox = Box.createHorizontalBox();
|
||||||
buttonBox.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
|
buttonBox.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
|
||||||
|
|
||||||
buttonBox.add(Box.createHorizontalGlue());
|
buttonBox.add(Box.createHorizontalGlue());
|
||||||
|
|
||||||
cancelButton = new JButton("Cancel");
|
cancelButton = new JButton("Cancel");
|
||||||
cancelButton.setActionCommand("cancel");
|
cancelButton.setActionCommand("cancel");
|
||||||
cancelButton.addActionListener(myEventHandler);
|
cancelButton.addActionListener(myEventHandler);
|
||||||
buttonBox.add(cancelButton);
|
buttonBox.add(cancelButton);
|
||||||
|
|
||||||
button = new JButton("Create");
|
button = new JButton("Create");
|
||||||
button.setActionCommand("create");
|
button.setActionCommand("create");
|
||||||
button.addActionListener(myEventHandler);
|
button.addActionListener(myEventHandler);
|
||||||
buttonBox.add(Box.createHorizontalStrut(5));
|
buttonBox.add(Box.createHorizontalStrut(5));
|
||||||
myDialog.rootPane.setDefaultButton(button);
|
myDialog.rootPane.setDefaultButton(button);
|
||||||
buttonBox.add(button);
|
buttonBox.add(button);
|
||||||
|
|
||||||
|
|
||||||
// MAIN PART
|
// MAIN PART
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
horizBox = Box.createHorizontalBox();
|
horizBox = Box.createHorizontalBox();
|
||||||
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
|
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
|
||||||
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||||
label = new JLabel("Simulation title");
|
label = new JLabel("Simulation title");
|
||||||
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
||||||
|
|
||||||
textField = new JTextField();
|
textField = new JTextField();
|
||||||
textField.setText("[no title]");
|
textField.setText("[no title]");
|
||||||
textField.setColumns(25);
|
textField.setColumns(25);
|
||||||
title = textField;
|
title = textField;
|
||||||
|
|
||||||
horizBox.add(label);
|
horizBox.add(label);
|
||||||
horizBox.add(Box.createHorizontalStrut(10));
|
horizBox.add(Box.createHorizontalStrut(10));
|
||||||
horizBox.add(textField);
|
horizBox.add(textField);
|
||||||
|
|
||||||
vertBox.add(horizBox);
|
vertBox.add(horizBox);
|
||||||
vertBox.add(Box.createRigidArea(new Dimension(0,5)));
|
vertBox.add(Box.createRigidArea(new Dimension(0,5)));
|
||||||
|
|
||||||
// Radio Medium selection
|
// Radio Medium selection
|
||||||
horizBox = Box.createHorizontalBox();
|
horizBox = Box.createHorizontalBox();
|
||||||
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
|
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
|
||||||
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||||
label = new JLabel("Radio Medium");
|
label = new JLabel("Radio Medium");
|
||||||
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
||||||
|
|
||||||
Vector<String> radioMediumDescriptions = new Vector<String>();
|
Vector<String> radioMediumDescriptions = new Vector<String>();
|
||||||
for (Class<? extends RadioMedium> radioMediumClass: gui.getRegisteredRadioMediums()) {
|
for (Class<? extends RadioMedium> radioMediumClass: gui.getRegisteredRadioMediums()) {
|
||||||
String description = GUI.getDescriptionOf(radioMediumClass);
|
String description = GUI.getDescriptionOf(radioMediumClass);
|
||||||
radioMediumDescriptions.add(description);
|
radioMediumDescriptions.add(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
comboBox = new JComboBox(radioMediumDescriptions);
|
comboBox = new JComboBox(radioMediumDescriptions);
|
||||||
|
|
||||||
comboBox.setSelectedIndex(0);
|
comboBox.setSelectedIndex(0);
|
||||||
radioMediumBox = comboBox;
|
radioMediumBox = comboBox;
|
||||||
label.setLabelFor(comboBox);
|
label.setLabelFor(comboBox);
|
||||||
|
|
||||||
horizBox.add(label);
|
horizBox.add(label);
|
||||||
horizBox.add(Box.createHorizontalStrut(10));
|
horizBox.add(Box.createHorizontalStrut(10));
|
||||||
horizBox.add(comboBox);
|
horizBox.add(comboBox);
|
||||||
horizBox.setToolTipText("Determines the radio surroundings behaviour");
|
horizBox.setToolTipText("Determines the radio surroundings behaviour");
|
||||||
|
|
||||||
vertBox.add(horizBox);
|
vertBox.add(horizBox);
|
||||||
vertBox.add(Box.createRigidArea(new Dimension(0,5)));
|
vertBox.add(Box.createRigidArea(new Dimension(0,5)));
|
||||||
|
|
||||||
|
|
||||||
/* // Radio Medium Logging selection
|
/* // Radio Medium Logging selection
|
||||||
smallPane = Box.createHorizontalBox();
|
smallPane = Box.createHorizontalBox();
|
||||||
smallPane.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
|
smallPane.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
|
||||||
smallPane.setAlignmentX(Component.LEFT_ALIGNMENT);
|
smallPane.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||||
logCheckBox = new JCheckBox("Log all radio traffic?");
|
logCheckBox = new JCheckBox("Log all radio traffic?");
|
||||||
logCheckBox.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
logCheckBox.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
||||||
|
|
||||||
textField = new JTextField();
|
textField = new JTextField();
|
||||||
textField.setText("[filename]");
|
textField.setText("[filename]");
|
||||||
textField.setColumns(25);
|
textField.setColumns(25);
|
||||||
logFilename = textField;
|
logFilename = textField;
|
||||||
|
|
||||||
smallPane.add(logCheckBox);
|
smallPane.add(logCheckBox);
|
||||||
smallPane.add(Box.createHorizontalStrut(10));
|
smallPane.add(Box.createHorizontalStrut(10));
|
||||||
smallPane.add(textField);
|
smallPane.add(textField);
|
||||||
|
|
||||||
|
|
||||||
mainPane.add(smallPane);
|
mainPane.add(smallPane);
|
||||||
mainPane.add(Box.createRigidArea(new Dimension(0,5)));
|
mainPane.add(Box.createRigidArea(new Dimension(0,5)));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// -- Advanced settings --
|
// -- Advanced settings --
|
||||||
Box advancedBox = Box.createVerticalBox();
|
Box advancedBox = Box.createVerticalBox();
|
||||||
|
@ -289,32 +289,32 @@ public class CreateSimDialog extends JDialog {
|
||||||
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||||
label = new JLabel("Simulation start time (ms)");
|
label = new JLabel("Simulation start time (ms)");
|
||||||
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
||||||
|
|
||||||
numberField = new JFormattedTextField(integerFormat);
|
numberField = new JFormattedTextField(integerFormat);
|
||||||
numberField.setValue(new Integer(0));
|
numberField.setValue(new Integer(0));
|
||||||
numberField.setColumns(4);
|
numberField.setColumns(4);
|
||||||
simulationTime = numberField;
|
simulationTime = numberField;
|
||||||
|
|
||||||
horizBox.add(label);
|
horizBox.add(label);
|
||||||
horizBox.add(Box.createHorizontalStrut(150));
|
horizBox.add(Box.createHorizontalStrut(150));
|
||||||
horizBox.add(numberField);
|
horizBox.add(numberField);
|
||||||
horizBox.setToolTipText("Initial value of simulated time");
|
horizBox.setToolTipText("Initial value of simulated time");
|
||||||
|
|
||||||
advancedBox.add(horizBox);
|
advancedBox.add(horizBox);
|
||||||
advancedBox.add(Box.createRigidArea(new Dimension(0,5)));
|
advancedBox.add(Box.createRigidArea(new Dimension(0,5)));
|
||||||
|
|
||||||
// Tick time
|
// Tick time
|
||||||
horizBox = Box.createHorizontalBox();
|
horizBox = Box.createHorizontalBox();
|
||||||
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
|
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
|
||||||
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||||
label = new JLabel("Simulation tick time (ms)");
|
label = new JLabel("Simulation tick time (ms)");
|
||||||
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
||||||
|
|
||||||
numberField = new JFormattedTextField(integerFormat);
|
numberField = new JFormattedTextField(integerFormat);
|
||||||
numberField.setValue(new Integer(1));
|
numberField.setValue(new Integer(1));
|
||||||
numberField.setColumns(4);
|
numberField.setColumns(4);
|
||||||
tickTime = numberField;
|
tickTime = numberField;
|
||||||
|
|
||||||
horizBox.add(label);
|
horizBox.add(label);
|
||||||
horizBox.add(Box.createHorizontalStrut(150));
|
horizBox.add(Box.createHorizontalStrut(150));
|
||||||
horizBox.add(numberField);
|
horizBox.add(numberField);
|
||||||
|
@ -322,19 +322,19 @@ public class CreateSimDialog extends JDialog {
|
||||||
|
|
||||||
advancedBox.add(horizBox);
|
advancedBox.add(horizBox);
|
||||||
advancedBox.add(Box.createRigidArea(new Dimension(0,5)));
|
advancedBox.add(Box.createRigidArea(new Dimension(0,5)));
|
||||||
|
|
||||||
// Delayed startup
|
// Delayed startup
|
||||||
horizBox = Box.createHorizontalBox();
|
horizBox = Box.createHorizontalBox();
|
||||||
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
|
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
|
||||||
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||||
label = new JLabel("Mote startup delay (max, ms)");
|
label = new JLabel("Mote startup delay (max, ms)");
|
||||||
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
||||||
|
|
||||||
numberField = new JFormattedTextField(integerFormat);
|
numberField = new JFormattedTextField(integerFormat);
|
||||||
numberField.setValue(new Integer(10000));
|
numberField.setValue(new Integer(10000));
|
||||||
numberField.setColumns(4);
|
numberField.setColumns(4);
|
||||||
delayedStartup = numberField;
|
delayedStartup = numberField;
|
||||||
|
|
||||||
horizBox.add(label);
|
horizBox.add(label);
|
||||||
horizBox.add(Box.createHorizontalStrut(150));
|
horizBox.add(Box.createHorizontalStrut(150));
|
||||||
horizBox.add(numberField);
|
horizBox.add(numberField);
|
||||||
|
@ -342,7 +342,7 @@ public class CreateSimDialog extends JDialog {
|
||||||
|
|
||||||
advancedBox.add(horizBox);
|
advancedBox.add(horizBox);
|
||||||
advancedBox.add(Box.createVerticalStrut(5));
|
advancedBox.add(Box.createVerticalStrut(5));
|
||||||
|
|
||||||
advancedBox.add(Box.createVerticalStrut(5));
|
advancedBox.add(Box.createVerticalStrut(5));
|
||||||
|
|
||||||
// Delay time
|
// Delay time
|
||||||
|
@ -351,12 +351,12 @@ public class CreateSimDialog extends JDialog {
|
||||||
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||||
label = new JLabel("Delay time (ms)");
|
label = new JLabel("Delay time (ms)");
|
||||||
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
||||||
|
|
||||||
numberField = new JFormattedTextField(integerFormat);
|
numberField = new JFormattedTextField(integerFormat);
|
||||||
numberField.setValue(new Integer(100));
|
numberField.setValue(new Integer(100));
|
||||||
numberField.setColumns(4);
|
numberField.setColumns(4);
|
||||||
delayTime = numberField;
|
delayTime = numberField;
|
||||||
|
|
||||||
horizBox.add(label);
|
horizBox.add(label);
|
||||||
horizBox.add(Box.createHorizontalStrut(150));
|
horizBox.add(Box.createHorizontalStrut(150));
|
||||||
horizBox.add(numberField);
|
horizBox.add(numberField);
|
||||||
|
@ -373,53 +373,53 @@ public class CreateSimDialog extends JDialog {
|
||||||
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||||
label = new JLabel("Main random seed");
|
label = new JLabel("Main random seed");
|
||||||
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
||||||
|
|
||||||
numberField = new JFormattedTextField(integerFormat);
|
numberField = new JFormattedTextField(integerFormat);
|
||||||
numberField.setValue(new Integer(123456));
|
numberField.setValue(new Integer(123456));
|
||||||
numberField.setColumns(4);
|
numberField.setColumns(4);
|
||||||
randomSeed = numberField;
|
randomSeed = numberField;
|
||||||
|
|
||||||
horizBox.add(label);
|
horizBox.add(label);
|
||||||
horizBox.add(Box.createHorizontalStrut(150));
|
horizBox.add(Box.createHorizontalStrut(150));
|
||||||
horizBox.add(numberField);
|
horizBox.add(numberField);
|
||||||
horizBox.setToolTipText("Main random seed. Determines mote tick order, mote startup delay etc.");
|
horizBox.setToolTipText("Main random seed. Determines mote tick order, mote startup delay etc.");
|
||||||
|
|
||||||
advancedBox.add(horizBox);
|
advancedBox.add(horizBox);
|
||||||
advancedBox.add(Box.createVerticalStrut(5));
|
advancedBox.add(Box.createVerticalStrut(5));
|
||||||
|
|
||||||
// Tick lists
|
// Tick lists
|
||||||
horizBox = Box.createHorizontalBox();
|
horizBox = Box.createHorizontalBox();
|
||||||
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
|
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
|
||||||
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||||
label = new JLabel("Number of tick lists");
|
label = new JLabel("Number of tick lists");
|
||||||
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
|
||||||
|
|
||||||
numberField = new JFormattedTextField(integerFormat);
|
numberField = new JFormattedTextField(integerFormat);
|
||||||
numberField.setValue(new Integer(1));
|
numberField.setValue(new Integer(1));
|
||||||
numberField.setColumns(4);
|
numberField.setColumns(4);
|
||||||
tickLists = numberField;
|
tickLists = numberField;
|
||||||
|
|
||||||
horizBox.add(label);
|
horizBox.add(label);
|
||||||
horizBox.add(Box.createHorizontalStrut(150));
|
horizBox.add(Box.createHorizontalStrut(150));
|
||||||
horizBox.add(numberField);
|
horizBox.add(numberField);
|
||||||
horizBox.setToolTipText("<html>Number of tick lists.<p>Every simulated mote belongs to a tick list, and each simulated loop only one list is allowed to act.<br>If the number of tick lists is 1, all motes are tick every simulation time increase.</html>");
|
horizBox.setToolTipText("<html>Number of tick lists.<p>Every simulated mote belongs to a tick list, and each simulated loop only one list is allowed to act.<br>If the number of tick lists is 1, all motes are tick every simulation time increase.</html>");
|
||||||
|
|
||||||
advancedBox.add(horizBox);
|
advancedBox.add(horizBox);
|
||||||
advancedBox.add(Box.createVerticalGlue());
|
advancedBox.add(Box.createVerticalGlue());
|
||||||
|
|
||||||
|
|
||||||
vertBox.add(advancedBox);
|
vertBox.add(advancedBox);
|
||||||
vertBox.add(Box.createVerticalGlue());
|
vertBox.add(Box.createVerticalGlue());
|
||||||
|
|
||||||
vertBox.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
|
vertBox.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
|
||||||
|
|
||||||
Container contentPane = getContentPane();
|
Container contentPane = getContentPane();
|
||||||
contentPane.add(vertBox, BorderLayout.CENTER);
|
contentPane.add(vertBox, BorderLayout.CENTER);
|
||||||
contentPane.add(buttonBox, BorderLayout.SOUTH);
|
contentPane.add(buttonBox, BorderLayout.SOUTH);
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AddSimEventHandler implements ActionListener {
|
private class AddSimEventHandler implements ActionListener {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (e.getActionCommand().equals("cancel")) {
|
if (e.getActionCommand().equals("cancel")) {
|
||||||
|
@ -430,10 +430,10 @@ public class CreateSimDialog extends JDialog {
|
||||||
mySimulation.setSimulationTime(((Number) simulationTime.getValue()).intValue());
|
mySimulation.setSimulationTime(((Number) simulationTime.getValue()).intValue());
|
||||||
mySimulation.setTickTime(((Number) tickTime.getValue()).intValue());
|
mySimulation.setTickTime(((Number) tickTime.getValue()).intValue());
|
||||||
mySimulation.setTitle(title.getText());
|
mySimulation.setTitle(title.getText());
|
||||||
|
|
||||||
String currentRadioMediumDescription = (String) radioMediumBox.getSelectedItem();
|
String currentRadioMediumDescription = (String) radioMediumBox.getSelectedItem();
|
||||||
for (Class<? extends RadioMedium> radioMediumClass: myGUI.getRegisteredRadioMediums()) {
|
for (Class<? extends RadioMedium> radioMediumClass: myGUI.getRegisteredRadioMediums()) {
|
||||||
String radioMediumDescription = GUI.getDescriptionOf(radioMediumClass);
|
String radioMediumDescription = GUI.getDescriptionOf(radioMediumClass);
|
||||||
|
|
||||||
if (currentRadioMediumDescription.equals(radioMediumDescription)) {
|
if (currentRadioMediumDescription.equals(radioMediumDescription)) {
|
||||||
try {
|
try {
|
||||||
|
@ -441,25 +441,26 @@ public class CreateSimDialog extends JDialog {
|
||||||
mySimulation.setRadioMedium(radioMedium);
|
mySimulation.setRadioMedium(radioMedium);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.fatal("Exception when creating radio medium: " + ex);
|
logger.fatal("Exception when creating radio medium: " + ex);
|
||||||
|
ex.printStackTrace();
|
||||||
mySimulation.setRadioMedium(null);
|
mySimulation.setRadioMedium(null);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (logCheckBox.isSelected()) {
|
/* if (logCheckBox.isSelected()) {
|
||||||
ConnectionLogger connLogger = new ConnectionLogger(new File(logFilename.getText()));
|
ConnectionLogger connLogger = new ConnectionLogger(new File(logFilename.getText()));
|
||||||
mySimulation.getRadioMedium().setConnectionLogger(connLogger);
|
mySimulation.getRadioMedium().setConnectionLogger(connLogger);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mySimulation.setRandomSeed(((Number) randomSeed.getValue()).longValue());
|
mySimulation.setRandomSeed(((Number) randomSeed.getValue()).longValue());
|
||||||
mySimulation.setNrTickLists(((Number) tickLists.getValue()).intValue());
|
mySimulation.setNrTickLists(((Number) tickLists.getValue()).intValue());
|
||||||
mySimulation.setDelayedMoteStartupTime(((Number) delayedStartup.getValue()).intValue());
|
mySimulation.setDelayedMoteStartupTime(((Number) delayedStartup.getValue()).intValue());
|
||||||
|
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue