setWindowIcon(ResourceLoader.getInstance().createIconFromLocalResource(
getClass().getClassLoader(), "route.png"));
setModal(true);
this.networkView = nv;
QGridLayout resultLayout = new QGridLayout();
QLabel tripLabel = new QLabel(
"Please enter the properties for the new trip:");
QLabel idLabel = new QLabel("Id:");
QLabel depTimeLabel = new QLabel("Start Time:");
QLabel fromNodeLabel = new QLabel("From Edge:");
QLabel toNodeLabel = new QLabel("To Edge:");
QLabel vTypeLabel = new QLabel("Vehicle Type:");
QLabel periodLabel = new QLabel("Emit interval:");
QLabel repnoLabel = new QLabel("Replication number:");
idText = new QLineEdit("Trip" + new Random().nextInt());
depTimeSpin = new QSpinBox();
ModelManager mm = ModelManager.getInstance();
depTimeSpin.setMinimum(mm.getSimulationStartTime());
depTimeSpin.setMaximum(mm.getSimulationEndTime());
fromEdgeEdit = new QLineEdit();
fromEdgeEdit.setEnabled(false);
fromEdgeSelectButton = new QPushButton("Select");
fromEdgeSelectButton.pressed.connect(this, "onFromNodeSelect()");
toEdgeEdit = new QLineEdit();
toEdgeEdit.setEnabled(false);
toEdgeSelectButton = new QPushButton("Select");
toEdgeSelectButton.pressed.connect(this, "onToNodeSelect()");
typeCombo = new QComboBox();
SumoManager sm = SumoManager.getInstance();
List<SumoVehicleType> vTypes = sm.getVehicleTypes();
for (SumoVehicleType v : vTypes) {
typeCombo.addItem(v.getId());
}
// _lg: this Dialog makes absoluteley no sense here
// typeAddButton = new QPushButton("Add Vehicle Type");
// typeAddButton.pressed.connect(this, "onTypeButtonSelect()");
periodEdit = new QSpinBox();
periodEdit.setMinimum(1);
periodEdit.setMaximum(100000);
periodEdit.setValue(1000);
repnoEdit = new QSpinBox();
repnoEdit.setValue(5);
repnoEdit.setMinimum(0);
repnoEdit.setMaximum(10000);
QPushButton bOk = new QPushButton("OK");
bOk.pressed.connect(this, "onOkButton()");
bOk.setDefault(true);
QPushButton bCancel = new QPushButton("Cancel");
bCancel.pressed.connect(this, "onCancelButton()");
QBoxLayout okCancelLayout = new QBoxLayout(Direction.RightToLeft);
okCancelLayout.addWidget(bCancel, 0, AlignmentFlag.AlignRight);
okCancelLayout.addWidget(bOk, 1, AlignmentFlag.AlignRight);
resultLayout.addWidget(tripLabel, 0, 0, 1, 3);
resultLayout.addWidget(idLabel, 1, 0, 1, 1);
resultLayout.addWidget(depTimeLabel, 2, 0, 1, 1);
resultLayout.addWidget(fromNodeLabel, 3, 0, 1, 1);
resultLayout.addWidget(toNodeLabel, 4, 0, 1, 1);
resultLayout.addWidget(vTypeLabel, 5, 0, 1, 1);
resultLayout.addWidget(periodLabel, 6, 0, 1, 1);
resultLayout.addWidget(repnoLabel, 7, 0, 1, 1);
resultLayout.addWidget(idText, 1, 1, 1, 2);
resultLayout.addWidget(depTimeSpin, 2, 1, 1, 2);
resultLayout.addWidget(fromEdgeEdit, 3, 1, 1, 1);
resultLayout.addWidget(fromEdgeSelectButton, 3, 2, 1, 1);
resultLayout.addWidget(toEdgeEdit, 4, 1, 1, 1);
resultLayout.addWidget(toEdgeSelectButton, 4, 2, 1, 1);
resultLayout.addWidget(typeCombo, 5, 1, 1, 2);
// resultLayout.addWidget(typeCombo, 5, 1, 1, 1);
// resultLayout.addWidget(typeAddButton, 5, 2, 1, 1);
resultLayout.addWidget(periodEdit, 6, 1, 1, 2);
resultLayout.addWidget(repnoEdit, 7, 1, 1, 2);
resultLayout.addLayout(okCancelLayout, 8, 0, 1, 3);
resultLayout.setColumnStretch(0, 1);
resultLayout.setColumnStretch(1, 5);
resultLayout.setColumnStretch(2, 3);
this.setLayout(resultLayout);
}