Package ch.fork.AdHocRailway.ui.turnouts.configuration

Examples of ch.fork.AdHocRailway.ui.turnouts.configuration.TurnoutConfig$CancelAction


                        "Please configure a group first", "Add Turnouts",
                        JOptionPane.INFORMATION_MESSAGE,
                        createImageIcon("messagebox_info.png"));
                return;
            }
            TurnoutConfig config = null;
            int selectedGroupPane = turnoutGroupsTabbedPane.getSelectedIndex();

            do {
                TurnoutGroup selectedTurnoutGroup = indexToTurnoutGroup
                        .get(selectedGroupPane);
                int nextNumber = 0;
                TurnoutPersistenceIface turnoutPersistence = AdHocRailway
                        .getInstance().getTurnoutPersistence();
                if (Preferences
                        .getInstance()
                        .getBooleanValue(
                                PreferencesKeys.USE_FIXED_TURNOUT_AND_ROUTE_GROUP_SIZES)) {
                    nextNumber = turnoutPersistence
                            .getNextFreeTurnoutNumberOfGroup(selectedTurnoutGroup);
                    if (nextNumber == -1) {
                        JOptionPane.showMessageDialog(
                                AdHocRailway.getInstance(),
                                "No more free numbers in this group", "Error",
                                JOptionPane.ERROR_MESSAGE);
                        AdHocRailway.getInstance().updateGUI();
                        turnoutGroupsTabbedPane
                                .setSelectedIndex(selectedGroupPane);
                        return;
                    }
                } else {
                    nextNumber = turnoutPersistence.getNextFreeTurnoutNumber();
                }

                Turnout newTurnout = new Turnout();
                newTurnout.setNumber(nextNumber);

                newTurnout.setBus1(Preferences.getInstance().getIntValue(
                        PreferencesKeys.DEFAULT_TURNOUT_BUS));
                newTurnout.setBus2(Preferences.getInstance().getIntValue(
                        PreferencesKeys.DEFAULT_TURNOUT_BUS));

                newTurnout.setTurnoutGroup(selectedTurnoutGroup);
                newTurnout.setDefaultStateEnum(SRCPTurnoutState.STRAIGHT);
                newTurnout.setOrientationEnum(TurnoutOrientation.EAST);
                newTurnout.setTurnoutType(turnoutPersistence
                        .getTurnoutType(SRCPTurnoutTypes.DEFAULT));

                config = new TurnoutConfig(AdHocRailway.getInstance(),
                        newTurnout);
            } while (!config.isCancelPressed());
            AdHocRailway.getInstance().updateGUI();
            turnoutGroupsTabbedPane.setSelectedIndex(selectedGroupPane);
        }
View Full Code Here


                return;
            TurnoutControlIface turnoutControl = AdHocRailway.getInstance()
                    .getTurnoutControl();

            turnoutControl.removeTurnoutChangeListener(TurnoutWidget.this);
            new TurnoutConfig(AdHocRailway.getInstance(), turnout);
            validateTurnout();
            turnoutControl.update();
            turnoutControl
                    .addTurnoutChangeListener(turnout, TurnoutWidget.this);
View Full Code Here

TOP

Related Classes of ch.fork.AdHocRailway.ui.turnouts.configuration.TurnoutConfig$CancelAction

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.