|
JHotDraw 7.4.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface InputFormat
An input format implements a strategy for reading a Drawing
which is encoded in an InputStream, a File or a
Transferable.
Typically an encoding can be recognized by a Mime type or by a file extension.
To identify the encoding used by a file, an appropriate FileFilter
for a javax.swing.JFileChooser component can be requested from InputFormat.
This interface intentionally contains many identical operations like OutputFormat to make it easy, to write classes that implement both interfaces.
Strategy
InputFormat encapsulates a strategy for reading drawings from
input streams.
Strategy: InputFormat; Context: Drawing.
| Method Summary | |
|---|---|
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)
Reads figures from a file and replaces the children of the drawing with them. |
void |
read(java.io.File file,
Drawing drawing,
boolean replace)
Reads figures from a file and adds them to the specified drawing. |
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. |
| Method Detail |
|---|
javax.swing.filechooser.FileFilter getFileFilter()
javax.swing.JComponent getInputFormatAccessory()
void read(java.io.File file,
Drawing drawing)
throws java.io.IOException
This is a convenience method for calling read(File,Drawing,true).
file - The file.drawing - The drawing.
java.io.IOException
void read(java.io.File file,
Drawing drawing,
boolean replace)
throws java.io.IOException
file - The file.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
void read(java.io.InputStream in,
Drawing drawing,
boolean replace)
throws java.io.IOException
in - 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.IOExceptionboolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
flavor - A DataFlavor.
void read(java.awt.datatransfer.Transferable t,
Drawing drawing,
boolean replace)
throws java.awt.datatransfer.UnsupportedFlavorException,
java.io.IOException
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
|
Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project. Some rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||