Package org.jfree.xml.writer

Examples of org.jfree.xml.writer.AttributeList


     * @param mi  the mapping info.
     *
     * @throws IOException if there is an I/O problem.
     */
    protected void writeManualMapping(final Writer writer, final ManualMappingInfo mi) throws IOException {
        final AttributeList al = new AttributeList();
        al.setAttribute(ClassModelTags.CLASS_ATTR, mi.getBaseClass().getName());
        al.setAttribute(ClassModelTags.READ_HANDLER_ATTR, mi.getReadHandler().getName());
        al.setAttribute(ClassModelTags.WRITE_HANDLER_ATTR, mi.getWriteHandler().getName());
        writeTag(writer, ClassModelTags.MANUAL_TAG, al, mi.getComments());
    }
View Full Code Here


    protected void writeMultiplexMapping(final Writer writer, final MultiplexMappingInfo mi)
        throws IOException {
       
        final TypeInfo[] tis = mi.getChildClasses();

        final AttributeList al = new AttributeList();
        al.setAttribute(ClassModelTags.BASE_CLASS_ATTR, mi.getBaseClass().getName());
        al.setAttribute(ClassModelTags.TYPE_ATTR, mi.getTypeAttribute());
        getWriterSupport().writeTag(writer, ClassModelTags.MAPPING_TAG, al, XMLWriterSupport.OPEN);

        for (int j = 0; j < tis.length; j++) {
            final AttributeList tiAttr = new AttributeList();
            tiAttr.setAttribute(ClassModelTags.NAME_ATTR, tis[j].getName());
            tiAttr.setAttribute(ClassModelTags.CLASS_ATTR, tis[j].getType().getName());
            writeTag(writer, ClassModelTags.TYPE_TAG, tiAttr, tis[j].getComments());
        }

        getWriterSupport().writeCloseTag(writer, ClassModelTags.MAPPING_TAG);
    }
View Full Code Here

        if (cd.isUndefined()) {
            return;
        }

        final AttributeList al = new AttributeList();
        al.setAttribute(ClassModelTags.CLASS_ATTR, cd.getName());
        if (cd.getRegisterKey() != null) {
            al.setAttribute(ClassModelTags.REGISTER_NAMES_ATTR, cd.getRegisterKey());
        }
        if (cd.isPreserve()) {
            al.setAttribute(ClassModelTags.IGNORE_ATTR, "true");
        }
        this.writerSupport.writeTag(writer, ClassModelTags.OBJECT_TAG, al, XMLWriterSupport.OPEN);

        final TypeInfo[] constructorInfo = cd.getConstructorDescription();
        if (constructorInfo != null && constructorInfo.length != 0) {
            this.writerSupport.writeTag(writer, ClassModelTags.CONSTRUCTOR_TAG);
            for (int i = 0; i < constructorInfo.length; i++) {
                final AttributeList constructorList = new AttributeList();
                constructorList.setAttribute(
                    ClassModelTags.CLASS_ATTR, constructorInfo[i].getType().getName()
                );
                constructorList.setAttribute(
                    ClassModelTags.PROPERTY_ATTR, constructorInfo[i].getName()
                );
                writeTag(writer, ClassModelTags.PARAMETER_TAG, constructorList,
                         constructorInfo[i].getComments());
            }
View Full Code Here

     * @param ipi  the property info.
     *
     * @throws IOException if there is an I/O problem.
     */
    private void writePropertyInfo(final Writer writer, final PropertyInfo ipi) throws IOException {
        final AttributeList props = new AttributeList();
        props.setAttribute(ClassModelTags.NAME_ATTR, ipi.getName());

        if (ipi instanceof IgnoredPropertyInfo) {
            writeTag(writer, ClassModelTags.IGNORED_PROPERTY_TAG, props, ipi.getComments());
            return;
        }

        if (ipi.getPropertyType().equals(PropertyType.ATTRIBUTE)) {
            props.setAttribute(ClassModelTags.ATTRIBUTE_ATTR, ipi.getXmlName());
            props.setAttribute(ClassModelTags.ATTRIBUTE_HANDLER_ATTR, ipi.getXmlHandler());
            writeTag(writer, ClassModelTags.ATTRIBUTE_PROPERTY_TAG, props, ipi.getComments());
        }
        else if (ipi.getPropertyType().equals(PropertyType.ELEMENT)) {
            if (ipi.getComments() == null || ipi.getComments().getOpenTagComment() == null)
            {
                this.writerSupport.indent(writer, XMLWriterSupport.INDENT_ONLY);
                writer.write("<!-- property type is " + ipi.getType() + " -->");
                writer.write(System.getProperty("line.separator", "\n"));
            }
            props.setAttribute(ClassModelTags.ELEMENT_ATTR, ipi.getXmlName());
            writeTag(writer, ClassModelTags.ELEMENT_PROPERTY_TAG, props, ipi.getComments());
        }
        else {
            props.setAttribute(ClassModelTags.LOOKUP_ATTR, ipi.getXmlName());
            writeTag(writer, ClassModelTags.LOOKUP_PROPERTY_TAG, props, ipi.getComments());
        }
    }
View Full Code Here

        final Iterator it = hints.keySet().iterator();
        while (it.hasNext()) {
            final RenderingHints.Key key = (RenderingHints.Key) it.next();
            final String keyname = hintFieldToString(key);
            final String value = hintFieldToString(hints.get(key));
            final AttributeList attribs = new AttributeList();
            attribs.setAttribute("key", keyname);
            attribs.setAttribute("value", value);
            writer.writeTag("entry", attribs, XMLWriterSupport.CLOSE);
            writer.allowLineBreak();
        }
        writer.writeCloseTag(tagName);
        writer.allowLineBreak();
View Full Code Here

        final float dashPhase = stroke.getDashPhase();
        final int endCap = stroke.getEndCap();
        final int lineJoin = stroke.getLineJoin();
        final float lineWidth = stroke.getLineWidth();
        final float miterLimit = stroke.getMiterLimit();
        final AttributeList attribs = new AttributeList();
        if (mPlexAttribute != null) {
            attribs.setAttribute(mPlexAttribute, mPlexValue);
        }
        attribs.setAttribute("type", "basic");
        attribs.setAttribute("endCap", String.valueOf(endCap));
        attribs.setAttribute("lineJoin", String.valueOf(lineJoin));
        attribs.setAttribute("lineWidth", String.valueOf(lineWidth));
        attribs.setAttribute("miterLimit", String.valueOf(miterLimit));
        if (dashArray != null) {
            attribs.setAttribute("dashArray", toString(dashArray));
            attribs.setAttribute("dashPhase", String.valueOf(dashPhase));
        }
        writer.writeTag(tagName, attribs, true);
    }
