コード例 #1
0
ファイル: AddNewStats.java プロジェクト: Eznoka/anathema
 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(
       new Command() {
         @Override
         public void execute() {
           List<String> definedNames = new ArrayList<>();
           for (IEquipmentStats stats : editModel.getStats()) {
             definedNames.add(stats.getName().getId());
           }
           String nameProposal = resources.getString(newStatsConfiguration.getNameKey());
           String[] nameArray = definedNames.toArray(new String[definedNames.size()]);
           IEquipmentStats equipmentStats =
               statsFactory.createNewStats(
                   nameArray, nameProposal, newStatsConfiguration.getType());
           editModel.addStatistics(equipmentStats);
         }
       });
   controlAvailability(newStatsConfiguration, newTool);
   editModel.addCompositionChangeListener(
       new ChangeListener() {
         @Override
         public void changeOccurred() {
           controlAvailability(newStatsConfiguration, newTool);
         }
       });
 }
コード例 #2
0
 private void initializeAppearance() {
   interaction.setTooltip(resources.getString("AnathemaCore.Tools.New.Name"));
   interaction.setIcon(new BasicUi().getNewIconPathForTaskbar());
 }