use of jmri.jmrit.catalog.NamedIcon in project JMRI by JMRI.
the class SlipTurnoutIconXml method loadTurnoutIcon.
private void loadTurnoutIcon(String state, int rotation, SlipTurnoutIcon l, Element element, Editor ed) {
NamedIcon icon = loadIcon(l, state, element, "SlipTurnout \"" + l.getNameString() + "\" icon \"" + state + "\" ", ed);
String textValue = null;
if (icon != null) {
if (state.equals("lowerWestToUpperEast")) {
l.setLowerWestToUpperEastIcon(icon);
} else if (state.equals("upperWestToLowerEast")) {
l.setUpperWestToLowerEastIcon(icon);
} else if (state.equals("lowerWestToLowerEast")) {
l.setLowerWestToLowerEastIcon(icon);
} else if (state.equals("upperWestToUpperEast")) {
l.setUpperWestToUpperEastIcon(icon);
} else if (state.equals("unknown")) {
l.setUnknownIcon(icon);
} else if (state.equals("inconsistent")) {
l.setInconsistentIcon(icon);
}
} else {
return;
}
Element elem = element.getChild(state);
if (elem != null) {
Element e = elem.getChild("text");
if (e != null) {
textValue = e.getText();
}
}
if (textValue != null) {
if (state.equals("lowerWestToUpperEast")) {
l.setLWUEText(textValue);
} else if (state.equals("upperWestToLowerEast")) {
l.setUWLEText(textValue);
} else if (state.equals("lowerWestToLowerEast")) {
l.setLWLEText(textValue);
} else if (state.equals("upperWestToUpperEast")) {
l.setUWUEText(textValue);
}
}
}
use of jmri.jmrit.catalog.NamedIcon in project JMRI by JMRI.
the class CircuitBuilder method convertTO.
private void convertTO() {
IndicatorTurnoutIcon t = new IndicatorTurnoutIcon(_editor);
t.setOccBlockHandle(InstanceManager.getDefault(NamedBeanHandleManager.class).getNamedBeanHandle(_currentBlock.getSystemName(), _currentBlock));
t.setTurnout(((TurnoutIcon) _oldIcon).getNamedTurnout());
t.setFamily(_trackTOPanel.getFamilyName());
HashMap<String, HashMap<String, NamedIcon>> iconMap = _trackTOPanel.getIconMaps();
Iterator<Entry<String, HashMap<String, NamedIcon>>> it = iconMap.entrySet().iterator();
while (it.hasNext()) {
Entry<String, HashMap<String, NamedIcon>> entry = it.next();
String status = entry.getKey();
Iterator<Entry<String, NamedIcon>> iter = entry.getValue().entrySet().iterator();
while (iter.hasNext()) {
Entry<String, NamedIcon> ent = iter.next();
t.setIcon(status, ent.getKey(), new NamedIcon(ent.getValue()));
}
}
t.setLevel(Editor.TURNOUTS);
t.setScale(_oldIcon.getScale());
t.rotate(_oldIcon.getDegrees());
finishConvert(t);
}
use of jmri.jmrit.catalog.NamedIcon in project JMRI by JMRI.
the class ControlPanelEditor method makePortalIconMap.
private void makePortalIconMap() {
_portalIconMap = new HashMap<String, NamedIcon>();
_portalIconMap.put(PortalIcon.VISIBLE, new NamedIcon("resources/icons/throttles/RoundRedCircle20.png", "resources/icons/throttles/RoundRedCircle20.png"));
_portalIconMap.put(PortalIcon.PATH, new NamedIcon("resources/icons/greenSquare.gif", "resources/icons/greenSquare.gif"));
_portalIconMap.put(PortalIcon.HIDDEN, new NamedIcon("resources/icons/Invisible.gif", "resources/icons/Invisible.gif"));
_portalIconMap.put(PortalIcon.TO_ARROW, new NamedIcon("resources/icons/track/toArrow.gif", "resources/icons/track/toArrow.gif"));
_portalIconMap.put(PortalIcon.FROM_ARROW, new NamedIcon("resources/icons/track/fromArrow.gif", "resources/icons/track/fromArrow.gif"));
}
use of jmri.jmrit.catalog.NamedIcon in project JMRI by JMRI.
the class SignalMastItemPanel method makeDndIconPanel.
@Override
protected void makeDndIconPanel(HashMap<String, NamedIcon> iconMap, String displayKey) {
if (_update) {
return;
}
_dragIconPanel.setToolTipText(Bundle.getMessage("ToolTipDragIcon"));
NamedIcon icon = getDragIcon();
JPanel panel = new JPanel();
String borderName = ItemPalette.convertText("dragToPanel");
panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), borderName));
JLabel label;
try {
label = getDragger(new DataFlavor(Editor.POSITIONABLE_FLAVOR), icon);
label.setToolTipText(Bundle.getMessage("ToolTipDragIcon"));
} catch (java.lang.ClassNotFoundException cnfe) {
cnfe.printStackTrace();
label = new JLabel();
}
label.setName(borderName);
panel.add(label);
int width = Math.max(100, panel.getPreferredSize().width);
panel.setPreferredSize(new java.awt.Dimension(width, panel.getPreferredSize().height));
panel.setToolTipText(Bundle.getMessage("ToolTipDragIcon"));
_dragIconPanel.add(panel);
}
use of jmri.jmrit.catalog.NamedIcon in project JMRI by JMRI.
the class AnalogClock2Display method init.
final void init() {
// Load the JMRI logo and clock face
// Icons are the original size version kept for to allow for mulitple resizing
// and scaled Icons are the version scaled for the panel size
jmriIcon = new NamedIcon("resources/logo.gif", "resources/logo.gif");
scaledIcon = new NamedIcon("resources/logo.gif", "resources/logo.gif");
clockIcon = new NamedIcon("resources/clock2.gif", "resources/clock2.gif");
logo = jmriIcon.getImage();
clockFace = clockIcon.getImage();
// Create an unscaled set of hands to get the original size (height)to use
// in the scaling calculations
hourHand = new Polygon(hourX, hourY, 11);
hourHeight = hourHand.getBounds().getSize().height;
minuteHand = new Polygon(minuteX, minuteY, 11);
minuteHeight = minuteHand.getBounds().getSize().height;
amPm = "AM";
// request callback to update time
clock.addMinuteChangeListener(new java.beans.PropertyChangeListener() {
@Override
public void propertyChange(java.beans.PropertyChangeEvent e) {
update();
}
});
// request callback to update changes in properties
clock.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
@Override
public void propertyChange(java.beans.PropertyChangeEvent e) {
update();
}
});
// set to default size
setSize(clockIcon.getIconHeight());
}
Aggregations