com.mucommander.ui.viewer.text
Class TextFactory

java.lang.Object
  extended by com.mucommander.ui.viewer.text.TextFactory
All Implemented Interfaces:
EditorFactory, ViewerFactory

public class TextFactory
extends java.lang.Object
implements ViewerFactory, EditorFactory

ViewerFactory and EditorFactory implementation for creating text viewers and editors.

Author:
Nicolas Rinaudo

Constructor Summary
TextFactory()
           
 
Method Summary
 boolean canEditFile(AbstractFile file)
          Returns true if this factory can create a file editor for the specified file.
 boolean canViewFile(AbstractFile file)
          Returns true if this factory can create a file viewer for the specified file.
 FileEditor createFileEditor()
          Returns a new instance of FileEditor.
 FileViewer createFileViewer()
          Returns a new instance of FileViewer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextFactory

public TextFactory()
Method Detail

canViewFile

public boolean canViewFile(AbstractFile file)
                    throws WarnUserException
Description copied from interface: ViewerFactory
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.

Specified by:
canViewFile in interface ViewerFactory
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.

canEditFile

public boolean canEditFile(AbstractFile file)
                    throws WarnUserException
Description copied from interface: EditorFactory
Returns true if this factory can create a file editor 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.

Specified by:
canEditFile in interface EditorFactory
Parameters:
file - file for which a editor must be created.
Returns:
true if this factory can create a file editor for the specified file.
Throws:
WarnUserException - if the specified file can be edited after the warning message contained in the exception is displayed to the end user.

createFileViewer

public FileViewer createFileViewer()
Description copied from interface: ViewerFactory
Returns a new instance of FileViewer.

Specified by:
createFileViewer in interface ViewerFactory
Returns:
a new instance of FileViewer.

createFileEditor

public FileEditor createFileEditor()
Description copied from interface: EditorFactory
Returns a new instance of FileEditor.

Specified by:
createFileEditor in interface EditorFactory
Returns:
a new instance of FileEditor.


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