Search in sources :

Example 96 with Element

use of com.zhan_dui.utils.m3u8.Element in project JMRI by JMRI.

the class PerformScriptModelXml method store.

/**
     * Default implementation for storing the model contents
     *
     * @param o Object to store, of type PerformActonModel
     * @return Element containing the complete info
     */
@Override
public Element store(Object o) {
    Element e = new Element("perform");
    PerformScriptModel g = (PerformScriptModel) o;
    e.setAttribute("name", FileUtil.getPortableFilename(g.getFileName()));
    e.setAttribute("type", "ScriptFile");
    e.setAttribute("class", this.getClass().getName());
    return e;
}
Also used : Element(org.jdom2.Element) PerformScriptModel(apps.PerformScriptModel)

Example 97 with Element

use of com.zhan_dui.utils.m3u8.Element in project JMRI by JMRI.

the class FileLocationPaneXml method storeUserFilesLocation.

private void storeUserFilesLocation(Element locations, String value) {
    Element userLocation = new Element("fileLocation");
    userLocation.setAttribute("defaultUserLocation", FileUtil.getPortableFilename(value, true, false));
    locations.addContent(userLocation);
}
Also used : Element(org.jdom2.Element)

Example 98 with Element

use of com.zhan_dui.utils.m3u8.Element in project JMRI by JMRI.

the class GuiLafConfigPaneXml method store.

/**
     * Default implementation for storing the static contents of the Swing LAF
     *
     * @param o Object to store, of type GuiLafConfigPane
     * @return Element containing the complete info
     */
@Override
public Element store(Object o) {
    Element e = new Element("gui");
    GuiLafConfigPane g = (GuiLafConfigPane) o;
    String lafClassName = g.getClassName();
    e.setAttribute("LAFclass", lafClassName);
    e.setAttribute("class", this.getClass().getName());
    Locale l = g.getLocale();
    e.setAttribute("LocaleLanguage", l.getLanguage());
    e.setAttribute("LocaleCountry", l.getCountry());
    e.setAttribute("LocaleVariant", l.getVariant());
    GuiLafPreferencesManager manager = InstanceManager.getDefault(GuiLafPreferencesManager.class);
    if (manager.getFontSize() != manager.getDefaultFontSize()) {
        e.setAttribute("fontsize", Integer.toString(manager.getFontSize()));
    }
    e.setAttribute("nonStandardMouseEvent", (g.mouseEvent.isSelected() ? "yes" : "no"));
    e.setAttribute("graphicTableState", (g.graphicStateDisplay.isSelected() ? "yes" : "no"));
    return e;
}
Also used : Locale(java.util.Locale) GuiLafPreferencesManager(apps.gui.GuiLafPreferencesManager) Element(org.jdom2.Element) GuiLafConfigPane(apps.GuiLafConfigPane)

Example 99 with Element

use of com.zhan_dui.utils.m3u8.Element in project JMRI by JMRI.

the class CreateButtonModelXml method store.

/**
     * Default implementation for storing the model contents
     *
     * @param o Object to store, of type CreateButtonModel
     * @return Element containing the complete info
     */
@Override
public Element store(Object o) {
    Element element = new Element("perform");
    CreateButtonModel g = (CreateButtonModel) o;
    element.setAttribute("name", g.getClassName());
    element.setAttribute("type", "Button");
    element.setAttribute("class", this.getClass().getName());
    // NOI18N
    Element property = new Element("property");
    // NOI18N
    property.setAttribute("name", "systemPrefix");
    property.setAttribute("value", g.getSystemPrefix());
    element.addContent(property);
    return element;
}
Also used : Element(org.jdom2.Element) CreateButtonModel(apps.CreateButtonModel)

Example 100 with Element

use of com.zhan_dui.utils.m3u8.Element in project JMRI by JMRI.

the class SystemConsoleConfigPanelXml method store.

/**
     * Arrange for console settings to be stored
     *
     * @param o Object to store, of type SystemConsole
     * @return Element containing the complete info
     */
@Override
public Element store(Object o) {
    Element e = new Element("console");
    e.setAttribute("class", this.getClass().getName());
    SystemConsolePreferencesManager manager = InstanceManager.getDefault(SystemConsolePreferencesManager.class);
    e.setAttribute("scheme", "" + manager.getScheme());
    e.setAttribute("fontfamily", "" + manager.getFontFamily());
    e.setAttribute("fontsize", "" + manager.getFontSize());
    e.setAttribute("fontstyle", "" + manager.getFontStyle());
    e.setAttribute("wrapstyle", "" + manager.getWrapStyle());
    return e;
}
Also used : Element(org.jdom2.Element) SystemConsolePreferencesManager(apps.systemconsole.SystemConsolePreferencesManager)

Aggregations

Element (org.jdom2.Element)673 Attribute (org.jdom2.Attribute)73 Document (org.jdom2.Document)58 File (java.io.File)49 ArrayList (java.util.ArrayList)36 NamedIcon (jmri.jmrit.catalog.NamedIcon)27 IOException (java.io.IOException)26 JDOMException (org.jdom2.JDOMException)26 XmlFile (jmri.jmrit.XmlFile)24 Test (org.junit.Test)24 Turnout (jmri.Turnout)20 DataConversionException (org.jdom2.DataConversionException)20 DocType (org.jdom2.DocType)19 Editor (jmri.jmrit.display.Editor)18 Point (java.awt.Point)15 HashMap (java.util.HashMap)15 Dimension (java.awt.Dimension)14 FileNotFoundException (java.io.FileNotFoundException)13 SignalHead (jmri.SignalHead)13 List (java.util.List)12