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