Search in sources :

Example 1 with ReporterIcon

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);
}
Also used : ReporterIcon(jmri.jmrit.display.ReporterIcon) Editor(jmri.jmrit.display.Editor)

Example 2 with ReporterIcon

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;
}
Also used : ReporterIcon(jmri.jmrit.display.ReporterIcon) Element(org.jdom2.Element)

Example 3 with ReporterIcon

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"));
}
Also used : ReporterIcon(jmri.jmrit.display.ReporterIcon) JPanel(javax.swing.JPanel) DataFlavor(java.awt.datatransfer.DataFlavor)

Aggregations

ReporterIcon (jmri.jmrit.display.ReporterIcon)3 DataFlavor (java.awt.datatransfer.DataFlavor)1 JPanel (javax.swing.JPanel)1 Editor (jmri.jmrit.display.Editor)1 Element (org.jdom2.Element)1