/** * Request the metamagic feats to be applied to a spell from the user via a chooser. * * @param spellNode The spell to have metamagic applied * @return The list of metamagic feats to be applied. */ private List<Ability> queryUserForMetamagic(SpellNode spellNode) { // get the list of metamagic feats for the PC List<InfoFacade> availableList = buildAvailableMetamagicFeatList(spellNode); if (availableList.isEmpty()) { return Collections.emptyList(); } String label = dataSet.getGameMode().getAddWithMetamagicMessage(); if (StringUtils.isEmpty(label)) { label = LanguageBundle.getString("InfoSpells.add.with.metamagic"); } final ArrayList<Ability> selectedList = new ArrayList<>(); GeneralChooserFacadeBase chooserFacade = new GeneralChooserFacadeBase(label, availableList, new ArrayList<>(), 99, infoFactory) { @Override public void commit() { for (InfoFacade item : getSelectedList()) { selectedList.add((Ability) item); } } }; chooserFacade.setDefaultView(ChooserTreeViewType.NAME); boolean result = delegate.showGeneralChooser(chooserFacade); return result ? selectedList : null; }