|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.poi.contrib.poibrowser.TreeReaderListener
public class TreeReaderListener
Organizes document information in a tree model in order to be
e.g. displayed in a Swing JTree
. An instance of this
class is created with a root tree node (MutableTreeNode
) and
registered as a POIFSReaderListener
with a POIFSReader
. While the latter processes
a POI filesystem it calls this class' processPOIFSReaderEvent(org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent)
for
each document it has been registered for. This method appends the document it
processes at the appropriate position into the tree rooted at the
above mentioned root tree node.
The root tree node should be the root tree node of a TreeModel
.
A top-level element in the tree model, i.e. an immediate child node of the root node, describes a POI filesystem as such. It is suggested to use the file's name (as seen by the operating system) but it could be any other string.
The value of a tree node is a DocumentDescriptor
. Unlike
a POIFSDocument
which may be as heavy
as many megabytes, an instance of DocumentDescriptor
is a
light-weight object and contains only some meta-information about a
document.
Field Summary | |
---|---|
protected java.lang.String |
filename
The name of the file this TreeReaderListener
processes. |
protected java.util.Map |
pathToNode
Maps filenames and POI document paths to their associated tree nodes. |
protected javax.swing.tree.MutableTreeNode |
rootNode
The tree's root node. |
Constructor Summary | |
---|---|
TreeReaderListener(java.lang.String filename,
javax.swing.tree.MutableTreeNode rootNode)
Creates a TreeReaderListener which should then be
registered with a
POIFSReader . |
Method Summary | |
---|---|
int |
getNrOfBytes()
|
void |
processPOIFSReaderEvent(POIFSReaderEvent event)
A document in the POI filesystem has been opened for reading. |
void |
setNrOfBytes(int nrOfBytes)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected javax.swing.tree.MutableTreeNode rootNode
The tree's root node. POI filesystems get attached to this node as children.
protected java.util.Map pathToNode
Maps filenames and POI document paths to their associated tree nodes.
protected java.lang.String filename
The name of the file this TreeReaderListener
processes. It is used to identify a top-level element in the
tree. Alternatively any other string can be used. It is just a
label which should identify a POI filesystem.
Constructor Detail |
---|
public TreeReaderListener(java.lang.String filename, javax.swing.tree.MutableTreeNode rootNode)
Creates a TreeReaderListener
which should then be
registered with a
POIFSReader
.
filename
- The name of the POI filesystem, i.e. the name
of the file the POI filesystem resides in. Alternatively any
other string can be used.rootNode
- All document information will be attached as
descendands to this tree node.Method Detail |
---|
public void setNrOfBytes(int nrOfBytes)
public int getNrOfBytes()
public void processPOIFSReaderEvent(POIFSReaderEvent event)
A document in the POI filesystem has been opened for reading. This method retrieves properties of the document and adds them to a tree model.
processPOIFSReaderEvent
in interface POIFSReaderListener
event
- the POIFSReaderEvent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |