use of pcgen.facade.core.UIDelegate.CustomEquipResult in project pcgen by PCGen.
the class CharacterFacadeImpl method openCustomizer.
private Equipment openCustomizer(Equipment aEq) {
if (aEq == null) {
return null;
}
Equipment newEquip = aEq.clone();
if (!newEquip.containsKey(ObjectKey.BASE_ITEM)) {
newEquip.put(ObjectKey.BASE_ITEM, CDOMDirectSingleRef.getRef(aEq));
}
List<VarModifier<?>> modifiers = newEquip.getListFor(ListKey.MODIFY);
if (modifiers != null) {
for (VarModifier<?> vm : modifiers) {
theCharacter.addModifier(vm, newEquip, newEquip);
}
}
for (EquipmentHead head : newEquip.getEquipmentHeads()) {
modifiers = head.getListFor(ListKey.MODIFY);
if (modifiers != null) {
for (VarModifier<?> vm : modifiers) {
theCharacter.addModifier(vm, head, head);
}
}
}
EquipmentBuilderFacadeImpl builder = new EquipmentBuilderFacadeImpl(newEquip, theCharacter, delegate);
CustomEquipResult result = delegate.showCustomEquipDialog(this, builder);
if (newEquip != null && result != CustomEquipResult.CANCELLED) {
dataSet.addEquipment(newEquip);
}
//TODO if this is returning null, then the SolverManager needs to destroy the unused channels :/
return result == CustomEquipResult.PURCHASE ? newEquip : null;
}
Aggregations