Package ch.fork.AdHocRailway.domain.routes

Examples of ch.fork.AdHocRailway.domain.routes.Route


        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting())
                return;
            if (routesList.getSelectedIndex() == -1)
                routesList.setSelectedIndex(0);
            Route selectedRoute = (Route) routesList.getSelectedValue();
            if (selectedRoute == null)
                return;
        }
View Full Code Here


        public Component getListCellRendererComponent(JList list, Object value,
                int index, boolean isSelected, boolean cellHasFocus) {
            Component component = super.getListCellRendererComponent(list,
                    value, index, isSelected, cellHasFocus);

            Route route = (Route) value;
            setText(route == null ? "" : (" " + route.getName()));
            return component;
        }
View Full Code Here

                }
            } else {
                nextNumber = routePersistence.getNextFreeRouteNumber();
            }

            Route newRoute = new Route();
            newRoute.setName(newRouteName);
            newRoute.setNumber(nextNumber);
            selectedRouteGroup.getRoutes().add(newRoute);

            newRoute.setRouteGroup(selectedRouteGroup);
            try {
                routePersistence.addRoute(newRoute);

                List<Route> routes = new ArrayList<Route>(
                        selectedRouteGroup.getRoutes());
View Full Code Here

        public void actionPerformed(ActionEvent e) {

            // PresentationModel<Turnout> model = new
            // PresentationModel<Turnout>(
            // turnoutModel);
            Route route = (Route) routesList.getSelectedValue();
            PresentationModel<Route> model = new PresentationModel<Route>(route);
            if (model == null)
                return;
            new RouteConfig(RoutesConfigurationDialog.this, model);
        }
View Full Code Here

        }

        public void actionPerformed(ActionEvent e) {
            RouteGroup selectedRouteGroup = (RouteGroup) (routeGroupList
                    .getSelectedValue());
            Route routeToDelete = (Route) (routesList.getSelectedValue());
            if (routeToDelete == null) {
                JOptionPane.showMessageDialog(RoutesConfigurationDialog.this,
                        "Please select a route", "Error",
                        JOptionPane.ERROR_MESSAGE);
                return;
            }
            int response = JOptionPane.showConfirmDialog(
                    RoutesConfigurationDialog.this, "Really remove Route '"
                            + routeToDelete.getName() + "' ?", "Remove Route",
                    JOptionPane.YES_NO_OPTION);
            if (response == JOptionPane.YES_OPTION) {
                try {
                    RoutePersistenceIface routePersistence = AdHocRailway
                            .getInstance().getRoutePersistence();
View Full Code Here

        }

    }

    public void propertyChange(PropertyChangeEvent evt) {
        Route route = presentationModel.getBean();
        if (!validate(route))
            return;
    }
View Full Code Here

            super("Record", ImageTools.createImageIcon("record_off.png"));
        }

        public void actionPerformed(ActionEvent e) {
            if (!recording) {
                Route selectedRoute = (Route) (presentationModel.getBean());
                if (selectedRoute == null) {
                    JOptionPane
                            .showMessageDialog(
                                    RouteConfig.this,
                                    "Please select a route",
View Full Code Here

        public RemoveRouteItemAction() {
            super("Remove Turnout", ImageTools.createImageIcon("remove.png"));
        }

        public void actionPerformed(ActionEvent e) {
            Route selectedRoute = (Route) (presentationModel.getBean());
            RouteItem routeItem = routeItemModel.getSelection();
            if (routeItem == null)
                return;
            RoutePersistenceIface routePersistence = AdHocRailway.getInstance()
                    .getRoutePersistence();
            routePersistence.deleteRouteItem(routeItem);
            List<RouteItem> routeItems = new ArrayList<RouteItem>(
                    selectedRoute.getRouteItems());
            routeItemModel.setList(routeItems);
        }
View Full Code Here

        }

        public void actionPerformed(ActionEvent e) {
            RoutePersistenceIface routePersistence = AdHocRailway.getInstance()
                    .getRoutePersistence();
            Route route = presentationModel.getBean();
            if (route.getId() == 0) {
                routePersistence.addRoute(route);
            } else {
                routePersistence.updateRoute(route);
            }
            okPressed = true;
            route.removePropertyChangeListener(RouteConfig.this);
            RouteConfig.this.setVisible(false);

        }
View Full Code Here

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

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

TOP

Related Classes of ch.fork.AdHocRailway.domain.routes.Route

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.