Search in sources :

Example 1 with MultiSensorItemPanel

use of jmri.jmrit.display.palette.MultiSensorItemPanel in project JMRI by JMRI.

the class MultiSensorIcon method editItem.

protected void editItem() {
    makePaletteFrame(Bundle.getMessage("EditItem", Bundle.getMessage("MultiSensor")));
    _itemPanel = new MultiSensorItemPanel(_paletteFrame, "MultiSensor", _iconFamily, PickListModel.multiSensorPickModelInstance(), _editor);
    ActionListener updateAction = (ActionEvent a) -> {
        updateItem();
    };
    // duplicate _iconMap map with unscaled and unrotated icons
    HashMap<String, NamedIcon> map = new HashMap<>();
    map.put("SensorStateInactive", inactive);
    map.put("BeanStateInconsistent", inconsistent);
    map.put("BeanStateUnknown", unknown);
    for (int i = 0; i < entries.size(); i++) {
        map.put(MultiSensorItemPanel.getPositionName(i), entries.get(i).icon);
    }
    _itemPanel.init(updateAction, map);
    for (int i = 0; i < entries.size(); i++) {
        _itemPanel.setSelection(entries.get(i).namedSensor.getBean());
    }
    _itemPanel.setUpDown(getUpDown());
    _paletteFrame.add(_itemPanel);
    _paletteFrame.pack();
    _paletteFrame.setVisible(true);
}
Also used : NamedIcon(jmri.jmrit.catalog.NamedIcon) ActionListener(java.awt.event.ActionListener) HashMap(java.util.HashMap) ActionEvent(java.awt.event.ActionEvent) MultiSensorItemPanel(jmri.jmrit.display.palette.MultiSensorItemPanel)

Aggregations

ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 HashMap (java.util.HashMap)1 NamedIcon (jmri.jmrit.catalog.NamedIcon)1 MultiSensorItemPanel (jmri.jmrit.display.palette.MultiSensorItemPanel)1