public class ODGInputFormat extends java.lang.Object implements InputFormat
| Constructor and Description |
|---|
ODGInputFormat()
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
javax.swing.filechooser.FileFilter |
getFileFilter()
Return a FileFilter that can be used to identify files which can be read
with this input format.
|
javax.swing.JComponent |
getInputFormatAccessory()
Return a JFileChooser accessory that can be used to customize the input
format.
|
boolean |
isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
Returns true, if this InputFormat can readFigures TransferData using the
specified DataFlavor.
|
void |
read(java.io.File file,
Drawing drawing) |
void |
read(java.io.File file,
Drawing drawing,
boolean replace) |
void |
read(java.io.InputStream in,
Drawing drawing,
boolean replace)
Reads figures from a file and adds them to the specified drawing.
|
void |
read(java.awt.datatransfer.Transferable t,
Drawing drawing,
boolean replace)
Reads figures from the specified Transferable and adds them to the
specified drawing.
|
void |
read(java.net.URI uri,
Drawing drawing)
Reads figures from an URI and replaces the children of the drawing
with them.
|
void |
read(java.net.URI uri,
Drawing drawing,
boolean replace)
Reads figures from an URI and adds them to the specified drawing.
|
void |
readFiguresFromDocumentContent(java.io.InputStream in,
Drawing drawing,
boolean replace)
Reads figures from the content.xml file of an ODG open document drawing
document.
|
static java.awt.geom.AffineTransform |
toTransform(java.lang.String str)
Converts an ODG draw:transform attribute value into an AffineTransform.
|
static java.lang.String[] |
toWSOrCommaSeparatedArray(java.lang.String str)
Returns a value as a String array.
|
public javax.swing.filechooser.FileFilter getFileFilter()
InputFormatgetFileFilter in interface InputFormatpublic javax.swing.JComponent getInputFormatAccessory()
InputFormatgetInputFormatAccessory in interface InputFormatpublic void read(java.net.URI uri,
Drawing drawing)
throws java.io.IOException
InputFormatThis is a convenience method for calling read(URI,Drawing,true).
read in interface InputFormaturi - The URI.drawing - The drawing.java.io.IOExceptionpublic void read(java.net.URI uri,
Drawing drawing,
boolean replace)
throws java.io.IOException
InputFormatread in interface InputFormaturi - The URI.drawing - The drawing.replace - Set this to true, if the contents of the file replaces the
contents of the drawing (for example, when loading a drawing from a file).
Set this to false, to add the contents of the file to the drawing (for
example, when the file has been dropped into the drawing view).java.io.IOExceptionpublic void read(java.io.File file,
Drawing drawing)
throws java.io.IOException
java.io.IOExceptionpublic void read(java.io.File file,
Drawing drawing,
boolean replace)
throws java.io.IOException
java.io.IOExceptionpublic boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
InputFormatisDataFlavorSupported in interface InputFormatflavor - A DataFlavor.public void read(java.awt.datatransfer.Transferable t,
Drawing drawing,
boolean replace)
throws java.awt.datatransfer.UnsupportedFlavorException,
java.io.IOException
InputFormatread in interface InputFormatt - The Transferable.drawing - The drawing.replace - Set this to true, if the contents of the transferable
replaces the contents of the drawing (for example, when loading a drawing
from a transferable). Set this to false, to add the contents of the
transferable to the drawing (for example, when the transferable has been
dropped or pasted into the drawing view).java.awt.datatransfer.UnsupportedFlavorExceptionjava.io.IOExceptionpublic void read(java.io.InputStream in,
Drawing drawing,
boolean replace)
throws java.io.IOException
InputFormatread in interface InputFormatin - The input stream.drawing - The drawing.replace - Set this to true, if the contents of the stream replaces the
contents of the drawing (for example, when loading a drawing from a stream).
Set this to false, to add the contents of the file to the drawing (for
example, when the stream has been dropped into the drawing view).java.io.IOExceptionpublic void readFiguresFromDocumentContent(java.io.InputStream in,
Drawing drawing,
boolean replace)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String[] toWSOrCommaSeparatedArray(java.lang.String str)
throws java.io.IOException
java.io.IOExceptionpublic static java.awt.geom.AffineTransform toTransform(java.lang.String str)
throws java.io.IOException
The draw:transform attribute specifies a list of transformations that can be applied to a
drawing shape.
The value of this attribute is a list of transform definitions, which are applied to the drawing shape
in the order in which they are listed. The transform definitions in the list must be separated by a
white space and/or a comma. The types of transform definitions available include:
• matrix(
java.io.IOException