package graphmatcher.test;
import graphmatcher.gui.LabeledTextField;
import java.awt.GridLayout;
import java.text.NumberFormat;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
public class ReportingPanel extends JPanel {
private LabeledTextField tpField, fnField, fpField, tnField, averageTimeField;
private JProgressBar recallBar, correctMatchingsBar;
private NumberFormat format = NumberFormat.getNumberInstance();
public ReportingPanel() {
setLayout(new GridLayout(7, 1));
setBorder(BorderFactory.createTitledBorder("Auswertung"));
tpField = new LabeledTextField("TP");
add(tpField);
fnField = new LabeledTextField("FN");
add(fnField);
fpField = new LabeledTextField("FP");
add(fpField);
tnField = new LabeledTextField("TN");
add(tnField);
recallBar = new JProgressBar(0, 100);
recallBar.setStringPainted(true);
add(recallBar);
correctMatchingsBar = new JProgressBar(0, 100);
correctMatchingsBar.setStringPainted(true);
add(correctMatchingsBar);
averageTimeField = new LabeledTextField("ms");
add(averageTimeField);
format.setMaximumFractionDigits(2);
format.setMinimumFractionDigits(2);
}
public void setTP(long l) {
tpField.setText("" + l);
}
public void setFN(long fn) {
fnField.setText("" + fn);
}
public void setFP(long fp) {
fpField.setText("" + fp);
}
public void setTN(long tn) {
tnField.setText("" + tn);
}
public void setRecall(double recall) {
recallBar.setValue((int) (recall * 100));
recallBar.setString("Recall: " + format.format(recall));
}
public void setCorrectMatchings(double correct) {
correctMatchingsBar.setValue((int) (correct * 100));
correctMatchingsBar.setString("Best correct: " + format.format(correct * 100) + "%");
}
public void setMS(long ms) {
averageTimeField.setText("" + ms);
}
}