use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class PaneProgDp3Action method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
// NOI18N
log.debug("Pane programmer requested");
if (f == null) {
log.debug("found f==null");
// create the initial frame that steers
// NOI18N
f = new JmriJFrame(apps.gui3.dp3.Bundle.getMessage("FrameProgrammerSetup"));
f.getContentPane().setLayout(new BorderLayout());
// ensure status line is cleared on close so it is normal if re-opened
f.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent we) {
// NOI18N
statusLabel.setText(SymbolicProgBundle.getMessage("StateIdle"));
f.windowClosing(we);
}
});
// add the Roster menu
JMenuBar menuBar = new JMenuBar();
// NOI18N
JMenu j = new JMenu(SymbolicProgBundle.getMessage("MenuFile"));
// NOI18N
j.add(new jmri.jmrit.decoderdefn.PrintDecoderListAction(SymbolicProgBundle.getMessage("MenuPrintDecoderDefinitions"), f, false));
// NOI18N
j.add(new jmri.jmrit.decoderdefn.PrintDecoderListAction(SymbolicProgBundle.getMessage("MenuPrintPreviewDecoderDefinitions"), f, true));
menuBar.add(j);
// NOI18N
menuBar.add(new jmri.jmrit.roster.swing.RosterMenu(SymbolicProgBundle.getMessage("MenuRoster"), jmri.jmrit.roster.swing.RosterMenu.MAINMENU, f));
f.setJMenuBar(menuBar);
final JPanel bottomPanel = new JPanel(new BorderLayout());
// new Loco on programming track
combinedLocoSelTree = new CombinedLocoSelTreePane(statusLabel, modePane) {
@Override
protected void startProgrammer(DecoderFile decoderFile, RosterEntry re, String progName) {
// progName is ignored here
log.debug("startProgrammer");
String title = // NOI18N
java.text.MessageFormat.format(// NOI18N
SymbolicProgBundle.getMessage("FrameServiceProgrammerTitle"), // NOI18N
new Object[] { Bundle.getMessage("NewDecoder") });
if (re != null) {
title = // NOI18N
java.text.MessageFormat.format(// NOI18N
SymbolicProgBundle.getMessage("FrameServiceProgrammerTitle"), new Object[] { re.getId() });
}
JFrame p;
if (!modePane.isSelected() || modePane.getProgrammer() == null) {
p = new PaneProgFrame(decoderFile, re, // NOI18N
title, // NOI18N
"programmers" + File.separator + "Comprehensive.xml", null, false) {
@Override
protected JPanel getModePane() {
return null;
}
};
} else {
p = new PaneServiceProgFrame(decoderFile, re, // NOI18N
title, // NOI18N
"programmers" + File.separator + "Comprehensive.xml", modePane.getProgrammer());
}
p.pack();
p.setVisible(true);
}
@Override
protected void openNewLoco() {
log.debug("openNewLoco");
// find the decoderFile object
DecoderFile decoderFile = DecoderIndexFile.instance().fileFromTitle(selectedDecoderType());
// NOI18N
log.debug("decoder file: {}", decoderFile.getFilename());
if (rosterIdField.getText().equals(SymbolicProgBundle.getMessage("LabelNewDecoder"))) {
// NOI18N
re = new RosterEntry();
re.setDecoderFamily(decoderFile.getFamily());
re.setDecoderModel(decoderFile.getModel());
// NOI18N
re.setId(SymbolicProgBundle.getMessage("LabelNewDecoder"));
//re.writeFile(cvModel, iCvModel, variableModel );
// note that we're leaving the filename null
// add the new roster entry to the in-memory roster
Roster.getDefault().addEntry(re);
} else {
try {
saveRosterEntry();
} catch (JmriException ex) {
// NOI18N
log.warn("Exception while saving roster entry", ex);
return;
}
}
// create a dummy RosterEntry with the decoder info
// no programmer name in this case
startProgrammer(decoderFile, re, "");
//Set our roster entry back to null so that a fresh roster entry can be created if needed
re = null;
}
@Override
protected JPanel layoutRosterSelection() {
log.debug("layoutRosterSelection");
return null;
}
@Override
protected JPanel layoutDecoderSelection() {
log.debug("layoutDecoderSelection");
JPanel pan = super.layoutDecoderSelection();
dTree.removeTreeSelectionListener(dListener);
dTree.addTreeSelectionListener(dListener = new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
if (!dTree.isSelectionEmpty() && dTree.getSelectionPath() != null && // check that this isn't just a model
((TreeNode) dTree.getSelectionPath().getLastPathComponent()).isLeaf() && // can't be just a mfg, has to be at least a family
dTree.getSelectionPath().getPathCount() > 2 && // can't be a multiple decoder selection
dTree.getSelectionCount() < 2) {
log.debug("Selection event with " + dTree.getSelectionPath().toString());
//if (locoBox != null) locoBox.setSelectedIndex(0);
go2.setEnabled(true);
go2.setRequestFocusEnabled(true);
go2.requestFocus();
// NOI18N
go2.setToolTipText(SymbolicProgBundle.getMessage("TipClickToOpen"));
decoderFile = DecoderIndexFile.instance().fileFromTitle(selectedDecoderType());
setUpRosterPanel();
} else {
decoderFile = null;
// decoder not selected - require one
go2.setEnabled(false);
// NOI18N
go2.setToolTipText(SymbolicProgBundle.getMessage("TipSelectLoco"));
setUpRosterPanel();
}
}
});
return pan;
}
@Override
protected void selectDecoder(int mfgID, int modelID, int productID) {
log.debug("selectDecoder");
//On selecting a new decoder start a fresh with a new roster entry
super.selectDecoder(mfgID, modelID, productID);
findDecoderAddress();
}
@Override
protected JPanel createProgrammerSelection() {
log.debug("createProgrammerSelection");
JPanel pane3a = new JPanel();
pane3a.setLayout(new BoxLayout(pane3a, BoxLayout.Y_AXIS));
// NOI18N
go2 = new JButton(Bundle.getMessage("OpenProgrammer"));
go2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
// NOI18N
log.debug("Open programmer pressed");
openButton();
// close this window to prevent having
// two windows processing at the same time
//
// Alternately, could have just cleared out a
// bunch of stuff to force starting over, but
// that seems to be an even more confusing
// user experience.
log.debug("Closing f {}", f);
WindowEvent wev = new WindowEvent(f, WindowEvent.WINDOW_CLOSING);
java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(wev);
}
});
go2.setAlignmentX(JLabel.RIGHT_ALIGNMENT);
go2.setEnabled(false);
// NOI18N
go2.setToolTipText(SymbolicProgBundle.getMessage("TipSelectLoco"));
bottomPanel.add(go2, BorderLayout.EAST);
return pane3a;
}
};
// load primary frame
JPanel topPanel = new JPanel();
topPanel.add(modePane);
topPanel.add(new JSeparator(javax.swing.SwingConstants.HORIZONTAL));
f.getContentPane().add(topPanel, BorderLayout.NORTH);
//f.getContentPane().add(modePane);
//f.getContentPane().add(new JSeparator(javax.swing.SwingConstants.HORIZONTAL));
combinedLocoSelTree.setAlignmentX(JLabel.CENTER_ALIGNMENT);
f.getContentPane().add(combinedLocoSelTree, BorderLayout.CENTER);
//f.getContentPane().add(new JSeparator(javax.swing.SwingConstants.HORIZONTAL));
//basicRoster.setEnabled(false);
statusLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
bottomPanel.add(statusLabel, BorderLayout.SOUTH);
f.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
f.pack();
// NOI18N
log.debug("Tab-Programmer setup created");
} else {
re = null;
combinedLocoSelTree.resetSelections();
}
f.setVisible(true);
}
use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class LogixTableAction method makeEditConditionalWindow.
// ********************* Edit Conditional Window and Methods *******************
/**
* Create and/or initialize the Edit Conditional window.
* <p>
* Note: you can get here via the New Conditional button (newConditionalPressed)
* or via an Edit button in the Conditional table of the Edit Logix window.
*/
void makeEditConditionalWindow() {
// deactivate this Logix
_curLogix.deActivateLogix();
conditionalUserName.setText(_curConditional.getUserName());
if (editConditionalFrame == null) {
editConditionalFrame = new JmriJFrame(rbx.getString("TitleEditConditional"), false, false);
editConditionalFrame.addHelpMenu("package.jmri.jmrit.beantable.ConditionalAddEdit", true);
Container contentPane = editConditionalFrame.getContentPane();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
JPanel panel1 = new JPanel();
panel1.setLayout(new FlowLayout());
panel1.add(new JLabel(Bundle.getMessage("ColumnSystemName") + ":"));
panel1.add(new JLabel(_curConditional.getSystemName()));
contentPane.add(panel1);
JPanel panel2 = new JPanel();
panel2.setLayout(new FlowLayout());
panel2.add(new JLabel(Bundle.getMessage("ColumnUserName") + ":"));
panel2.add(conditionalUserName);
conditionalUserName.setToolTipText(rbx.getString("ConditionalUserNameHint"));
contentPane.add(panel2);
// add Logical Expression Section
JPanel logicPanel = new JPanel();
logicPanel.setLayout(new BoxLayout(logicPanel, BoxLayout.Y_AXIS));
// add Antecedent Expression Panel -ONLY appears for MIXED operator statements
_antecedent = _curConditional.getAntecedentExpression();
_logicType = _curConditional.getLogicType();
_antecedentField = new JTextField(65);
_antecedentField.setFont(new Font("SansSerif", Font.BOLD, 14));
_antecedentField.setText(_antecedent);
_antecedentPanel = makeEditPanel(_antecedentField, "LabelAntecedent", "LabelAntecedentHint");
JButton helpButton = new JButton(Bundle.getMessage("MenuHelp"));
_antecedentPanel.add(helpButton);
helpButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
helpPressed(e);
}
});
_antecedentPanel.add(helpButton);
_antecedentPanel.setVisible(_logicType == Conditional.MIXED);
logicPanel.add(_antecedentPanel);
// add state variable table title
JPanel varTitle = new JPanel();
varTitle.setLayout(new FlowLayout());
varTitle.add(new JLabel(rbx.getString("StateVariableTableTitle")));
logicPanel.add(varTitle);
// set up state variables table
// initialize and populate Combo boxes for table of state variables
_notOperatorBox = new JComboBox<String>();
_notOperatorBox.addItem(" ");
_notOperatorBox.addItem(Bundle.getMessage("LogicNOT"));
_andOperatorBox = new JComboBox<String>();
_andOperatorBox.addItem(Bundle.getMessage("LogicAND"));
_andOperatorBox.addItem(Bundle.getMessage("LogicOR"));
// initialize table of state variables
_variableTableModel = new VariableTableModel();
JTable variableTable = new JTable(_variableTableModel);
variableTable.setRowHeight(_notOperatorBox.getPreferredSize().height);
variableTable.setRowSelectionAllowed(false);
int rowHeight = variableTable.getRowHeight();
TableColumnModel variableColumnModel = variableTable.getColumnModel();
TableColumn rowColumn = variableColumnModel.getColumn(VariableTableModel.ROWNUM_COLUMN);
rowColumn.setResizable(false);
rowColumn.setMaxWidth(new JTextField(3).getPreferredSize().width);
TableColumn andColumn = variableColumnModel.getColumn(VariableTableModel.AND_COLUMN);
andColumn.setResizable(false);
andColumn.setCellEditor(new DefaultCellEditor(_andOperatorBox));
andColumn.setMaxWidth(_andOperatorBox.getPreferredSize().width - 5);
TableColumn notColumn = variableColumnModel.getColumn(VariableTableModel.NOT_COLUMN);
notColumn.setCellEditor(new DefaultCellEditor(_notOperatorBox));
notColumn.setMaxWidth(_notOperatorBox.getPreferredSize().width - 5);
notColumn.setResizable(false);
TableColumn descColumn = variableColumnModel.getColumn(VariableTableModel.DESCRIPTION_COLUMN);
descColumn.setPreferredWidth(300);
descColumn.setMinWidth(200);
descColumn.setResizable(true);
TableColumn stateColumn = variableColumnModel.getColumn(VariableTableModel.STATE_COLUMN);
stateColumn.setResizable(true);
stateColumn.setMinWidth(50);
stateColumn.setMaxWidth(80);
TableColumn triggerColumn = variableColumnModel.getColumn(VariableTableModel.TRIGGERS_COLUMN);
triggerColumn.setResizable(true);
triggerColumn.setMinWidth(30);
triggerColumn.setMaxWidth(80);
TableColumn editColumn = variableColumnModel.getColumn(VariableTableModel.EDIT_COLUMN);
ButtonRenderer buttonRenderer = new ButtonRenderer();
variableTable.setDefaultRenderer(JButton.class, buttonRenderer);
TableCellEditor buttonEditor = new ButtonEditor(new JButton());
variableTable.setDefaultEditor(JButton.class, buttonEditor);
JButton testButton = new JButton("XXXXXX");
variableTable.setRowHeight(testButton.getPreferredSize().height);
editColumn.setMinWidth(testButton.getPreferredSize().width);
editColumn.setMaxWidth(testButton.getPreferredSize().width);
editColumn.setResizable(false);
TableColumn deleteColumn = variableColumnModel.getColumn(VariableTableModel.DELETE_COLUMN);
// ButtonRenderer and TableCellEditor already set
deleteColumn.setMinWidth(testButton.getPreferredSize().width);
deleteColumn.setMaxWidth(testButton.getPreferredSize().width);
deleteColumn.setResizable(false);
// add a scroll pane
JScrollPane variableTableScrollPane = new JScrollPane(variableTable);
Dimension dim = variableTable.getPreferredSize();
dim.height = 7 * rowHeight;
variableTableScrollPane.getViewport().setPreferredSize(dim);
logicPanel.add(variableTableScrollPane);
// set up state variable buttons and logic
JPanel panel42 = new JPanel();
panel42.setLayout(new FlowLayout());
// Add State Variable
JButton addVariableButton = new JButton(rbx.getString("AddVariableButton"));
panel42.add(addVariableButton);
addVariableButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addVariablePressed(e);
}
});
addVariableButton.setToolTipText(rbx.getString("AddVariableButtonHint"));
JButton checkVariableButton = new JButton(rbx.getString("CheckVariableButton"));
panel42.add(checkVariableButton);
checkVariableButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkVariablePressed(e);
}
});
checkVariableButton.setToolTipText(rbx.getString("CheckVariableButtonHint"));
logicPanel.add(panel42);
// logic type area
_operatorBox = new JComboBox<String>(new String[] { Bundle.getMessage("LogicAND"), Bundle.getMessage("LogicOR"), Bundle.getMessage("LogicMixed") });
JPanel typePanel = makeEditPanel(_operatorBox, "LabelLogicType", "TypeLogicHint");
_operatorBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logicTypeChanged(e);
}
});
_operatorBox.setSelectedIndex(_logicType - 1);
logicPanel.add(typePanel);
logicPanel.add(Box.createHorizontalStrut(STRUT));
Border logicPanelBorder = BorderFactory.createEtchedBorder();
Border logicPanelTitled = BorderFactory.createTitledBorder(logicPanelBorder, rbx.getString("TitleLogicalExpression") + " ");
logicPanel.setBorder(logicPanelTitled);
contentPane.add(logicPanel);
// End of Logic Expression Section
JPanel triggerPanel = new JPanel();
triggerPanel.setLayout(new BoxLayout(triggerPanel, BoxLayout.Y_AXIS));
ButtonGroup tGroup = new ButtonGroup();
_triggerOnChangeButton = new JRadioButton(rbx.getString("triggerOnChange"));
_triggerOnChangeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
_actionTableModel.fireTableDataChanged();
}
});
tGroup.add(_triggerOnChangeButton);
triggerPanel.add(_triggerOnChangeButton);
JRadioButton triggerOnAny = new JRadioButton(rbx.getString("triggerOnAny"));
triggerOnAny.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
_actionTableModel.fireTableDataChanged();
}
});
tGroup.add(triggerOnAny);
triggerPanel.add(triggerOnAny);
triggerOnAny.setSelected(true);
JPanel trigPanel = new JPanel();
trigPanel.add(triggerPanel);
contentPane.add(trigPanel);
_triggerOnChangeButton.setSelected(_curConditional.getTriggerOnChange());
// add Action Consequents Section
JPanel conseqentPanel = new JPanel();
conseqentPanel.setLayout(new BoxLayout(conseqentPanel, BoxLayout.Y_AXIS));
JPanel actTitle = new JPanel();
actTitle.setLayout(new FlowLayout());
actTitle.add(new JLabel(rbx.getString("ActionTableTitle")));
conseqentPanel.add(actTitle);
// set up action consequents table
_actionTableModel = new ActionTableModel();
JTable actionTable = new JTable(_actionTableModel);
actionTable.setRowSelectionAllowed(false);
actionTable.setRowHeight(testButton.getPreferredSize().height);
JPanel actionPanel = new JPanel();
actionPanel.setLayout(new BoxLayout(actionPanel, BoxLayout.Y_AXIS));
JPanel actionTitle = new JPanel();
actionTitle.setLayout(new FlowLayout());
conseqentPanel.add(actionPanel);
TableColumnModel actionColumnModel = actionTable.getColumnModel();
TableColumn descriptionColumn = actionColumnModel.getColumn(ActionTableModel.DESCRIPTION_COLUMN);
descriptionColumn.setResizable(true);
descriptionColumn.setPreferredWidth(600);
descriptionColumn.setMinWidth(300);
//descriptionColumn.setMaxWidth(760);
TableColumn actionEditColumn = actionColumnModel.getColumn(ActionTableModel.EDIT_COLUMN);
// ButtonRenderer already exists
actionTable.setDefaultRenderer(JButton.class, buttonRenderer);
TableCellEditor editButEditor = new ButtonEditor(new JButton());
actionTable.setDefaultEditor(JButton.class, editButEditor);
actionEditColumn.setMinWidth(testButton.getPreferredSize().width);
actionEditColumn.setMaxWidth(testButton.getPreferredSize().width);
actionEditColumn.setResizable(false);
TableColumn actionDeleteColumn = actionColumnModel.getColumn(ActionTableModel.DELETE_COLUMN);
// ButtonRenderer and TableCellEditor already set
actionDeleteColumn.setMinWidth(testButton.getPreferredSize().width);
actionDeleteColumn.setMaxWidth(testButton.getPreferredSize().width);
actionDeleteColumn.setResizable(false);
// add a scroll pane
JScrollPane actionTableScrollPane = new JScrollPane(actionTable);
dim = actionTableScrollPane.getPreferredSize();
dim.height = 7 * rowHeight;
actionTableScrollPane.getViewport().setPreferredSize(dim);
conseqentPanel.add(actionTableScrollPane);
// add action buttons to Action Section
JPanel panel43 = new JPanel();
panel43.setLayout(new FlowLayout());
JButton addActionButton = new JButton(rbx.getString("addActionButton"));
panel43.add(addActionButton);
addActionButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addActionPressed(e);
}
});
addActionButton.setToolTipText(rbx.getString("addActionButtonHint"));
conseqentPanel.add(panel43);
// - Reorder action button
JButton reorderButton = new JButton(rbx.getString("ReorderButton"));
panel43.add(reorderButton);
reorderButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
reorderActionPressed(e);
}
});
reorderButton.setToolTipText(rbx.getString("ReorderButtonHint"));
conseqentPanel.add(panel43);
Border conseqentPanelBorder = BorderFactory.createEtchedBorder();
Border conseqentPanelTitled = BorderFactory.createTitledBorder(conseqentPanelBorder, rbx.getString("TitleAction"));
conseqentPanel.setBorder(conseqentPanelTitled);
contentPane.add(conseqentPanel);
// End of Action Consequents Section
// Bottom Buttons - Update Conditional
JPanel panel5 = new JPanel();
panel5.setLayout(new FlowLayout());
JButton updateConditional = new JButton(rbx.getString("UpdateConditionalButton"));
panel5.add(updateConditional);
updateConditional.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updateConditionalPressed(e);
}
});
updateConditional.setToolTipText(rbx.getString("UpdateConditionalButtonHint"));
// Cancel
JButton cancelConditional = new JButton(Bundle.getMessage("ButtonCancel"));
panel5.add(cancelConditional);
cancelConditional.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
cancelConditionalPressed(e);
}
});
cancelConditional.setToolTipText(rbx.getString("CancelConditionalButtonHint"));
// Delete Conditional
JButton deleteConditional = new JButton(Bundle.getMessage("ButtonDelete"));
panel5.add(deleteConditional);
deleteConditional.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
deleteConditionalPressed(null);
}
});
deleteConditional.setToolTipText(rbx.getString("DeleteConditionalButtonHint"));
contentPane.add(panel5);
}
// setup window closing listener
editConditionalFrame.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
cancelConditionalPressed(null);
}
});
// initialize state variable table
_variableTableModel.fireTableDataChanged();
// initialize action variables
_actionTableModel.fireTableDataChanged();
editConditionalFrame.pack();
editConditionalFrame.setVisible(true);
inEditConditionalMode = true;
// update variables to their current states
checkVariablePressed(null);
}
use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class LogixTableAction method makeEditVariableWindow.
/**
* Create and/or initialize the Edit a Variable pane.
* <p>
* Note: you can get here via the New Variable button (addVariablePressed)
* or via an Edit button in the Variable table of the EditConditional window.
*
* @param row index of item to be edited in _variableList
*/
void makeEditVariableWindow(int row) {
if (alreadyEditingActionOrVariable()) {
return;
}
_curVariableRowNumber = row;
_curVariable = _variableList.get(row);
_editVariableFrame = new JmriJFrame(rbx.getString("TitleEditVariable"), true, true);
// _editVariableFrame.setLocation(10, 100);
JPanel topPanel = makeTopPanel(_editVariableFrame, "TitleAntecedentPhrase", 500, 160);
Box panel1 = Box.createHorizontalBox();
panel1.add(Box.createHorizontalGlue());
panel1.add(Box.createHorizontalStrut(STRUT));
// Item Type
_variableTypeBox = new JComboBox<String>();
for (int i = 0; i <= Conditional.ITEM_TYPE_LAST_STATE_VAR; i++) {
_variableTypeBox.addItem(ConditionalVariable.getItemTypeString(i));
}
panel1.add(makeEditPanel(_variableTypeBox, "LabelVariableType", "VariableTypeHint"));
panel1.add(Box.createHorizontalStrut(STRUT));
// Item Name
_variableNameField = new JTextField(30);
_variableNamePanel = makeEditPanel(_variableNameField, "LabelItemName", null);
_variableNamePanel.setMaximumSize(new Dimension(50, _variableNamePanel.getPreferredSize().height));
_variableNamePanel.setVisible(false);
panel1.add(_variableNamePanel);
panel1.add(Box.createHorizontalStrut(STRUT));
// Arbitrary name combo box to facilitate the panel construction
_variableComboNamePanel = makeEditPanel(_sensorNameBox, "LabelItemName", null);
_variableComboNamePanel.setVisible(false);
panel1.add(_variableComboNamePanel);
panel1.add(Box.createHorizontalStrut(STRUT));
// Combo box section for selecting conditional reference
// First box selects the Logix, the second selects the conditional within the logix
_selectLogixBox.addItem("XXXXXXXXXXXXXXXXXXXXX");
_selectConditionalBox.addItem("XXXXXXXXXXXXXXXXXXXXX");
_selectLogixPanel = makeEditPanel(_selectLogixBox, "SelectLogix", null);
_selectConditionalPanel = makeEditPanel(_selectConditionalBox, "SelectConditional", null);
_selectLogixPanel.setVisible(false);
_selectConditionalPanel.setVisible(false);
panel1.add(_selectLogixPanel);
panel1.add(_selectConditionalPanel);
panel1.add(Box.createHorizontalStrut(STRUT));
// State Box
_variableStateBox = new JComboBox<String>();
_variableStateBox.addItem("XXXXXXX");
_variableStatePanel = makeEditPanel(_variableStateBox, "LabelVariableState", "VariableStateHint");
_variableStatePanel.setVisible(false);
panel1.add(_variableStatePanel);
panel1.add(Box.createHorizontalStrut(STRUT));
// Aspects
_variableSignalBox = new JComboBox<String>();
_variableSignalBox.addItem("XXXXXXXXX");
_variableSignalPanel = makeEditPanel(_variableSignalBox, "LabelVariableAspect", "VariableAspectHint");
_variableSignalPanel.setVisible(false);
panel1.add(_variableSignalPanel);
panel1.add(Box.createHorizontalStrut(STRUT));
// Compare operator
_variableComparePanel = new JPanel();
_variableComparePanel.setLayout(new BoxLayout(_variableComparePanel, BoxLayout.X_AXIS));
_variableCompareOpBox = new JComboBox<String>();
for (int i = 1; i <= ConditionalVariable.NUM_COMPARE_OPERATIONS; i++) {
_variableCompareOpBox.addItem(ConditionalVariable.getCompareOperationString(i));
}
_variableComparePanel.add(makeEditPanel(_variableCompareOpBox, "LabelCompareOp", "CompareHintMemory"));
_variableComparePanel.add(Box.createHorizontalStrut(STRUT));
// Compare type
_variableCompareTypeBox = new JComboBox<String>();
for (int i = 0; i < Conditional.ITEM_TO_MEMORY_TEST.length; i++) {
_variableCompareTypeBox.addItem(ConditionalVariable.describeState(Conditional.ITEM_TO_MEMORY_TEST[i]));
}
_variableComparePanel.add(makeEditPanel(_variableCompareTypeBox, "LabelCompareType", "CompareTypeHint"));
_variableComparePanel.setVisible(false);
_variableCompareTypeBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
compareTypeChanged(_variableCompareTypeBox.getSelectedIndex());
_editVariableFrame.pack();
}
});
panel1.add(_variableComparePanel);
panel1.add(Box.createHorizontalStrut(STRUT));
// Data 1
_variableData1Field = new JTextField(30);
_variableData1Panel = makeEditPanel(_variableData1Field, "LabelStartTime", "DataHintTime");
_variableData1Panel.setMaximumSize(new Dimension(45, _variableData1Panel.getPreferredSize().height));
_variableData1Panel.setVisible(false);
panel1.add(_variableData1Panel);
panel1.add(Box.createHorizontalStrut(STRUT));
// Data 2
_variableData2Field = new JTextField(30);
_variableData2Panel = makeEditPanel(_variableData2Field, "LabelEndTime", "DataHintTime");
_variableData2Panel.setMaximumSize(new Dimension(45, _variableData2Panel.getPreferredSize().height));
_variableData2Panel.setVisible(false);
panel1.add(_variableData2Panel);
panel1.add(Box.createHorizontalStrut(STRUT));
panel1.add(Box.createHorizontalGlue());
topPanel.add(panel1);
ActionListener updateListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updateVariablePressed();
}
};
ActionListener cancelListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
cancelEditVariablePressed();
}
};
ActionListener deleteListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
deleteVariablePressed();
}
};
JPanel panel = makeButtonPanel(updateListener, cancelListener, deleteListener);
topPanel.add(panel);
topPanel.add(Box.createVerticalGlue());
Container contentPane = _editVariableFrame.getContentPane();
contentPane.add(topPanel);
// note - this listener cannot be added before other action items
// have been created
_variableTypeBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
variableTypeChanged(_variableTypeBox.getSelectedIndex());
_editVariableFrame.pack();
}
});
// setup window closing listener
_editVariableFrame.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
cancelEditVariablePressed();
}
});
initializeStateVariables();
_editVariableFrame.pack();
_editVariableFrame.setVisible(true);
}
use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class LogixTableAction method makeEditActionWindow.
// *************************** Edit Action Window and methods **********************
/**
* Create and/or initialize the Edit Action window.
* <p>
* Note: you can get here
* via the New Action button (addActionPressed) or via an Edit button in the
* Action table of the EditConditional window.
*
* @param row index in the table of the Action to be edited
*/
void makeEditActionWindow(int row) {
if (alreadyEditingActionOrVariable()) {
return;
}
_curActionRowNumber = row;
_curAction = _actionList.get(row);
_editActionFrame = new JmriJFrame(rbx.getString("TitleEditAction"), true, true);
// _editActionFrame.setLocation(10, 300);
JPanel topPanel = makeTopPanel(_editActionFrame, "TitleConsequentPhrase", 600, 160);
Box panel1 = Box.createHorizontalBox();
panel1.add(Box.createHorizontalGlue());
_actionItemTypeBox = new JComboBox<String>();
for (int i = 0; i <= Conditional.ITEM_TYPE_LAST_ACTION; i++) {
_actionItemTypeBox.addItem(DefaultConditionalAction.getItemTypeString(i));
}
panel1.add(makeEditPanel(_actionItemTypeBox, "LabelActionItem", "ActionItemHint"));
panel1.add(Box.createHorizontalStrut(STRUT));
_actionNameField = new JTextField(30);
_namePanel = makeEditPanel(_actionNameField, "LabelItemName", null);
_namePanel.setMaximumSize(new Dimension(50, _namePanel.getPreferredSize().height));
_namePanel.setVisible(false);
panel1.add(_namePanel);
panel1.add(Box.createHorizontalStrut(STRUT));
// Arbitrary name combo box to facilitate the panel construction
_actionComboNamePanel = makeEditPanel(_sensorNameBox, "LabelItemName", null);
_actionComboNamePanel.setVisible(false);
panel1.add(_actionComboNamePanel);
panel1.add(Box.createHorizontalStrut(STRUT));
_actionTypeBox = new JComboBox<String>();
_actionTypeBox.addItem("");
_actionTypePanel = makeEditPanel(_actionTypeBox, "LabelActionType", "ActionTypeHint");
_actionTypePanel.setVisible(false);
panel1.add(_actionTypePanel);
panel1.add(Box.createHorizontalStrut(STRUT));
_actionBox = new JComboBox<String>();
_actionBox.addItem("");
_actionPanel = makeEditPanel(_actionBox, "LabelActionType", "ActionTypeHint");
_actionPanel.setVisible(false);
panel1.add(_actionPanel);
panel1.add(Box.createHorizontalStrut(STRUT));
_shortActionString = new JTextField(15);
_shortTextPanel = makeEditPanel(_shortActionString, "LabelActionText", null);
_shortTextPanel.setMaximumSize(new Dimension(25, _shortTextPanel.getPreferredSize().height));
_shortTextPanel.add(Box.createVerticalGlue());
_shortTextPanel.setVisible(false);
panel1.add(_shortTextPanel);
panel1.add(Box.createHorizontalStrut(STRUT));
_actionOptionBox = new JComboBox<String>();
for (int i = 1; i <= Conditional.NUM_ACTION_OPTIONS; i++) {
_actionOptionBox.addItem(DefaultConditionalAction.getOptionString(i, _triggerOnChangeButton.isSelected()));
}
_optionPanel = makeEditPanel(_actionOptionBox, "LabelActionOption", "ActionOptionHint");
_optionPanel.setVisible(false);
panel1.add(_optionPanel);
panel1.add(Box.createHorizontalStrut(STRUT));
panel1.add(Box.createHorizontalGlue());
topPanel.add(panel1);
topPanel.add(Box.createVerticalStrut(5));
topPanel.add(Box.createVerticalGlue());
Box panel2 = Box.createHorizontalBox();
panel2.add(Box.createHorizontalGlue());
_setPanel = new JPanel();
_setPanel.setLayout(new BoxLayout(_setPanel, BoxLayout.Y_AXIS));
JPanel p = new JPanel();
p.add(new JLabel(rbx.getString("LabelActionFile")));
_setPanel.add(p);
// "File" replaced by ...
_actionSetButton = new JButton("...");
_actionSetButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
validateAction();
setFileLocation(e);
}
});
_actionSetButton.setMaximumSize(_actionSetButton.getPreferredSize());
_setPanel.add(_actionSetButton);
_actionSetButton.setToolTipText(rbx.getString("FileButtonHint"));
_setPanel.add(Box.createVerticalGlue());
_setPanel.setVisible(false);
panel2.add(_setPanel);
panel2.add(Box.createHorizontalStrut(5));
_longActionString = new JTextField(50);
_textPanel = makeEditPanel(_longActionString, "LabelActionText", null);
_textPanel.setMaximumSize(new Dimension(80, _textPanel.getPreferredSize().height));
_textPanel.add(Box.createVerticalGlue());
_textPanel.setVisible(false);
panel2.add(_textPanel);
panel2.add(Box.createHorizontalGlue());
topPanel.add(panel2);
topPanel.add(Box.createVerticalStrut(5));
topPanel.add(Box.createVerticalGlue());
ActionListener updateListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updateActionPressed();
}
};
ActionListener cancelListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
cancelEditActionPressed();
}
};
ActionListener deleteListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
deleteActionPressed();
}
};
JPanel panel = makeButtonPanel(updateListener, cancelListener, deleteListener);
topPanel.add(panel);
topPanel.add(Box.createVerticalGlue());
Container contentPane = _editActionFrame.getContentPane();
contentPane.add(topPanel);
// note - this listener cannot be added until all items are entered into _actionItemTypeBox
_actionItemTypeBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int select = _actionItemTypeBox.getSelectedIndex();
if (log.isDebugEnabled()) {
log.debug("_actionItemTypeBoxListener: select= " + select);
}
actionItemChanged(select);
_editActionFrame.pack();
}
});
// setup window closing listener
_editActionFrame.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
cancelEditActionPressed();
}
});
actionItemChanged(Conditional.TYPE_NONE);
initializeActionVariables();
_editActionFrame.setVisible(true);
_editActionFrame.pack();
}
use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class SignalHeadTableAction method makeEditSignalWindow.
void makeEditSignalWindow() {
// keep border and label names the same as in typeChanged() above
String eSName = _curSignal.getSystemName();
if (editingHead) {
if (eSName.equals(editSysName)) {
editFrame.setVisible(true);
} else {
log.error("Attempt to edit two signal heads at the same time-" + editSysName + "-and-" + eSName + "-");
String msg = Bundle.getMessage("WarningEdit", new Object[] { editSysName, eSName });
JOptionPane.showMessageDialog(editFrame, msg, Bundle.getMessage("WarningTitle"), JOptionPane.ERROR_MESSAGE);
editFrame.setVisible(true);
return;
}
}
// not currently editing a signal head
editSysName = eSName;
editingHead = true;
curS = InstanceManager.getDefault(jmri.SignalHeadManager.class).getBySystemName(editSysName);
if (editFrame == null) {
dccSignalPanelEdt();
eto1 = new BeanSelectCreatePanel(InstanceManager.turnoutManagerInstance(), null);
eto2 = new BeanSelectCreatePanel(InstanceManager.turnoutManagerInstance(), null);
eto3 = new BeanSelectCreatePanel(InstanceManager.turnoutManagerInstance(), null);
eto4 = new BeanSelectCreatePanel(InstanceManager.turnoutManagerInstance(), null);
eto5 = new BeanSelectCreatePanel(InstanceManager.turnoutManagerInstance(), null);
eto6 = new BeanSelectCreatePanel(InstanceManager.turnoutManagerInstance(), null);
eto7 = new BeanSelectCreatePanel(InstanceManager.turnoutManagerInstance(), null);
// set up a new edit window
editFrame = new JmriJFrame(Bundle.getMessage("TitleEditSignalHead"), false, true);
editFrame.addHelpMenu("package.jmri.jmrit.beantable.SignalAddEdit", true);
editFrame.getContentPane().setLayout(new BorderLayout());
JPanel panelHeader = new JPanel();
panelHeader.setLayout(new BoxLayout(panelHeader, BoxLayout.Y_AXIS));
JPanel p;
p = new JPanel();
p.setLayout(new FlowLayout());
p.add(signalType);
panelHeader.add(p);
panelHeader.add(new JSeparator());
p = new JPanel();
p.setLayout(new FlowLayout());
p.add(eSystemNameLabel);
p.add(eSystemName);
p.add(eSysNameLabel);
p.add(dccOffSetAddressEdt);
dccOffSetAddressEdt.setToolTipText(Bundle.getMessage("DccOffsetTooltip"));
panelHeader.add(p);
p = new JPanel();
p.setLayout(new FlowLayout());
p.add(eUserNameLabel);
p.add(eUserName);
panelHeader.add(p);
editFrame.getContentPane().add(panelHeader, BorderLayout.PAGE_START);
// create seven boxes for input information, and put into pane
JPanel panelCentre = new JPanel();
panelCentre.setLayout(new BoxLayout(panelCentre, BoxLayout.Y_AXIS));
ev1Panel = new JPanel();
ev1Panel.setLayout(defaultFlow);
ev1Panel.add(eto1);
ev1Panel.add(es1Box);
ev1Panel.add(emsaBox);
emsaBox.setToolTipText(Bundle.getMessage("SignalHeadMergTooltip"));
ev1Panel.setBorder(ev1Border);
panelCentre.add(ev1Panel);
ev2Panel = new JPanel();
ev2Panel.setLayout(defaultFlow);
ev2Panel.add(eto2);
ev2Panel.add(es2Box);
ev2Panel.add(es2aBox);
ev2Panel.add(emstBox);
emstBox.setToolTipText(Bundle.getMessage("SignalHeadUseTooltip"));
ev2Panel.add(dccSignalPanelEdt);
ev2Panel.setBorder(ev2Border);
panelCentre.add(ev2Panel);
ev3Panel = new JPanel();
ev3Panel.setLayout(defaultFlow);
ev3Panel.add(eto3);
ev3Panel.add(es3Box);
ev3Panel.add(es3aBox);
ev3Panel.setBorder(ev3Border);
panelCentre.add(ev3Panel);
ev4Panel = new JPanel();
ev4Panel.setLayout(defaultFlow);
ev4Panel.add(eto4);
ev4Panel.add(es4Box);
ev4Panel.setBorder(ev4Border);
panelCentre.add(ev4Panel);
ev5Panel = new JPanel();
ev5Panel.setLayout(defaultFlow);
ev5Panel.add(eto5);
ev5Panel.add(es5Box);
ev5Panel.setBorder(ev5Border);
panelCentre.add(ev5Panel);
ev6Panel = new JPanel();
ev6Panel.setLayout(defaultFlow);
ev6Panel.add(eto6);
ev6Panel.add(es6Box);
ev6Panel.setBorder(ev6Border);
panelCentre.add(ev6Panel);
ev7Panel = new JPanel();
ev7Panel.setLayout(defaultFlow);
ev7Panel.add(eto7);
ev7Panel.add(es7Box);
ev7Panel.setBorder(ev7Border);
panelCentre.add(ev7Panel);
p = new JPanel();
p.setLayout(defaultFlow);
p.add(evtLabel);
p.add(etot);
p.add(estBox);
panelCentre.add(p);
JScrollPane scrollPane = new JScrollPane(panelCentre);
editFrame.getContentPane().add(scrollPane, BorderLayout.CENTER);
JPanel panelBottom = new JPanel();
panelBottom.setLayout(new BoxLayout(panelBottom, BoxLayout.Y_AXIS));
// add buttons
p = new JPanel();
p.setLayout(new FlowLayout(FlowLayout.TRAILING));
JButton cancel;
p.add(cancel = new JButton(Bundle.getMessage("ButtonCancel")));
cancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
cancelPressed(e);
}
});
JButton update;
p.add(update = new JButton(Bundle.getMessage("ButtonUpdate")));
update.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updatePressed(e);
}
});
panelBottom.add(p);
editFrame.getContentPane().add(panelBottom, BorderLayout.PAGE_END);
editFrame.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
cancelPressed(null);
}
});
} else {
eto1.refresh();
eto2.refresh();
eto3.refresh();
eto4.refresh();
eto5.refresh();
eto6.refresh();
eto7.refresh();
}
// default the seven optional items to hidden, and system name to visible
eSystemName.setVisible(false);
eSysNameLabel.setVisible(true);
eUserNameLabel.setVisible(true);
eUserName.setVisible(true);
ev1Panel.setVisible(false);
dccOffSetAddressEdt.setVisible(false);
eto1.setVisible(false);
es1Box.setVisible(false);
ev2Panel.setVisible(false);
eto2.setVisible(false);
es2Box.setVisible(false);
es2aBox.setVisible(false);
dccSignalPanelEdt.setVisible(false);
ev3Panel.setVisible(false);
eto3.setVisible(false);
es3Box.setVisible(false);
es3aBox.setVisible(false);
ev4Panel.setVisible(false);
eto4.setVisible(false);
es4Box.setVisible(false);
ev5Panel.setVisible(false);
eto5.setVisible(false);
es5Box.setVisible(false);
ev6Panel.setVisible(false);
eto6.setVisible(false);
es6Box.setVisible(false);
ev7Panel.setVisible(false);
eto7.setVisible(false);
es7Box.setVisible(false);
evtLabel.setVisible(false);
etot.setVisible(false);
estBox.setVisible(false);
emstBox.setVisible(false);
emsaBox.setVisible(false);
// determine class name of signal head and initialize edit panel for this class of signal
className = curS.getClass().getName();
if (className.equals("jmri.implementation.QuadOutputSignalHead")) {
signalType.setText(quadOutput);
eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
eSysNameLabel.setText(curS.getSystemName());
eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
eUserName.setText(curS.getUserName());
ev1Border.setTitle(Bundle.getMessage("LabelGreenTurnoutNumber"));
ev1Panel.setVisible(true);
eto1.setVisible(true);
et1 = ((TripleTurnoutSignalHead) curS).getGreen().getBean();
eto1.setDefaultNamedBean(et1);
ev2Border.setTitle(Bundle.getMessage("LabelYellowTurnoutNumber"));
ev2Panel.setVisible(true);
eto2.setVisible(true);
eto2.setDefaultNamedBean(((TripleTurnoutSignalHead) curS).getYellow().getBean());
ev3Border.setTitle(Bundle.getMessage("LabelRedTurnoutNumber"));
ev3Panel.setVisible(true);
eto3.setVisible(true);
eto3.setDefaultNamedBean(((TripleTurnoutSignalHead) curS).getRed().getBean());
ev4Border.setTitle(Bundle.getMessage("LabelLunarTurnoutNumber"));
ev4Panel.setVisible(true);
eto4.setVisible(true);
eto4.setDefaultNamedBean(((QuadOutputSignalHead) curS).getLunar().getBean());
} else if (className.equals("jmri.implementation.TripleTurnoutSignalHead")) {
signalType.setText(tripleTurnout);
eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
eSysNameLabel.setText(curS.getSystemName());
eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
eUserName.setText(curS.getUserName());
ev1Border.setTitle(Bundle.getMessage("LabelGreenTurnoutNumber"));
ev1Panel.setVisible(true);
eto1.setVisible(true);
eto1.setDefaultNamedBean(((TripleTurnoutSignalHead) curS).getGreen().getBean());
ev2Border.setTitle(Bundle.getMessage("LabelYellowTurnoutNumber"));
ev2Panel.setVisible(true);
eto2.setVisible(true);
eto2.setDefaultNamedBean(((TripleTurnoutSignalHead) curS).getYellow().getBean());
ev3Border.setTitle(Bundle.getMessage("LabelRedTurnoutNumber"));
ev3Panel.setVisible(true);
eto3.setVisible(true);
eto3.setDefaultNamedBean(((TripleTurnoutSignalHead) curS).getRed().getBean());
} else if (className.equals("jmri.implementation.TripleOutputSignalHead")) {
signalType.setText(tripleOutput);
eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
eSysNameLabel.setText(curS.getSystemName());
eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
eUserName.setText(curS.getUserName());
ev1Border.setTitle(Bundle.getMessage("LabelGreenTurnoutNumber"));
ev1Panel.setVisible(true);
eto1.setVisible(true);
eto1.setDefaultNamedBean(((TripleOutputSignalHead) curS).getGreen().getBean());
ev2Border.setTitle(Bundle.getMessage("LabelBlueTurnoutNumber"));
ev2Panel.setVisible(true);
eto2.setVisible(true);
eto2.setDefaultNamedBean(((TripleOutputSignalHead) curS).getBlue().getBean());
ev3Border.setTitle(Bundle.getMessage("LabelRedTurnoutNumber"));
ev3Panel.setVisible(true);
eto3.setVisible(true);
eto3.setDefaultNamedBean(((TripleOutputSignalHead) curS).getRed().getBean());
} else if (className.equals("jmri.implementation.DoubleTurnoutSignalHead")) {
signalType.setText(doubleTurnout);
eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
eSysNameLabel.setText(curS.getSystemName());
eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
eUserName.setText(curS.getUserName());
ev1Border.setTitle(Bundle.getMessage("LabelGreenTurnoutNumber"));
ev1Panel.setVisible(true);
eto1.setVisible(true);
eto1.setDefaultNamedBean(((DoubleTurnoutSignalHead) curS).getGreen().getBean());
ev2Border.setTitle(Bundle.getMessage("LabelRedTurnoutNumber"));
ev2Panel.setVisible(true);
eto2.setVisible(true);
eto2.setDefaultNamedBean(((DoubleTurnoutSignalHead) curS).getRed().getBean());
} else if (className.equals("jmri.implementation.SingleTurnoutSignalHead")) {
signalType.setText(singleTurnout);
eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
eSysNameLabel.setText(curS.getSystemName());
eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
eUserName.setText(curS.getUserName());
ev1Border.setTitle(Bundle.getMessage("LabelTurnoutNumber"));
ev1Panel.setVisible(true);
eto1.setVisible(true);
eto1.setDefaultNamedBean(((SingleTurnoutSignalHead) curS).getOutput().getBean());
ev2Border.setTitle(Bundle.getMessage("LabelTurnoutClosedAppearance"));
ev2Panel.setVisible(true);
es2aBox.setVisible(true);
setSignalStateInBox(es2aBox, ((SingleTurnoutSignalHead) curS).getOnAppearance());
ev3Border.setTitle(Bundle.getMessage("LabelTurnoutThrownAppearance"));
ev3Panel.setVisible(true);
es3aBox.setVisible(true);
setSignalStateInBox(es3aBox, ((SingleTurnoutSignalHead) curS).getOffAppearance());
} else if (className.equals("jmri.implementation.VirtualSignalHead")) {
signalType.setText(virtualHead);
eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
eSysNameLabel.setText(curS.getSystemName());
eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
eUserName.setText(curS.getUserName());
} else if (className.equals("jmri.implementation.LsDecSignalHead")) {
// LDT LS-DEC
signalType.setText(lsDec);
eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
eSysNameLabel.setText(curS.getSystemName());
eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
eUserName.setText(curS.getUserName());
ev1Border.setTitle(Bundle.getMessage("LabelGreenTurnoutNumber"));
ev1Panel.setVisible(true);
eto1.setVisible(true);
eto1.setDefaultNamedBean(((jmri.implementation.LsDecSignalHead) curS).getGreen().getBean());
es1Box.setVisible(true);
setTurnoutStateInBox(es1Box, ((jmri.implementation.LsDecSignalHead) curS).getGreenState(), turnoutStateValues);
ev2Border.setTitle(Bundle.getMessage("LabelYellowTurnoutNumber"));
ev2Panel.setVisible(true);
eto2.setVisible(true);
eto2.setDefaultNamedBean(((jmri.implementation.LsDecSignalHead) curS).getYellow().getBean());
es2Box.setVisible(true);
setTurnoutStateInBox(es2Box, ((jmri.implementation.LsDecSignalHead) curS).getYellowState(), turnoutStateValues);
ev3Border.setTitle(Bundle.getMessage("LabelRedTurnoutNumber"));
ev3Panel.setVisible(true);
eto3.setVisible(true);
eto3.setDefaultNamedBean(((jmri.implementation.LsDecSignalHead) curS).getRed().getBean());
es3Box.setVisible(true);
setTurnoutStateInBox(es3Box, ((jmri.implementation.LsDecSignalHead) curS).getRedState(), turnoutStateValues);
ev4Border.setTitle(Bundle.getMessage("LabelFlashGreenTurnoutNumber"));
ev4Panel.setVisible(true);
eto4.setVisible(true);
eto4.setDefaultNamedBean(((jmri.implementation.LsDecSignalHead) curS).getFlashGreen().getBean());
es4Box.setVisible(true);
setTurnoutStateInBox(es4Box, ((jmri.implementation.LsDecSignalHead) curS).getFlashGreenState(), turnoutStateValues);
ev5Border.setTitle(Bundle.getMessage("LabelFlashYellowTurnoutNumber"));
ev5Panel.setVisible(true);
eto5.setVisible(true);
eto5.setDefaultNamedBean(((jmri.implementation.LsDecSignalHead) curS).getFlashYellow().getBean());
es5Box.setVisible(true);
setTurnoutStateInBox(es5Box, ((jmri.implementation.LsDecSignalHead) curS).getFlashYellowState(), turnoutStateValues);
ev6Border.setTitle(Bundle.getMessage("LabelFlashRedTurnoutNumber"));
ev6Panel.setVisible(true);
eto6.setVisible(true);
eto6.setDefaultNamedBean(((jmri.implementation.LsDecSignalHead) curS).getFlashRed().getBean());
es6Box.setVisible(true);
setTurnoutStateInBox(es6Box, ((jmri.implementation.LsDecSignalHead) curS).getFlashRedState(), turnoutStateValues);
ev7Border.setTitle(Bundle.getMessage("LabelDarkTurnoutNumber"));
ev7Panel.setVisible(true);
eto7.setVisible(true);
eto7.setDefaultNamedBean(((jmri.implementation.LsDecSignalHead) curS).getDark().getBean());
es7Box.setVisible(true);
setTurnoutStateInBox(es7Box, ((jmri.implementation.LsDecSignalHead) curS).getDarkState(), turnoutStateValues);
} else if (className.equals("jmri.implementation.SE8cSignalHead")) {
handleSE8cEditSignal();
} else if (className.equals("jmri.jmrix.grapevine.SerialSignalHead")) {
signalType.setText(grapevine);
eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
eSysNameLabel.setText(curS.getSystemName());
eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
eUserName.setText(curS.getUserName());
/*ev1Border.setTitle(Bundle.getMessage("LabelUserName"));
ev1Panel.setVisible(true);
eto1.setVisible(true);
eto1.setText(curS.getUserName());*/
} else if (className.equals("jmri.jmrix.acela.AcelaSignalHead")) {
signalType.setText(acela);
eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
eSysNameLabel.setText(curS.getSystemName());
eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
eUserName.setText(curS.getUserName());
/*ev1Border.setTitle(Bundle.getMessage("LabelUserName"));
ev1Panel.setVisible(true);
eto1.setVisible(true);
eto1.setText(curS.getUserName());*/
evtLabel.setText(Bundle.getMessage("LabelAspectType") + ":");
etot.setVisible(false);
AcelaNode tNode = AcelaAddress.getNodeFromSystemName(curS.getSystemName(), jmri.InstanceManager.getDefault(jmri.jmrix.acela.AcelaSystemConnectionMemo.class));
if (tNode == null) {
// node does not exist, ignore call
log.error("Can't find new Acela Signal with name '" + curS.getSystemName());
return;
}
int headnumber = Integer.parseInt(curS.getSystemName().substring(2, curS.getSystemName().length()));
estBox.setVisible(true);
setSignalheadTypeInBox(estBox, tNode.getOutputSignalHeadType(headnumber), signalheadTypeValues);
} else if (className.equals("jmri.implementation.DccSignalHead")) {
signalType.setText(dccSignalDecoder);
eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
eSysNameLabel.setText(curS.getSystemName());
eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
eUserName.setText(curS.getUserName());
for (int i = 0; i < DccSignalHead.getDefaultValidStates().length; i++) {
JSpinner tmp = dccAspectEdt[i];
tmp.setValue(((DccSignalHead) curS).getOutputForAppearance(curS.getValidStates()[i]));
// tmp.setValue((Integer) DccSignalHead.getDefaultNumberForApperance(DccSignalHead.getDefaultValidStates()[i]))
}
dccOffSetAddressEdt.setVisible(true);
dccOffSetAddressEdt.setSelected(((DccSignalHead) curS).useAddressOffSet());
ev2Border.setTitle(Bundle.getMessage("LabelAspectNumbering"));
ev2Panel.setVisible(true);
dccSignalPanelEdt.setVisible(true);
} else if (className.equals("jmri.implementation.MergSD2SignalHead")) {
//Edit signal stuff to go here!
signalType.setText(mergSignalDriver);
eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
eSysNameLabel.setText(curS.getSystemName());
eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
eUserName.setText(curS.getUserName());
// same as line 1054
ev1Border.setTitle(Bundle.getMessage("NumberOfAppearances"));
ev1Panel.setVisible(true);
setUkSignalAspectsFromBox(emsaBox, ((jmri.implementation.MergSD2SignalHead) curS).getAspects());
eto1.setVisible(false);
emsaBox.setVisible(true);
// emsaBox.setToolTipText(Bundle.getMessage("SignalHeadMergTooltip"));
// same as line 1090
ev2Border.setTitle(Bundle.getMessage("UseAs"));
ev2Panel.setVisible(true);
eto2.setVisible(false);
emstBox.setVisible(true);
if (((jmri.implementation.MergSD2SignalHead) curS).getHome()) {
// "Home"
setUkSignalType(emstBox, Bundle.getMessage("HomeSignal"));
} else {
//"Distant"
setUkSignalType(emstBox, Bundle.getMessage("DistantSignal"));
}
//setUKSignalTypeFromBox(emstBox, ((jmri.implementation.MergSD2SignalHead)curS).getAspects());
ev3Border.setTitle(Bundle.getMessage("InputNum", " 1 "));
ev3Panel.setVisible(true);
eto3.setVisible(true);
eto3.setDefaultNamedBean(((jmri.implementation.MergSD2SignalHead) curS).getInput1().getBean());
ev4Border.setTitle(Bundle.getMessage("InputNum", " 2 "));
ev4Panel.setVisible(true);
eto4.setVisible(true);
if (((jmri.implementation.MergSD2SignalHead) curS).getInput2() != null) {
eto4.setDefaultNamedBean(((jmri.implementation.MergSD2SignalHead) curS).getInput2().getBean());
}
ev5Border.setTitle(Bundle.getMessage("InputNum", " 3 "));
ev5Panel.setVisible(true);
eto5.setVisible(true);
if (((jmri.implementation.MergSD2SignalHead) curS).getInput3() != null) {
eto5.setDefaultNamedBean(((jmri.implementation.MergSD2SignalHead) curS).getInput3().getBean());
}
emsaBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ukAspectChange(true);
}
});
ukAspectChange(true);
} else {
log.error("Cannot edit SignalHead of unrecognized type: " + className);
}
// finish up
editFrame.pack();
editFrame.setVisible(true);
}
Aggregations