Search in sources :

Example 1 with PR3MS100ModeStatus

use of jmri.jmrix.loconet.locostats.PR3MS100ModeStatus in project JMRI by JMRI.

the class LocoStatsPanel method notifyChangedInterfaceStatus.

/**
     * Listener for LocoNet Interface Status changes
     * 
     * @param o a LocoNetStatus object
     */
@Override
@SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST_OF_RETURN_VALUE", justification = "GUI elements are created such that cast to JmriJFrame this is accurate")
public void notifyChangedInterfaceStatus(Object o) {
    // NOI18N
    log.debug("Update is being handled:" + o.toString());
    if (!updateRequestPending) {
        return;
    }
    if (o.getClass() == LocoBufferIIStatus.class) {
        LocoBufferIIStatus s = (LocoBufferIIStatus) o;
        version.setText((Integer.toHexString(s.version)));
        breaks.setText((Integer.toString(s.breaks)));
        errors.setText((Integer.toString(s.errors)));
        lb2Panel.setVisible(true);
        rawPanel.setVisible(false);
        ms100Panel.setVisible(false);
        pr2Panel.setVisible(false);
        ((JmriJFrame) getRootPane().getParent()).setPreferredSize(null);
        ((JmriJFrame) getRootPane().getParent()).pack();
    } else if (o.getClass() == PR2Status.class) {
        PR2Status s = (PR2Status) o;
        serial.setText(Integer.toString(s.serial));
        status.setText(Integer.toString(s.status));
        current.setText(Integer.toString(s.current));
        hardware.setText(Integer.toString(s.hardware));
        software.setText(Integer.toString(s.software));
        lb2Panel.setVisible(false);
        rawPanel.setVisible(false);
        ms100Panel.setVisible(true);
        pr2Panel.setVisible(true);
        ((JmriJFrame) getRootPane().getParent()).setPreferredSize(null);
        ((JmriJFrame) getRootPane().getParent()).pack();
    } else if (o.getClass() == PR3MS100ModeStatus.class) {
        PR3MS100ModeStatus s = (PR3MS100ModeStatus) o;
        goodMsgCnt.setText(Integer.toString(s.goodMsgCnt));
        badMsgCnt.setText(Integer.toString(s.badMsgCnt));
        ms100status.setText(Integer.toString(s.ms100status));
        lb2Panel.setVisible(false);
        rawPanel.setVisible(false);
        ms100Panel.setVisible(true);
        pr2Panel.setVisible(true);
        ((JmriJFrame) getRootPane().getParent()).setPreferredSize(null);
        ((JmriJFrame) getRootPane().getParent()).pack();
    } else if (o.getClass() == RawStatus.class) {
        RawStatus s = (RawStatus) o;
        r1.setText(Integer.toString(s.raw[0]));
        r2.setText(Integer.toString(s.raw[1]));
        r3.setText(Integer.toString(s.raw[2]));
        r4.setText(Integer.toString(s.raw[3]));
        r5.setText(Integer.toString(s.raw[4]));
        r6.setText(Integer.toString(s.raw[5]));
        r7.setText(Integer.toString(s.raw[6]));
        r8.setText(Integer.toString(s.raw[7]));
        lb2Panel.setVisible(false);
        rawPanel.setVisible(true);
        ms100Panel.setVisible(false);
        pr2Panel.setVisible(false);
        ((JmriJFrame) getRootPane().getParent()).setPreferredSize(null);
        ((JmriJFrame) getRootPane().getParent()).pack();
    }
}
Also used : PR3MS100ModeStatus(jmri.jmrix.loconet.locostats.PR3MS100ModeStatus) JmriJFrame(jmri.util.JmriJFrame) LocoBufferIIStatus(jmri.jmrix.loconet.locostats.LocoBufferIIStatus) PR2Status(jmri.jmrix.loconet.locostats.PR2Status) RawStatus(jmri.jmrix.loconet.locostats.RawStatus) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Aggregations

SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 LocoBufferIIStatus (jmri.jmrix.loconet.locostats.LocoBufferIIStatus)1 PR2Status (jmri.jmrix.loconet.locostats.PR2Status)1 PR3MS100ModeStatus (jmri.jmrix.loconet.locostats.PR3MS100ModeStatus)1 RawStatus (jmri.jmrix.loconet.locostats.RawStatus)1 JmriJFrame (jmri.util.JmriJFrame)1