Package net.n3.nanoxml

Examples of net.n3.nanoxml.XMLElement


        }
        parent.addChild(xmlElement);
    }

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


          return isLast;
        }
   
    public void toXml(XMLElement conditionalStylesRoot)
    {
      final XMLElement itemElement = conditionalStylesRoot.createElement("conditional_style");
      conditionalStylesRoot.addChild(itemElement);
      itemElement.setAttribute("ACTIVE", Boolean.toString(isActive()));
      final IStyle style = getStyle();
      if (style instanceof StyleNamedObject) {
        final String referencedStyle = ((StyleNamedObject)style).getObject().toString();
        itemElement.setAttribute("LOCALIZED_STYLE_REF", referencedStyle);
      }
      else {
        final String referencedStyle = style.toString();
        itemElement.setAttribute("STYLE_REF", referencedStyle);
      }
      itemElement.setAttribute("LAST", Boolean.toString(isLast()));
      if(condition != null)
        condition.toXml(itemElement);

    }
View Full Code Here

      final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
      final URL resource = ResourceController.getResourceController().getResource(xmlDescriptorFile);
      xmlDescriptorStream = resource.openStream();
      final IXMLReader reader = new StdXMLReader(xmlDescriptorStream);
      parser.setReader(reader);
      final XMLElement xml = (XMLElement) parser.parse();
      final Enumeration<XMLElement> actionDescriptors = xml.enumerateChildren();
      while (actionDescriptors.hasMoreElements()) {
        final XMLElement descriptor = actionDescriptors.nextElement();
        final String name = descriptor.getAttribute("name", null);
        final XMLElement xmlProperties = descriptor.getFirstChildNamed("properties");
        final Properties properties = xmlProperties.getAttributes();
        final ExportWithXSLT action = new ExportWithXSLT(name, properties);
        addExportEngine(action.getFileFilter(), action);
      }
    }
    catch (final Exception e) {
View Full Code Here

      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

TOP

Related Classes of net.n3.nanoxml.XMLElement

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.