use of jmri.jmrix.loconet.locostats.RawStatus 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();
}
}
Aggregations