com.mucommander.ui.viewer
Interface ViewerFactory

All Known Implementing Classes:
ImageFactory, TextFactory

public interface ViewerFactory

A common interface for instanciating FileViewer implementations, and finding out if a viewer is capable of viewing a particular file.

Author:
Nicolas Rinaudo, Maxence Bernard

Method Summary
 boolean canViewFile(AbstractFile file)
          Returns true if this factory can create a file viewer for the specified file.
 FileViewer createFileViewer()
          Returns a new instance of FileViewer.
 

Method Detail

canViewFile

boolean canViewFile(AbstractFile file)
                    throws WarnUserException
Returns true if this factory can create a file viewer for the specified file.

The FileEditor may base its decision stricly upon the file's name and its extension or may wish to read some of the file and compare it to a magic number.

Parameters:
file - file for which a viewer must be created.
Returns:
true if this factory can create a file viewer for the specified file.
Throws:
WarnUserException - if the specified file can be viewed after the warning message contained in the exception is displayed to the end user.

createFileViewer

FileViewer createFileViewer()
Returns a new instance of FileViewer.

Returns:
a new instance of FileViewer.


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