Examples of TurnoutType


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

    public Component getListCellRendererComponent(JList list, Object value,
            int index, boolean isSelected, boolean cellHasFocus) {
        JLabel iconLabel = (JLabel) super.getListCellRendererComponent(list,
                value, index, isSelected, cellHasFocus);
        iconLabel.setHorizontalAlignment(SwingConstants.CENTER);
        TurnoutType type = (TurnoutType) value;
        iconLabel.setText("");
        if (type.getTurnoutTypeEnum() == SRCPTurnoutTypes.DEFAULT) {
            iconLabel.setIcon(ImageTools
                    .createImageIcon("switches/default_switch_small.png"));
        } else if (type.getTurnoutTypeEnum() == SRCPTurnoutTypes.DOUBLECROSS) {
            iconLabel.setIcon(ImageTools
                    .createImageIcon("switches/double_cross_switch_small.png"));
        } else if (type.getTurnoutTypeEnum() == SRCPTurnoutTypes.THREEWAY) {
            iconLabel.setIcon(ImageTools
                    .createImageIcon("switches/three_way_switch_small.png"));
        }
        return iconLabel;
    }
View Full Code Here

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

    }

    class TurnoutTypeSelectionListener implements ActionListener {

        public void actionPerformed(ActionEvent e) {
            TurnoutType selectedTurnoutType = (TurnoutType) turnoutTypeComboBox
                    .getSelectedItem();
            switch (selectedTurnoutType.getTurnoutTypeEnum()) {
            case DEFAULT:
            case DOUBLECROSS:
                bus2TextField.setValue(0);
                bus2TextField.setEnabled(false);
                address2TextField.setValue(0);
View Full Code Here

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

    public Component getTableCellRendererComponent(JTable table, Object value,
            boolean isSelected, boolean hasFocus, int row, int column) {
        JLabel iconLabel = (JLabel) super.getTableCellRendererComponent(table,
                value, isSelected, hasFocus, row, column);
        iconLabel.setHorizontalAlignment(SwingConstants.CENTER);
        TurnoutType type = (TurnoutType) value;
        iconLabel.setText("");
        if (type.getTurnoutTypeEnum() == SRCPTurnoutTypes.DEFAULT) {
            iconLabel.setIcon(ImageTools
                    .createImageIcon("switches/default_switch_small.png"));
        } else if (type.getTurnoutTypeEnum() == SRCPTurnoutTypes.DOUBLECROSS) {
            iconLabel.setIcon(ImageTools
                    .createImageIcon("switches/double_cross_switch_small.png"));
        } else if (type.getTurnoutTypeEnum() == SRCPTurnoutTypes.THREEWAY) {
            iconLabel.setIcon(ImageTools
                    .createImageIcon("switches/three_way_switch_small.png"));
        }

        return iconLabel;
View Full Code Here

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

            e.printStackTrace();
        }
        if (locomotivePersistence instanceof HibernateLocomotivePersistence) {
        }

        TurnoutType defaultType = new TurnoutType(0, "DEFAULT");
        TurnoutType doublecrossType = new TurnoutType(0, "DOUBLECROSS");
        TurnoutType threewayType = new TurnoutType(0, "THREEWAY");

        turnoutPersistence.addTurnoutType(defaultType);
        turnoutPersistence.addTurnoutType(doublecrossType);
        turnoutPersistence.addTurnoutType(threewayType);
View Full Code Here

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

        String defaultstate = attributes.getValue("defaultstate");
        String orientation = attributes.getValue("orientation");
        int number = Integer.parseInt(attributes.getValue("number"));

        if (type.equals("DefaultSwitch")) {
            TurnoutType turnoutType = turnoutPersistence
                    .getTurnoutType(SRCPTurnoutTypes.DEFAULT);
            actualTurnout = new Turnout(0, turnoutType, actualTurnoutGroup,
                    number, desc, defaultstate.toUpperCase(),
                    orientation.toUpperCase(), 0, 0, false);
            actualAddresses = new Address[1];
            turnoutType.getTurnouts().add(actualTurnout);
        } else if (type.equals("DoubleCrossSwitch")) {
            TurnoutType turnoutType = turnoutPersistence
                    .getTurnoutType(SRCPTurnoutTypes.DOUBLECROSS);
            actualTurnout = new Turnout(0, turnoutType, actualTurnoutGroup,
                    number, desc, defaultstate.toUpperCase(),
                    orientation.toUpperCase(), 0, 0, false);
            actualAddresses = new Address[1];
            turnoutType.getTurnouts().add(actualTurnout);
        } else if (type.equals("ThreeWaySwitch")) {
            TurnoutType turnoutType = turnoutPersistence
                    .getTurnoutType(SRCPTurnoutTypes.THREEWAY);
            actualTurnout = new Turnout(0, turnoutType, actualTurnoutGroup,
                    number, desc, defaultstate.toUpperCase(),
                    orientation.toUpperCase(), 0, 0, false);
            actualAddresses = new Address[2];
            turnoutType.getTurnouts().add(actualTurnout);
        }
    }
View Full Code Here

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

        String desc = attributes.getValue("desc");
        String defaultstate = attributes.getValue("defaultstate");
        String orientation = attributes.getValue("orientation");
        int number = Integer.parseInt(attributes.getValue("number"));
        if (type.toUpperCase().equals("DEFAULT")) {
            TurnoutType turnoutType = turnoutPersistence
                    .getTurnoutType(SRCPTurnoutTypes.DEFAULT);
            actualTurnout = new Turnout(0, turnoutType, actualTurnoutGroup,
                    number, desc, defaultstate.toUpperCase(),
                    orientation.toUpperCase(), 0, 0, false);
            actualAddresses = new Address[1];
            turnoutType.getTurnouts().add(actualTurnout);
        } else if (type.toUpperCase().equals("DOUBLECROSS")) {
            TurnoutType turnoutType = turnoutPersistence
                    .getTurnoutType(SRCPTurnoutTypes.DOUBLECROSS);
            actualTurnout = new Turnout(0, turnoutType, actualTurnoutGroup,
                    number, desc, defaultstate.toUpperCase(),
                    orientation.toUpperCase(), 0, 0, false);
            actualAddresses = new Address[1];
            turnoutType.getTurnouts().add(actualTurnout);
        } else if (type.toUpperCase().equals("THREEWAY")) {
            TurnoutType turnoutType = turnoutPersistence
                    .getTurnoutType(SRCPTurnoutTypes.THREEWAY);
            actualTurnout = new Turnout(0, turnoutType, actualTurnoutGroup,
                    number, desc, defaultstate.toUpperCase(),
                    orientation.toUpperCase(), 0, 0, false);
            actualAddresses = new Address[2];
            turnoutType.getTurnouts().add(actualTurnout);
        }
    }
View Full Code Here

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

        } catch (LocomotivePersistenceException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        TurnoutType defaultType = new TurnoutType(0, "DEFAULT");
        TurnoutType doublecrossType = new TurnoutType(0, "DOUBLECROSS");
        TurnoutType threewayType = new TurnoutType(0, "THREEWAY");

        turnoutPersistence.addTurnoutType(defaultType);
        turnoutPersistence.addTurnoutType(doublecrossType);
        turnoutPersistence.addTurnoutType(threewayType);
View Full Code Here

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

        String orientation = attributes.getValue("orientation");
        int number = Integer.parseInt(attributes.getValue("number"));

        if (type.toUpperCase().equals("DEFAULT")
                || type.toUpperCase().equals("DEFAULTSWITCH")) {
            TurnoutType turnoutType = turnoutPersistence
                    .getTurnoutType(SRCPTurnoutTypes.DEFAULT);
            actualTurnout = new Turnout(0, turnoutType, actualTurnoutGroup,
                    number, desc, defaultstate.toUpperCase(),
                    orientation.toUpperCase(), 0, 0, false);
            actualAddresses = new Address[1];
            turnoutType.getTurnouts().add(actualTurnout);
        } else if (type.toUpperCase().equals("DOUBLECROSS")
                || type.toUpperCase().equals("DOUBLECROSSSWITCH")) {
            TurnoutType turnoutType = turnoutPersistence
                    .getTurnoutType(SRCPTurnoutTypes.DOUBLECROSS);
            actualTurnout = new Turnout(0, turnoutType, actualTurnoutGroup,
                    number, desc, defaultstate.toUpperCase(),
                    orientation.toUpperCase(), 0, 0, false);
            actualAddresses = new Address[1];
            turnoutType.getTurnouts().add(actualTurnout);
        } else if (type.toUpperCase().equals("THREEWAY")
                || type.toUpperCase().equals("THREEWAYSWITCH")) {
            TurnoutType turnoutType = turnoutPersistence
                    .getTurnoutType(SRCPTurnoutTypes.THREEWAY);
            actualTurnout = new Turnout(0, turnoutType, actualTurnoutGroup,
                    number, desc, defaultstate.toUpperCase(),
                    orientation.toUpperCase(), 0, 0, false);
            actualAddresses = new Address[2];
            turnoutType.getTurnouts().add(actualTurnout);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.