Search in sources :

Example 1 with AbstractSignalHeadManager

use of jmri.managers.AbstractSignalHeadManager in project JMRI by JMRI.

the class AbstractSignalHeadManagerXml method replaceSignalHeadManager.

/**
     * Replace the current signal head manager, if there is one, with one newly
     * created during a load operation. This is skipped if they are of the same
     * absolute type.
     */
protected void replaceSignalHeadManager() {
    if (InstanceManager.getDefault(jmri.SignalHeadManager.class).getClass().getName().equals(AbstractSignalHeadManager.class.getName())) {
        return;
    }
    // if old manager exists, remove it from configuration process
    if (InstanceManager.getNullableDefault(jmri.SignalHeadManager.class) != null) {
        InstanceManager.getDefault(jmri.ConfigureManager.class).deregister(InstanceManager.getDefault(jmri.SignalHeadManager.class));
    }
    // register new one with InstanceManager
    AbstractSignalHeadManager pManager = new AbstractSignalHeadManager();
    InstanceManager.setSignalHeadManager(pManager);
    // register new one for configuration
    ConfigureManager cm = InstanceManager.getNullableDefault(jmri.ConfigureManager.class);
    if (cm != null) {
        cm.registerConfig(pManager, jmri.Manager.SIGNALHEADS);
    }
}
Also used : ConfigureManager(jmri.ConfigureManager) AbstractSignalHeadManager(jmri.managers.AbstractSignalHeadManager) SignalHeadManager(jmri.SignalHeadManager) AbstractSignalHeadManager(jmri.managers.AbstractSignalHeadManager)

Example 2 with AbstractSignalHeadManager

use of jmri.managers.AbstractSignalHeadManager in project JMRI by JMRI.

the class JUnitUtil method initInternalSignalHeadManager.

public static void initInternalSignalHeadManager() {
    SignalHeadManager m = new AbstractSignalHeadManager();
    InstanceManager.setSignalHeadManager(m);
    if (InstanceManager.getNullableDefault(ConfigureManager.class) != null) {
        InstanceManager.getDefault(ConfigureManager.class).registerConfig(m, jmri.Manager.SIGNALHEADS);
    }
}
Also used : ConfigureManager(jmri.ConfigureManager) AbstractSignalHeadManager(jmri.managers.AbstractSignalHeadManager) SignalHeadManager(jmri.SignalHeadManager) AbstractSignalHeadManager(jmri.managers.AbstractSignalHeadManager)

Aggregations

ConfigureManager (jmri.ConfigureManager)2 SignalHeadManager (jmri.SignalHeadManager)2 AbstractSignalHeadManager (jmri.managers.AbstractSignalHeadManager)2