Methods Summary |
---|
private void | dropDocument(org.apache.poi.poifs.eventfilesystem.POIFSReaderListener listener, org.apache.poi.poifs.filesystem.DocumentDescriptor descriptor)
Set listeners = ( Set ) chosenDocumentDescriptors.get(descriptor);
listeners.remove(listener);
if (listeners.size() == 0)
{
chosenDocumentDescriptors.remove(descriptor);
}
|
java.util.Iterator | getListeners(org.apache.poi.poifs.filesystem.POIFSDocumentPath path, java.lang.String name)get am iterator of listeners for a particular document
Set rval = new HashSet(omnivorousListeners);
Set selectiveListeners =
( Set ) chosenDocumentDescriptors.get(new DocumentDescriptor(path,
name));
if (selectiveListeners != null)
{
rval.addAll(selectiveListeners);
}
return rval.iterator();
|
void | registerListener(org.apache.poi.poifs.eventfilesystem.POIFSReaderListener listener, org.apache.poi.poifs.filesystem.POIFSDocumentPath path, java.lang.String documentName)register a POIFSReaderListener for a particular document
if (!omnivorousListeners.contains(listener))
{
// not an omnivorous listener (if it was, this method is a
// no-op)
Set descriptors = ( Set ) selectiveListeners.get(listener);
if (descriptors == null)
{
// this listener has not registered before
descriptors = new HashSet();
selectiveListeners.put(listener, descriptors);
}
DocumentDescriptor descriptor = new DocumentDescriptor(path,
documentName);
if (descriptors.add(descriptor))
{
// this listener wasn't already listening for this
// document -- add the listener to the set of
// listeners for this document
Set listeners =
( Set ) chosenDocumentDescriptors.get(descriptor);
if (listeners == null)
{
// nobody was listening for this document before
listeners = new HashSet();
chosenDocumentDescriptors.put(descriptor, listeners);
}
listeners.add(listener);
}
}
|
void | registerListener(org.apache.poi.poifs.eventfilesystem.POIFSReaderListener listener)register for all documents
if (!omnivorousListeners.contains(listener))
{
// wasn't already listening for everything, so drop
// anything listener might have been listening for and
// then add the listener to the set of omnivorous
// listeners
removeSelectiveListener(listener);
omnivorousListeners.add(listener);
}
|
private void | removeSelectiveListener(org.apache.poi.poifs.eventfilesystem.POIFSReaderListener listener)
Set selectedDescriptors = ( Set ) selectiveListeners.remove(listener);
if (selectedDescriptors != null)
{
Iterator iter = selectedDescriptors.iterator();
while (iter.hasNext())
{
dropDocument(listener, ( DocumentDescriptor ) iter.next());
}
}
|