Search in sources :

Example 1 with PositionableEllipse

use of jmri.jmrit.display.controlPanelEditor.shape.PositionableEllipse in project JMRI by JMRI.

the class PositionableEllipseXml method store.

/**
     * Default implementation for storing the contents of a PositionableShape
     *
     * @param o Object to store, of type PositionableShape
     * @return Element containing the complete info
     */
@Override
public Element store(Object o) {
    PositionableEllipse p = (PositionableEllipse) o;
    if (!p.isActive()) {
        // if flagged as inactive, don't store
        return null;
    }
    Element element = new Element("positionableEllipse");
    storeCommonAttributes(p, element);
    Element elem = new Element("size");
    elem.setAttribute("width", "" + p.getWidth());
    elem.setAttribute("height", "" + p.getHeight());
    element.addContent(elem);
    element.setAttribute("class", "jmri.jmrit.display.controlPanelEditor.shape.configurexml.PositionableEllipseXml");
    return element;
}
Also used : Element(org.jdom2.Element) PositionableEllipse(jmri.jmrit.display.controlPanelEditor.shape.PositionableEllipse)

Example 2 with PositionableEllipse

use of jmri.jmrit.display.controlPanelEditor.shape.PositionableEllipse in project JMRI by JMRI.

the class PositionableEllipseXml method load.

/**
     * Create a PositionableShape, then add to a target JLayeredPane
     *
     * @param element Top level Element to unpack.
     * @param o       Editor as an Object
     */
@Override
public void load(Element element, Object o) {
    // create the objects
    Editor ed = (Editor) o;
    PositionableEllipse ps = new PositionableEllipse(ed);
    Element elem = element.getChild("size");
    ps.setWidth(getInt(elem, "width"));
    ps.setHeight(getInt(elem, "height"));
    ed.putItem(ps);
    // load individual item's option settings after editor has set its global settings
    loadCommonAttributes(ps, Editor.MARKERS, element);
}
Also used : Element(org.jdom2.Element) PositionableEllipse(jmri.jmrit.display.controlPanelEditor.shape.PositionableEllipse) Editor(jmri.jmrit.display.Editor)

Aggregations

PositionableEllipse (jmri.jmrit.display.controlPanelEditor.shape.PositionableEllipse)2 Element (org.jdom2.Element)2 Editor (jmri.jmrit.display.Editor)1