com.mucommander.ui.viewer
Class ViewerRegistrar

java.lang.Object
  extended by com.mucommander.ui.viewer.ViewerRegistrar

public class ViewerRegistrar
extends java.lang.Object

ViewerRegistrar maintains a list of registered file viewers and provides methods to dynamically register file viewers and create appropriate FileViewer (Panel) and ViewerFrame (Window) instances for a given AbstractFile.

Author:
Maxence Bernard

Constructor Summary
ViewerRegistrar()
           
 
Method Summary
static FileViewer createFileViewer(AbstractFile file)
          Creates and returns an appropriate FileViewer for the given file type.
static ViewerFrame createViewerFrame(MainFrame mainFrame, AbstractFile file, java.awt.Image icon)
          Creates and returns a ViewerFrame to start viewing the given file.
static void registerFileViewer(ViewerFactory factory)
          Registers a FileViewer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewerRegistrar

public ViewerRegistrar()
Method Detail

registerFileViewer

public static void registerFileViewer(ViewerFactory factory)
Registers a FileViewer.

Parameters:
factory - file viewer factory to register.

createViewerFrame

public static ViewerFrame createViewerFrame(MainFrame mainFrame,
                                            AbstractFile file,
                                            java.awt.Image icon)
Creates and returns a ViewerFrame to start viewing the given file. The ViewerFrame will be monitored so that if it is the last window on screen when it is closed by the user, it will trigger the shutdown sequence.

Parameters:
mainFrame - the parent MainFrame instance
file - the file that will be displayed by the returned ViewerFrame
icon - window's icon.
Returns:
the created ViewerFrame

createFileViewer

public static FileViewer createFileViewer(AbstractFile file)
                                   throws UserCancelledException
Creates and returns an appropriate FileViewer for the given file type.

Parameters:
file - the file that will be displayed by the returned FileViewer
Returns:
the created FileViewer
Throws:
UserCancelledException - if the user has been asked to confirm the operation and cancelled


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard