📄 jsimproblemswindow.java
字号:
Object sourceKey = temp.get(i);
String sourceName = mc.getStationModel().getStationName(sourceKey);
problems.add(new ProblemElement(ModelChecker.ERROR_PROBLEM,ModelChecker.SOURCE_WITH_NO_OPEN_CLASSES_ERROR,"<html><font color=\"white\">----</font><b>Error</b><font color=\"white\">---------</font>" + sourceName + " without open classes associated",sourceKey,null));
}
}
if(mc.isThereEmptyBlockingRegionError()) {
Vector regionKeys = mc.getKeysOfEmptyBlockingRegions();
for (int i=0; i<regionKeys.size(); i++) {
String name = mc.getBlockingModel().getRegionName(regionKeys.get(i));
problems.add(new ProblemElement(ModelChecker.ERROR_PROBLEM,ModelChecker.EMPTY_BLOCKING_REGION,"<html><font color=\"white\">----</font><b>Error</b><font color=\"white\">---------</font>Finite Capacity Region "+ name+" is empty",regionKeys.get(i),null));
}
}
if (mc.isTherePreloadingInBlockingRegionError()) {
problems.add(new ProblemElement(ModelChecker.ERROR_PROBLEM,ModelChecker.PRELOADING_WITH_BLOCKING,"<html><font color=\"white\">----</font><b>Error</b><font color=\"white\">---------</font>Preloading of stations inside a blocking region is not supported",null,null));
}
if (mc.isTherejoinWithoutForkError()) {
problems.add(new ProblemElement(ModelChecker.ERROR_PROBLEM,ModelChecker.JOIN_WITHOUT_FORK_ERROR,"<html><font color=\"white\">----</font><b>Error</b><font color=\"white\">---------</font>Join without fork",null,null));
}
if (mc.isThereMoreThanOneSinkWarning()) {
problems.add(new ProblemElement(ModelChecker.WARNING_PROBLEM,ModelChecker.MORE_THAN_ONE_SINK_WARNING,"<html><font color=\"white\">--</font><i>Warning</i><font color=\"white\">--------</font>More than one sink defined, measures may not be accurate",null,null));
}
if (mc.isThereNoBackwardLinkWarning()) {
Vector temp = mc.getKeysOfStationWithoutBackwardLinks();
for (int i=0; i<temp.size(); i++) {
Object stationKey = temp.get(i);
String stationName = mc.getStationModel().getStationName(stationKey);
problems.add(new ProblemElement(ModelChecker.WARNING_PROBLEM,ModelChecker.NO_BACKWARD_LINK_WARNING,"<html><font color=\"white\">--</font><i>Warning</i><font color=\"white\">--------</font>" + stationName + " is not backward linked",stationKey,null));
}
}
if (mc.isThereParametricAnalysisModelModifiedWarning()) {
problems.add(new ProblemElement(ModelChecker.WARNING_PROBLEM,ModelChecker.PARAMETRIC_ANALYSIS_MODEL_MODIFIED_WARNING,"<html><font color=\"white\">--</font><i>Warning</i><font color=\"white\">--------</font>What-if analysis model modified",null,null));
}
if (mc.isThereParametricAnalysisNoMoreAvaibleWarning()) {
problems.add(new ProblemElement(ModelChecker.WARNING_PROBLEM,ModelChecker.PARAMETRIC_ANALYSIS_NO_MORE_AVAIBLE_WARNING,"<html><font color=\"white\">--</font><i>Warning</i><font color=\"white\">--------</font>What-if analysis not avaible",null,null));
}
if (mc.isThereForkWithoutJoinWarnings()) {
problems.add(new ProblemElement(ModelChecker.WARNING_PROBLEM,ModelChecker.FORK_WITHOUT_JOIN_WARNING,"<html><font color=\"white\">--</font><i>Warning</i><font color=\"white\">--------</font>Fork found but no join",null,null));
}
}
}
///**
// * Enable or not to run simulation
// * @return true if the simulation is runnable and user wants to run simulation
// */
//public boolean simulationRunnable() {
// if ((!operationCanceled)&&(mc.isErrorFree())) canBeRun = true;
// return canBeRun;
//}
private void addComponent (Component component,GridBagLayout gbl,GridBagConstraints gbc, int row, int column, int width, int heigth) {
Container c = this.getContentPane();
gbc.gridx=column;
gbc.gridy=row;
gbc.gridwidth=width;
gbc.gridheight=heigth;
gbl.setConstraints(component,gbc);
c.add(component);
}
private void getRelatedPanel(int problemType,int problemSubType,Object relatedStation, Object relatedClass) {
gi.showRelatedPanel(problemType,problemSubType,relatedStation,relatedClass);
}
private class ProblemElementRenderer implements ListCellRenderer{
private String[] iconNames = new String[] {"Error", "Warning"};
private Icon[] icons = new Icon[iconNames.length];
private int[] problemTypes = {ModelChecker.ERROR_PROBLEM, ModelChecker.WARNING_PROBLEM};
public ProblemElementRenderer(){
for(int i=0; i<iconNames.length; i++){
icons[i] = ImageLoader.loadImage(iconNames[i], new Dimension(16,16));
}
}
public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
JLabel label = null;
for(int i=0; i<problemTypes.length; i++){
if(problemTypes[i] == ((ProblemElement)value).getProblemType()) {
String errorDescription = ((ProblemElement) value).getDescription();
label = new JLabel(errorDescription,
icons[i],
JLabel.LEFT);
}
}
if(label==null){
String errorDescription;
if (((Integer)value).intValue() == 0) errorDescription = "<html><b>Error</b></html>";
else errorDescription = "Warning";
label = new JLabel(errorDescription);
}
label.setOpaque(true);
label.setBorder(
new LineBorder(cellHasFocus ? Color.BLUE : Color.WHITE)
);
label.setBackground(
isSelected ? list.getSelectionBackground() : Color.WHITE
);
label.setForeground(
isSelected ? list.getSelectionForeground() : Color.BLACK
);
label.setFont(isSelected ?
label.getFont().deriveFont(Font.BOLD) :
label.getFont().deriveFont(Font.ROMAN_BASELINE));
//label.setMaximumSize(new Dimension(label.getMaximumSize().width,5));
return label;
}
}
private class ProblemElement {
int type;
int subType;
String description;
Object relatedStationKey;
Object relatedClassKey;
public ProblemElement(int type,int subType, String description,Object relatedStationKey,Object relatedClassKey) {
this.type = type;
this.subType = subType;
this.description = description;
this.relatedStationKey = relatedStationKey;
this.relatedClassKey = relatedClassKey;
}
public int getProblemType() {
return type;
}
public int getProblemSubType() {
return subType;
}
public String getDescription() {
return description;
}
public Object getRelatedStationKey() {
return relatedStationKey;
}
public Object getRelatedClassKey() {
return relatedClassKey;
}
}
private class ButtonEventHandler implements ActionListener {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == cancelButton) {
//operationCanceled = true;
dispose();
}
else if (e.getSource() == continueButton) {
setVisible(false);
if (toMVAConversion) {
((JSIMMain)gi).launchToJMVA();
}
else {
((JSIMMain)gi).launchSimulation();
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -