use of javax.swing.table.TableColumn in project jdk8u_jdk by JetBrains.
the class SynthTableUI method paintCells.
private void paintCells(SynthContext context, Graphics g, int rMin, int rMax, int cMin, int cMax) {
JTableHeader header = table.getTableHeader();
TableColumn draggedColumn = (header == null) ? null : header.getDraggedColumn();
TableColumnModel cm = table.getColumnModel();
int columnMargin = cm.getColumnMargin();
Rectangle cellRect;
TableColumn aColumn;
int columnWidth;
if (table.getComponentOrientation().isLeftToRight()) {
for (int row = rMin; row <= rMax; row++) {
cellRect = table.getCellRect(row, cMin, false);
for (int column = cMin; column <= cMax; column++) {
aColumn = cm.getColumn(column);
columnWidth = aColumn.getWidth();
cellRect.width = columnWidth - columnMargin;
if (aColumn != draggedColumn) {
paintCell(context, g, cellRect, row, column);
}
cellRect.x += columnWidth;
}
}
} else {
for (int row = rMin; row <= rMax; row++) {
cellRect = table.getCellRect(row, cMin, false);
aColumn = cm.getColumn(cMin);
if (aColumn != draggedColumn) {
columnWidth = aColumn.getWidth();
cellRect.width = columnWidth - columnMargin;
paintCell(context, g, cellRect, row, cMin);
}
for (int column = cMin + 1; column <= cMax; column++) {
aColumn = cm.getColumn(column);
columnWidth = aColumn.getWidth();
cellRect.width = columnWidth - columnMargin;
cellRect.x -= columnWidth;
if (aColumn != draggedColumn) {
paintCell(context, g, cellRect, row, column);
}
}
}
}
// Paint the dragged column if we are dragging.
if (draggedColumn != null) {
paintDraggedArea(context, g, rMin, rMax, draggedColumn, header.getDraggedDistance());
}
// Remove any renderers that may be left in the rendererPane.
rendererPane.removeAll();
}
use of javax.swing.table.TableColumn in project JMRI by JMRI.
the class SignallingPanel method buildBlocksPanel.
/**
* Compose GUI for setting up Blocks tab for an SML.
*
* @return a JPanel containing the SML control blocks configuration interface
*/
JPanel buildBlocksPanel() {
JPanel blockPanel = new JPanel();
blockPanel.setLayout(new BoxLayout(blockPanel, BoxLayout.Y_AXIS));
jmri.BlockManager bm = jmri.InstanceManager.getDefault(jmri.BlockManager.class);
List<String> systemNameList = bm.getSystemNameList();
_manualBlockList = new ArrayList<ManualBlockList>(systemNameList.size());
Iterator<String> iter = systemNameList.iterator();
while (iter.hasNext()) {
String systemName = iter.next();
_manualBlockList.add(new ManualBlockList(bm.getBySystemName(systemName)));
}
if ((sml != null) && (destMast != null)) {
ArrayList<Block> blkList = sml.getAutoBlocks(destMast);
_automaticBlockList = new ArrayList<AutoBlockList>(blkList.size());
Iterator<Block> iterBlk = blkList.iterator();
while (iterBlk.hasNext()) {
Block blk = iterBlk.next();
AutoBlockList blockitem = new AutoBlockList(blk);
blockitem.setState(sml.getAutoBlockState(blk, destMast));
_automaticBlockList.add(blockitem);
}
}
// this hides a field
JPanel p2xc = new JPanel();
JPanel p2xcSpace = new JPanel();
p2xcSpace.setLayout(new BoxLayout(p2xcSpace, BoxLayout.Y_AXIS));
p2xcSpace.add(new JLabel("XXX"));
p2xc.add(p2xcSpace);
JPanel p21c = new JPanel();
p21c.setLayout(new BoxLayout(p21c, BoxLayout.Y_AXIS));
p21c.add(new JLabel(Bundle.getMessage("LabelSelectChecked", Bundle.getMessage("Blocks"))));
p2xc.add(p21c);
_blockModel = new BlockModel();
JTable manualBlockTable = new JTable(_blockModel);
TableRowSorter<BlockModel> manualBlockSorter = new TableRowSorter<>(_blockModel);
// configure row height for comboBox
// row height has to be greater than for plain tables
manualBlockTable.setRowHeight(Sizer.getPreferredSize().height - 2);
manualBlockSorter.setComparator(BlockModel.SNAME_COLUMN, new SystemNameComparator());
RowSorterUtil.setSortOrder(manualBlockSorter, BlockModel.SNAME_COLUMN, SortOrder.ASCENDING);
// create static comboBox in State column
_blockModel.configStateColumn(manualBlockTable);
manualBlockTable.setRowSorter(manualBlockSorter);
manualBlockTable.setRowSelectionAllowed(false);
manualBlockTable.setPreferredScrollableViewportSize(new java.awt.Dimension(480, 100));
// JComboBox<String> stateCCombo = new JComboBox<>(); // moved to ManualBlockTable class
TableColumnModel _manualBlockColumnModel = manualBlockTable.getColumnModel();
TableColumn includeColumnC = _manualBlockColumnModel.getColumn(BlockModel.INCLUDE_COLUMN);
includeColumnC.setResizable(false);
// was fixed 60
includeColumnC.setMinWidth(9 * Bundle.getMessage("Include").length());
includeColumnC.setMaxWidth(includeColumnC.getMinWidth() + 5);
TableColumn sNameColumnC = _manualBlockColumnModel.getColumn(BlockModel.SNAME_COLUMN);
sNameColumnC.setResizable(true);
sNameColumnC.setMinWidth(75);
sNameColumnC.setMaxWidth(95);
TableColumn stateColumnC = _manualBlockColumnModel.getColumn(BlockModel.STATE_COLUMN);
//stateColumnC.setCellEditor(new DefaultCellEditor(stateCCombo)); // moved to ManualBlockTable class
stateColumnC.setResizable(false);
stateColumnC.setMinWidth(9 * Math.max(SET_TO_UNOCCUPIED.length(), SET_TO_OCCUPIED.length()) + 40);
// was fixed 100
stateColumnC.setMaxWidth(stateColumnC.getMinWidth() + 10);
// remaining space is filled by UserName
_manualBlockScrollPane = new JScrollPane(manualBlockTable);
p2xc.add(_manualBlockScrollPane, BorderLayout.CENTER);
blockPanel.add(p2xc);
p2xc.setVisible(true);
ROW_HEIGHT = manualBlockTable.getRowHeight();
p2xcSpace.setVisible(false);
JPanel p2xaSpace = new JPanel();
p2xaSpace.setLayout(new BoxLayout(p2xaSpace, BoxLayout.Y_AXIS));
p2xaSpace.add(new JLabel("XXX"));
p2xb.add(p2xaSpace);
JPanel p21a = new JPanel();
p21a.setLayout(new BoxLayout(p21a, BoxLayout.Y_AXIS));
p21a.add(new JLabel(Bundle.getMessage("LabelAutogenerated", Bundle.getMessage("Blocks"))));
p2xb.add(p21a);
_autoBlockModel = new AutoBlockModel();
JTable autoBlockTable = new JTable(_autoBlockModel);
TableRowSorter<AutoBlockModel> autoBlockSorter = new TableRowSorter<>(_autoBlockModel);
autoBlockSorter.setComparator(AutoBlockModel.SNAME_COLUMN, new SystemNameComparator());
RowSorterUtil.setSortOrder(autoBlockSorter, AutoBlockModel.SNAME_COLUMN, SortOrder.ASCENDING);
autoBlockTable.setRowSorter(autoBlockSorter);
autoBlockTable.setRowSelectionAllowed(false);
autoBlockTable.setPreferredScrollableViewportSize(new java.awt.Dimension(480, 100));
TableColumnModel _autoBlockColumnModel = autoBlockTable.getColumnModel();
TableColumn sNameColumnA = _autoBlockColumnModel.getColumn(AutoBlockModel.SNAME_COLUMN);
sNameColumnA.setResizable(true);
sNameColumnA.setMinWidth(75);
sNameColumnA.setMaxWidth(95);
TableColumn stateColumnA = _autoBlockColumnModel.getColumn(AutoBlockModel.STATE_COLUMN);
stateColumnA.setResizable(false);
stateColumnA.setMinWidth(90);
stateColumnA.setMaxWidth(100);
_autoBlockScrollPane = new JScrollPane(autoBlockTable);
p2xb.add(_autoBlockScrollPane, BorderLayout.CENTER);
blockPanel.add(p2xb);
p2xb.setVisible(true);
ROW_HEIGHT = autoBlockTable.getRowHeight();
p2xaSpace.setVisible(false);
return blockPanel;
}
use of javax.swing.table.TableColumn in project JMRI by JMRI.
the class ControllerFilterFrame method buildTable.
private void buildTable(JTable table) {
table.getModel().addTableModelListener(this);
table.setRowSelectionAllowed(false);
table.setPreferredScrollableViewportSize(new java.awt.Dimension(580, 240));
//table.getTableHeader().setBackground(Color.lightGray);
table.setShowGrid(false);
table.setShowHorizontalLines(true);
table.setGridColor(Color.gray);
table.setRowHeight(30);
TableColumnModel columnModel = table.getColumnModel();
TableColumn include = columnModel.getColumn(AbstractFilterModel.INCLUDECOL);
include.setResizable(false);
include.setMinWidth(60);
include.setMaxWidth(70);
TableColumn sName = columnModel.getColumn(AbstractFilterModel.SNAMECOL);
sName.setResizable(true);
sName.setMinWidth(80);
sName.setPreferredWidth(80);
sName.setMaxWidth(340);
TableColumn uName = columnModel.getColumn(AbstractFilterModel.UNAMECOL);
uName.setResizable(true);
uName.setMinWidth(180);
uName.setPreferredWidth(300);
uName.setMaxWidth(440);
}
use of javax.swing.table.TableColumn 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();
}
use of javax.swing.table.TableColumn in project intellij-plugins by JetBrains.
the class EditableTreeTable method updateColumnSizes.
// copied from TableView
public void updateColumnSizes() {
final JTableHeader header = getTableHeader();
final TableCellRenderer defaultRenderer = header == null ? null : header.getDefaultRenderer();
ColumnInfo[] columns = ((ListTreeTableModelOnColumns) getTableModel()).getColumnInfos();
for (int i = 0; i < columns.length; i++) {
final ColumnInfo columnInfo = columns[i];
final TableColumn column = getColumnModel().getColumn(i);
final Component headerComponent = defaultRenderer == null ? null : defaultRenderer.getTableCellRendererComponent(this, column.getHeaderValue(), false, false, 0, 0);
final Dimension headerSize = headerComponent == null ? JBUI.emptySize() : headerComponent.getPreferredSize();
final String maxStringValue;
final String preferredValue;
if (columnInfo.getWidth(this) > 0) {
int width = columnInfo.getWidth(this);
column.setMaxWidth(width);
column.setPreferredWidth(width);
column.setMinWidth(width);
} else if ((maxStringValue = columnInfo.getMaxStringValue()) != null) {
int width = getFontMetrics(getFont()).stringWidth(maxStringValue) + columnInfo.getAdditionalWidth();
width = Math.max(width, headerSize.width);
column.setPreferredWidth(width);
column.setMaxWidth(width);
} else if ((preferredValue = columnInfo.getPreferredStringValue()) != null) {
int width = getFontMetrics(getFont()).stringWidth(preferredValue) + columnInfo.getAdditionalWidth();
width = Math.max(width, headerSize.width);
column.setPreferredWidth(width);
}
}
}
Aggregations