Package jmri.jmrit.ctc.editor.code
Class CommonSubs
- java.lang.Object
-
- jmri.jmrit.ctc.editor.code.CommonSubs
-
public class CommonSubs extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description CommonSubs()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addHelpMenu(javax.swing.JFrame frame, java.lang.String ref, boolean direct)
Add a standard help menu, including the window specific help item.static void
addSensorToSensorList(java.util.ArrayList<NBHSensor> list, java.lang.String sensorName)
Add a valid NBHSensor entry to an ArrayList.static boolean
allowClose(java.awt.Component parentComponent, boolean dataChanged)
static void
checkJComboBoxNotEmpty(javax.swing.JComboBox<java.lang.String> combo, javax.swing.JLabel promptName, java.util.ArrayList<java.lang.String> errors)
static void
checkJTextFieldNotEmpty(javax.swing.JTextField field, javax.swing.JLabel promptName, java.util.ArrayList<java.lang.String> errors)
static int
compactDefaultTableModel(javax.swing.table.DefaultTableModel defaultTableModel)
static java.util.ArrayList<java.lang.Integer>
getArrayListOfSelectableOSSectionUniqueIDs(java.util.ArrayList<CodeButtonHandlerData> codeButtonHandlerDataList)
static java.util.ArrayList<java.lang.String>
getArrayListOfSelectableSwitchDirectionIndicators(java.util.ArrayList<CodeButtonHandlerData> codeButtonHandlerDataList)
static java.lang.String
getCSVStringFromDefaultTableModel(javax.swing.table.DefaultTableModel defaultTableModel)
static int
getIntFromJTextFieldNoThrow(javax.swing.JTextField textField)
static NBHSensor
getNBHSensor(java.lang.String newName, boolean isInternal)
Get a NBHSensor from the CtcManager NBHSensor map or create a new one.static NBHSignal
getNBHSignal(java.lang.String newName)
Get a NBHSignal from the CtcManager NBHSignal map or create a new one.static NBHTurnout
getNBHTurnout(java.lang.String newName, boolean feedbackDifferent)
Get a NBHTurnout from the CtcManager NBHTurnout map or create a new one.static java.util.ArrayList<java.lang.String>
getStringArrayFromDefaultTableModel(javax.swing.table.DefaultTableModel defaultTableModel)
static boolean
isJComboBoxNotEmpty(javax.swing.JComboBox<java.lang.String> combo)
static boolean
isJTextFieldNotEmpty(javax.swing.JTextField field)
static boolean
missingFieldsErrorDialogDisplayed(java.awt.Component parentComponent, java.util.ArrayList<java.lang.String> errors, boolean isCancel)
static void
numberButtonGroup(javax.swing.ButtonGroup buttonGroup)
static void
populateJComboBoxWithBeans(javax.swing.JComboBox<java.lang.String> jComboBox, java.lang.String beanType, java.lang.String currentSelection, boolean firstRowBlank)
Populate a combo box with bean names using getDisplayName().static void
populateJComboBoxWithColumnDescriptions(javax.swing.JComboBox<java.lang.String> jComboBox, CTCSerialData ctcSerialData)
static void
populateJComboBoxWithColumnDescriptionsAndSelectViaUniqueID(javax.swing.JComboBox<java.lang.String> jComboBox, CTCSerialData ctcSerialData, int uniqueID)
static boolean
populateJComboBoxWithColumnDescriptionsExceptOurs(javax.swing.JComboBox<java.lang.String> jComboBox, CTCSerialData ctcSerialData, int ourUniqueID, java.util.ArrayList<java.lang.Integer> uniqueIDS)
static void
setButtonSelected(javax.swing.ButtonGroup buttonGroup, int selected)
static void
setMillisecondsEdit(javax.swing.JFormattedTextField formattedTextField)
static void
setSelectedIndexOfJComboBoxViaUniqueID(javax.swing.JComboBox<java.lang.String> jComboBox, CTCSerialData ctcSerialData, int uniqueID)
-
-
-
Constructor Detail
-
CommonSubs
public CommonSubs()
-
-
Method Detail
-
setMillisecondsEdit
public static void setMillisecondsEdit(javax.swing.JFormattedTextField formattedTextField)
-
getIntFromJTextFieldNoThrow
public static int getIntFromJTextFieldNoThrow(javax.swing.JTextField textField)
-
allowClose
public static boolean allowClose(java.awt.Component parentComponent, boolean dataChanged)
-
addHelpMenu
public static void addHelpMenu(javax.swing.JFrame frame, java.lang.String ref, boolean direct)
Add a standard help menu, including the window specific help item.- Parameters:
frame
- The frame receiving the help menu.ref
- JHelp reference for the desired window-specific help pagedirect
- true if the help main-menu item goes directly to the help system, such as when there are no items in the help menu
-
getCSVStringFromDefaultTableModel
public static java.lang.String getCSVStringFromDefaultTableModel(javax.swing.table.DefaultTableModel defaultTableModel)
-
getStringArrayFromDefaultTableModel
public static java.util.ArrayList<java.lang.String> getStringArrayFromDefaultTableModel(javax.swing.table.DefaultTableModel defaultTableModel)
-
compactDefaultTableModel
public static int compactDefaultTableModel(javax.swing.table.DefaultTableModel defaultTableModel)
-
getArrayListOfSelectableSwitchDirectionIndicators
public static java.util.ArrayList<java.lang.String> getArrayListOfSelectableSwitchDirectionIndicators(java.util.ArrayList<CodeButtonHandlerData> codeButtonHandlerDataList)
-
getArrayListOfSelectableOSSectionUniqueIDs
public static java.util.ArrayList<java.lang.Integer> getArrayListOfSelectableOSSectionUniqueIDs(java.util.ArrayList<CodeButtonHandlerData> codeButtonHandlerDataList)
-
populateJComboBoxWithColumnDescriptionsAndSelectViaUniqueID
public static void populateJComboBoxWithColumnDescriptionsAndSelectViaUniqueID(javax.swing.JComboBox<java.lang.String> jComboBox, CTCSerialData ctcSerialData, int uniqueID)
-
populateJComboBoxWithColumnDescriptions
public static void populateJComboBoxWithColumnDescriptions(javax.swing.JComboBox<java.lang.String> jComboBox, CTCSerialData ctcSerialData)
-
populateJComboBoxWithColumnDescriptionsExceptOurs
public static boolean populateJComboBoxWithColumnDescriptionsExceptOurs(javax.swing.JComboBox<java.lang.String> jComboBox, CTCSerialData ctcSerialData, int ourUniqueID, java.util.ArrayList<java.lang.Integer> uniqueIDS)
-
populateJComboBoxWithBeans
public static void populateJComboBoxWithBeans(javax.swing.JComboBox<java.lang.String> jComboBox, java.lang.String beanType, java.lang.String currentSelection, boolean firstRowBlank)
Populate a combo box with bean names using getDisplayName().If a panel xml file has not been loaded, the combo box will behave as a text field (editable), otherwise it will behave as standard combo box (not editable).
- Parameters:
jComboBox
- The string based combo box to be populated.beanType
- The bean type to be loaded. It has to be in the switch list.currentSelection
- The current item to be selected, none if null.firstRowBlank
- True to create a blank row. If the selection is null or empty, the blank row will be selected.
-
setSelectedIndexOfJComboBoxViaUniqueID
public static void setSelectedIndexOfJComboBoxViaUniqueID(javax.swing.JComboBox<java.lang.String> jComboBox, CTCSerialData ctcSerialData, int uniqueID)
-
numberButtonGroup
public static void numberButtonGroup(javax.swing.ButtonGroup buttonGroup)
-
setButtonSelected
public static void setButtonSelected(javax.swing.ButtonGroup buttonGroup, int selected)
-
missingFieldsErrorDialogDisplayed
public static boolean missingFieldsErrorDialogDisplayed(java.awt.Component parentComponent, java.util.ArrayList<java.lang.String> errors, boolean isCancel)
-
checkJTextFieldNotEmpty
public static void checkJTextFieldNotEmpty(javax.swing.JTextField field, javax.swing.JLabel promptName, java.util.ArrayList<java.lang.String> errors)
-
isJTextFieldNotEmpty
public static boolean isJTextFieldNotEmpty(javax.swing.JTextField field)
-
checkJComboBoxNotEmpty
public static void checkJComboBoxNotEmpty(javax.swing.JComboBox<java.lang.String> combo, javax.swing.JLabel promptName, java.util.ArrayList<java.lang.String> errors)
-
isJComboBoxNotEmpty
public static boolean isJComboBoxNotEmpty(javax.swing.JComboBox<java.lang.String> combo)
-
getNBHSensor
public static NBHSensor getNBHSensor(java.lang.String newName, boolean isInternal)
Get a NBHSensor from the CtcManager NBHSensor map or create a new one.- Parameters:
newName
- The new name to be retrieved from the map or created.isInternal
- True if an internal sensor is being requested. Internal will create the sensor if necessary using provide(String).- Returns:
- a NBHSensor or null.
-
getNBHTurnout
public static NBHTurnout getNBHTurnout(java.lang.String newName, boolean feedbackDifferent)
Get a NBHTurnout from the CtcManager NBHTurnout map or create a new one.- Parameters:
newName
- The new name to be retrieved from the map or created.feedbackDifferent
- The feedback different state.- Returns:
- a valid NBHTurnout or an empty NBHTurnout.
-
getNBHSignal
public static NBHSignal getNBHSignal(java.lang.String newName)
Get a NBHSignal from the CtcManager NBHSignal map or create a new one.- Parameters:
newName
- The new name to be retrieved from the map or created.- Returns:
- a valid NBHSignal or null.
-
addSensorToSensorList
public static void addSensorToSensorList(java.util.ArrayList<NBHSensor> list, java.lang.String sensorName)
Add a valid NBHSensor entry to an ArrayList. The sensor name has to match an existing sensor in the JMRI sensor table.- Parameters:
list
- The NBHSensor array list.sensorName
- The proposed sensor name.
-
-