DAVEditor.java :  » Net » SkunkDAV » org » skunk » dav » client » gui » editor » Java Open Source

Java Open Source » Net » SkunkDAV 
SkunkDAV » org » skunk » dav » client » gui » editor » DAVEditor.java
/*
 *  Copyright (c) 2000, Jacob Smullyan.
 *
 *  This is part of SkunkDAV, a WebDAV client.  See http://skunkdav.sourceforge.net/ 
 *  for the latest version.
 * 
 *  SkunkDAV is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License as published
 *  by the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 * 
 *  SkunkDAV  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
 *  General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with SkunkDAV; see the file COPYING.  If not, write to the Free
 *  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 *  02111-1307, USA.
*/

package org.skunk.dav.client.gui.editor;

import org.skunk.dav.client.DAVFile;
import org.skunk.dav.client.gui.Buffer;
import javax.swing.JComponent;

/**
 * an extension of the <code>Buffer</code> interface for
 * buffers that enable the user to modify the contents
 * of a <code>DAVFile</code>.
 *
 * @author Jacob Smullyan
 */
public interface DAVEditor extends Buffer
{
    /**
     * @return the file contents of the editor.
     */
    byte[] getResourceBody() ;

    /**
     * sets the file contents of the editor.
     * @param the new contents
     */
    void setResourceBody(byte[] resourceBody);

    /**
     * @return the DAVFile upon which this editor is operating.
     */
    DAVFile getDAVFile();

    /**
     * sets the editor's DAVFile
     * @param file the new file
     */
    void setDAVFile(DAVFile file);

    /**
     * @return the name of the resource upon which the editor is operating
     */
    String getResourceName();

    /**
     * sets the resource name
     * @param resourceName the new resource name
     */
    void setResourceName(String resourceName);
    /**
     * @return whether the contents of the file have been 
     *   changed in the editor since the last load or save.
     */
    boolean isDirty();

    /**
     * sets the dirty flag on the editor.
     * @param dirty the new value of the dirty flag
     */
    void setDirty(boolean dirty);

    /**
     * @return whether the editor will accept input
     */
    boolean isWriteable();

    /**
     * sets the writeable flag on the editor
     * @param writeable the new value of the writeable flag
     */
    void setWriteable(boolean writeable);

    /**
     * saves the file being edited.
     */
    void save();

    /**
     * saves the file being edited, prompting the user for a new filename.
     */
    void saveAs();

    /**
     * saves the file being edited to the given filename.
     * @param filename the new filename
     */
    void saveAs(String filename);

    /**
     * loads the contents of the editor's DAVFile into the editor.
     * @throws CannotLoadException if it cannot load the file.
     */
    void load() throws CannotLoadException;

    /**
     * adds an EditListener.
     * @param ed the edit listener
     */
    void addEditListener(EditListener ed);

    /**
     * removes an EditListener.
     * @param ed the edit listener
     */
    void removeEditListener(EditListener ed);

    /**
     * @return the undo manager for this editor.  May be null.
     */
    DAVEditorUndoManager getUndoManager();
}



/* $Log: DAVEditor.java,v $
/* Revision 1.8  2000/12/19 22:06:15  smulloni
/* adding documentation.
/*
/* Revision 1.7  2000/12/08 05:50:30  smulloni
/* fixed MessageCatalogEditor.  The spi features are now a special build option,
/* and editors are loaded through reflection.
/*
/* Revision 1.6  2000/12/03 23:53:26  smulloni
/* added license and copyright preamble to java files.
/*
/* Revision 1.5  2000/12/03 20:40:06  smulloni
/* reconciling the minos.skunk.org cvs repository with sourceforge.
/*
/* Revision 1.5  2000/12/01 22:54:14  smullyan
/* added undo and basic editing functionality to text editor; defined some
/* keybindings in an inflexible way that will have to be changed soon.
/*
/* Revision 1.4  2000/11/20 23:30:23  smullyan
/* more editor integration work.
/*
/* Revision 1.3  2000/11/17 20:25:07  smullyan
/* new SaveAction; a StateMonitor being added to handle application state.
/*
/* Revision 1.2  2000/11/15 20:17:05  smullyan
/* added a Buffer interface, which is a wrapper around a displayable component.
/*
/* Revision 1.1  2000/11/14 23:14:39  smullyan
/* first cut at editing framework
/* */
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.