use of org.freeplane.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class PatternFormat method toXml.
public XMLElement toXml() {
final XMLElement xmlElement = new XMLElement(ELEMENT_NAME);
xmlElement.setAttribute("type", getType());
xmlElement.setAttribute("style", getStyle());
if (getName() != null)
xmlElement.setAttribute("name", getName());
if (getLocale() != null)
xmlElement.setAttribute("locale", getLocale().toString());
xmlElement.setContent(getPattern());
return xmlElement;
}
use of org.freeplane.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 org.freeplane.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 org.freeplane.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 org.freeplane.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);
}
}
}
Aggregations