001package jmri.jmrit.vsdecoder;
002
003import java.beans.PropertyChangeEvent;
004import java.beans.PropertyChangeListener;
005import javax.swing.JPanel;
006
007/**
008 * <hr>
009 * This file is part of JMRI.
010 * <p>
011 * JMRI is free software; you can redistribute it and/or modify it under 
012 * the terms of version 2 of the GNU General Public License as published 
013 * by the Free Software Foundation. See the "COPYING" file for a copy
014 * of this license.
015 * <p>
016 * JMRI is distributed in the hope that it will be useful, but WITHOUT 
017 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
018 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
019 * for more details.
020 * <p>
021 *
022 * @author Mark Underwood Copyright (C) 2011
023 * @author Klaus Killinger Copyright (C) 2018
024 */
025public class EnginePane extends JPanel {
026    // Superclass for Diesel, Steam, Electric panes.
027    // Doesn't really do anything.
028
029    String name;
030    EngineSoundEvent engine;
031    private boolean force_stop_at_zero;
032
033    public EnginePane(String n, EngineSoundEvent e) {
034        super();
035        name = n;
036        engine = e;
037        listenerList = new javax.swing.event.EventListenerList();
038    }
039
040    public EnginePane(String n) {
041        this(n, null);
042    }
043
044    public EnginePane() {
045        this(null, null);
046    }
047
048    public void init() {
049    }
050
051    public void initContext(Object context) {
052        initComponents();
053    }
054
055    public void initComponents() {
056    }
057
058    @Override
059    public String getName() {
060        return name;
061    }
062
063    @Override
064    public void setName(String n) {
065        name = n;
066    }
067
068    public EngineSoundEvent getEngine() {
069        return engine;
070    }
071
072    public void setEngine(EngineSoundEvent e) {
073        engine = e;
074    }
075
076    public void setThrottle(int t) {
077    }
078
079    public void setSpeed(float s) {
080    }
081
082    void setStopOption(boolean m) {
083        force_stop_at_zero = m;
084    }
085
086    public boolean getStopOption() {
087        return force_stop_at_zero;
088    }
089
090    public void startButtonClick() {
091    }
092
093    public void setButtonDelay(long t) {
094    }
095
096    @Override
097    public void addPropertyChangeListener(PropertyChangeListener listener) {
098        listenerList.add(PropertyChangeListener.class, listener);
099    }
100
101    @Override
102    public void removePropertyChangeListener(PropertyChangeListener listener) {
103        listenerList.remove(PropertyChangeListener.class, listener);
104    }
105
106    protected void firePropertyChangeEvent(PropertyChangeEvent evt) {
107        //Object[] listeners = listenerList.getListenerList();
108
109        for (PropertyChangeListener l : listenerList.getListeners(PropertyChangeListener.class)) {
110            l.propertyChange(evt);
111        }
112    }
113
114}