Search in sources :

Example 1 with SystemConsoleConfigPanel

use of apps.SystemConsoleConfigPanel in project JMRI by JMRI.

the class SystemConsoleConfigPanelXml method load.

@Override
public boolean load(Element shared, Element perNode) throws Exception {
    boolean result = true;
    String value;
    SystemConsolePreferencesManager manager = InstanceManager.getDefault(SystemConsolePreferencesManager.class);
    try {
        if ((value = shared.getAttributeValue("scheme")) != null) {
            manager.setScheme(Integer.parseInt(value));
        }
        if ((value = shared.getAttributeValue("fontfamily")) != null) {
            manager.setFontFamily(value);
        }
        if ((value = shared.getAttributeValue("fontsize")) != null) {
            manager.setFontSize(Integer.parseInt(value));
        }
        if ((value = shared.getAttributeValue("fontstyle")) != null) {
            manager.setFontStyle(Integer.parseInt(value));
        }
        if ((value = shared.getAttributeValue("wrapstyle")) != null) {
            manager.setWrapStyle(Integer.parseInt(value));
        }
    } catch (NumberFormatException ex) {
        log.error("NumberFormatException while setting System Console parameters: " + ex);
        result = false;
    }
    // As we've had a load request, register the system console with the
    // preference manager
    ConfigureManager cm = jmri.InstanceManager.getNullableDefault(jmri.ConfigureManager.class);
    if (cm != null) {
        cm.registerPref(new SystemConsoleConfigPanel());
    }
    return result;
}
Also used : ConfigureManager(jmri.ConfigureManager) SystemConsoleConfigPanel(apps.SystemConsoleConfigPanel) SystemConsolePreferencesManager(apps.systemconsole.SystemConsolePreferencesManager)

Aggregations

SystemConsoleConfigPanel (apps.SystemConsoleConfigPanel)1 SystemConsolePreferencesManager (apps.systemconsole.SystemConsolePreferencesManager)1 ConfigureManager (jmri.ConfigureManager)1