java.lang.Object
org.jhotdraw8.draw.io.SimpleXmlWriter
- All Implemented Interfaces:
ClipboardOutputFormat,OutputFormat
SimpleXmlWriter.
Represents each Figure by an element, and each figure property by an attribute.
All attribute values are treated as value types, except if an attribute type is an instance of Figure.
This writer only works for drawings which can be described entirely by the properties of its figures.
Attempts to preserve comments in the XML file, by associating them to the figures and to the drawing.
Does not preserve whitespace in the XML file.
- Author:
- Werner Randelshofer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FigureFactoryprotected final org.jhotdraw8.base.converter.IdFactorystatic final NonNullObjectKey<Integer> Specifies the number of characters that should be used for indentation.protected final Stringprotected String -
Constructor Summary
ConstructorsConstructorDescriptionSimpleXmlWriter(FigureFactory factory, org.jhotdraw8.base.converter.IdFactory idFactory) SimpleXmlWriter(FigureFactory factory, org.jhotdraw8.base.converter.IdFactory idFactory, String namespaceURI, String namespaceQualifier) -
Method Summary
Modifier and TypeMethodDescriptionImmutableMap<Key<?>, Object> booleanvoidsetFigureFactory(FigureFactory figureFactory) voidsetNamespaceURI(String namespaceURI) voidsetOptions(ImmutableMap<Key<?>, Object> newValue) toDocument(@Nullable URI documentHome, Drawing internal) toDocument(@Nullable URI documentHome, Drawing internal, Collection<Figure> selection) voidWrites a Drawing into an output stream.protected voidvoidWrites a selection of figures from a Drawing into a clipboardprotected voidwriteClipping(XMLStreamWriter w, Drawing internal, Collection<Figure> selection, @Nullable URI documentHome) protected voidwriteDocument(XMLStreamWriter w, @Nullable URI documentHome, Drawing internal) protected voidwriteElementAttributes(XMLStreamWriter w, Figure figure) protected voidwriteNodeRecursively(XMLStreamWriter w, Figure figure, int depth) protected voidwriteProcessingInstructions(XMLStreamWriter w, Drawing external) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jhotdraw8.draw.input.ClipboardOutputFormat
writeMethods inherited from interface org.jhotdraw8.draw.io.OutputFormat
write, write
-
Field Details
-
figureFactory
-
idFactory
protected final org.jhotdraw8.base.converter.IdFactory idFactory -
namespaceQualifier
-
namespaceURI
-
INDENT_AMOUNT
Specifies the number of characters that should be used for indentation.
-
-
Constructor Details
-
SimpleXmlWriter
-
SimpleXmlWriter
public SimpleXmlWriter(FigureFactory factory, org.jhotdraw8.base.converter.IdFactory idFactory, String namespaceURI, String namespaceQualifier)
-
-
Method Details
-
isNamespaceAware
public boolean isNamespaceAware() -
setFigureFactory
-
setNamespaceURI
-
toDocument
public Document toDocument(@Nullable URI documentHome, Drawing internal, Collection<Figure> selection) throws IOException - Throws:
IOException
-
toDocument
- Throws:
IOException
-
setOptions
- Specified by:
setOptionsin interfaceOutputFormat
-
getOptions
- Specified by:
getOptionsin interfaceOutputFormat
-
write
public void write(OutputStream out, @Nullable URI documentHome, Drawing drawing, WorkState<Void> workState) throws IOException Description copied from interface:OutputFormatWrites a Drawing into an output stream.- Specified by:
writein interfaceOutputFormat- Parameters:
out- The output stream.documentHome- Document home URI for creating relative URIs in the document if this URI is null, all URIs in the document will be absolutedrawing- The drawing.workState- for progress monitoring and cancelling the operation- Throws:
IOException- if an IO error occurs
-
write
protected void write(@Nullable URI documentHome, Writer out, Drawing drawing, WorkState<Void> workState) throws IOException - Throws:
IOException
-
write
public void write(Map<javafx.scene.input.DataFormat, Object> out, Drawing drawing, Collection<Figure> selection) throws IOExceptionDescription copied from interface:ClipboardOutputFormatWrites a selection of figures from a Drawing into a clipboard- Specified by:
writein interfaceClipboardOutputFormat- Parameters:
out- The clipboarddrawing- The drawing.selection- A selection- Throws:
IOException- if an IO error occurs
-
writeClipping
protected void writeClipping(XMLStreamWriter w, Drawing internal, Collection<Figure> selection, @Nullable URI documentHome) throws IOException, XMLStreamException - Throws:
IOExceptionXMLStreamException
-
writeDocument
protected void writeDocument(XMLStreamWriter w, @Nullable URI documentHome, Drawing internal) throws XMLStreamException - Throws:
XMLStreamException
-
writeElementAttributes
protected void writeElementAttributes(XMLStreamWriter w, Figure figure) throws IOException, XMLStreamException - Throws:
IOExceptionXMLStreamException
-
writeNodeRecursively
- Throws:
IOException
-
writeProcessingInstructions
protected void writeProcessingInstructions(XMLStreamWriter w, Drawing external) throws XMLStreamException - Throws:
XMLStreamException
-