Package jmri.jmrit.ctc.editor.code
Class CommonSubs
java.lang.Object
jmri.jmrit.ctc.editor.code.CommonSubs
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddHelpMenu(JFrame frame, String ref, boolean direct) Add a standard help menu, including the window specific help item.static voidaddSensorToSensorList(ArrayList<NBHSensor> list, String sensorName) Add a valid NBHSensor entry to an ArrayList.static booleanallowClose(Component parentComponent, boolean dataChanged) static voidstatic voidcheckJTextFieldNotEmpty(JTextField field, JLabel promptName, ArrayList<String> errors) static intcompactDefaultTableModel(DefaultTableModel defaultTableModel) getArrayListOfSelectableOSSectionUniqueIDs(ArrayList<CodeButtonHandlerData> codeButtonHandlerDataList) getArrayListOfSelectableSwitchDirectionIndicators(ArrayList<CodeButtonHandlerData> codeButtonHandlerDataList) static StringgetCSVStringFromDefaultTableModel(DefaultTableModel defaultTableModel) static intgetIntFromJTextFieldNoThrow(JTextField textField) static NBHSensorgetNBHSensor(String newName, boolean isInternal) Get a NBHSensor from the CtcManager NBHSensor map or create a new one.static NBHSignalgetNBHSignal(String newName) Get a NBHSignal from the CtcManager NBHSignal map or create a new one.static NBHTurnoutgetNBHTurnout(String newName, boolean feedbackDifferent) Get a NBHTurnout from the CtcManager NBHTurnout map or create a new one.getStringArrayFromDefaultTableModel(DefaultTableModel defaultTableModel) static booleanisJComboBoxNotEmpty(JComboBox<String> combo) static booleanisJTextFieldNotEmpty(JTextField field) static booleanmissingFieldsErrorDialogDisplayed(Component parentComponent, ArrayList<String> errors, boolean isCancel) static voidnumberButtonGroup(ButtonGroup buttonGroup) static voidpopulateJComboBoxWithBeans(JComboBox<String> jComboBox, String beanType, String currentSelection, boolean firstRowBlank) Populate a combo box with bean names using getDisplayName().static voidpopulateJComboBoxWithColumnDescriptions(JComboBox<String> jComboBox, CTCSerialData ctcSerialData) static voidpopulateJComboBoxWithColumnDescriptionsAndSelectViaUniqueID(JComboBox<String> jComboBox, CTCSerialData ctcSerialData, int uniqueID) static booleanpopulateJComboBoxWithColumnDescriptionsExceptOurs(JComboBox<String> jComboBox, CTCSerialData ctcSerialData, int ourUniqueID, ArrayList<Integer> uniqueIDS) static voidsetButtonSelected(ButtonGroup buttonGroup, int selected) static voidsetMillisecondsEdit(JFormattedTextField formattedTextField) static voidsetSelectedIndexOfJComboBoxViaUniqueID(JComboBox<String> jComboBox, CTCSerialData ctcSerialData, int uniqueID)
-
Constructor Details
-
CommonSubs
public CommonSubs()
-
-
Method Details
-
setMillisecondsEdit
-
getIntFromJTextFieldNoThrow
-
allowClose
-
addHelpMenu
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
-
getStringArrayFromDefaultTableModel
public static ArrayList<String> getStringArrayFromDefaultTableModel(DefaultTableModel defaultTableModel) -
compactDefaultTableModel
-
getArrayListOfSelectableSwitchDirectionIndicators
public static ArrayList<String> getArrayListOfSelectableSwitchDirectionIndicators(ArrayList<CodeButtonHandlerData> codeButtonHandlerDataList) -
getArrayListOfSelectableOSSectionUniqueIDs
public static ArrayList<Integer> getArrayListOfSelectableOSSectionUniqueIDs(ArrayList<CodeButtonHandlerData> codeButtonHandlerDataList) -
populateJComboBoxWithColumnDescriptionsAndSelectViaUniqueID
public static void populateJComboBoxWithColumnDescriptionsAndSelectViaUniqueID(JComboBox<String> jComboBox, CTCSerialData ctcSerialData, int uniqueID) -
populateJComboBoxWithColumnDescriptions
public static void populateJComboBoxWithColumnDescriptions(JComboBox<String> jComboBox, CTCSerialData ctcSerialData) -
populateJComboBoxWithColumnDescriptionsExceptOurs
public static boolean populateJComboBoxWithColumnDescriptionsExceptOurs(JComboBox<String> jComboBox, CTCSerialData ctcSerialData, int ourUniqueID, ArrayList<Integer> uniqueIDS) -
populateJComboBoxWithBeans
public static void populateJComboBoxWithBeans(JComboBox<String> jComboBox, String beanType, 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(JComboBox<String> jComboBox, CTCSerialData ctcSerialData, int uniqueID) -
numberButtonGroup
-
setButtonSelected
-
missingFieldsErrorDialogDisplayed
public static boolean missingFieldsErrorDialogDisplayed(Component parentComponent, ArrayList<String> errors, boolean isCancel) -
checkJTextFieldNotEmpty
public static void checkJTextFieldNotEmpty(JTextField field, JLabel promptName, ArrayList<String> errors) -
isJTextFieldNotEmpty
-
checkJComboBoxNotEmpty
-
isJComboBoxNotEmpty
-
getNBHSensor
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
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
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
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.
-