private void createSeries(final XYChart chart) {
   // populating the series with data
   XYChart.Series series;
   Scenario scenario =
       (Scenario) Applicazione.getInstance().getModello().getBean(Scenario.class.getName());
   for (MappingTool tool : scenario.getToolsList()) {
     if (logger.isTraceEnabled()) logger.trace("Tool Scan : " + tool.getName());
     if (tool.getNumberExecutions() > 0) {
       series = new XYChart.Series();
       series.setName(tool.getName());
       if (!mapColor.containsKey(tool.getName())) {
         mapColor.put(tool.getName(), PropertiesLoader.loadColorName(tool.getName()));
         if (logger.isTraceEnabled())
           logger.trace(
               "map color put" + tool.getName() + " value " + mapColor.get(tool.getName()));
       }
       series.getData().add(new XYChart.Data(0, 0));
       List<MappingExecution> listExecution = new ArrayList<MappingExecution>();
       listExecution.addAll(tool.getExecutionsList());
       Collections.sort(listExecution);
       if (logger.isTraceEnabled()) logger.trace("Mapping executions: " + listExecution.size());
       for (MappingExecution mappingTask : listExecution) {
         int effort = 0;
         if (logger.isTraceEnabled()) logger.trace("Mapping: " + mappingTask);
         if (mappingTask.getEffortRecording() != null) {
           if (logger.isTraceEnabled())
             logger.trace("Updating effort:" + mappingTask.getEffortRecording());
           effort = mappingTask.getEffortRecording().getTotalInteraction();
         }
         series
             .getData()
             .add(new XYChart.Data(mappingTask.getQuality().getFmeasure() * 100, effort));
       }
       chart.getData().add(series);
     }
   }
   setColors();
   //        printNodes(chart, 0);
 }
 private void setColors() {
   Scenario scenario =
       (Scenario) Applicazione.getInstance().getModello().getBean(Scenario.class.getName());
   for (int i = 0; i < chart.getData().size(); i++) {
     for (Node node : chart.lookupAll(".series" + i)) {
       node.getStyleClass().remove("default-color" + i);
       node.getStyleClass()
           .add("default-color" + mapColor.get(scenario.getToolsList().get(i).getName()));
     }
     int item = 0;
     for (Node node : chart.lookupAll(".chart-legend-item")) {
       if (node instanceof Label && ((Label) node).getGraphic() != null) {
         String color = mapColor.get(scenario.getToolsList().get(item).getName());
         if (color != null && !color.isEmpty()) {
           ((Label) node).getGraphic().getStyleClass().remove("default-color" + item);
           ((Label) node).getGraphic().getStyleClass().add("default-color" + color);
         }
       }
       item++;
     }
   }
 }
Beispiel #3
0
 //    private static void copyFile(File f1, String pathOut) throws DAOException {
 //        InputStream in = null;
 //        OutputStream out = null;
 //        try {
 //            String namef2 = f1.getName();
 //            in = new FileInputStream(f1);
 //            out = new FileOutputStream(new File(pathOut + "/" + namef2));
 //            byte[] buf = new byte[1024];
 //            int len;
 //            while ((len = in.read(buf)) > 0) {
 //                out.write(buf, 0, len);
 //            }
 //            in.close();
 //            out.close();
 //            logger.debug("File " + namef2 + " copied.");
 //        } catch (FileNotFoundException ex) {
 //            logger.error(ex.getLocalizedMessage());
 //            throw new DAOException(ex);
 //        } catch (IOException ex) {
 //
 //            throw new DAOException(ex);
 //        } finally {
 //            try {
 //                in.close();
 //                out.close();
 //            } catch (Exception ex) {
 //            }
 //        }
 //    }
 public static void loadTools(Scenario scenario, List<String> tools) throws DAOException {
   File directory = new File(scenario.getOutPath());
   for (final String name : tools) {
     FileFilter filter =
         new FileFilter() {
           public boolean accept(File pathname) {
             if (pathname.isDirectory() && pathname.getName().equals(name)) {
               return true;
             }
             return false;
           }
         };
     File[] subDir = directory.listFiles(filter);
     if (subDir.length != 0) {
       File file = subDir[0];
       MappingTool tool = loadTool(file.getAbsolutePath());
       if (tool != null) {
         scenario.addTool(tool);
       }
     }
   }
 }
Beispiel #4
0
 public static void createDirectory(MappingTool tool, Scenario sc) throws DAOException {
   try {
     File directoryTool = new File(sc.getOutPath() + File.separator + tool.getName());
     directoryTool.mkdirs();
     //            if (tool.getFileScript() != null && !tool.getFileScript().equals("")) {
     //                logger.debug("There is File script");
     //                String script =
     // tool.getFileScript().substring(tool.getFileScript().lastIndexOf(File.separator) + 1);
     //                copyFile(directoryTool, script);
     //            }
     createFileProperties(tool, directoryTool);
     tool.setDirectory(directoryTool.getAbsolutePath());
   } catch (Exception ex) {
     logger.error(ex.getMessage());
     throw new DAOException(ex);
   }
 }