use of jmri.jmrit.display.palette.IndicatorItemPanel in project JMRI by JMRI.
the class CircuitBuilder method convertIcon.
/**
* Converts icon to IndicatorTrack
*/
private void convertIcon(Positionable pos) {
_oldIcon = (PositionableLabel) pos;
_editor.highlight(_oldIcon);
_editor.toFront();
_editor.repaint();
if (pos instanceof TurnoutIcon) {
makePaletteFrame("IndicatorTO");
_trackTOPanel = new IndicatorTOItemPanel(_convertFrame, "IndicatorTO", null, null, _editor);
ActionListener updateAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent a) {
convertTO();
}
};
_trackTOPanel.init(updateAction);
_convertDialog.add(_trackTOPanel);
} else {
makePaletteFrame("IndicatorTrack");
_trackPanel = new IndicatorItemPanel(_convertFrame, "IndicatorTrack", null, _editor);
ActionListener updateAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent a) {
convertSeg();
}
};
_trackPanel.init(updateAction);
_convertDialog.add(_trackPanel);
}
_convertDialog.pack();
_convertDialog.setVisible(true);
_editor.repaint();
}
use of jmri.jmrit.display.palette.IndicatorItemPanel in project JMRI by JMRI.
the class IndicatorTrackIcon method editItem.
protected void editItem() {
makePaletteFrame(java.text.MessageFormat.format(Bundle.getMessage("EditItem"), Bundle.getMessage("IndicatorTrack")));
_trackPanel = new IndicatorItemPanel(_paletteFrame, "IndicatorTrack", _iconFamily, _editor);
ActionListener updateAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent a) {
updateItem();
}
};
// 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);
}
_trackPanel.init(updateAction, map);
if (namedOccSensor != null) {
_trackPanel.setOccDetector(namedOccSensor.getBean().getDisplayName());
}
if (namedOccBlock != null) {
_trackPanel.setOccDetector(namedOccBlock.getBean().getDisplayName());
}
_trackPanel.setShowTrainName(_pathUtil.showTrain());
_trackPanel.setPaths(_pathUtil.getPaths());
_paletteFrame.add(_trackPanel);
_paletteFrame.setLocationRelativeTo(this);
_paletteFrame.toFront();
_paletteFrame.pack();
_paletteFrame.setVisible(true);
}
Aggregations