Search in sources :

Example 1 with SignalHeadItemPanel

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

the class SignalHeadIcon method editItem.

protected void editItem() {
    makePaletteFrame(java.text.MessageFormat.format(Bundle.getMessage("EditItem"), Bundle.getMessage("BeanNameSignalHead")));
    _itemPanel = new SignalHeadItemPanel(_paletteFrame, "SignalHead", getFamily(), PickListModel.signalHeadPickModelInstance(), //NOI18N
    _editor);
    ActionListener updateAction = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent a) {
            updateItem();
        }
    };
    // _iconMap keys with local names - Let SignalHeadItemPanel figure this out
    // duplicate _iconMap map with unscaled and unrotated icons
    HashMap<String, NamedIcon> map = new HashMap<String, NamedIcon>();
    Iterator<Entry<String, NamedIcon>> it = _iconMap.entrySet().iterator();
    while (it.hasNext()) {
        Entry<String, NamedIcon> entry = it.next();
        NamedIcon oldIcon = entry.getValue();
        NamedIcon newIcon = cloneIcon(oldIcon, this);
        newIcon.rotate(0, this);
        newIcon.scale(1.0, this);
        newIcon.setRotation(4, this);
        map.put(entry.getKey(), newIcon);
    }
    _itemPanel.init(updateAction, map);
    _itemPanel.setSelection(getSignalHead());
    _paletteFrame.add(_itemPanel);
    _paletteFrame.pack();
    _paletteFrame.setVisible(true);
}
Also used : NamedIcon(jmri.jmrit.catalog.NamedIcon) Entry(java.util.Map.Entry) ActionListener(java.awt.event.ActionListener) SignalHeadItemPanel(jmri.jmrit.display.palette.SignalHeadItemPanel) HashMap(java.util.HashMap) ActionEvent(java.awt.event.ActionEvent)

Aggregations

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