public class SVGInputFormat extends java.lang.Object implements InputFormat
SVG-static
feature string.
http://www.w3.org/TR/SVGMobile12/
Design pattern:
Name: Abstract Factory.
Role: Client.
Partners: SVGFigureFactory
as Abstract Factory.
Constructor and Description |
---|
SVGInputFormat()
Creates a new instance.
|
SVGInputFormat(SVGFigureFactory factory) |
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)
This is the main reading method.
|
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 |
read(java.net.URL url,
Drawing drawing,
boolean replace) |
static java.lang.String[] |
toCommaSeparatedArray(java.lang.String str)
Returns a value as a String array.
|
static java.lang.String[] |
toQuotedAndCommaSeparatedArray(java.lang.String str)
Returns a value as a String array.
|
static java.awt.geom.AffineTransform |
toTransform(IXMLElement elem,
java.lang.String str) |
static java.lang.String[] |
toWSOrCommaSeparatedArray(java.lang.String str)
Returns a value as a String array.
|
public SVGInputFormat()
public SVGInputFormat(SVGFigureFactory factory)
public void read(java.net.URI uri, Drawing drawing) throws java.io.IOException
InputFormat
This is a convenience method for calling read(URI,Drawing,true).
read
in interface InputFormat
uri
- The URI.drawing
- The drawing.java.io.IOException
public void read(java.net.URI uri, Drawing drawing, boolean replace) throws java.io.IOException
InputFormat
read
in interface InputFormat
uri
- 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.IOException
public void read(java.io.File file, Drawing drawing) throws java.io.IOException
java.io.IOException
public void read(java.io.File file, Drawing drawing, boolean replace) throws java.io.IOException
java.io.IOException
public void read(java.net.URL url, Drawing drawing, boolean replace) throws java.io.IOException
java.io.IOException
public void read(java.io.InputStream in, Drawing drawing, boolean replace) throws java.io.IOException
read
in interface InputFormat
in
- The input stream.drawing
- The drawing to which this method adds figures.replace
- Whether attributes on the drawing object
should by changed by this method. Set this to false, when reading individual
images from the clipboard.java.io.IOException
public static java.lang.String[] toCommaSeparatedArray(java.lang.String str) throws java.io.IOException
java.io.IOException
public static java.lang.String[] toWSOrCommaSeparatedArray(java.lang.String str) throws java.io.IOException
java.io.IOException
public static java.lang.String[] toQuotedAndCommaSeparatedArray(java.lang.String str) throws java.io.IOException
java.io.IOException
public static java.awt.geom.AffineTransform toTransform(IXMLElement elem, java.lang.String str) throws java.io.IOException
java.io.IOException
public javax.swing.filechooser.FileFilter getFileFilter()
InputFormat
getFileFilter
in interface InputFormat
public javax.swing.JComponent getInputFormatAccessory()
InputFormat
getInputFormatAccessory
in interface InputFormat
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
InputFormat
isDataFlavorSupported
in interface InputFormat
flavor
- A DataFlavor.public void read(java.awt.datatransfer.Transferable t, Drawing drawing, boolean replace) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException
InputFormat
read
in interface InputFormat
t
- 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.UnsupportedFlavorException
java.io.IOException