|
JHotDraw 7.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jhotdraw.draw.TextInputFormat
public class TextInputFormat
An input format for importing text into a drawing.
This class uses the prototype design pattern. A TextHolderFigure figure is used as a prototype for creating a figure that holds the imported text.
For text that spans multiple lines, TextInputFormat can either add all the text to the same Figure, or it can create a new Figure for each line.
TextHolderFigure
Constructor Summary | |
---|---|
TextInputFormat(TextHolderFigure prototype)
Creates a new image output format for text, for a figure that can not. |
|
TextInputFormat(TextHolderFigure prototype,
java.lang.String formatName,
java.lang.String description,
java.lang.String fileExtension,
boolean isMultiline)
Creates a new image output format for the specified image format. |
Method Summary | |
---|---|
java.util.LinkedList<Figure> |
createTextHolderFigures(java.io.InputStream in)
|
java.lang.String |
getFileExtension()
|
javax.swing.filechooser.FileFilter |
getFileFilter()
Return a FileFilter that can be used to identify files which can be restored with this Storage 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 adds them to the specified drawing. |
void |
read(java.io.InputStream in,
Drawing drawing)
Reads figures from a file and adds them to the specified drawing. |
void |
read(java.awt.datatransfer.Transferable t,
Drawing drawing)
Reads figures from the specified Transferable and adds them to the specified drawing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextInputFormat(TextHolderFigure prototype)
public TextInputFormat(TextHolderFigure prototype, java.lang.String formatName, java.lang.String description, java.lang.String fileExtension, boolean isMultiline)
formatName
- The format name for the javax.imageio.ImageIO object.description
- The format description to be used for the file filter.fileExtension
- The file extension to be used for file filter.isMultiline
- Set this to true, if the TextHolderFigure can hold
multiple lines of text. If this is true, multiple lines of text are
added to the same figure. If this is false, a new Figure is created for
each line of text.Method Detail |
---|
public javax.swing.filechooser.FileFilter getFileFilter()
InputFormat
getFileFilter
in interface InputFormat
public java.lang.String getFileExtension()
public javax.swing.JComponent getInputFormatAccessory()
InputFormat
getInputFormatAccessory
in interface InputFormat
public void read(java.io.File file, Drawing drawing) throws java.io.IOException
InputFormat
read
in interface InputFormat
file
- The file.drawing
- The drawing.
java.io.IOException
public void read(java.io.InputStream in, Drawing drawing) throws java.io.IOException
InputFormat
read
in interface InputFormat
in
- The input stream.drawing
- The drawing.
java.io.IOException
public java.util.LinkedList<Figure> createTextHolderFigures(java.io.InputStream in) throws java.io.IOException
java.io.IOException
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) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException
InputFormat
read
in interface InputFormat
t
- The Transferable.drawing
- The drawing.
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException
|
Copyright 1996-2007 (c) JHotDraw.org. Some rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |