Package ch.fork.AdHocRailway.technical.configuration

Examples of ch.fork.AdHocRailway.technical.configuration.Preferences


    public boolean isOkPressed() {
        return okPressed;
    }

    private void loadPreferences() {
        Preferences p = Preferences.getInstance();
        locomotiveControlNumberModel.setValue(p
                .getIntValue(LOCOMOTIVE_CONTROLES));
        switchControlNumberModel.setValue(p.getIntValue(TURNOUT_CONTROLES));
        routeControlNumberModel.setValue(p.getIntValue(ROUTE_CONTROLES));
        keyBoardLayoutComboBox.setSelectedItem(p
                .getStringValue(KEYBOARD_LAYOUT));
        writeLog.setSelected(p.getBooleanValue(LOGGING));
        fullscreen.setSelected(p.getBooleanValue(FULLSCREEN));
        tabbedTrackCheckBox.setSelected(p.getBooleanValue(TABBED_TRACK));
        fixedTurnoutGroupSizesCheckBox.setSelected(p
                .getBooleanValue(USE_FIXED_TURNOUT_AND_ROUTE_GROUP_SIZES));
        openLastFileCheckBox.setSelected(p.getBooleanValue(OPEN_LAST_FILE));

        defaultTurnoutBusModel.setValue(p.getIntValue(DEFAULT_TURNOUT_BUS));
        defaultLocomotiveBusModel.setValue(p
                .getIntValue(DEFAULT_LOCOMOTIVE_BUS));
        defaultActivationTimeModel.setValue(p.getIntValue(ACTIVATION_TIME));
        defaultRoutingDelayModel.setValue(p.getIntValue(ROUTING_DELAY));
        defaultLockDurationModel.setValue(p.getIntValue(LOCK_DURATION));
        interface6051.setSelected(p.getBooleanValue(INTERFACE_6051));

        hostnameTextField.setText(p.getStringValue(HOSTNAME));
        portnumberTextField.setText(Integer.toString(p.getIntValue(PORT)));
        autoconnectCheckBox.setSelected(p.getBooleanValue(AUTOCONNECT));

        useDatabaseCheckBox.setSelected(p.getBooleanValue(USE_DATABASE));
        databaseHostField.setText(p.getStringValue(DATABASE_HOST));
        databaseNameField.setText(p.getStringValue(DATABASE_NAME));
        databaseUserField.setText(p.getStringValue(DATABASE_USER));
        databasePasswordField.setText(p.getStringValue(DATABASE_PWD));
    }
View Full Code Here


        databaseUserField.setText(p.getStringValue(DATABASE_USER));
        databasePasswordField.setText(p.getStringValue(DATABASE_PWD));
    }

    public void savePreferences() {
        Preferences p = Preferences.getInstance();
        p.setIntValue(LOCOMOTIVE_CONTROLES, locomotiveControlNumberModel
                .getNumber().intValue());
        p.setIntValue(TURNOUT_CONTROLES, switchControlNumberModel.getNumber()
                .intValue());
        p.setIntValue(ROUTE_CONTROLES, routeControlNumberModel.getNumber()
                .intValue());
        p.setStringValue(KEYBOARD_LAYOUT, keyBoardLayoutComboBox
                .getSelectedItem().toString());
        p.setBooleanValue(LOGGING, writeLog.isSelected());
        p.setBooleanValue(FULLSCREEN, fullscreen.isSelected());
        p.setBooleanValue(TABBED_TRACK, tabbedTrackCheckBox.isSelected());
        p.setBooleanValue(USE_FIXED_TURNOUT_AND_ROUTE_GROUP_SIZES,
                fixedTurnoutGroupSizesCheckBox.isSelected());
        p.setBooleanValue(OPEN_LAST_FILE, openLastFileCheckBox.isSelected());

        p.setIntValue(DEFAULT_TURNOUT_BUS, defaultTurnoutBusModel.getNumber()
                .intValue());
        p.setIntValue(DEFAULT_LOCOMOTIVE_BUS, defaultLocomotiveBusModel
                .getNumber().intValue());
        p.setIntValue(ACTIVATION_TIME, defaultActivationTimeModel.getNumber()
                .intValue());
        p.setIntValue(ROUTING_DELAY, defaultRoutingDelayModel.getNumber()
                .intValue());
        p.setIntValue(LOCK_DURATION, defaultLockDurationModel.getNumber()
                .intValue());
        p.setBooleanValue(INTERFACE_6051, interface6051.isSelected());

        p.setStringValue(HOSTNAME, (String) hostnameTextField.getText());
        p.setIntValue(PORT, Integer.parseInt(portnumberTextField.getText()));
        p.setBooleanValue(AUTOCONNECT, autoconnectCheckBox.isSelected());

        p.setBooleanValue(USE_DATABASE, useDatabaseCheckBox.isSelected());
        p.setStringValue(DATABASE_HOST, (String) databaseHostField.getText());
        p.setStringValue(DATABASE_NAME, (String) databaseNameField.getText());
        p.setStringValue(DATABASE_USER, (String) databaseUserField.getText());
        p.setStringValue(DATABASE_PWD, (String) databasePasswordField.getText());
        try {
            p.save();
        } catch (FileNotFoundException e) {
            ExceptionProcessor.getInstance().processException(e);
        } catch (IOException e) {
            ExceptionProcessor.getInstance().processException(e);
        }
View Full Code Here

TOP

Related Classes of ch.fork.AdHocRailway.technical.configuration.Preferences

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.