Пример #1
0
 public void addTool(
     final NewStatsConfiguration newStatsConfiguration,
     ToolListView<IEquipmentStats> statsListView) {
   final Tool newTool = statsListView.addTool();
   newTool.setTooltip(resources.getString(newStatsConfiguration.getTooltipKey()));
   newTool.setIcon(newStatsConfiguration.getIconPath());
   newTool.setOverlay(new RelativePath("icons/ButtonPlus16.png"));
   newTool.setCommand(
       () -> {
         List<String> definedNames =
             editModel
                 .getStats()
                 .stream()
                 .map(stats -> stats.getName().getId())
                 .collect(Collectors.toList());
         String nameProposal = resources.getString(newStatsConfiguration.getNameKey());
         IEquipmentStats equipmentStats =
             statsFactory.createNewStats(
                 definedNames, nameProposal, newStatsConfiguration.getType());
         editModel.addStatistics(equipmentStats);
       });
 }