use of pcgen.pluginmgr.messages.PlayerCharacterWasClosedMessage in project pcgen by PCGen.
the class CharacterFacadeImpl method closeCharacter.
@Override
public void closeCharacter() {
FacetLibrary.getFacet(LanguageFacet.class).removeDataFacetChangeListener(langListener);
FacetLibrary.getFacet(TemplateFacet.class).removeDataFacetChangeListener(templateListener);
FacetLibrary.getFacet(XPFacet.class).removeDataFacetChangeListener(xpListener);
FacetLibrary.getFacet(AutoEquipmentFacet.class).removeDataFacetChangeListener(autoEquipListener);
characterAbilities.closeCharacter();
charLevelsFacade.closeCharacter();
companionSupportFacade.closeCharacter();
PluginManager.getInstance().getPostbox().handleMessage(new PlayerCharacterWasClosedMessage(this, theCharacter));
Globals.getPCList().remove(theCharacter);
lastExportChar = null;
/*
* Unfortunately, a dummy rather than null is necessary because the UI
* does model swaps and such that do not pause events in the UI so that
* it is trying to update things that do not exist
*/
theCharacter = DUMMY_PC;
charDisplay = null;
dataSet.detachDelegates();
}
use of pcgen.pluginmgr.messages.PlayerCharacterWasClosedMessage in project pcgen by PCGen.
the class PCGTrackerPlugin method handleMessage.
/**
* listens to messages from the GMGen system, and handles them as needed
* @param message the source of the event from the system
*/
@Override
public void handleMessage(PCGenMessage message) {
if (message instanceof FileMenuOpenMessage) {
if (isActive()) {
handleOpen();
}
} else if (message instanceof PlayerCharacterWasLoadedMessage) {
PlayerCharacterWasLoadedMessage cmessage = (PlayerCharacterWasLoadedMessage) message;
model.add(cmessage.getPc());
} else if (message instanceof FocusOrStateChangeOccurredMessage) {
if (isActive()) {
charToolsItem.setEnabled(false);
try {
GMGenSystem.inst.openFileItem.setEnabled(true);
} catch (Exception e) {
// TODO Handle this?
}
} else {
charToolsItem.setEnabled(true);
}
} else if (message instanceof GMGenBeingClosedMessage) {
handleClose();
} else /*else if (message instanceof SavePCGRequestMessage)
{
SavePCGRequestMessage smessage = (SavePCGRequestMessage) message;
savePC(smessage.getPC(), false);
}*/
if (message instanceof PlayerCharacterWasClosedMessage) {
PlayerCharacterWasClosedMessage cmessage = (PlayerCharacterWasClosedMessage) message;
model.remove(cmessage.getPC());
}
}
use of pcgen.pluginmgr.messages.PlayerCharacterWasClosedMessage in project pcgen by PCGen.
the class PCGTrackerPlugin method removeSelected.
private void removeSelected() {
for (Object obj : theView.getLoadedList().getSelectedValuesList()) {
PlayerCharacter pc = model.get(obj);
model.removeElement(obj);
messageHandler.handleMessage(new PlayerCharacterWasClosedMessage(this, pc));
}
}
Aggregations