Package ch.fork.AdHocRailway.domain.turnouts

Examples of ch.fork.AdHocRailway.domain.turnouts.TurnoutControlIface


        indexToTurnoutGroup.clear();
        turnoutGroupsTabbedPane.removeAll();
        int maxTurnoutCols = preferences
                .getIntValue(PreferencesKeys.TURNOUT_CONTROLES);
        int i = 1;
        TurnoutControlIface turnoutControl = AdHocRailway.getInstance()
                .getTurnoutControl();

        turnoutControl.removeAllTurnoutChangeListener();

        TurnoutPersistenceIface turnoutPersistence = AdHocRailway.getInstance()
                .getTurnoutPersistence();

        for (TurnoutGroup turnoutGroup : turnoutPersistence
View Full Code Here


            public void run() {
                try {
                    TurnoutPersistenceIface turnoutPersistence = AdHocRailway
                            .getInstance().getTurnoutPersistence();
                    TurnoutControlIface turnoutControl = AdHocRailway
                            .getInstance().getTurnoutControl();

                    for (Turnout t : turnoutPersistence.getAllTurnouts()) {
                        turnoutControl.setDefaultState(t);
                        Thread.sleep(Preferences.getInstance().getIntValue(
                                PreferencesKeys.ROUTING_DELAY));
                    }
                } catch (TurnoutException e1) {
                    ExceptionProcessor.getInstance().processException(e1);
View Full Code Here

            historyStack.removeFirst();
            historyWidgets.removeFirst();
        }
        historyStack.addFirst(obj);
        JPanel w = null;
        TurnoutControlIface turnoutControl = AdHocRailway.getInstance()
                .getTurnoutControl();

        if (obj instanceof Turnout) {
            Turnout turnout = (Turnout) obj;
            w = new StaticTurnoutWidget(turnout,
                    turnoutControl.getTurnoutState(turnout));
        } else if (obj instanceof Route) {
            w = new RouteWidget((Route) obj);
        } else {
            return;
        }
View Full Code Here

        public void actionPerformed(ActionEvent e) {

            try {
                RouteControlIface routeControl = AdHocRailway.getInstance()
                        .getRouteControl();
                TurnoutControlIface turnoutControl = AdHocRailway.getInstance()
                        .getTurnoutControl();

                String enteredNumberAsString = enteredNumberKeys.toString();
                if (enteredNumberKeys.toString().equals("")) {
                    if (historyStack.size() == 0)
                        return;
                    Object obj = historyStack.removeFirst();
                    if (obj instanceof Turnout) {
                        Turnout t = (Turnout) obj;
                        turnoutControl.setDefaultState(t);
                    } else if (obj instanceof Route) {
                        Route r = (Route) obj;
                        routeControl.disableRoute(r);
                    } else {
                        return;
View Full Code Here

            searchedTurnout = turnoutPersistence
                    .getTurnoutByNumber(enteredNumber);
            if (searchedTurnout == null) {
                return;
            }
            TurnoutControlIface turnoutControl = AdHocRailway.getInstance()
                    .getTurnoutControl();

            if (this instanceof CurvedLeftAction) {
                turnoutControl.setCurvedLeft(searchedTurnout);
            } else if (this instanceof StraightAction) {
                turnoutControl.setStraight(searchedTurnout);
            } else if (this instanceof CurvedRightAction) {
                turnoutControl.setCurvedRight(searchedTurnout);
            } else if (this instanceof EnableRouteAction) {
                if (!searchedTurnout.isThreeWay()) {
                    turnoutControl.setNonDefaultState(searchedTurnout);
                }
            } else if (this instanceof DisableRouteAction) {
                if (!searchedTurnout.isThreeWay()) {
                    turnoutControl.setDefaultState(searchedTurnout);
                }
            }
            updateHistory(searchedTurnout);
        }
View Full Code Here

    }

    public void setEnabled(boolean enabled) {
        super.setEnabled(enabled);

        TurnoutControlIface turnoutControl = AdHocRailway.getInstance()
                .getTurnoutControl();
        turnoutControl.removeTurnoutChangeListener(this);
        if (!enabled) {
            setBackground(new Color(255, 177, 177));
        } else {
            // setBackground(defaultBackground);
            turnoutControl.addTurnoutChangeListener(turnout, this);
        }
        widgetEnabled = enabled;
        turnoutCanvas.setTurnoutState(SRCPTurnoutState.UNDEF);
    }
View Full Code Here

    private class MouseAction extends MouseAdapter {
        public void mouseClicked(MouseEvent e) {
            if (!widgetEnabled)
                return;
            TurnoutControlIface turnoutControl = AdHocRailway.getInstance()
                    .getTurnoutControl();

            if (e.getClickCount() == 1 && e.getButton() == MouseEvent.BUTTON1) {
                try {
                    if (!testMode)
                        turnoutControl.toggle(turnout);
                    else
                        turnoutControl.toggleTest(turnout);
                } catch (TurnoutException e1) {
                    ExceptionProcessor.getInstance().processException(e1);
                }
            } else if (e.getClickCount() == 1
                    && e.getButton() == MouseEvent.BUTTON3) {
View Full Code Here

        }

        private void displaySwitchConfig() {
            if (testMode)
                return;
            TurnoutControlIface turnoutControl = AdHocRailway.getInstance()
                    .getTurnoutControl();

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

            turnoutChanged(turnout, actualTurnoutState);
        }
View Full Code Here

TOP

Related Classes of ch.fork.AdHocRailway.domain.turnouts.TurnoutControlIface

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.