org.xnap.gui.viewer
Class ViewerManager

java.lang.Object
  extended by org.xnap.gui.viewer.ViewerManager

public class ViewerManager
extends java.lang.Object

This class keeps track of the installed viewers and their handled file extensions. It follows the singleton pattern. ListListeners can be notified of additions or removals of viewers.


Method Summary
 void addListListener(ListListener listener)
           
 Viewer getDefaultViewer(java.io.File file)
          Returns the Viewer object that is registered to handle file.
static ViewerManager getInstance()
           
 Viewer[] getViewers()
          Returns an array of all registered vierwers.
 Viewer[] getViewers(java.io.File file)
          Returns array of all viewers registered for this type of file.
 void register(java.lang.String[] extensions, Viewer viewer)
          Registers viewer to handle files with extension extensions.
 void register(java.lang.String extension, Viewer viewer)
          Registers viewer to handle files with extension extension.
 void register(Viewer viewer)
          Registers viewer to handle files with any extension.
 void removeListListener(ListListener listener)
           
 void setDefaultViewer(java.io.File file, Viewer viewer)
           
 void unregister(java.lang.String[] extensions, Viewer viewer)
          Registers viewer to handle files with extension extensions.
 void unregister(java.lang.String extension, Viewer viewer)
          Unregisters viewer to handle files with extension extensions.
 void unregister(Viewer viewer)
          Unregisters viewer to handle files with any extension.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ViewerManager getInstance()

addListListener

public void addListListener(ListListener listener)

removeListListener

public void removeListListener(ListListener listener)

getDefaultViewer

public Viewer getDefaultViewer(java.io.File file)
Returns the Viewer object that is registered to handle file.

Returns:
null, if no suitable viewer was found; the viewer, otherwise

getViewers

public Viewer[] getViewers(java.io.File file)
Returns array of all viewers registered for this type of file.

Parameters:
file - the file's extension is used to determine the viewers
Returns:
array of viewers or null

getViewers

public Viewer[] getViewers()
Returns an array of all registered vierwers.


register

public void register(java.lang.String extension,
                     Viewer viewer)
Registers viewer to handle files with extension extension.


register

public void register(Viewer viewer)
Registers viewer to handle files with any extension.


register

public void register(java.lang.String[] extensions,
                     Viewer viewer)
Registers viewer to handle files with extension extensions.


unregister

public void unregister(java.lang.String extension,
                       Viewer viewer)
Unregisters viewer to handle files with extension extensions.


unregister

public void unregister(Viewer viewer)
Unregisters viewer to handle files with any extension.


unregister

public void unregister(java.lang.String[] extensions,
                       Viewer viewer)
Registers viewer to handle files with extension extensions.


setDefaultViewer

public void setDefaultViewer(java.io.File file,
                             Viewer viewer)


Copyright © 2001-2005 XNap Team. All Rights Reserved.