* Shows the panel to solve a problem
*/
public void showRelatedPanel(int problemType, int problemSubType, Object relatedStation, Object relatedClass) {
// if it is a no class error show the class panel
if ((problemSubType == ModelChecker.NO_CLASSES_ERROR) && (problemType == ModelChecker.ERROR_PROBLEM)) {
dialogFactory.getDialog(new jmodelClassesPanel(model, model), "Manage User Classes");
model.manageJobs(); // a close class may be added
}
// if it is a no station error show an error message dialog
else if ((problemSubType == ModelChecker.NO_STATION_ERROR) && (problemType == ModelChecker.ERROR_PROBLEM)) {
JOptionPane.showMessageDialog(null, "Please insert at least one server or delay before starting simulation.", "Error",
JOptionPane.ERROR_MESSAGE);
} else if ((problemSubType == ModelChecker.SIMULATION_ERROR) && (problemType == ModelChecker.ERROR_PROBLEM)) {
dialogFactory.getDialog(new MeasurePanel(model, model, model), "Edit Performance Indices");
}
// if a measure is inconsistent (i.e have one or more 'null' field) show
// performance indices panel
else if ((problemSubType == ModelChecker.INCONSISTENT_MEASURE_ERROR) && (problemType == ModelChecker.ERROR_PROBLEM)) {
dialogFactory.getDialog(new MeasurePanel(model, model, model), "Edit Performance Indices");
}
else if ((problemSubType == ModelChecker.SINK_PERF_IND_WITH_NO_SINK_ERROR) && (problemType == ModelChecker.ERROR_PROBLEM)) {
dialogFactory.getDialog(new MeasurePanel(model, model, model), "Edit Performance Indices");
}
else if ((problemSubType == ModelChecker.SINK_PERF_WITH_CLOSED_CLASS_ERROR) && (problemType == ModelChecker.ERROR_PROBLEM)) {
dialogFactory.getDialog(new MeasurePanel(model, model, model), "Edit Performance Indices");
}
// if a measure was defined more than once ask to erase all redundant
// measure
else if ((problemSubType == ModelChecker.DUPLICATE_MEASURE_ERROR) && (problemType == ModelChecker.ERROR_PROBLEM)) {
int k = JOptionPane.showConfirmDialog(null, "Delete all redundant performance indices?\n", "Redundant performance indices found",
JOptionPane.ERROR_MESSAGE);
if (k == 0) {
mc.deleteRedundantMeasure();
}
}
// if it is a reference station error show the class panel
else if ((problemSubType == ModelChecker.REFERENCE_STATION_ERROR) && (problemType == ModelChecker.ERROR_PROBLEM)) {
dialogFactory.getDialog(new jmodelClassesPanel(model, model), "Manage User Classes");
model.manageJobs(); // a close class may be added
}
// if a source has been inserted in the model but no open classes
// defined show the class panel
else if ((problemSubType == ModelChecker.SOURCE_WITH_NO_OPEN_CLASSES_ERROR) && (problemType == ModelChecker.ERROR_PROBLEM)) {
dialogFactory.getDialog(new jmodelClassesPanel(model, model), "Manage User Classes");
} else if ((problemSubType == ModelChecker.ROUTING_ERROR) && (problemType == ModelChecker.ERROR_PROBLEM)) {
StationParameterPanel tempPanel = new StationParameterPanel(model, model, relatedStation);
String stationName = model.getStationName(relatedStation);
// set the station parameter panel to show the routing section
tempPanel.showRoutingSectionPanel(relatedClass);
dialogFactory.getDialog(tempPanel, "Editing " + stationName + " Properties...");
}
// if a class may be routed into a station whose forward stations are
// all sink show an error message
else if ((problemSubType == ModelChecker.ALL_FORWARD_STATION_ARE_SINK_ERROR) && (problemType == ModelChecker.ERROR_PROBLEM)) {
String stationName = model.getStationName(relatedStation);
String className = model.getClassName(relatedClass);
JOptionPane.showMessageDialog(null, "Close class " + className + " may be routed into " + stationName
+ " whose forward station are all sink.", "Error", JOptionPane.ERROR_MESSAGE);
}
// if no open classes defined but at least a sink has been defined show
// the class panel
else if ((problemSubType == ModelChecker.SINK_BUT_NO_OPEN_CLASSES_ERROR) && (problemType == ModelChecker.ERROR_PROBLEM)) {
dialogFactory.getDialog(new jmodelClassesPanel(model, model), "Manage User Classes");
// JOptionPane.showConfirmDialog(null,"Add an open class to the
// model?",
// "Error",JOptionPane.OK_CANCEL_OPTION,JOptionPane.ERROR_MESSAGE);
}
// if an open class defined but no sink have been defined show an error