import jp.naist.se.stigmata.CertainPairComparisonResultSet;\r
import jp.naist.se.stigmata.ComparisonPair;\r
import jp.naist.se.stigmata.ComparisonResultSet;\r
-import jp.naist.se.stigmata.format.BirthmarkComparisonResultFormat;\r
+import jp.naist.se.stigmata.format.FormatManager;\r
import jp.naist.se.stigmata.spi.ResultFormatSpi;\r
+import jp.naist.se.stigmata.ui.swing.actions.SaveAction;\r
\r
/**\r
* \r
* @author Haruaki TAMADA\r
* @version $Revision$ $Date$\r
*/\r
-public class PairComparisonResultSetPane extends JPanel implements BirthmarkDataWritable{\r
+public class PairComparisonResultSetPane extends JPanel{\r
private static final long serialVersionUID = 3298346465652354302L;\r
\r
private StigmataFrame frame;\r
initData(model, list);\r
}\r
\r
- public void writeData(PrintWriter out, ResultFormatSpi service) throws IOException{\r
- BirthmarkComparisonResultFormat format = service.getComparisonResultFormat();\r
- format.printResult(out, new CertainPairComparisonResultSet(\r
- list.toArray(new ComparisonPair[list.size()]), context\r
- ));\r
- }\r
-\r
private void obfuscateClassNames(){\r
ClassNameObfuscator obfuscator = new ClassNameObfuscator();\r
List<ComparisonPair> newList = new ArrayList<ComparisonPair>();\r
JComponent buttonPanel = Box.createHorizontalBox();\r
JPanel similarityPane = new JPanel(new GridLayout(1, 3));\r
JComponent southPanel = Box.createVerticalBox();\r
- JButton saveButton = Utility.createButton("savecomparison");\r
+ JButton saveButton = Utility.createButton(\r
+ "savecomparison", new SaveAction(frame, new AsciiDataWritable(){\r
+ public void writeAsciiData(PrintWriter out, String format) throws IOException{\r
+ ResultFormatSpi service = FormatManager.getInstance().getService(format);\r
+ if(service == null){\r
+ service = FormatManager.getDefaultFormatService();\r
+ }\r
+ service.getComparisonResultFormat().printResult(\r
+ out, new CertainPairComparisonResultSet(\r
+ list.toArray(new ComparisonPair[list.size()]), context\r
+ )\r
+ );\r
+ }\r
+ })\r
+ );\r
JButton obfuscateButton = Utility.createButton("obfuscate");\r
JScrollPane scroll = new JScrollPane();\r
averageLabel = new JLabel(Double.toString(average), JLabel.RIGHT);\r
}\r
}\r
});\r
- saveButton.addActionListener(new ActionListener(){\r
- public void actionPerformed(ActionEvent e){\r
- frame.saveAction(PairComparisonResultSetPane.this);\r
- }\r
- });\r
\r
obfuscateButton.addActionListener(new ActionListener(){\r
public void actionPerformed(ActionEvent e){\r