use of jmri.jmrit.picker.PickSinglePanel in project JMRI by JMRI.
the class LogixTableAction method createSinglePanelPickList.
/**
* Create a single panel picklist JFrame for choosing action and variable names.
* <p>
* Called from {@link #actionItemChanged} and {@link #variableTypeChanged}
* @since 4.7.3
* @param itemType The selected variable or action type
* @param isVariable True if called by variableTypeChanged
*/
void createSinglePanelPickList(int itemType, boolean isVariable) {
if (_pickListener != null) {
int saveType = _pickListener.getItemType();
if (saveType != itemType) {
// The type has changed, need to start over
closeSinglePanelPickList();
} else {
// The pick list has already been created
return;
}
}
switch(itemType) {
case // 1
Conditional.ITEM_TYPE_SENSOR:
_pickSingle = new PickSinglePanel(PickListModel.sensorPickModelInstance());
break;
case // 2
Conditional.ITEM_TYPE_TURNOUT:
_pickSingle = new PickSinglePanel(PickListModel.turnoutPickModelInstance());
break;
case // 3
Conditional.ITEM_TYPE_LIGHT:
_pickSingle = new PickSinglePanel(PickListModel.lightPickModelInstance());
break;
case // 4
Conditional.ITEM_TYPE_SIGNALHEAD:
_pickSingle = new PickSinglePanel(PickListModel.signalHeadPickModelInstance());
break;
case // 5
Conditional.ITEM_TYPE_SIGNALMAST:
_pickSingle = new PickSinglePanel(PickListModel.signalMastPickModelInstance());
break;
case // 6
Conditional.ITEM_TYPE_MEMORY:
_pickSingle = new PickSinglePanel(PickListModel.memoryPickModelInstance());
break;
case // 8
Conditional.ITEM_TYPE_WARRANT:
_pickSingle = new PickSinglePanel(PickListModel.warrantPickModelInstance());
break;
case // 10
Conditional.ITEM_TYPE_OBLOCK:
_pickSingle = new PickSinglePanel(PickListModel.oBlockPickModelInstance());
break;
case // 11
Conditional.ITEM_TYPE_ENTRYEXIT:
_pickSingle = new PickSinglePanel(PickListModel.entryExitPickModelInstance());
break;
// break;
default:
// Skip any other items.
return;
}
// Create the JFrame
_pickSingleFrame = new JmriJFrame(rbx.getString("SinglePickFrame"));
_pickSingleFrame.setContentPane(_pickSingle);
_pickSingleFrame.pack();
_pickSingleFrame.setVisible(true);
_pickSingleFrame.toFront();
// Set the table selection listener
_pickListener = new PickSingleListener();
_pickTable = _pickSingle.getTable();
_pickTable.getSelectionModel().addListSelectionListener(_pickListener);
// Save the current item type
_pickListener.setItemType(itemType);
}
Aggregations