use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class ReminderHook method createExtension.
@Override
protected IExtension createExtension(final NodeModel node, final XMLElement element) {
final ReminderExtension reminderExtension = new ReminderExtension(node);
final XMLElement parameters = element.getFirstChildNamed("Parameters");
final String time = parameters.getAttribute(REMINDUSERAT, "0");
final String unit = parameters.getAttribute(UNIT, "DAY");
final String period = parameters.getAttribute(PERIOD, "1");
reminderExtension.setRemindUserAt(Long.parseLong(time));
reminderExtension.setPeriodUnit(PeriodUnit.valueOf(unit));
reminderExtension.setPeriod(Integer.parseInt(period));
final String script = parameters.getAttribute(SCRIPT, null);
reminderExtension.setScript(script);
return reminderExtension;
}
use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class EdgeBuilder method writeContent.
private void writeContent(final ITreeWriter writer, final NodeModel node, final EdgeModel model, final boolean forceFormatting) throws IOException {
final EdgeStyle styleObj = forceFormatting ? ec.getStyle(node) : model.getStyle();
final String style = EdgeStyle.toString(styleObj);
final Color color = forceFormatting ? ec.getColor(node) : model.getColor();
final int width = forceFormatting ? ec.getWidth(node) : model.getWidth();
final DashVariant dash = forceFormatting ? ec.getDash(node) : model.getDash();
if (forceFormatting || style != null || color != null || width != EdgeModel.DEFAULT_WIDTH || dash != null) {
final XMLElement edge = new XMLElement();
edge.setName("edge");
boolean relevant = false;
if (style != null) {
if (style.equals(EdgeStyle.EDGESTYLE_HIDDEN)) {
edge.setAttribute("HIDE", "true");
relevant = true;
}
edge.setAttribute("STYLE", style);
relevant = true;
}
if (color != null) {
ColorUtils.setColorAttributes(edge, "COLOR", "ALPHA", color);
relevant = true;
}
if (width != EdgeModel.WIDTH_PARENT) {
if (width == EdgeModel.WIDTH_THIN) {
edge.setAttribute("WIDTH", EdgeModel.EDGEWIDTH_THIN);
} else {
edge.setAttribute("WIDTH", Integer.toString(width));
}
relevant = true;
}
if (dash != null) {
edge.setAttribute("DASH", dash.name());
relevant = true;
}
if (relevant) {
writer.addElement(model, edge);
}
}
}
use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class OptionPanelWindowConfigurationStorage method decorateDialog.
public static OptionPanelWindowConfigurationStorage decorateDialog(final String marshalled, final JDialog dialog) {
final OptionPanelWindowConfigurationStorage storage = new OptionPanelWindowConfigurationStorage();
final XMLElement xml = storage.unmarschall(marshalled, dialog);
if (xml != null) {
storage.panel = xml.getAttribute("panel", null);
return storage;
}
return null;
}
use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class UnknownElementWriter method writeAttributes.
public void writeAttributes(final ITreeWriter writer, final Object userObject, final IExtension extension) {
final UnknownElements elements = (UnknownElements) extension;
final XMLElement unknownElements = elements.getUnknownElements();
if (unknownElements != null) {
final Enumeration<String> unknownAttributes = unknownElements.enumerateAttributeNames();
while (unknownAttributes.hasMoreElements()) {
final String name = unknownAttributes.nextElement();
final String value = unknownElements.getAttribute(name, null);
writer.addAttribute(name, value);
}
}
}
use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class StdXMLBuilder method startElement.
/**
* This method is called when a new XML element is encountered.
*
* @see #endElement
* @param name
* the name of the element.
* @param nsPrefix
* the prefix used to identify the namespace. If no namespace has
* been specified, this parameter is null.
* @param nsURI
* the URI associated with the namespace. If no namespace has
* been specified, or no URI is associated with nsPrefix, this
* parameter is null.
* @param systemID
* the system ID of the XML data source.
* @param lineNr
* the line in the source where the element starts.
*/
public void startElement(final String name, final String nsPrefix, final String nsURI, final String systemID, final int lineNr) {
String fullName = name;
if (nsPrefix != null) {
fullName = nsPrefix + ':' + name;
}
final XMLElement elt = new XMLElement(fullName, nsURI, systemID, lineNr);
last = elt;
if (stack.empty()) {
root = elt;
} else {
final XMLElement top = (XMLElement) stack.peek();
top.addChild(elt);
}
stack.push(elt);
}
Aggregations