Search in sources :

Example 1 with FocusOrStateChangeOccurredMessage

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);
}
Also used : RequestFileOpenedMessageForCurrentlyOpenedPCsMessage(pcgen.pluginmgr.messages.RequestFileOpenedMessageForCurrentlyOpenedPCsMessage) FocusOrStateChangeOccurredMessage(pcgen.pluginmgr.messages.FocusOrStateChangeOccurredMessage)

Example 2 with FocusOrStateChangeOccurredMessage

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));
}
Also used : FocusOrStateChangeOccurredMessage(pcgen.pluginmgr.messages.FocusOrStateChangeOccurredMessage)

Example 3 with FocusOrStateChangeOccurredMessage

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();
        }
    }
}
Also used : FileMenuSaveMessage(gmgen.pluginmgr.messages.FileMenuSaveMessage) FocusOrStateChangeOccurredMessage(pcgen.pluginmgr.messages.FocusOrStateChangeOccurredMessage) CombatHasBeenInitiatedMessage(gmgen.pluginmgr.messages.CombatHasBeenInitiatedMessage)

Example 4 with FocusOrStateChangeOccurredMessage

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());
    }
}
Also used : PlayerCharacterWasLoadedMessage(pcgen.pluginmgr.messages.PlayerCharacterWasLoadedMessage) FocusOrStateChangeOccurredMessage(pcgen.pluginmgr.messages.FocusOrStateChangeOccurredMessage) FileMenuOpenMessage(gmgen.pluginmgr.messages.FileMenuOpenMessage) PlayerCharacterWasClosedMessage(pcgen.pluginmgr.messages.PlayerCharacterWasClosedMessage) GMGenBeingClosedMessage(gmgen.pluginmgr.messages.GMGenBeingClosedMessage)

Aggregations

FocusOrStateChangeOccurredMessage (pcgen.pluginmgr.messages.FocusOrStateChangeOccurredMessage)4 CombatHasBeenInitiatedMessage (gmgen.pluginmgr.messages.CombatHasBeenInitiatedMessage)1 FileMenuOpenMessage (gmgen.pluginmgr.messages.FileMenuOpenMessage)1 FileMenuSaveMessage (gmgen.pluginmgr.messages.FileMenuSaveMessage)1 GMGenBeingClosedMessage (gmgen.pluginmgr.messages.GMGenBeingClosedMessage)1 PlayerCharacterWasClosedMessage (pcgen.pluginmgr.messages.PlayerCharacterWasClosedMessage)1 PlayerCharacterWasLoadedMessage (pcgen.pluginmgr.messages.PlayerCharacterWasLoadedMessage)1 RequestFileOpenedMessageForCurrentlyOpenedPCsMessage (pcgen.pluginmgr.messages.RequestFileOpenedMessageForCurrentlyOpenedPCsMessage)1