001package jmri.jmrix.easydcc.easydccmon;
002
003import jmri.jmrix.easydcc.EasyDccListener;
004import jmri.jmrix.easydcc.EasyDccMessage;
005import jmri.jmrix.easydcc.EasyDccReply;
006import jmri.jmrix.easydcc.EasyDccSystemConnectionMemo;
007
008/**
009 * Frame displaying (and logging) EasyDCC command messages.
010 *
011 * @author Bob Jacobsen Copyright (C) 2001
012 */
013public class EasyDccMonFrame extends jmri.jmrix.AbstractMonFrame implements EasyDccListener {
014
015    private EasyDccSystemConnectionMemo _memo = null;
016
017    public EasyDccMonFrame(EasyDccSystemConnectionMemo memo) {
018        super();
019        _memo = memo;
020    }
021
022    @Override
023    protected String title() {
024        return Bundle.getMessage("MonitorXTitle", "EasyDCC");
025    }
026
027    @Override
028    protected void init() {
029        // connect to TrafficController
030        _memo.getTrafficController().addEasyDccListener(this);
031    }
032
033    @Override
034    public void dispose() {
035        _memo.getTrafficController().removeEasyDccListener(this);
036        super.dispose();
037    }
038
039    @Override
040    public synchronized void message(EasyDccMessage l) {  // receive a message and log it
041        nextLine("cmd: \"" + l.toString() + "\"\n", "");
042    }
043
044    @Override
045    public synchronized void reply(EasyDccReply l) {  // receive a reply message and log it
046        nextLine("rep: \"" + l.toString() + "\"\n", "");
047    }
048
049}