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 TypeMethodDescriptionbooleanvoidsetFigureFactory(FigureFactory figureFactory) voidsetNamespaceURI(String namespaceURI) voidsetOptions(@NonNull ImmutableMap<Key<?>, Object> newValue) toDocument(@Nullable URI documentHome, @NonNull Drawing internal) toDocument(@Nullable URI documentHome, @NonNull Drawing internal, @NonNull Collection<Figure> selection) voidwrite(@NonNull OutputStream out, @Nullable URI documentHome, @NonNull Drawing drawing, @NonNull WorkState<Void> workState) Writes a Drawing into an output stream.protected voidwrite(@Nullable URI documentHome, @NonNull Writer out, @NonNull Drawing drawing, @NonNull WorkState<Void> workState) voidwrite(@NonNull Map<javafx.scene.input.DataFormat, Object> out, Drawing drawing, Collection<Figure> selection) Writes a selection of figures from a Drawing into a clipboardprotected voidwriteClipping(@NonNull XMLStreamWriter w, @NonNull Drawing internal, @NonNull Collection<Figure> selection, @Nullable URI documentHome) protected voidwriteDocument(@NonNull XMLStreamWriter w, @Nullable URI documentHome, @NonNull Drawing internal) protected voidwriteElementAttributes(@NonNull XMLStreamWriter w, @NonNull Figure figure) protected voidwriteNodeRecursively(@NonNull XMLStreamWriter w, @NonNull Figure figure, int depth) protected voidwriteProcessingInstructions(@NonNull XMLStreamWriter w, @NonNull 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, @NonNull Drawing internal, @NonNull Collection<Figure> selection) throws IOException - Throws:
IOException
-
toDocument
public Document toDocument(@Nullable URI documentHome, @NonNull Drawing internal) throws IOException - Throws:
IOException
-
setOptions
- Specified by:
setOptionsin interfaceOutputFormat
-
getOptions
- Specified by:
getOptionsin interfaceOutputFormat
-
write
public void write(@NonNull OutputStream out, @Nullable URI documentHome, @NonNull Drawing drawing, @NonNull 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, @NonNull Writer out, @NonNull Drawing drawing, @NonNull WorkState<Void> workState) throws IOException - Throws:
IOException
-
write
public void write(@NonNull 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(@NonNull XMLStreamWriter w, @NonNull Drawing internal, @NonNull Collection<Figure> selection, @Nullable URI documentHome) throws IOException, XMLStreamException - Throws:
IOExceptionXMLStreamException
-
writeDocument
protected void writeDocument(@NonNull XMLStreamWriter w, @Nullable URI documentHome, @NonNull Drawing internal) throws XMLStreamException - Throws:
XMLStreamException
-
writeElementAttributes
protected void writeElementAttributes(@NonNull XMLStreamWriter w, @NonNull Figure figure) throws IOException, XMLStreamException - Throws:
IOExceptionXMLStreamException
-
writeNodeRecursively
protected void writeNodeRecursively(@NonNull XMLStreamWriter w, @NonNull Figure figure, int depth) throws IOException - Throws:
IOException
-
writeProcessingInstructions
protected void writeProcessingInstructions(@NonNull XMLStreamWriter w, @NonNull Drawing external) throws XMLStreamException - Throws:
XMLStreamException
-