/* * Moonlight|3D Copyright (C) 2007 The Moonlight|3D team * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Created on Mar 14, 2007 */ package ml.core.document; import ml.core.exceptions.Exception; import ml.core.helper.FileType; /** * A factory for a particular type of documents. It handles * creating empty documents and loading of existing ones. * * @author gregor */ public interface DocumentFactory { /** * Get a unique type identification of this document type * for internal use * * @return a unique identifier for this document type */ public String getTypeName(); /** * Return a user-readable identification of this document type. * * @return name of document type */ public String getDisplayName(); /** * Return the file type for this document type. * * @return the FileType describing this document type * @see ml.core.helper.FileType */ public FileType getFileType(); /** * Create a new empty document of this type and return it. * * @return a new document */ Document createNewDocument(); /** * Do a quick check if the file with the given name can * be loaded by this document factory. * * @param filename the file to check * @return true if the file can be opened */ public boolean canOpenDocument(String filename); /** * Load the data from the file into a new document and * return it. * * @param filename the name of the file to load * @return the document representing the opened file * @throws Exception */ Document openDocument(String filename) throws Exception; }