Examples of IElementDOMHandler


Examples of org.freeplane.core.io.IElementDOMHandler

    ModeController modeController = Controller.getCurrentModeController();
    if (persistent) {
      final MapController mapController = modeController.getMapController();
      mapController.getWriteManager().addExtensionElementWriter(getExtensionClass(),
        new XmlWriter());
      mapController.getReadManager().addElementHandler("conditional_styles", new IElementDOMHandler() {
        public Object createElement(Object parent, String tag, XMLElement attributes) {
          return parent;
        }

        public void endElement(Object parent, String tag, Object element, XMLElement dom) {
          final NodeModel node = (NodeModel) parent;
          final MapStyleModel mapStyleModel = MapStyleModel.getExtension(node);
          if(mapStyleModel != null)
            loadConditionalStyles(mapStyleModel.getConditionalStyleModel(), dom);
        }
        });

        mapController.getWriteManager().addExtensionElementWriter(ConditionalStyleModel.class,
          new IExtensionElementWriter() {
          public void writeContent(ITreeWriter writer, Object element, IExtension extension) throws IOException {
            final ConditionalStyleModel conditionalStyleModel = (ConditionalStyleModel) extension;
            if (conditionalStyleModel.getStyleCount() == 0)
              return;
            final XMLElement hook = new XMLElement("hook");
            hook.setAttribute("NAME", NODE_CONDITIONAL_STYLES);
            saveConditionalStyles(conditionalStyleModel, hook, false);
            writer.addElement(null, hook);
          }
        });
       
        mapController.getReadManager().addElementHandler("hook", new IElementDOMHandler() {
          public Object createElement(Object parent, String tag, XMLElement attributes) {
            if (attributes == null
                || !NODE_CONDITIONAL_STYLES.equals(attributes.getAttribute("NAME", null))) {
              return null;
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.