View Full Code Here

     */
    public void write(final String tagName, final Object object, final XMLWriter writer,
                      final String mPlexAttribute, final String mPlexValue)
        throws IOException, XMLWriterException {
        final Color color = (Color) object;
        final AttributeList attribs = new AttributeList();
        if (mPlexAttribute != null) {
            attribs.setAttribute(mPlexAttribute, mPlexValue);
        }
        attribs.setAttribute("value", encodeColor(color));
        if (color.getAlpha() != 255) {
            attribs.setAttribute("alpha", String.valueOf(color.getAlpha()));
        }
        writer.writeTag(tagName, attribs, true);
    }
View Full Code Here

        throws IOException, XMLWriterException {

        try {
            this.factory.readProperties(object);

            final AttributeList attributes = new AttributeList();
            if (mPlexAttribute != null) {
                attributes.setAttribute(mPlexAttribute, mPlexValue);
            }
            final AttributeDefinition[] attribDefs = this.factory.getAttributeDefinitions();
            final ArrayList properties = new ArrayList();
            for (int i = 0; i < attribDefs.length; i++) {
                final AttributeDefinition adef = attribDefs[i];
                final String pName = adef.getAttributeName();
                final Object propValue = this.factory.getProperty(adef.getPropertyName());
                if (propValue != null) {
                    Log.debug(
                        "Here: " + this.factory.getBaseClass() + " -> " + adef.getPropertyName()
                    );
                    final String value = adef.getHandler().toAttributeValue(propValue);
                    if (value != null) {
                        attributes.setAttribute(pName, value);
                    }
                }
                properties.add(adef.getPropertyName());
            }
            writer.writeTag(tagName, attributes, false);
View Full Code Here

        final Rectangle2D rect = (Rectangle2D) object;
        final double x = rect.getX();
        final double y = rect.getY();
        final double w = rect.getWidth();
        final double h = rect.getHeight();
        final AttributeList attribs = new AttributeList();
        if (mPlexAttribute != null) {
            attribs.setAttribute(mPlexAttribute, mPlexValue);
        }
        attribs.setAttribute("x", String.valueOf(x));
        attribs.setAttribute("y", String.valueOf(y));
        attribs.setAttribute("width", String.valueOf(w));
        attribs.setAttribute("height", String.valueOf(h));
        writer.writeTag(tagName, attribs, true);
    }
View Full Code Here

     * @throws XMLWriterException if there is a writer error.
     */
    public void write(final String tagName, final Object object, final XMLWriter writer,
                      final String mPlexAttribute, final String mPlexValue)
        throws IOException, XMLWriterException {
        final AttributeList attribs = new AttributeList();
        if (mPlexAttribute != null) {
            attribs.setAttribute(mPlexAttribute, mPlexValue);
        }
        final Insets i = (Insets) object;
        attribs.setAttribute("top", String.valueOf(i.top));
        attribs.setAttribute("left", String.valueOf(i.left));
        attribs.setAttribute("bottom", String.valueOf(i.bottom));
        attribs.setAttribute("right", String.valueOf(i.right));
        writer.writeTag(tagName, attribs, XMLWriterSupport.CLOSE);
    }
View Full Code Here

TOP

Related Classes of org.jfree.xml.writer.AttributeList

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.