use of pcgen.facade.core.EquipmentListFacade in project pcgen by PCGen.
the class EquipmentTableModel method setEquipmentList.
protected void setEquipmentList(EquipmentListFacade equipmentList) {
EquipmentListFacade oldList = this.equipmentList;
if (oldList != null) {
oldList.removeEquipmentListListener(this);
}
this.equipmentList = equipmentList;
if (equipmentList != null) {
equipmentList.addEquipmentListListener(this);
}
super.setDelegate(equipmentList);
}
use of pcgen.facade.core.EquipmentListFacade in project pcgen by PCGen.
the class CharacterFacadeImpl method initEquipSet.
/**
* Initialise the equipment set facades, ensuring that the character has a
* default equipment set.
*/
private void initEquipSet() {
// Setup the default EquipSet if not already present
if (!charDisplay.hasEquipSet()) {
String id = EquipmentSetFacadeImpl.getNewIdPath(charDisplay, null);
EquipSet eSet = new EquipSet(id, LanguageBundle.getString("in_ieDefault"));
theCharacter.addEquipSet(eSet);
theCharacter.setCalcEquipSetId(id);
}
// Detach listeners from old set
if (equipSet.get() != null) {
EquipmentListFacade equippedItems = equipSet.get().getEquippedItems();
equippedItems.removeListListener(this);
equippedItems.removeEquipmentListListener(this);
}
// Make facades for each root equipset.
List<EquipmentSetFacade> eqSetList = new ArrayList<>();
EquipmentSetFacade currSet = null;
String currIdPath = theCharacter.getCalcEquipSetId();
for (EquipSet es : charDisplay.getEquipSet()) {
if (es.getParentIdPath().equals("0")) {
final EquipmentSetFacadeImpl facade = new EquipmentSetFacadeImpl(delegate, theCharacter, es, dataSet, purchasedEquip, todoManager, this);
eqSetList.add(facade);
if (es.getIdPath().equals(currIdPath)) {
currSet = facade;
}
}
}
equipmentSets.updateContents(eqSetList);
if (currSet != null) {
equipSet.set(currSet);
}
EquipmentSetFacade set = equipSet.get();
set.getEquippedItems().addListListener(this);
set.getEquippedItems().addEquipmentListListener(this);
refreshTotalWeight();
}
Aggregations