use of jmri.jmrit.display.ReporterIcon in project JMRI by JMRI.
the class ReporterIconXml method load.
/**
* Create a PositionableLabel, then add to a target JLayeredPane
*
* @param element Top level Element to unpack.
* @param o an Editor as an Object
*/
@Override
public void load(Element element, Object o) {
Editor ed = (Editor) o;
ReporterIcon l = new ReporterIcon(ed);
loadTextInfo(l, element);
l.setReporter(jmri.InstanceManager.getDefault(jmri.ReporterManager.class).getReporter(element.getAttribute("reporter").getValue()));
l.setSize(l.getPreferredSize().width, l.getPreferredSize().height);
ed.putItem(l);
// load individual item's option settings after editor has set its global settings
loadCommonAttributes(l, Editor.REPORTERS, element);
}
use of jmri.jmrit.display.ReporterIcon in project JMRI by JMRI.
the class ReporterIconXml method store.
/**
* Default implementation for storing the contents of a ReporterIcon
*
* @param o Object to store, of type ReporterIcon
* @return Element containing the complete info
*/
@Override
public Element store(Object o) {
ReporterIcon p = (ReporterIcon) o;
Element element = new Element("reportericon");
// include contents
element.setAttribute("reporter", p.getReporter().getSystemName());
storeCommonAttributes(p, element);
storeTextInfo(p, element);
element.setAttribute("class", "jmri.jmrit.display.configurexml.ReporterIconXml");
return element;
}
use of jmri.jmrit.display.ReporterIcon in project JMRI by JMRI.
the class ReporterItemPanel method makeDndIconPanel.
@Override
protected void makeDndIconPanel(HashMap<String, NamedIcon> iconMap, String displayKey) {
if (_update) {
return;
}
_reporter = new ReporterIcon(_editor);
JPanel panel = new JPanel();
JPanel comp;
try {
comp = getDragger(new DataFlavor(Editor.POSITIONABLE_FLAVOR));
comp.setToolTipText(Bundle.getMessage("ToolTipDragIcon"));
} catch (java.lang.ClassNotFoundException cnfe) {
cnfe.printStackTrace();
comp = new JPanel();
}
panel.add(comp);
panel.revalidate();
int width = Math.max(100, panel.getPreferredSize().width);
panel.setPreferredSize(new java.awt.Dimension(width, panel.getPreferredSize().height));
panel.setToolTipText(Bundle.getMessage("ToolTipDragIcon"));
_dragIconPanel = panel;
_dragIconPanel.setToolTipText(Bundle.getMessage("ToolTipDragIcon"));
}
Aggregations