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;
}
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);
}
Aggregations