use of org.freeplane.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class AddOnProperties method parseTranslations.
private Map<String, Map<String, String>> parseTranslations(Vector<XMLElement> xmlElements) {
final Map<String, Map<String, String>> result = new HashMap<String, Map<String, String>>();
if (xmlElements != null && !xmlElements.isEmpty()) {
for (XMLElement xmlElement : xmlElements.get(0).getChildren()) {
Map<String, String> properties = new LinkedHashMap<String, String>();
result.put(xmlElement.getAttribute("name", null), properties);
for (XMLElement entryXmlElement : xmlElement.getChildren()) {
properties.put(entryXmlElement.getAttribute("key", null), entryXmlElement.getContent());
}
}
}
return result;
}
use of org.freeplane.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class AddOnProperties method toXml.
// // this is the Groovy equivalent for all this below - removed from the script to avoid redundancies
// writer.write('<?xml version="1.0" encoding="UTF-8"?>' + System.getProperty("line.separator"))
// new MarkupBuilder(writer).addon( configMap['properties'] ) {
// description('') {
// writer.write('<![CDATA[' + configMap['description'] + ']]>')
// }
// permissions( configMap['permissions'] )
// translations {
// configMap['translations'].collect{ loc, translationMap ->
// locale( name:loc ) {
// translationMap.collect{ k,v ->
// entry(key:k, v)
// }
// }
// }
// }
// 'preferences.xml'('') {
// writer.write('<![CDATA[' + configMap['preferences.xml'] + ']]>')
// }
// 'default.properties'( configMap['default.properties'] )
// deinstall {
// configMap['deinstall'].collect { pair ->
// "${pair[0]}"(pair[1])
// }
// }
// }
// writer.close()
public XMLElement toXml() {
final XMLElement addonElement = new XMLElement("addon");
addonElement.setAttribute("name", name);
addonElement.setAttribute("version", version);
addonElement.setAttribute("latestVersion", latestVersion == null ? "" : latestVersion);
addonElement.setAttribute("freeplaneVersionFrom", freeplaneVersionFrom.toString());
if (freeplaneVersionTo != null)
addonElement.setAttribute("freeplaneVersionTo", freeplaneVersionTo.toString());
if (homepage != null)
addonElement.setAttribute("homepage", homepage.toString());
if (updateUrl != null)
addonElement.setAttribute("updateUrl", updateUrl.toString());
if (author != null)
addonElement.setAttribute("author", author);
addonElement.setAttribute("active", Boolean.toString(active));
addAsChildWithContent(addonElement, "description", description);
addAsChildWithContent(addonElement, "license", license);
addAsChildWithContent(addonElement, "preferences.xml", preferencesXml);
addTranslationsAsChild(addonElement);
addDefaultPropertiesAsChild(addonElement);
addImagesAsChild(addonElement);
addDeinstallationRulesAsChild(addonElement);
return addonElement;
}
use of org.freeplane.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class ReminderHook method saveExtension.
@Override
protected void saveExtension(final IExtension extension, final XMLElement element) {
super.saveExtension(extension, element);
final ReminderExtension reminderExtension = (ReminderExtension) extension;
final XMLElement parameters = element.createElement("Parameters");
parameters.setAttribute(REMINDUSERAT, Long.toString(reminderExtension.getRemindUserAt()));
parameters.setAttribute(PERIOD, Integer.toString(reminderExtension.getPeriod()));
parameters.setAttribute(UNIT, reminderExtension.getPeriodUnit().toString());
final String script = reminderExtension.getScript();
if (script != null) {
parameters.setAttribute(SCRIPT, script);
}
element.addChild(parameters);
}
use of org.freeplane.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class TimeWindowColumnSetting method marschall.
void marschall(final XMLElement xml) {
final XMLElement child = new XMLElement("time_window_column_setting");
child.setAttribute("column_sorting", Integer.toString(columnSorting));
child.setAttribute("column_width", Integer.toString(columnWidth));
xml.addChild(child);
}
use of org.freeplane.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class UnknownElementWriter method writeContent.
public void writeContent(final ITreeWriter writer, final Object element, final IExtension extension) throws IOException {
final UnknownElements elements = (UnknownElements) extension;
final XMLElement unknownElements = elements.getUnknownElements();
if (unknownElements != null) {
final Enumeration<XMLElement> unknownChildren = unknownElements.enumerateChildren();
while (unknownChildren.hasMoreElements()) {
writer.addElement(null, unknownChildren.nextElement());
}
}
}
Aggregations