/* * 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; public interface Document { /** * Update any data that the document implementation computes * at runtime from the data that is actually persistent. This * is especially needed after loading documents. This is first * called after the afterNew() and afterOpen() lifecycle events * so that any any listener that wants to be informed about * these updates has a chance to do so. * */ void update(); /** * Save the document to the file with the given name. * * @param filename the file name to save the file to. * @throws Exception */ void save(String filename) throws Exception; /** * Conduct any cleanup that may be neccessary to close * this document and remove the associated data from * the program. * */ void close(); /** * Returns true if the document may have unsaved changes * that would be lost if the file would be closed without * saving. */ public boolean hasUnsavedChanges(); /** * Returns a unique type identification of this document * for internal use. This should be identical the the type name * of the corresponding document factory. * * @return a unique identifier for this document type */ public String getTypeName(); /** * Returns the full file and directory name of the * file to which the document was last saved. * * @return last file name for document */ public String getFilename(); }