use of edu.umd.cs.findbugs.annotations.SuppressFBWarnings in project JMRI by JMRI.
the class NXFrame method makeAutoRunPanel.
@SuppressFBWarnings(value = "DB_DUPLICATE_SWITCH_CLAUSES", justification = "Same code for both cases")
private JPanel makeAutoRunPanel(int interpretation) {
JPanel p1 = new JPanel();
p1.setLayout(new BoxLayout(p1, BoxLayout.PAGE_AXIS));
float maxSpeed;
float throttleIncr;
String maxSpeedLabel;
String throttleIncrLabel;
switch(interpretation) {
case SignalSpeedMap.PERCENT_NORMAL:
case SignalSpeedMap.PERCENT_THROTTLE:
maxSpeed = _maxThrottle;
maxSpeedLabel = "MaxSpeed";
throttleIncr = _minSpeed;
throttleIncrLabel = "RampIncrement";
break;
case SignalSpeedMap.SPEED_MPH:
// 2.2369363 is 3.6 converted by mile/km
maxSpeed = _maxThrottle * _throttleFactor * 223.69363f;
maxSpeedLabel = "MaxMph";
throttleIncr = _minSpeed * _throttleFactor * 223.69363f;
throttleIncrLabel = "MinMph";
break;
case SignalSpeedMap.SPEED_KMPH:
maxSpeed = _maxThrottle * _throttleFactor * 360f;
maxSpeedLabel = "MaxKMph";
throttleIncr = _minSpeed * _throttleFactor * 360f;
throttleIncrLabel = "MinKMph";
break;
default:
maxSpeed = _maxThrottle;
maxSpeedLabel = "MaxSpeed";
throttleIncr = _minSpeed;
throttleIncrLabel = "RampIncrement";
}
p1.add(makeTextBoxPanel(false, _maxSpeedBox, maxSpeedLabel, null));
p1.add(makeTextBoxPanel(false, _rampInterval, "rampInterval", null));
p1.add(makeTextBoxPanel(false, _rampIncre, throttleIncrLabel, "ToolTipRampIncrement"));
p1.add(makeTextBoxPanel(false, _throttleFactorBox, "ThrottleScale", "ToolTipThrottleScale"));
p1.add(makeTextBoxPanel(false, _shareRouteBox, "ShareRoute", "ToolTipShareRoute"));
_maxSpeedBox.setText(Float.toString(maxSpeed));
_rampInterval.setText(Float.toString(_intervalTime / 1000));
_rampIncre.setText(Float.toString(throttleIncr));
_throttleFactorBox.setText(Float.toString(_throttleFactor));
JPanel p2 = new JPanel();
p2.setLayout(new BoxLayout(p2, BoxLayout.PAGE_AXIS));
// JPanel trainPanel = makeTrainIdPanel(makeTextBoxPanel(
// false, _shareRouteBox, "ShareRoute", "ToolTipShareRoute"));
JPanel trainPanel = makeTrainIdPanel(null);
p2.add(trainPanel);
JPanel autoRunPanel = new JPanel();
autoRunPanel.setLayout(new BoxLayout(autoRunPanel, BoxLayout.PAGE_AXIS));
JPanel pp = new JPanel();
pp.setLayout(new BoxLayout(pp, BoxLayout.LINE_AXIS));
pp.add(Box.createHorizontalStrut(STRUT_SIZE));
pp.add(p1);
pp.add(Box.createHorizontalStrut(STRUT_SIZE));
pp.add(p2);
pp.add(Box.createHorizontalStrut(STRUT_SIZE));
autoRunPanel.add(pp);
ButtonGroup bg = new ButtonGroup();
bg.add(_forward);
bg.add(_reverse);
p1 = new JPanel();
p1.setLayout(new BoxLayout(p1, BoxLayout.LINE_AXIS));
p1.add(Box.createHorizontalGlue());
p1.add(makeTextBoxPanel(false, _forward, "forward", null));
p1.add(makeTextBoxPanel(false, _reverse, "reverse", null));
p1.add(Box.createHorizontalGlue());
pp = new JPanel();
pp.setLayout(new BoxLayout(pp, BoxLayout.LINE_AXIS));
pp.add(Box.createHorizontalStrut(STRUT_SIZE));
pp.add(p1);
pp.add(Box.createHorizontalStrut(STRUT_SIZE));
pp.add(Box.createHorizontalStrut(2 * STRUT_SIZE));
autoRunPanel.add(pp);
JPanel ppp = new JPanel();
ppp.setLayout(new BoxLayout(ppp, BoxLayout.LINE_AXIS));
ppp.add(Box.createHorizontalStrut(STRUT_SIZE));
ppp.add(makeTextBoxPanel(false, _stageEStop, "StageEStop", null));
ppp.add(Box.createHorizontalStrut(STRUT_SIZE));
ppp.add(makeTextBoxPanel(false, _haltStartBox, "HaltAtStart", null));
ppp.add(Box.createHorizontalStrut(STRUT_SIZE));
ppp.add(makeTextBoxPanel(false, _calibrateBox, "Calibrate", "calibBlockMessage"));
ppp.add(Box.createHorizontalStrut(STRUT_SIZE));
autoRunPanel.add(ppp);
return autoRunPanel;
}
use of edu.umd.cs.findbugs.annotations.SuppressFBWarnings in project JMRI by JMRI.
the class LocationCopyFrame method buttonActionPerformed.
@Override
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "GUI ease of use")
protected void buttonActionPerformed(java.awt.event.ActionEvent ae) {
if (ae.getSource() == copyButton) {
log.debug("copy location button activated");
if (!checkName()) {
return;
}
if (locationBox.getSelectedItem() == null) {
JOptionPane.showMessageDialog(this, Bundle.getMessage("SelectLocationToCopy"), MessageFormat.format(Bundle.getMessage("CanNotLocation"), new Object[] { Bundle.getMessage("ButtonCopy") }), JOptionPane.ERROR_MESSAGE);
return;
}
Location location = (Location) locationBox.getSelectedItem();
// check to see if there are cars scheduled for pickup or set out
if (moveRollingStockCheckBox.isSelected()) {
for (Track track : location.getTrackList()) {
if (track.getPickupRS() > 0) {
JOptionPane.showMessageDialog(this, MessageFormat.format(Bundle.getMessage("FoundRollingStockPickUp"), new Object[] { track.getPickupRS() }), MessageFormat.format(Bundle.getMessage("TrainsServicingTrack"), new Object[] { track.getName() }), JOptionPane.WARNING_MESSAGE);
// can't move rolling stock, some are scheduled for a pick up
return;
}
if (track.getDropRS() > 0) {
JOptionPane.showMessageDialog(this, MessageFormat.format(Bundle.getMessage("FoundRollingStockDrop"), new Object[] { track.getDropRS() }), MessageFormat.format(Bundle.getMessage("TrainsServicingTrack"), new Object[] { track.getName() }), JOptionPane.WARNING_MESSAGE);
// can't move rolling stock, some are scheduled for drops
return;
}
}
}
// now copy all of the tracks
Location newLocation = locationManager.newLocation(loctionNameTextField.getText());
location.copyLocation(newLocation);
// does the user want the cars to also move to the new tracks?
if (moveRollingStockCheckBox.isSelected()) {
for (Track track : location.getTrackList()) {
moveRollingStock(track, newLocation.getTrackByName(track.getName(), null));
if (deleteTrackCheckBox.isSelected()) {
location.deleteTrack(track);
}
}
}
}
if (ae.getSource() == saveButton) {
log.debug("save track button activated");
// save checkbox states
moveRollingStock = moveRollingStockCheckBox.isSelected();
deleteTrack = deleteTrackCheckBox.isSelected();
// save location file
OperationsXml.save();
}
}
use of edu.umd.cs.findbugs.annotations.SuppressFBWarnings in project JMRI by JMRI.
the class CarsTableModel method toggleSelectVisible.
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", // NOI18N
justification = "GUI ease of use")
public void toggleSelectVisible() {
XTableColumnModel tcm = (XTableColumnModel) _table.getColumnModel();
isSelectVisible = !tcm.isColumnVisible(tcm.getColumnByModelIndex(SELECT_COLUMN));
tcm.setColumnVisible(tcm.getColumnByModelIndex(SELECT_COLUMN), isSelectVisible);
}
use of edu.umd.cs.findbugs.annotations.SuppressFBWarnings in project JMRI by JMRI.
the class SprogIIUpdateFrame method notifyVersion.
@SuppressFBWarnings(value = "SWL_SLEEP_WITH_LOCK_HELD")
@Override
public synchronized void notifyVersion(SprogVersion v) {
sv = v;
if (sv.sprogType.isSprog() == false) {
// Didn't recognize a SPROG so check if it is in boot mode already
if (log.isDebugEnabled()) {
log.debug("SPROG not found - looking for bootloader");
}
statusBar.setText("SPROG not found - looking for bootloader");
blockLen = -1;
requestBoot();
} else {
// Check that it's not a V4
if (sv.sprogType.sprogType > SprogType.SPROGV4) {
statusBar.setText("Found " + sv.toString());
blockLen = sv.sprogType.getBlockLen();
// Put SPROG in boot mode
if (log.isDebugEnabled()) {
log.debug("Putting SPROG in boot mode");
}
msg = new SprogMessage("b 1 1 1");
tc.sendSprogMessage(msg, this);
// SPROG II and 3 will not reply to this so just wait a while
tc.setSprogState(SprogState.SIIBOOTMODE);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// retain if needed later
Thread.currentThread().interrupt();
}
// Look for bootloader version
requestBoot();
} else {
log.error("Incorrect SPROG Type detected");
statusBar.setText("Incorrect SPROG Type detected");
bootState = BootState.IDLE;
}
}
}
use of edu.umd.cs.findbugs.annotations.SuppressFBWarnings in project JMRI by JMRI.
the class NodeConfigFrame method initComponents.
/**
* Initialize the config window
*/
@SuppressFBWarnings(value = "SBSC_USE_STRINGBUFFER_CONCATENATION")
// though it would be good to fix it if you're working in this area
@Override
public void initComponents() {
setTitle(rb.getString("WindowTitle"));
// Container contentPane = getContentPane();
contentPane = getContentPane();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
// Set up node address and node type
JPanel panel1 = new JPanel();
panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS));
// Copy and pasted from the info button
String nodesstring = "";
int tempnumnodes = _memo.getTrafficController().getNumNodes();
for (int i = 0; i < tempnumnodes; i++) {
AcelaNode tempnode;
tempnode = (AcelaNode) _memo.getTrafficController().getNodeFromAddress(i);
nodesstring = nodesstring + " " + tempnode.getNodeTypeString();
}
thenodesStaticC.setText(nodesstring);
// panelthenodes displays the current node configuration and polling result
JPanel panelthenodes = new JPanel();
panelthenodes.setLayout(new BoxLayout(panelthenodes, BoxLayout.Y_AXIS));
JPanel panelthenodes1 = new JPanel();
panelthenodes1.setLayout(new FlowLayout());
panelthenodes1.add(new JLabel(" The nodes: "));
panelthenodes1.add(thenodesStaticH);
panelthenodes.add(panelthenodes1);
JPanel panelthenodes2 = new JPanel();
panelthenodes2.setLayout(new FlowLayout());
panelthenodes2.add(new JLabel("As Configured: "));
panelthenodes2.add(thenodesStaticC);
panelthenodes.add(panelthenodes2);
JPanel panelthenodes3 = new JPanel();
panelthenodes3.setLayout(new FlowLayout());
panelthenodes3.add(new JLabel(" As Polled: "));
panelthenodes3.add(thenodesStaticP);
panelthenodes.add(panelthenodes3);
Border panelthenodesBorder = BorderFactory.createEtchedBorder();
Border panelthenodesTitled = BorderFactory.createTitledBorder(panelthenodesBorder, rb.getString("BoxLabelNodes"));
panelthenodes.setBorder(panelthenodesTitled);
contentPane.add(panelthenodes);
// panel11 is the node address
JPanel panel11 = new JPanel();
panel11.setLayout(new FlowLayout());
panel11.add(new JLabel(rb.getString("LabelNodeAddress") + " "));
nodeAddrBox = new JComboBox<String>(AcelaNode.getNodeNames());
nodeAddrBox.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent event) {
infoButtonActionPerformed();
}
});
panel11.add(nodeAddrBox);
panel11.add(nodeAddrField);
// nodeAddrField.setToolTipText(rb.getString("TipNodeAddress"));
nodeAddrField.setText("0");
panel11.add(nodeAddrStatic);
nodeAddrField.setVisible(false);
nodeAddrStatic.setVisible(false);
contentPane.add(panel11);
// panelNodeInfo is the node type
JPanel panelNodeInfo = new JPanel();
panelNodeInfo.add(new JLabel(" " + rb.getString("LabelNodeType") + " "));
nodeTypeBox = new JComboBox<String>(AcelaNode.getModuleNames());
nodeTypeBox.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent event) {
String s = (String) nodeTypeBox.getSelectedItem();
if (s.equals("Acela")) {
panelAcela.setVisible(true);
panelTBrain.setVisible(false);
panelDash8.setVisible(false);
panelWatchman.setVisible(false);
panelSignalman.setVisible(false);
panelSwitchman.setVisible(false);
panelYardMaster.setVisible(false);
panelSentry.setVisible(false);
} else if (s.equals("TrainBrain")) {
panelAcela.setVisible(false);
panelTBrain.setVisible(true);
panelDash8.setVisible(false);
panelWatchman.setVisible(false);
panelSignalman.setVisible(false);
panelSwitchman.setVisible(false);
panelYardMaster.setVisible(false);
panelSentry.setVisible(false);
} else if (s.equals("Dash-8")) {
panelAcela.setVisible(false);
panelTBrain.setVisible(false);
panelDash8.setVisible(true);
panelWatchman.setVisible(false);
panelSignalman.setVisible(false);
panelSwitchman.setVisible(false);
panelYardMaster.setVisible(false);
panelSentry.setVisible(false);
} else if (s.equals("Watchman")) {
panelAcela.setVisible(false);
panelTBrain.setVisible(false);
panelDash8.setVisible(false);
panelWatchman.setVisible(true);
panelSignalman.setVisible(false);
panelSwitchman.setVisible(false);
panelYardMaster.setVisible(false);
panelSentry.setVisible(false);
} else if (s.equals("SignalMan")) {
panelAcela.setVisible(false);
panelTBrain.setVisible(false);
panelDash8.setVisible(false);
panelWatchman.setVisible(false);
panelSignalman.setVisible(true);
panelSwitchman.setVisible(false);
panelYardMaster.setVisible(false);
panelSentry.setVisible(false);
} else if (s.equals("SwitchMan")) {
panelAcela.setVisible(false);
panelTBrain.setVisible(false);
panelDash8.setVisible(false);
panelWatchman.setVisible(false);
panelSignalman.setVisible(false);
panelSwitchman.setVisible(true);
panelYardMaster.setVisible(false);
panelSentry.setVisible(false);
} else if (s.equals("YardMaster")) {
panelAcela.setVisible(false);
panelTBrain.setVisible(false);
panelDash8.setVisible(false);
panelWatchman.setVisible(false);
panelSignalman.setVisible(false);
panelSwitchman.setVisible(false);
panelYardMaster.setVisible(true);
panelSentry.setVisible(false);
} else if (s.equals("Sentry")) {
panelAcela.setVisible(false);
panelTBrain.setVisible(false);
panelDash8.setVisible(false);
panelWatchman.setVisible(false);
panelSignalman.setVisible(false);
panelSwitchman.setVisible(false);
panelYardMaster.setVisible(false);
panelSentry.setVisible(true);
} else // Add code here for other types of nodes
{
panelAcela.setVisible(false);
panelTBrain.setVisible(false);
panelDash8.setVisible(false);
panelWatchman.setVisible(false);
panelSignalman.setVisible(false);
panelSwitchman.setVisible(false);
panelYardMaster.setVisible(false);
panelSentry.setVisible(false);
}
}
});
panelNodeInfo.add(nodeTypeBox);
nodeTypeBox.setToolTipText(rb.getString("TipNodeType"));
panelNodeInfo.add(nodeTypeStatic);
nodeTypeBox.setVisible(false);
nodeTypeStatic.setVisible(true);
contentPane.add(panelNodeInfo);
// Set up the Acela nodes
panelAcela.setLayout(new BoxLayout(panelAcela, BoxLayout.Y_AXIS));
JPanel panelAcela1 = new JPanel();
panelAcela1.setLayout(new FlowLayout());
statusTextAcela1.setText(stdStatusAcela1);
statusTextAcela1.setVisible(true);
panelAcela1.add(statusTextAcela1);
panelAcela.add(panelAcela1);
JPanel panelAcela2 = new JPanel();
panelAcela2.setLayout(new FlowLayout());
statusTextAcela2.setText(stdStatusAcela2);
statusTextAcela2.setVisible(true);
panelAcela2.add(statusTextAcela2);
panelAcela.add(panelAcela2);
JPanel panelAcela3 = new JPanel();
panelAcela3.setLayout(new FlowLayout());
statusTextAcela3.setText(stdStatusAcela3);
statusTextAcela3.setVisible(true);
panelAcela3.add(statusTextAcela3);
panelAcela.add(panelAcela3);
JPanel panelAcela4 = new JPanel();
panelAcela4.setLayout(new FlowLayout());
statusTextAcela4.setText(stdStatusAcela4);
statusTextAcela4.setVisible(true);
panelAcela4.add(statusTextAcela4);
panelAcela.add(panelAcela4);
JPanel panelAcela5 = new JPanel();
panelAcela5.setLayout(new FlowLayout());
statusTextAcela5.setText(stdStatusAcela5);
statusTextAcela5.setVisible(true);
panelAcela5.add(statusTextAcela5);
panelAcela.add(panelAcela5);
JPanel panelAcela6 = new JPanel();
panelAcela6.setLayout(new FlowLayout());
statusTextAcela6.setText(stdStatusAcela6);
statusTextAcela6.setVisible(true);
panelAcela6.add(statusTextAcela6);
panelAcela.add(panelAcela6);
JPanel panelAcela7 = new JPanel();
panelAcela7.setLayout(new FlowLayout());
statusTextAcela7.setText(stdStatusAcela7);
statusTextAcela7.setVisible(true);
panelAcela7.add(statusTextAcela7);
panelAcela.add(panelAcela7);
JPanel panelAcela8 = new JPanel();
panelAcela8.setLayout(new FlowLayout());
statusTextAcela8.setText(stdStatusAcela8);
statusTextAcela8.setVisible(true);
panelAcela8.add(statusTextAcela8);
panelAcela.add(panelAcela8);
JPanel panelAcela9 = new JPanel();
panelAcela9.setLayout(new FlowLayout());
statusTextAcela9.setText(stdStatusAcela9);
statusTextAcela9.setVisible(true);
panelAcela9.add(statusTextAcela9);
panelAcela.add(panelAcela9);
JPanel panelAcela10 = new JPanel();
panelAcela10.setLayout(new FlowLayout());
statusTextAcela10.setText(stdStatusAcela10);
statusTextAcela10.setVisible(true);
panelAcela10.add(statusTextAcela10);
panelAcela.add(panelAcela10);
JPanel panelAcela11 = new JPanel();
panelAcela11.setLayout(new FlowLayout());
statusTextAcela11.setText(stdStatusAcela11);
statusTextAcela11.setVisible(true);
panelAcela11.add(statusTextAcela11);
panelAcela.add(panelAcela11);
Border panelAcelaBorder = BorderFactory.createEtchedBorder();
Border panelAcelaTitled = BorderFactory.createTitledBorder(panelAcelaBorder, rb.getString("BoxLabelNodeSpecific"));
panelAcela.setBorder(panelAcelaTitled);
contentPane.add(panelAcela);
// Set up the Dash8 nodes
panelDash8.setLayout(new BoxLayout(panelDash8, BoxLayout.Y_AXIS));
JPanel panelDash81 = new JPanel();
panelDash81.setLayout(new FlowLayout());
statusTextDash81.setText(stdStatusDash81);
statusTextDash81.setVisible(true);
panelDash81.add(statusTextDash81);
panelDash8.add(panelDash81);
JPanel panelDash82 = new JPanel();
panelDash82.setLayout(new FlowLayout());
statusTextDash82.setText(stdStatusDash82);
statusTextDash82.setVisible(true);
panelDash82.add(statusTextDash82);
panelDash8.add(panelDash82);
JPanel panelDash83 = new JPanel();
panelDash83.setLayout(new FlowLayout());
statusTextDash83.setText(stdStatusDash83);
statusTextDash83.setVisible(true);
panelDash83.add(statusTextDash83);
panelDash8.add(panelDash83);
// Output circuit configuration
d8outputConfigModel = new OutputConfigModel();
d8outputConfigModel.setNumRows(8);
d8outputConfigModel.setEditMode(false);
JTable d8outputConfigTable = new JTable(d8outputConfigModel);
d8outputConfigTable.setRowSelectionAllowed(false);
d8outputConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 125));
JComboBox<String> d8outputWiredCombo = new JComboBox<String>();
d8outputWiredCombo.addItem(rb.getString("OutputWiredNC"));
d8outputWiredCombo.addItem(rb.getString("OutputWiredNO"));
JComboBox<String> d8initialStateCombo = new JComboBox<String>();
d8initialStateCombo.addItem(rb.getString("InitialStateOn"));
d8initialStateCombo.addItem(rb.getString("InitialStateOff"));
JComboBox<String> d8outputTypeCombo = new JComboBox<String>();
d8outputTypeCombo.addItem(rb.getString("OutputTypeONOFF"));
d8outputTypeCombo.addItem(rb.getString("OutputTypePULSE"));
d8outputTypeCombo.addItem(rb.getString("OutputTypeBLINK"));
JComboBox<String> d8outputLengthCombo = new JComboBox<String>();
for (int t = 0; t < 255; t++) {
d8outputLengthCombo.addItem(String.valueOf(t));
}
TableColumnModel d8outputColumnModel = d8outputConfigTable.getColumnModel();
TableColumn d8outputCircuitAddressColumn = d8outputColumnModel.getColumn(OutputConfigModel.OUTPUTCIRCUITADDRESS_COLUMN);
d8outputCircuitAddressColumn.setMinWidth(70);
d8outputCircuitAddressColumn.setMaxWidth(80);
TableColumn d8outputWiredColumn = d8outputColumnModel.getColumn(OutputConfigModel.OUTPUTWIRED_COLUMN);
d8outputWiredColumn.setCellEditor(new DefaultCellEditor(d8outputWiredCombo));
d8outputWiredColumn.setResizable(false);
d8outputWiredColumn.setMinWidth(90);
d8outputWiredColumn.setMaxWidth(100);
TableColumn d8initialStateColumn = d8outputColumnModel.getColumn(OutputConfigModel.INITIALSTATE_COLUMN);
d8initialStateColumn.setCellEditor(new DefaultCellEditor(d8initialStateCombo));
d8initialStateColumn.setResizable(false);
d8initialStateColumn.setMinWidth(90);
d8initialStateColumn.setMaxWidth(100);
TableColumn d8outputTypeColumn = d8outputColumnModel.getColumn(OutputConfigModel.OUTPUTTYPE_COLUMN);
d8outputTypeColumn.setCellEditor(new DefaultCellEditor(d8outputTypeCombo));
d8outputTypeColumn.setResizable(false);
d8outputTypeColumn.setMinWidth(90);
d8outputTypeColumn.setMaxWidth(100);
TableColumn d8outputLengthColumn = d8outputColumnModel.getColumn(OutputConfigModel.OUTPUTLENGTH_COLUMN);
d8outputLengthColumn.setCellEditor(new DefaultCellEditor(d8outputLengthCombo));
d8outputLengthColumn.setResizable(false);
d8outputLengthColumn.setMinWidth(90);
d8outputLengthColumn.setMaxWidth(100);
TableColumn d8outputaddressColumn = d8outputColumnModel.getColumn(OutputConfigModel.OUTPUTADDRESS_COLUMN);
d8outputaddressColumn.setMinWidth(110);
d8outputaddressColumn.setMaxWidth(120);
// Finish Set up the Dash8 nodes
JScrollPane d8outputScrollPane = new JScrollPane(d8outputConfigTable);
JPanel panelDash8Table = new JPanel();
panelDash8Table.setLayout(new BoxLayout(panelDash8Table, BoxLayout.Y_AXIS));
panelDash8Table.add(d8outputScrollPane, BorderLayout.CENTER);
panelDash8.add(panelDash8Table, BoxLayout.Y_AXIS);
Border panelDash8Border = BorderFactory.createEtchedBorder();
Border panelDash8Titled = BorderFactory.createTitledBorder(panelDash8Border, rb.getString("BoxLabelNodeSpecific"));
panelDash8.setBorder(panelDash8Titled);
panelDash8.setVisible(false);
contentPane.add(panelDash8);
// Set up the TBrain nodes
panelTBrain.setLayout(new BoxLayout(panelTBrain, BoxLayout.Y_AXIS));
JPanel panelTBrain1 = new JPanel();
statusTextTBrain1.setText(stdStatusTBrain1);
statusTextTBrain1.setVisible(true);
panelTBrain1.add(statusTextTBrain1);
panelTBrain.add(panelTBrain1);
JPanel panelTBrain2 = new JPanel();
statusTextTBrain2.setText(stdStatusTBrain2);
statusTextTBrain2.setVisible(true);
panelTBrain2.add(statusTextTBrain2);
panelTBrain.add(panelTBrain2);
JPanel panelTBrain3 = new JPanel();
statusTextTBrain3.setText(stdStatusTBrain3);
statusTextTBrain3.setVisible(true);
panelTBrain3.add(statusTextTBrain3);
panelTBrain.add(panelTBrain3);
TBoutputConfigModel = new OutputConfigModel();
TBoutputConfigModel.setNumRows(4);
TBoutputConfigModel.setEditMode(false);
JTable TBoutputConfigTable = new JTable(TBoutputConfigModel);
TBoutputConfigTable.setRowSelectionAllowed(false);
TBoutputConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 62));
JComboBox<String> TBoutputWiredCombo = new JComboBox<String>();
TBoutputWiredCombo.addItem(rb.getString("OutputWiredNC"));
TBoutputWiredCombo.addItem(rb.getString("OutputWiredNO"));
JComboBox<String> TBoutputTypeCombo = new JComboBox<String>();
TBoutputTypeCombo.addItem(rb.getString("OutputTypeONOFF"));
TBoutputTypeCombo.addItem(rb.getString("OutputTypePULSE"));
TBoutputTypeCombo.addItem(rb.getString("OutputTypeBLINK"));
JComboBox<String> TBinitialStateCombo = new JComboBox<String>();
TBinitialStateCombo.addItem(rb.getString("InitialStateOn"));
TBinitialStateCombo.addItem(rb.getString("InitialStateOff"));
JComboBox<String> TBoutputLengthCombo = new JComboBox<String>();
for (int t = 0; t < 255; t++) {
TBoutputLengthCombo.addItem(String.valueOf(t));
}
TableColumnModel TBoutputColumnModel = TBoutputConfigTable.getColumnModel();
TableColumn TBoutputCircuitAddressColumn = TBoutputColumnModel.getColumn(OutputConfigModel.OUTPUTCIRCUITADDRESS_COLUMN);
TBoutputCircuitAddressColumn.setMinWidth(70);
TBoutputCircuitAddressColumn.setMaxWidth(80);
TableColumn TBoutputWiredColumn = TBoutputColumnModel.getColumn(OutputConfigModel.OUTPUTWIRED_COLUMN);
TBoutputWiredColumn.setCellEditor(new DefaultCellEditor(TBoutputWiredCombo));
TBoutputWiredColumn.setResizable(false);
TBoutputWiredColumn.setMinWidth(90);
TBoutputWiredColumn.setMaxWidth(100);
TableColumn TBinitialStateColumn = TBoutputColumnModel.getColumn(OutputConfigModel.INITIALSTATE_COLUMN);
TBinitialStateColumn.setCellEditor(new DefaultCellEditor(TBinitialStateCombo));
TBinitialStateColumn.setResizable(false);
TBinitialStateColumn.setMinWidth(90);
TBinitialStateColumn.setMaxWidth(100);
TableColumn TBoutputTypeColumn = TBoutputColumnModel.getColumn(OutputConfigModel.OUTPUTTYPE_COLUMN);
TBoutputTypeColumn.setCellEditor(new DefaultCellEditor(TBoutputTypeCombo));
TBoutputTypeColumn.setResizable(false);
TBoutputTypeColumn.setMinWidth(90);
TBoutputTypeColumn.setMaxWidth(100);
TableColumn TBoutputLengthColumn = TBoutputColumnModel.getColumn(OutputConfigModel.OUTPUTLENGTH_COLUMN);
TBoutputLengthColumn.setCellEditor(new DefaultCellEditor(TBoutputLengthCombo));
TBoutputLengthColumn.setResizable(false);
TBoutputLengthColumn.setMinWidth(90);
TBoutputLengthColumn.setMaxWidth(100);
TableColumn TBoutputaddressColumn = TBoutputColumnModel.getColumn(OutputConfigModel.OUTPUTADDRESS_COLUMN);
TBoutputaddressColumn.setMinWidth(110);
TBoutputaddressColumn.setMaxWidth(120);
JScrollPane TBoutputScrollPane = new JScrollPane(TBoutputConfigTable);
JPanel panelTrainBrainTable = new JPanel();
panelTrainBrainTable.setLayout(new BoxLayout(panelTrainBrainTable, BoxLayout.Y_AXIS));
panelTrainBrainTable.add(TBoutputScrollPane, BorderLayout.CENTER);
panelTBrain.add(panelTrainBrainTable, BoxLayout.Y_AXIS);
TBsensorConfigModel = new SensorConfigModel();
TBsensorConfigModel.setNumRows(4);
TBsensorConfigModel.setEditMode(false);
JTable TBsensorConfigTable = new JTable(TBsensorConfigModel);
TBsensorConfigTable.setRowSelectionAllowed(false);
TBsensorConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 62));
JComboBox<String> TBfilterTypeCombo = new JComboBox<String>();
TBfilterTypeCombo.addItem(rb.getString("FilterTypeNoise"));
TBfilterTypeCombo.addItem(rb.getString("FilterTypeDebounce"));
TBfilterTypeCombo.addItem(rb.getString("FilterTypeCarGap"));
TBfilterTypeCombo.addItem(rb.getString("FilterTypeDirtyTrack"));
JComboBox<String> TBfilterPolarityCombo = new JComboBox<String>();
TBfilterPolarityCombo.addItem(rb.getString("FilterNormalPolarity"));
TBfilterPolarityCombo.addItem(rb.getString("FilterInversePolarity"));
JComboBox<String> TBfilterThresholdCombo = new JComboBox<String>();
for (int t = 0; t < 32; t++) {
TBfilterThresholdCombo.addItem(String.valueOf(t));
}
TableColumnModel TBtypeColumnModel = TBsensorConfigTable.getColumnModel();
TableColumn TBcircuitAddressColumn = TBtypeColumnModel.getColumn(SensorConfigModel.SENSORCIRCUITADDRESS_COLUMN);
TBcircuitAddressColumn.setMinWidth(70);
TBcircuitAddressColumn.setMaxWidth(80);
TableColumn TBcardTypeColumn = TBtypeColumnModel.getColumn(SensorConfigModel.TYPE_COLUMN);
TBcardTypeColumn.setCellEditor(new DefaultCellEditor(TBfilterTypeCombo));
TBcardTypeColumn.setResizable(false);
TBcardTypeColumn.setMinWidth(90);
TBcardTypeColumn.setMaxWidth(100);
TableColumn TBcardPolarityColumn = TBtypeColumnModel.getColumn(SensorConfigModel.POLARITY_COLUMN);
TBcardPolarityColumn.setCellEditor(new DefaultCellEditor(TBfilterPolarityCombo));
TBcardPolarityColumn.setResizable(false);
TBcardPolarityColumn.setMinWidth(90);
TBcardPolarityColumn.setMaxWidth(100);
TableColumn TBcardThresholdColumn = TBtypeColumnModel.getColumn(SensorConfigModel.THRESHOLD_COLUMN);
TBcardThresholdColumn.setCellEditor(new DefaultCellEditor(TBfilterThresholdCombo));
TBcardThresholdColumn.setResizable(false);
TBcardThresholdColumn.setMinWidth(90);
TBcardThresholdColumn.setMaxWidth(100);
TableColumn TBsensorAddressColumn = TBtypeColumnModel.getColumn(SensorConfigModel.SENSORADDRESS_COLUMN);
TBsensorAddressColumn.setMinWidth(110);
TBsensorAddressColumn.setMaxWidth(1200);
JScrollPane TBsensorScrollPane = new JScrollPane(TBsensorConfigTable);
JPanel panelTBsensortable = new JPanel();
panelTBsensortable.setLayout(new BoxLayout(panelTBsensortable, BoxLayout.Y_AXIS));
panelTBsensortable.add(TBsensorScrollPane, BorderLayout.CENTER);
panelTBrain.add(panelTBsensortable, BoxLayout.Y_AXIS);
// Finish Set up the TrainBrain nodes
Border panelTBrainBorder = BorderFactory.createEtchedBorder();
Border panelTBrainTitled = BorderFactory.createTitledBorder(panelTBrainBorder, rb.getString("BoxLabelNodeSpecific"));
panelTBrain.setBorder(panelTBrainTitled);
contentPane.add(panelTBrain);
panelTBrain.setVisible(false);
// Set up the Watchman nodes
panelWatchman.setLayout(new BoxLayout(panelWatchman, BoxLayout.Y_AXIS));
JPanel panelWatchman1 = new JPanel();
panelWatchman1.setLayout(new FlowLayout());
statusTextWatchman1.setText(stdStatusWatchman1);
statusTextWatchman1.setVisible(true);
panelWatchman1.add(statusTextWatchman1);
panelWatchman.add(panelWatchman1);
JPanel panelWatchman2 = new JPanel();
panelWatchman2.setLayout(new FlowLayout());
statusTextWatchman2.setText(stdStatusWatchman2);
statusTextWatchman2.setVisible(true);
panelWatchman2.add(statusTextWatchman2);
panelWatchman.add(panelWatchman2);
JPanel panelWatchman3 = new JPanel();
panelWatchman3.setLayout(new FlowLayout());
statusTextWatchman3.setText(stdStatusWatchman3);
statusTextWatchman3.setVisible(true);
panelWatchman3.add(statusTextWatchman3);
panelWatchman.add(panelWatchman3);
wmsensorConfigModel = new SensorConfigModel();
wmsensorConfigModel.setNumRows(8);
wmsensorConfigModel.setEditMode(false);
JTable wmsensorConfigTable = new JTable(wmsensorConfigModel);
wmsensorConfigTable.setRowSelectionAllowed(false);
wmsensorConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 125));
JComboBox<String> wmfilterTypeCombo = new JComboBox<String>();
wmfilterTypeCombo.addItem(rb.getString("FilterTypeNoise"));
wmfilterTypeCombo.addItem(rb.getString("FilterTypeDebounce"));
wmfilterTypeCombo.addItem(rb.getString("FilterTypeCarGap"));
wmfilterTypeCombo.addItem(rb.getString("FilterTypeDirtyTrack"));
JComboBox<String> wmfilterPolarityCombo = new JComboBox<String>();
wmfilterPolarityCombo.addItem(rb.getString("FilterNormalPolarity"));
wmfilterPolarityCombo.addItem(rb.getString("FilterInversePolarity"));
JComboBox<String> wmfilterThresholdCombo = new JComboBox<String>();
for (int t = 0; t < 32; t++) {
wmfilterThresholdCombo.addItem(String.valueOf(t));
}
TableColumnModel wmtypeColumnModel = wmsensorConfigTable.getColumnModel();
TableColumn wmcircuitAddressColumn = wmtypeColumnModel.getColumn(SensorConfigModel.SENSORCIRCUITADDRESS_COLUMN);
wmcircuitAddressColumn.setMinWidth(70);
wmcircuitAddressColumn.setMaxWidth(80);
TableColumn wmcardTypeColumn = wmtypeColumnModel.getColumn(SensorConfigModel.TYPE_COLUMN);
wmcardTypeColumn.setCellEditor(new DefaultCellEditor(wmfilterTypeCombo));
wmcardTypeColumn.setResizable(false);
wmcardTypeColumn.setMinWidth(90);
wmcardTypeColumn.setMaxWidth(100);
TableColumn wmcardPolarityColumn = wmtypeColumnModel.getColumn(SensorConfigModel.POLARITY_COLUMN);
wmcardPolarityColumn.setCellEditor(new DefaultCellEditor(wmfilterPolarityCombo));
wmcardPolarityColumn.setResizable(false);
wmcardPolarityColumn.setMinWidth(90);
wmcardPolarityColumn.setMaxWidth(100);
TableColumn wmcardThresholdColumn = wmtypeColumnModel.getColumn(SensorConfigModel.THRESHOLD_COLUMN);
wmcardThresholdColumn.setCellEditor(new DefaultCellEditor(wmfilterThresholdCombo));
wmcardThresholdColumn.setResizable(false);
wmcardThresholdColumn.setMinWidth(90);
wmcardThresholdColumn.setMaxWidth(100);
TableColumn wmsensorAddressColumn = wmtypeColumnModel.getColumn(SensorConfigModel.SENSORADDRESS_COLUMN);
wmsensorAddressColumn.setMinWidth(110);
wmsensorAddressColumn.setMaxWidth(1200);
// Finish Set up the Watchman nodes
JScrollPane wmsensorScrollPane = new JScrollPane(wmsensorConfigTable);
JPanel panelWatchmantable = new JPanel();
panelWatchmantable.setLayout(new BoxLayout(panelWatchmantable, BoxLayout.Y_AXIS));
panelWatchmantable.add(wmsensorScrollPane, BorderLayout.CENTER);
panelWatchman.add(panelWatchmantable, BoxLayout.Y_AXIS);
Border panelWatchmanBorder = BorderFactory.createEtchedBorder();
Border panelWatchmanTitled = BorderFactory.createTitledBorder(panelWatchmanBorder, rb.getString("BoxLabelNodeSpecific"));
panelWatchman.setBorder(panelWatchmanTitled);
contentPane.add(panelWatchman);
panelWatchman.setVisible(false);
// Set up the Signalman nodes
panelSignalman.setLayout(new BoxLayout(panelSignalman, BoxLayout.Y_AXIS));
JPanel panelSignalman1 = new JPanel();
panelSignalman1.setLayout(new FlowLayout());
statusTextSignalman1.setText(stdStatusSignalman1);
statusTextSignalman1.setVisible(true);
panelSignalman1.add(statusTextSignalman1);
panelSignalman.add(panelSignalman1);
JPanel panelSignalman2 = new JPanel();
panelSignalman2.setLayout(new FlowLayout());
statusTextSignalman2.setText(stdStatusSignalman2);
statusTextSignalman2.setVisible(true);
panelSignalman2.add(statusTextSignalman2);
panelSignalman.add(panelSignalman2);
JPanel panelSignalman3 = new JPanel();
panelSignalman3.setLayout(new FlowLayout());
statusTextSignalman3.setText(stdStatusSignalman3);
statusTextSignalman3.setVisible(true);
panelSignalman3.add(statusTextSignalman3);
panelSignalman.add(panelSignalman3);
// Output circuit configuration
smoutputConfigModel = new OutputConfigModel();
smoutputConfigModel.setNumRows(16);
smoutputConfigModel.setEditMode(false);
JTable smoutputConfigTable = new JTable(smoutputConfigModel);
smoutputConfigTable.setRowSelectionAllowed(false);
smoutputConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 125));
JComboBox<String> smoutputWiredCombo = new JComboBox<String>();
smoutputWiredCombo.addItem(rb.getString("OutputWiredNC"));
smoutputWiredCombo.addItem(rb.getString("OutputWiredNO"));
JComboBox<String> sminitialStateCombo = new JComboBox<String>();
sminitialStateCombo.addItem(rb.getString("InitialStateOn"));
sminitialStateCombo.addItem(rb.getString("InitialStateOff"));
JComboBox<String> smoutputTypeCombo = new JComboBox<String>();
smoutputTypeCombo.addItem(rb.getString("OutputTypeONOFF"));
smoutputTypeCombo.addItem(rb.getString("OutputTypePULSE"));
smoutputTypeCombo.addItem(rb.getString("OutputTypeBLINK"));
JComboBox<String> smoutputLengthCombo = new JComboBox<String>();
for (int t = 0; t < 255; t++) {
smoutputLengthCombo.addItem(String.valueOf(t));
}
TableColumnModel smoutputColumnModel = smoutputConfigTable.getColumnModel();
TableColumn smoutputCircuitAddressColumn = smoutputColumnModel.getColumn(OutputConfigModel.OUTPUTCIRCUITADDRESS_COLUMN);
smoutputCircuitAddressColumn.setMinWidth(70);
smoutputCircuitAddressColumn.setMaxWidth(80);
TableColumn smoutputWiredColumn = smoutputColumnModel.getColumn(OutputConfigModel.OUTPUTWIRED_COLUMN);
smoutputWiredColumn.setCellEditor(new DefaultCellEditor(smoutputWiredCombo));
smoutputWiredColumn.setResizable(false);
smoutputWiredColumn.setMinWidth(90);
smoutputWiredColumn.setMaxWidth(100);
TableColumn sminitialStateColumn = smoutputColumnModel.getColumn(OutputConfigModel.INITIALSTATE_COLUMN);
sminitialStateColumn.setCellEditor(new DefaultCellEditor(sminitialStateCombo));
sminitialStateColumn.setResizable(false);
sminitialStateColumn.setMinWidth(90);
sminitialStateColumn.setMaxWidth(100);
TableColumn smoutputTypeColumn = smoutputColumnModel.getColumn(OutputConfigModel.OUTPUTTYPE_COLUMN);
smoutputTypeColumn.setCellEditor(new DefaultCellEditor(smoutputTypeCombo));
smoutputTypeColumn.setResizable(false);
smoutputTypeColumn.setMinWidth(90);
smoutputTypeColumn.setMaxWidth(100);
TableColumn smoutputLengthColumn = smoutputColumnModel.getColumn(OutputConfigModel.OUTPUTLENGTH_COLUMN);
smoutputLengthColumn.setCellEditor(new DefaultCellEditor(smoutputLengthCombo));
smoutputLengthColumn.setResizable(false);
smoutputLengthColumn.setMinWidth(90);
smoutputLengthColumn.setMaxWidth(100);
TableColumn smoutputaddressColumn = smoutputColumnModel.getColumn(OutputConfigModel.OUTPUTADDRESS_COLUMN);
smoutputaddressColumn.setMinWidth(110);
smoutputaddressColumn.setMaxWidth(120);
// Finish Set up the Signalman nodes
JScrollPane smoutputScrollPane = new JScrollPane(smoutputConfigTable);
JPanel panelSignalmanTable = new JPanel();
panelSignalmanTable.setLayout(new BoxLayout(panelSignalmanTable, BoxLayout.Y_AXIS));
panelSignalmanTable.add(smoutputScrollPane, BorderLayout.CENTER);
panelSignalman.add(panelSignalmanTable, BoxLayout.Y_AXIS);
Border panelSignalmanBorder = BorderFactory.createEtchedBorder();
Border panelSignalmanTitled = BorderFactory.createTitledBorder(panelSignalmanBorder, rb.getString("BoxLabelNodeSpecific"));
panelSignalman.setBorder(panelSignalmanTitled);
panelSignalman.setVisible(false);
contentPane.add(panelSignalman);
// Set up the YardMaster nodes
panelYardMaster.setLayout(new BoxLayout(panelYardMaster, BoxLayout.Y_AXIS));
JPanel panelYardMaster1 = new JPanel();
panelYardMaster1.setLayout(new FlowLayout());
statusTextYardMaster1.setText(stdStatusYardMaster1);
statusTextYardMaster1.setVisible(true);
panelYardMaster1.add(statusTextYardMaster1);
panelYardMaster.add(panelYardMaster1);
JPanel panelYardMaster2 = new JPanel();
panelYardMaster2.setLayout(new FlowLayout());
statusTextYardMaster2.setText(stdStatusYardMaster2);
statusTextYardMaster2.setVisible(true);
panelYardMaster2.add(statusTextYardMaster2);
panelYardMaster.add(panelYardMaster2);
JPanel panelYardMaster3 = new JPanel();
panelYardMaster3.setLayout(new FlowLayout());
statusTextYardMaster3.setText(stdStatusYardMaster3);
statusTextYardMaster3.setVisible(true);
panelYardMaster3.add(statusTextYardMaster3);
panelYardMaster.add(panelYardMaster3);
// Output circuit configuration
ymoutputConfigModel = new OutputConfigModel();
ymoutputConfigModel.setNumRows(16);
ymoutputConfigModel.setEditMode(false);
JTable ymoutputConfigTable = new JTable(ymoutputConfigModel);
ymoutputConfigTable.setRowSelectionAllowed(false);
ymoutputConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 125));
JComboBox<String> ymoutputWiredCombo = new JComboBox<String>();
ymoutputWiredCombo.addItem(rb.getString("OutputWiredNC"));
ymoutputWiredCombo.addItem(rb.getString("OutputWiredNO"));
JComboBox<String> yminitialStateCombo = new JComboBox<String>();
yminitialStateCombo.addItem(rb.getString("InitialStateOn"));
yminitialStateCombo.addItem(rb.getString("InitialStateOff"));
JComboBox<String> ymoutputTypeCombo = new JComboBox<String>();
ymoutputTypeCombo.addItem(rb.getString("OutputTypeONOFF"));
ymoutputTypeCombo.addItem(rb.getString("OutputTypePULSE"));
ymoutputTypeCombo.addItem(rb.getString("OutputTypeBLINK"));
JComboBox<String> ymoutputLengthCombo = new JComboBox<String>();
for (int t = 0; t < 255; t++) {
ymoutputLengthCombo.addItem(String.valueOf(t));
}
TableColumnModel ymoutputColumnModel = ymoutputConfigTable.getColumnModel();
TableColumn ymoutputCircuitAddressColumn = ymoutputColumnModel.getColumn(OutputConfigModel.OUTPUTCIRCUITADDRESS_COLUMN);
ymoutputCircuitAddressColumn.setMinWidth(70);
ymoutputCircuitAddressColumn.setMaxWidth(80);
TableColumn ymoutputWiredColumn = ymoutputColumnModel.getColumn(OutputConfigModel.OUTPUTWIRED_COLUMN);
ymoutputWiredColumn.setCellEditor(new DefaultCellEditor(ymoutputWiredCombo));
ymoutputWiredColumn.setResizable(false);
ymoutputWiredColumn.setMinWidth(90);
ymoutputWiredColumn.setMaxWidth(100);
TableColumn yminitialStateColumn = ymoutputColumnModel.getColumn(OutputConfigModel.INITIALSTATE_COLUMN);
yminitialStateColumn.setCellEditor(new DefaultCellEditor(yminitialStateCombo));
yminitialStateColumn.setResizable(false);
yminitialStateColumn.setMinWidth(90);
yminitialStateColumn.setMaxWidth(100);
TableColumn ymoutputTypeColumn = ymoutputColumnModel.getColumn(OutputConfigModel.OUTPUTTYPE_COLUMN);
ymoutputTypeColumn.setCellEditor(new DefaultCellEditor(ymoutputTypeCombo));
ymoutputTypeColumn.setResizable(false);
ymoutputTypeColumn.setMinWidth(90);
ymoutputTypeColumn.setMaxWidth(100);
TableColumn ymoutputLengthColumn = ymoutputColumnModel.getColumn(OutputConfigModel.OUTPUTLENGTH_COLUMN);
ymoutputLengthColumn.setCellEditor(new DefaultCellEditor(ymoutputLengthCombo));
ymoutputLengthColumn.setResizable(false);
ymoutputLengthColumn.setMinWidth(90);
ymoutputLengthColumn.setMaxWidth(100);
TableColumn ymoutputaddressColumn = ymoutputColumnModel.getColumn(OutputConfigModel.OUTPUTADDRESS_COLUMN);
ymoutputaddressColumn.setMinWidth(110);
ymoutputaddressColumn.setMaxWidth(120);
// Finish Set up the YardMaster nodes
JScrollPane ymoutputScrollPane = new JScrollPane(ymoutputConfigTable);
JPanel panelYardMasterTable = new JPanel();
panelYardMasterTable.setLayout(new BoxLayout(panelYardMasterTable, BoxLayout.Y_AXIS));
panelYardMasterTable.add(ymoutputScrollPane, BorderLayout.CENTER);
panelYardMaster.add(panelYardMasterTable, BoxLayout.Y_AXIS);
Border panelYardMasterBorder = BorderFactory.createEtchedBorder();
Border panelYardMasterTitled = BorderFactory.createTitledBorder(panelYardMasterBorder, rb.getString("BoxLabelNodeSpecific"));
panelYardMaster.setBorder(panelYardMasterTitled);
panelYardMaster.setVisible(false);
contentPane.add(panelYardMaster);
// Set up the SwitchMan nodes
panelSwitchman.setLayout(new BoxLayout(panelSwitchman, BoxLayout.Y_AXIS));
JPanel panelSwitchman1 = new JPanel();
panelSwitchman1.setLayout(new FlowLayout());
statusTextSwitchman1.setText(stdStatusSwitchman1);
statusTextSwitchman1.setVisible(true);
panelSwitchman1.add(statusTextSwitchman1);
panelSwitchman.add(panelSwitchman1);
JPanel panelSwitchman2 = new JPanel();
panelSwitchman2.setLayout(new FlowLayout());
statusTextSwitchman2.setText(stdStatusSwitchman2);
statusTextSwitchman2.setVisible(true);
panelSwitchman2.add(statusTextSwitchman2);
panelSwitchman.add(panelSwitchman2);
JPanel panelSwitchman3 = new JPanel();
panelSwitchman3.setLayout(new FlowLayout());
statusTextSwitchman3.setText(stdStatusSwitchman3);
statusTextSwitchman3.setVisible(true);
panelSwitchman3.add(statusTextSwitchman3);
panelSwitchman.add(panelSwitchman3);
// Output circuit configuration
swoutputConfigModel = new OutputConfigModel();
swoutputConfigModel.setNumRows(16);
swoutputConfigModel.setEditMode(false);
JTable swoutputConfigTable = new JTable(swoutputConfigModel);
swoutputConfigTable.setRowSelectionAllowed(false);
swoutputConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 125));
JComboBox<String> swoutputWiredCombo = new JComboBox<String>();
swoutputWiredCombo.addItem(rb.getString("OutputWiredNC"));
swoutputWiredCombo.addItem(rb.getString("OutputWiredNO"));
JComboBox<String> swinitialStateCombo = new JComboBox<String>();
swinitialStateCombo.addItem(rb.getString("InitialStateOn"));
swinitialStateCombo.addItem(rb.getString("InitialStateOff"));
JComboBox<String> swoutputTypeCombo = new JComboBox<String>();
swoutputTypeCombo.addItem(rb.getString("OutputTypeONOFF"));
swoutputTypeCombo.addItem(rb.getString("OutputTypePULSE"));
swoutputTypeCombo.addItem(rb.getString("OutputTypeBLINK"));
JComboBox<String> swoutputLengthCombo = new JComboBox<String>();
for (int t = 0; t < 255; t++) {
swoutputLengthCombo.addItem(String.valueOf(t));
}
TableColumnModel swoutputColumnModel = swoutputConfigTable.getColumnModel();
TableColumn swoutputCircuitAddressColumn = swoutputColumnModel.getColumn(OutputConfigModel.OUTPUTCIRCUITADDRESS_COLUMN);
swoutputCircuitAddressColumn.setMinWidth(70);
swoutputCircuitAddressColumn.setMaxWidth(80);
TableColumn swoutputWiredColumn = swoutputColumnModel.getColumn(OutputConfigModel.OUTPUTWIRED_COLUMN);
swoutputWiredColumn.setCellEditor(new DefaultCellEditor(swoutputWiredCombo));
swoutputWiredColumn.setResizable(false);
swoutputWiredColumn.setMinWidth(90);
swoutputWiredColumn.setMaxWidth(100);
TableColumn swinitialStateColumn = swoutputColumnModel.getColumn(OutputConfigModel.INITIALSTATE_COLUMN);
swinitialStateColumn.setCellEditor(new DefaultCellEditor(swinitialStateCombo));
swinitialStateColumn.setResizable(false);
swinitialStateColumn.setMinWidth(90);
swinitialStateColumn.setMaxWidth(100);
TableColumn swoutputTypeColumn = swoutputColumnModel.getColumn(OutputConfigModel.OUTPUTTYPE_COLUMN);
swoutputTypeColumn.setCellEditor(new DefaultCellEditor(swoutputTypeCombo));
swoutputTypeColumn.setResizable(false);
swoutputTypeColumn.setMinWidth(90);
swoutputTypeColumn.setMaxWidth(100);
TableColumn swoutputLengthColumn = swoutputColumnModel.getColumn(OutputConfigModel.OUTPUTLENGTH_COLUMN);
swoutputLengthColumn.setCellEditor(new DefaultCellEditor(swoutputLengthCombo));
swoutputLengthColumn.setResizable(false);
swoutputLengthColumn.setMinWidth(90);
swoutputLengthColumn.setMaxWidth(100);
TableColumn swoutputaddressColumn = swoutputColumnModel.getColumn(OutputConfigModel.OUTPUTADDRESS_COLUMN);
swoutputaddressColumn.setMinWidth(110);
swoutputaddressColumn.setMaxWidth(120);
// Finish Set up the Switchman nodes
JScrollPane swoutputScrollPane = new JScrollPane(swoutputConfigTable);
JPanel panelSwitchmanTable = new JPanel();
panelSwitchmanTable.setLayout(new BoxLayout(panelSwitchmanTable, BoxLayout.Y_AXIS));
panelSwitchmanTable.add(swoutputScrollPane, BorderLayout.CENTER);
panelSwitchman.add(panelSwitchmanTable, BoxLayout.Y_AXIS);
Border panelSwitchmanBorder = BorderFactory.createEtchedBorder();
Border panelSwitchmanTitled = BorderFactory.createTitledBorder(panelSwitchmanBorder, rb.getString("BoxLabelNodeSpecific"));
panelSwitchman.setBorder(panelSwitchmanTitled);
panelSwitchman.setVisible(false);
contentPane.add(panelSwitchman);
// Set up the Sentry nodes
panelSentry.setLayout(new BoxLayout(panelSentry, BoxLayout.Y_AXIS));
JPanel panelSentry1 = new JPanel();
panelSentry1.setLayout(new FlowLayout());
statusTextSentry1.setText(stdStatusSentry1);
statusTextSentry1.setVisible(true);
panelSentry1.add(statusTextSentry1);
panelSentry.add(panelSentry1);
JPanel panelSentry2 = new JPanel();
panelSentry2.setLayout(new FlowLayout());
statusTextSentry2.setText(stdStatusSentry2);
statusTextSentry2.setVisible(true);
panelSentry2.add(statusTextSentry2);
panelSentry.add(panelSentry2);
JPanel panelSentry3 = new JPanel();
panelSentry3.setLayout(new FlowLayout());
statusTextSentry3.setText(stdStatusSentry3);
statusTextSentry3.setVisible(true);
panelSentry3.add(statusTextSentry3);
panelSentry.add(panelSentry3);
sysensorConfigModel = new SensorConfigModel();
sysensorConfigModel.setNumRows(16);
sysensorConfigModel.setEditMode(false);
JTable sysensorConfigTable = new JTable(sysensorConfigModel);
sysensorConfigTable.setRowSelectionAllowed(false);
sysensorConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 125));
JComboBox<String> syfilterTypeCombo = new JComboBox<String>();
syfilterTypeCombo.addItem(rb.getString("FilterTypeNoise"));
syfilterTypeCombo.addItem(rb.getString("FilterTypeDebounce"));
syfilterTypeCombo.addItem(rb.getString("FilterTypeCarGap"));
syfilterTypeCombo.addItem(rb.getString("FilterTypeDirtyTrack"));
JComboBox<String> syfilterPolarityCombo = new JComboBox<String>();
syfilterPolarityCombo.addItem(rb.getString("FilterNormalPolarity"));
syfilterPolarityCombo.addItem(rb.getString("FilterInversePolarity"));
JComboBox<String> syfilterThresholdCombo = new JComboBox<String>();
for (int t = 0; t < 32; t++) {
syfilterThresholdCombo.addItem(String.valueOf(t));
}
TableColumnModel sytypeColumnModel = sysensorConfigTable.getColumnModel();
TableColumn sycircuitAddressColumn = sytypeColumnModel.getColumn(SensorConfigModel.SENSORCIRCUITADDRESS_COLUMN);
sycircuitAddressColumn.setMinWidth(70);
sycircuitAddressColumn.setMaxWidth(80);
TableColumn sycardTypeColumn = sytypeColumnModel.getColumn(SensorConfigModel.TYPE_COLUMN);
sycardTypeColumn.setCellEditor(new DefaultCellEditor(syfilterTypeCombo));
sycardTypeColumn.setResizable(false);
sycardTypeColumn.setMinWidth(90);
sycardTypeColumn.setMaxWidth(100);
TableColumn sycardPolarityColumn = sytypeColumnModel.getColumn(SensorConfigModel.POLARITY_COLUMN);
sycardPolarityColumn.setCellEditor(new DefaultCellEditor(syfilterPolarityCombo));
sycardPolarityColumn.setResizable(false);
sycardPolarityColumn.setMinWidth(90);
sycardPolarityColumn.setMaxWidth(100);
TableColumn sycardThresholdColumn = sytypeColumnModel.getColumn(SensorConfigModel.THRESHOLD_COLUMN);
sycardThresholdColumn.setCellEditor(new DefaultCellEditor(syfilterThresholdCombo));
sycardThresholdColumn.setResizable(false);
sycardThresholdColumn.setMinWidth(90);
sycardThresholdColumn.setMaxWidth(100);
TableColumn sysensorAddressColumn = sytypeColumnModel.getColumn(SensorConfigModel.SENSORADDRESS_COLUMN);
sysensorAddressColumn.setMinWidth(110);
sysensorAddressColumn.setMaxWidth(1200);
// Finish Set up the Sentry nodes
JScrollPane sysensorScrollPane = new JScrollPane(sysensorConfigTable);
JPanel panelSentrytable = new JPanel();
panelSentrytable.setLayout(new BoxLayout(panelSentrytable, BoxLayout.Y_AXIS));
panelSentrytable.add(sysensorScrollPane, BorderLayout.CENTER);
panelSentry.add(panelSentrytable, BoxLayout.Y_AXIS);
Border panelSentryBorder = BorderFactory.createEtchedBorder();
Border panelSentryTitled = BorderFactory.createTitledBorder(panelSentryBorder, rb.getString("BoxLabelNodeSpecific"));
panelSentry.setBorder(panelSentryTitled);
contentPane.add(panelSentry);
panelSentry.setVisible(false);
// Set up the notes panel
JPanel panel3 = new JPanel();
panel3.setLayout(new BoxLayout(panel3, BoxLayout.Y_AXIS));
JPanel panel31 = new JPanel();
panel31.setLayout(new FlowLayout());
statusText1.setText(stdStatus1);
statusText1.setVisible(true);
panel31.add(statusText1);
JPanel panel32 = new JPanel();
panel32.setLayout(new FlowLayout());
statusText2.setText(stdStatus2);
statusText2.setVisible(true);
panel32.add(statusText2);
JPanel panel33 = new JPanel();
panel33.setLayout(new FlowLayout());
statusText3.setText(stdStatus3);
statusText3.setVisible(true);
panel33.add(statusText3);
panel3.add(panel31);
panel3.add(panel32);
panel3.add(panel33);
Border panel3Border = BorderFactory.createEtchedBorder();
Border panel3Titled = BorderFactory.createTitledBorder(panel3Border, rb.getString("BoxLabelNotes"));
panel3.setBorder(panel3Titled);
contentPane.add(panel3);
// Set up buttons
JPanel panel4 = new JPanel();
panel4.setLayout(new FlowLayout());
addButton.setText(rb.getString("ButtonAdd"));
addButton.setVisible(true);
addButton.setToolTipText(rb.getString("TipAddButton"));
addButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
addButtonActionPerformed();
}
});
panel4.add(addButton);
editButton.setText(rb.getString("ButtonEdit"));
editButton.setVisible(true);
editButton.setToolTipText(rb.getString("TipEditButton"));
panel4.add(editButton);
editButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
editButtonActionPerformed();
}
});
panel4.add(deleteButton);
deleteButton.setText(rb.getString("ButtonDelete"));
deleteButton.setVisible(true);
deleteButton.setToolTipText(rb.getString("TipDeleteButton"));
panel4.add(deleteButton);
deleteButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
deleteButtonActionPerformed();
}
});
panel4.add(doneButton);
doneButton.setText(rb.getString("ButtonDone"));
doneButton.setVisible(true);
doneButton.setToolTipText(rb.getString("TipDoneButton"));
panel4.add(doneButton);
doneButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
doneButtonActionPerformed();
}
});
panel4.add(updateButton);
updateButton.setText(rb.getString("ButtonUpdate"));
updateButton.setVisible(true);
updateButton.setToolTipText(rb.getString("TipUpdateButton"));
panel4.add(updateButton);
updateButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
updateButtonActionPerformed();
}
});
updateButton.setVisible(false);
panel4.add(cancelButton);
cancelButton.setText(rb.getString("ButtonCancel"));
cancelButton.setVisible(true);
cancelButton.setToolTipText(rb.getString("TipCancelButton"));
panel4.add(cancelButton);
cancelButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
cancelButtonActionPerformed();
}
});
cancelButton.setVisible(false);
contentPane.add(panel4);
// add help menu to window
addHelpMenu("package.jmri.jmrix.acela.nodeconfig.NodeConfigFrame", true);
// pack for display
pack();
}
Aggregations