Package ch.fork.AdHocRailway.domain.locomotives

Examples of ch.fork.AdHocRailway.domain.locomotives.Locomotive


        public void run() {
            try {
                LocomotiveControlface locomotiveControl = AdHocRailway
                        .getInstance().getLocomotiveControl();
                for (LocomotiveWidget widget : locomotiveWidgets) {
                    Locomotive myLocomotive = widget.getMyLocomotive();
                    if (myLocomotive == null)
                        continue;
                    if (locomotiveControl.isLocked(myLocomotive)
                            && !locomotiveControl.isLockedByMe(myLocomotive))
                        continue;
View Full Code Here


        private LocomotiveTableModel(ListModel listModel) {
            super(listModel, COLUMNS);
        }

        public Object getValueAt(int rowIndex, int columnIndex) {
            Locomotive locomotive = getRow(rowIndex);
            switch (columnIndex) {
            case 0:
                return locomotive.getName();
            case 1:
                return locomotive.getLocomotiveType();
            case 2:
                return locomotive.getBus();
            case 3:
                return locomotive.getAddress();
            case 4:
                return locomotive.getImage();
            case 5:
                return locomotive.getDescription();
            default:
                throw new IllegalStateException("Unknown column");
            }
        }
View Full Code Here

        }

        public void actionPerformed(ActionEvent e) {
            LocomotiveGroup selectedLocomotiveGroup = (LocomotiveGroup) (locomotiveGroupList
                    .getSelectedValue());
            Locomotive newLocomotive = new Locomotive();
            newLocomotive.setLocomotiveGroup(selectedLocomotiveGroup);
            selectedLocomotiveGroup.getLocomotives().add(newLocomotive);
            LocomotiveConfig locomotiveConfig = new LocomotiveConfig(
                    LocomotiveConfigurationDialog.this, newLocomotive);
            if (locomotiveConfig.isOkPressed()) {
                selectedLocomotiveGroup.getLocomotives().add(newLocomotive);
View Full Code Here

        public void actionPerformed(ActionEvent e) {
            LocomotiveGroup selectedLocomotiveGroup = (LocomotiveGroup) locomotiveGroupList
                    .getSelectedValue();

            int row = locomotivesTable.getSelectedRow();
            Locomotive locomotiveToDelete = locomotiveModel.getElementAt(row);

            LocomotivePersistenceIface locomotivePersistence = AdHocRailway
                    .getInstance().getLocomotivePersistence();
            locomotivePersistence.deleteLocomotive(locomotiveToDelete);
            List<Locomotive> locomotives = new ArrayList<Locomotive>(
View Full Code Here

    public boolean isCancelPressed() {
        return cancelPressed;
    }

    public void propertyChange(PropertyChangeEvent event) {
        Locomotive locomotive = presentationModel.getBean();
        if (!validate(locomotive, event))
            return;
    }
View Full Code Here

        public ApplyChangesAction() {
            super("OK");
        }

        public void actionPerformed(ActionEvent e) {
            Locomotive locomotive = presentationModel.getBean();
            LocomotivePersistenceIface locomotivePersistence = AdHocRailway
                    .getInstance().getLocomotivePersistence();
            if (locomotive.getId() == 0) {
                locomotivePersistence.addLocomotive(locomotive);
            } else {
                locomotivePersistence.updateLocomotive(locomotive);
            }
View Full Code Here

        public CancelAction() {
            super("Cancel");
        }

        public void actionPerformed(ActionEvent e) {
            Locomotive locomotive = presentationModel.getBean();
            locomotive.removePropertyChangeListener(LocomotiveConfig.this);
            okPressed = false;
            cancelPressed = true;
            LocomotiveConfig.this.setVisible(false);
        }
View Full Code Here

        int address = Integer.parseInt(attributes.getValue("address"));

        if (type.equals("DeltaLocomotive")) {
            LocomotiveType locomotiveType = locomotivePersistence
                    .getLocomotiveTypeByName("DELTA");
            actualLocomotive = new Locomotive(0, actualLocomotiveGroup,
                    locomotiveType, name, desc, "", address, bus);
            locomotiveType.getLocomotives().add(actualLocomotive);
        } else if (type.equals("DigitalLocomotive")) {
            LocomotiveType locomotiveType = locomotivePersistence
                    .getLocomotiveTypeByName("DIGITAL");
            actualLocomotive = new Locomotive(0, actualLocomotiveGroup,
                    locomotiveType, name, desc, "", address, bus);
            locomotiveType.getLocomotives().add(actualLocomotive);
        }
    }
View Full Code Here

        int bus = Integer.parseInt(attributes.getValue("bus"));
        int address = Integer.parseInt(attributes.getValue("address"));
        if (type.toUpperCase().equals("DELTA")) {
            LocomotiveType locomotiveType = locomotivePersistence
                    .getLocomotiveTypeByName("DELTA");
            actualLocomotive = new Locomotive(0, actualLocomotiveGroup,
                    locomotiveType, name, desc, "", address, bus);
            locomotiveType.getLocomotives().add(actualLocomotive);
        } else if (type.toUpperCase().equals("DIGITAL")) {
            LocomotiveType locomotiveType = locomotivePersistence
                    .getLocomotiveTypeByName("DIGITAL");
            actualLocomotive = new Locomotive(0, actualLocomotiveGroup,
                    locomotiveType, name, desc, "", address, bus);
            locomotiveType.getLocomotives().add(actualLocomotive);
        }
    }
View Full Code Here

        if (type.toUpperCase().equals("DELTA")
                || type.toUpperCase().equals("DELTALOCOMOTIVE")) {
            LocomotiveType locomotiveType = locomotivePersistence
                    .getLocomotiveTypeByName("DELTA");
            actualLocomotive = new Locomotive(0, actualLocomotiveGroup,
                    locomotiveType, name, desc, "", address, bus);
            locomotiveType.getLocomotives().add(actualLocomotive);
        } else if (type.toUpperCase().equals("DIGITAL")
                || type.toUpperCase().equals("DIGITALLOCOMOTIVE")) {
            LocomotiveType locomotiveType = locomotivePersistence
                    .getLocomotiveTypeByName("DIGITAL");
            actualLocomotive = new Locomotive(0, actualLocomotiveGroup,
                    locomotiveType, name, desc, "", address, bus);
            locomotiveType.getLocomotives().add(actualLocomotive);
        }
    }
View Full Code Here

TOP

Related Classes of ch.fork.AdHocRailway.domain.locomotives.Locomotive

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.