use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class TimeWindowConfigurationStorage method decorateDialog.
public static TimeWindowConfigurationStorage decorateDialog(final String marshalled, final JDialog dialog) {
final TimeWindowConfigurationStorage storage = new TimeWindowConfigurationStorage();
final XMLElement xml = storage.unmarschall(marshalled, dialog);
if (xml != null) {
final Iterator<XMLElement> iterator = xml.getChildren().iterator();
while (iterator.hasNext()) {
storage.addTimeWindowColumnSetting(TimeWindowColumnSetting.create(iterator.next()));
}
return storage;
}
return null;
}
use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class AddOnProperties method addDeinstallationRulesAsChild.
private void addDeinstallationRulesAsChild(XMLElement parent) {
final XMLElement xmlElement = new XMLElement("deinstall");
for (String[] rule : deinstallationRules) {
final XMLElement ruleElement = new XMLElement(rule[0]);
ruleElement.setContent(rule[1]);
xmlElement.addChild(ruleElement);
}
parent.addChild(xmlElement);
}
use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class AddOnProperties method addTranslationsAsChild.
private void addTranslationsAsChild(XMLElement parent) {
final XMLElement translationsElement = new XMLElement("translations");
for (Entry<String, Map<String, String>> localeEntry : translations.entrySet()) {
final XMLElement localeElement = new XMLElement("locale");
localeElement.setAttribute("name", localeEntry.getKey());
for (Entry<String, String> translationEntry : localeEntry.getValue().entrySet()) {
final XMLElement translationElement = new XMLElement("entry");
translationElement.setAttribute("key", translationEntry.getKey());
translationElement.setContent(StringEscapeUtils.escapeJava(translationEntry.getValue()));
localeElement.addChild(translationElement);
}
translationsElement.addChild(localeElement);
}
parent.addChild(translationsElement);
}
use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class AddOnsController method registerPlugins.
private void registerPlugins() {
final File addOnsDir = getAddOnsDir();
// in applets the addOnsDir will be null
if (addOnsDir == null)
return;
File[] addonXmlFiles = addOnsDir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".plugin.xml");
}
});
final IXMLParser parser = XMLLocalParserFactory.createLocalXMLParser();
for (File file : addonXmlFiles) {
BufferedInputStream inputStream = null;
try {
inputStream = new BufferedInputStream(new FileInputStream(file));
final IXMLReader reader = new StdXMLReader(inputStream);
parser.setReader(reader);
registerInstalledAddOn(new AddOnProperties(AddOnType.PLUGIN, (XMLElement) parser.parse()));
} catch (final Exception e) {
LogUtils.warn("error parsing " + file, e);
} finally {
FileUtils.silentlyClose(inputStream);
}
}
}
use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class NodeWriter method writeAttributesGenerateContent.
private void writeAttributesGenerateContent(final ITreeWriter writer, final NodeModel node) {
/**
* fc, 12.6.2005: XML must not contain any zero characters.
*/
xmlNode = new XMLElement();
EncryptionModel encryptionModel = EncryptionModel.getModel(node);
mayWriteChildren = true;
final Object mode = mode(writer);
final boolean isNodeAlreadyWritten = isAlreadyWritten(node);
if (encryptionModel != null && !(encryptionModel.isAccessible() && Mode.EXPORT.equals(mode)) && !isNodeAlreadyWritten) {
final String enctyptedContent = encryptionModel.calculateEncryptedContent(mapController);
if (enctyptedContent != null) {
writer.addAttribute(NodeBuilder.XML_NODE_ENCRYPTED_CONTENT, enctyptedContent);
mayWriteChildren = false;
}
}
if (mayWriteChildren && (writeFolded || !mode(writer).equals(Mode.FILE))) {
if (mapController.isFolded(node) && !isNodeAlreadyWritten) {
writer.addAttribute("FOLDED", "true");
} else if (node.isRoot() && !Mode.STYLE.equals(mode)) {
writer.addAttribute("FOLDED", "false");
}
}
final NodeModel parentNode = node.getParentNode();
if (parentNode != null && parentNode.isRoot()) {
writer.addAttribute("POSITION", node.isLeft() ? "left" : "right");
}
final boolean saveID = !mode.equals(Mode.STYLE);
if (saveID) {
final String id = node.createID();
writer.addAttribute("ID", id);
writeReferenceNodeId(writer, node);
}
if (!isNodeAlreadyWritten) {
if (!mode.equals(Mode.STYLE) && node.getHistoryInformation() != null && ResourceController.getResourceController().getBooleanProperty(NodeBuilder.RESOURCES_SAVE_MODIFICATION_TIMES)) {
writer.addAttribute(NodeBuilder.XML_NODE_HISTORY_CREATED_AT, TreeXmlWriter.dateToString(node.getHistoryInformation().getCreatedAt()));
writer.addAttribute(NodeBuilder.XML_NODE_HISTORY_LAST_MODIFIED_AT, TreeXmlWriter.dateToString(node.getHistoryInformation().getLastModifiedAt()));
}
}
if (!isNodeAlreadyWritten || Mode.EXPORT.equals(mode)) {
writeIconSize(writer, node);
linkBuilder.writeAttributes(writer, node);
writer.addExtensionAttributes(node, node.getSharedExtensions().values());
}
writer.addExtensionAttributes(node, node.getIndividualExtensionValues());
}
Aggregations