|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.filechooser.FileView | +--org.thdl.tib.bibl.TTFileView
TTFileView test to see if a file is an .xml file and if so, assumes it's a Tibbibl
and searches for the first <title> element and sets the file's description to that.
It then uses this description for the name of the text by overriding the getName(java.io.File)
function.
This is used in for the JFileChooser
in FileAction
so that
when the open-file window appears it lists the text names instead of the file names.
Field Summary |
Constructor Summary | |
TTFileView()
|
Method Summary | |
String |
getDescription(File f)
Returns a human readable description of the file. |
String |
getName(File fl)
Overrides the ancestor's-- FileView --getName() function
so that it returns the text title as the name, if it is an XML file. |
void |
putDescription(File fl)
Adds a description to the file, if the file is an XML file and the docHandler ,
that is an XMLReader , successfully processes the document and returns a TibDoc . |
Methods inherited from class javax.swing.filechooser.FileView |
getIcon, getTypeDescription, isTraversable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TTFileView()
Method Detail |
public String getName(File fl)
Overrides the ancestor's--FileView
--getName() function
so that it returns the text title as the name, if it is an XML file. This has the
effect of presenting a list of text names in the open dialog rather than their less
comprehensible file names.
getName
in class FileView
fl
- File
whose name is requested.
String
the description of the file which has been set to
the text title if it is an XML file.public void putDescription(File fl)
Adds a description to the file, if the file is an XML file and the docHandler
,
that is an XMLReader
, successfully processes the document and returns a TibDoc
.
Furthermore, it must find a <title> element (the first in the document) with some text.
If all these conditions are met, the description of the file is set to the text of the title
element. Otherwise, the description is set to null
.
public String getDescription(File f)
getDescription
in class FileView
FileView.getDescription(java.io.File)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |