use of pcgen.pluginmgr.messages.FocusOrStateChangeOccurredMessage in project pcgen by PCGen.
the class GMGenSystem method initialize.
private void initialize() {
Utility.configurePlatformUI();
if (SystemUtils.IS_OS_MAC_OSX) {
macOSXRegistration();
}
Utility.setApplicationTitle(APPLICATION_NAME);
inst = this;
initLogger();
createMenuBar();
theView = new GMGenSystemView();
pluginManager.addMember(this);
PluginManager.getInstance().startAllPlugins();
initComponents();
initSettings();
messageHandler.handleMessage(new RequestFileOpenedMessageForCurrentlyOpenedPCsMessage(this));
messageHandler.handleMessage(new FocusOrStateChangeOccurredMessage(this, editMenu));
inst.setVisible(true);
}
use of pcgen.pluginmgr.messages.FocusOrStateChangeOccurredMessage in project pcgen by PCGen.
the class GMGenSystem method stateUpdate.
/**
* Calls the necessary methods if an item on the GUI or model has changed.
*
* @param event - The event that has happened.
*/
private void stateUpdate(EventObject event) {
newFileItem.setEnabled(false);
openFileItem.setEnabled(false);
saveFileItem.setEnabled(false);
clearEditMenu();
messageHandler.handleMessage(new FocusOrStateChangeOccurredMessage(this, editMenu));
}
use of pcgen.pluginmgr.messages.FocusOrStateChangeOccurredMessage in project pcgen by PCGen.
the class ExperienceAdjusterPlugin 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 CombatHasBeenInitiatedMessage) {
if (message.getSource() == this) {
CombatHasBeenInitiatedMessage cmessage = (CombatHasBeenInitiatedMessage) message;
if (initList == null) {
initList = cmessage.getCombat();
}
eaModel.setCombat(initList);
}
update();
} else if (message instanceof FocusOrStateChangeOccurredMessage) {
if (isActive()) {
experienceToolsItem.setEnabled(false);
if (initList == null) {
messageHandler.handleMessage(new CombatHasBeenInitiatedMessage(this));
}
update();
} else {
experienceToolsItem.setEnabled(true);
}
} else if (message instanceof FileMenuSaveMessage) {
if (isActive()) {
handleExportButton();
}
}
}
use of pcgen.pluginmgr.messages.FocusOrStateChangeOccurredMessage 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());
}
}
Aggregations