Package org.freeplane.n3.nanoxml

Examples of org.freeplane.n3.nanoxml.ContentReader


      final String userName = condition.getUserName();
      final String newUserName = JOptionPane.showInputDialog(AFilterComposerDialog.this,
          TextUtils.getText("enter_condition_name"), userName == null ? "" : userName);
      if(newUserName == null)
        return;
      XMLElement xmlCondition = new XMLElement();
      condition.toXml(xmlCondition);
      ASelectableCondition newCondition = filterController.getConditionFactory().loadCondition(xmlCondition.getChildAtIndex(0));
      if(newCondition== null)
        return;
      if (newUserName.equals("")) {
        if(userName == null)
          return;
View Full Code Here


    public IPropertyControlCreator getCreator(final String name, final XMLElement data) {
      final int childrenCount = data.getChildrenCount();
      final Vector<String> choices = new Vector<String>(childrenCount);
      final Vector<String> translations = new Vector<String>(childrenCount);
      for (int i = 0; i < childrenCount; i++) {
        final XMLElement element = data.getChildAtIndex(i);
        final String choice = element.getAttribute("value", null);
        choices.add(choice);
        final String translationKey = element.getAttribute("text", "OptionPanel." + choice);
        final String translation = TextUtils.getOptionalText(translationKey);
        translations.add(translation);
      }
      return createComboProperty(name, choices, translations);
    }
View Full Code Here

          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);
          }
        });
       
View Full Code Here

      else {
        style = StyleFactory.create(styleElement.getAttribute("STYLE_REF", null));
      }
      final ASelectableCondition condition;
      if(styleElement.getChildrenCount() == 1){
        final XMLElement conditionElement = styleElement.getChildAtIndex(0);
        try {
                  condition = conditionFactory.loadCondition(conditionElement);
                }
                catch (Exception e) {
                  e.printStackTrace();
View Full Code Here

  private void saveConditionalStyles(ConditionalStyleModel conditionalStyleModel, XMLElement parent, boolean createRoot) {
    final int styleCount = conditionalStyleModel.getStyleCount();
    if(styleCount == 0){
      return;
    }
    final XMLElement conditionalStylesRoot;
    if(createRoot){
      conditionalStylesRoot = parent.createElement("conditional_styles");
    parent.addChild(conditionalStylesRoot);
    }
    else
View Full Code Here

 
  private void saveProperties(Map<String, String> properties, XMLElement element) {
    if(properties.isEmpty()){
      return;
    }
      final XMLElement xmlElement = new XMLElement("properties");
      for (Entry<String, String>  entry: properties.entrySet()){
        xmlElement.setAttribute(entry.getKey(), entry.getValue());
      }
      element.addChild(xmlElement);
    }
View Full Code Here

  public void save(final ITreeWriter writer, final ConnectorModel model) throws IOException {
    final NodeModel target = model.getTarget();
    if (target == null) {
      return;
    }
    final XMLElement arrowLink = new XMLElement();
    arrowLink.setName("arrowlink");
    final Shape shape = model.getShape();
    arrowLink.setAttribute("SHAPE", shape.toString());
    final Color color = model.getColor();
    arrowLink.setAttribute("COLOR", ColorUtils.colorToString(color));
    final int width = model.getWidth();
    arrowLink.setAttribute("WIDTH", Integer.toString(width));
    final int alpha = model.getAlpha();
    arrowLink.setAttribute("TRANSPARENCY", Integer.toString(alpha));
    final int[]dash = model.getDash();
    if (dash != null) {
      StringBuilder sb = null;
      for(int i : dash){
        if(sb == null){
          sb = new StringBuilder(dash.length * 4);
        }
        else{
          sb.append(' ');
        }
        sb.append(i);
      }
      if(sb != null){
        arrowLink.setAttribute("DASH", sb.toString());       
      }
    }
   
    final int fontSize = model.getLabelFontSize();
    arrowLink.setAttribute("FONT_SIZE", Integer.toString(fontSize));

    final String fontFamily = model.getLabelFontFamily();
    arrowLink.setAttribute("FONT_FAMILY", fontFamily);
   
    final String destinationLabel = target.createID();

    if (destinationLabel != null) {
      arrowLink.setAttribute("DESTINATION", destinationLabel);
    }
    final String sourceLabel = model.getSourceLabel();
    if (sourceLabel != null) {
      arrowLink.setAttribute("SOURCE_LABEL", sourceLabel);
    }
    final String targetLabel = model.getTargetLabel();
    if (targetLabel != null) {
      arrowLink.setAttribute("TARGET_LABEL", targetLabel);
    }
    final String middleLabel = model.getMiddleLabel();
    if (middleLabel != null) {
      arrowLink.setAttribute("MIDDLE_LABEL", middleLabel);
    }
    final Point startInclination = model.getStartInclination();
    if (startInclination != null) {
      arrowLink.setAttribute("STARTINCLINATION", TreeXmlWriter.PointToXml(startInclination));
    }
    final Point endInclination = model.getEndInclination();
    if (endInclination != null) {
      arrowLink.setAttribute("ENDINCLINATION", TreeXmlWriter.PointToXml(endInclination));
    }
    final String startArrow = model.getStartArrow().toString();
    if (startArrow != null) {
      arrowLink.setAttribute("STARTARROW", startArrow);
    }
    final String endArrow = model.getEndArrow().toString();
    if (endArrow != null) {
      arrowLink.setAttribute("ENDARROW", endArrow);
    }
    writer.addElement(model, arrowLink);
  }
View Full Code Here

    }

    public void endElement(final Object parent, final String tag, final Object userObject,
                           final XMLElement lastBuiltElement) {
      if (getHookAnnotation().onceForMap()) {
        final XMLElement parentNodeElement = lastBuiltElement.getParent().getParent();
        if (parentNodeElement == null || !parentNodeElement.getName().equals("map")) {
          return;
        }
      }
      final NodeModel node = (NodeModel) userObject;
      if (node.getExtension(getExtensionClass()) != null) {
View Full Code Here

  }

  protected class XmlWriter implements IExtensionElementWriter {
    public void writeContent(final ITreeWriter writer, final Object object, final IExtension extension)
            throws IOException {
      final XMLElement element = new XMLElement("hook");
      try {
        saveExtension(extension, element);
        writer.addElement(null, element);
      }
      catch (final Exception e) {
View Full Code Here

    final TreeXmlWriter xmlWriter = new TreeXmlWriter(writeManager, fileout);
    xmlWriter.setHint(Hint.MODE, mode);
    if (forceFormat) {
      xmlWriter.setHint(WriterHint.FORCE_FORMATTING);
    }
    final XMLElement xmlMap = new XMLElement("map");
    setSaveInvisible(saveInvisible);
    xmlWriter.addElement(map, xmlMap);
    xmlWriter.flush();
    fileout.close();
  }
View Full Code Here

TOP

Related Classes of org.freeplane.n3.nanoxml.ContentReader

Copyright © 2018 www.massapicom. 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.