Search in sources :

Example 6 with Gui2InfoFactory

use of pcgen.gui2.facade.Gui2InfoFactory in project pcgen by PCGen.

the class UserInputManager method doChooser.

/**
	 * Display a chooser to the user.
	 * 
	 * @param aPc The character the choice is for.
	 * @param availableList The list of possible choices.
	 * @param selectedList The list of existing selections.
	 * @return list The list of the new selections made by the user (unchanged if the dialog was cancelled)
	 */
@Override
public List<String> doChooser(PlayerCharacter aPc, final List<String> availableList, final List<String> selectedList, final List<String> reservedList) {
    int effectiveChoices = getNumEffectiveChoices(selectedList, reservedList, aPc);
    boolean dupsAllowed = controller.isMultYes() && controller.isStackYes();
    Globals.sortChooserLists(availableList, selectedList);
    String title = StringUtils.isBlank(info.getTitle()) ? "in_chooser" : info.getTitle();
    if (title.startsWith("in_")) {
        title = LanguageBundle.getString(title);
    }
    CDOMChooserFacadeImpl<String> chooserFacade = new CDOMChooserFacadeImpl<>(title, availableList, selectedList, effectiveChoices);
    chooserFacade.setAllowsDups(dupsAllowed);
    chooserFacade.setInfoFactory(new Gui2InfoFactory(aPc));
    chooserFacade.setUserInput(true);
    ChooserFactory.getDelegate().showGeneralChooser(chooserFacade);
    return chooserFacade.getFinalSelected();
}
Also used : Gui2InfoFactory(pcgen.gui2.facade.Gui2InfoFactory)

Aggregations

Gui2InfoFactory (pcgen.gui2.facade.Gui2InfoFactory)6 ArrayList (java.util.ArrayList)4 CDOMChooserFacadeImpl (pcgen.core.chooser.CDOMChooserFacadeImpl)4 PCClass (pcgen.core.PCClass)2 DecimalFormat (java.text.DecimalFormat)1 HashSet (java.util.HashSet)1 PCStat (pcgen.core.PCStat)1 SpellProhibitor (pcgen.core.SpellProhibitor)1 SubClass (pcgen.core.SubClass)1 SubstitutionClass (pcgen.core.SubstitutionClass)1