home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 39 / IOPROG_39.ISO / SOFT / sdkjava40.exe / data1.cab / fg_Samples / Samples / afc11 / JNotepad / src / IFileOperationTargetExt.java < prev    next >
Encoding:
Java Source  |  2000-05-04  |  3.6 KB  |  138 lines

  1. //
  2. // (C) Copyright 1995 - 1999 Microsoft Corporation.  All rights reserved.
  3. //
  4.  
  5. /**
  6.  *    Extends IFileOperationTarget to add some methods that are specific to
  7.  *    objects which act like files. Classes which encapsulate files or file-like
  8.  *    objects should adhere to this interface. This allows others to use an
  9.  *    entirely different implementation of this interface with your code and have
  10.  *    everything work.
  11.  *    <p>
  12.  *    JNotepad uses this interface in:
  13.  *    <ul>
  14.  *    <li><a href="FileControl.html">FileControl</a>
  15.  *    <li><a href="DiskFileControl.html">DiskFileControl</a>
  16.  *    <li><a href="ClipboardControl.html">ClipboardControl</a>
  17.  *    </ul>
  18.  *
  19.  *    @see    IFileOperationTarget
  20.  *
  21.  *    @version    1.0, 7/15/97
  22.  */
  23.  
  24. import java.io.File;
  25.  
  26. public interface IFileOperationTargetExt extends IFileOperationTarget
  27. {
  28.     /**
  29.      *    Returns the edit control associated with this file control.
  30.      */
  31.     public ITextOperationTargetExt getEditControl();
  32.     
  33.     /**
  34.      *    Sets the filename and filepath of the file associated with this control.
  35.      *
  36.      *    @param    path    Path of file to load
  37.      *    @param    name    Name of file to load
  38.      */
  39.     public void setFile(String path, String name);
  40.         
  41.     /**
  42.      *    Returns the path of the file.
  43.      */
  44.     public String getFilePath();
  45.         
  46.     /**
  47.      *    Returns the name of the file.
  48.      */
  49.     public String getFileName();
  50.  
  51.     /**
  52.      *    Returns the file object
  53.      */
  54.     public File getFile();
  55.  
  56.     /**
  57.      *    Returns the file object
  58.      */
  59.     public void setFile(File f);
  60.  
  61.     /**
  62.      *    Returns the path and the name together
  63.      */
  64.     public String getFileLocation();
  65.  
  66.     /**
  67.      *    Returns the filename that should be displayed on the screen (on a tab,
  68.      *    for example). If the filename is null, returns "(untitled)". Adds
  69.      *    dirty bit indicators and read-only indicators prefixed onto the name.
  70.      */
  71.     public String getDisplayFileName();    
  72.     
  73.     /**
  74.      *    Returns the extension of the file, without the period.
  75.      *    
  76.      *    @returns    The extension of the file. If there is no extension, an empty
  77.      *                string is returned. The period is not included. If there is no
  78.      *                filename defined, returns null.
  79.      */
  80.     public String getFileExtension();
  81.  
  82.     /**
  83.      *    Sets the file's read only state.
  84.      *
  85.      *    @param    ro    true if the file is to be marked read only, false if it is
  86.      *                to be writable.
  87.      */
  88.     public void setReadOnly(boolean ro);
  89.         
  90.     /**
  91.      *    Returns the read only state of the file.
  92.      */
  93.     public boolean isReadOnly();
  94.         
  95.     /**
  96.      *    Returns the contents of the edit control associated with this file.
  97.      *    This is the contents of the file.
  98.      */
  99.     public String getText();
  100.             
  101.     /**
  102.      *    Returns the name of the image file we should use to display next to the
  103.      *    filename (in a tab, for example). This is a small picture which represents
  104.      *    the type of file graphically. This class returns an image of a blank file.
  105.      */
  106.     public String getImageName();
  107.  
  108.     /**
  109.      *    Called when the object has received focus. Usually done when it is
  110.      *    kept in a tab and the tabviewer has brought the tab into focus.
  111.      */
  112.     public void gotFocus();    
  113.  
  114.     /**
  115.      *    Returns whether this file is capable of being saved. Returning false from 
  116.      *    this method prevents applications from trying to save it to disk or asking users
  117.      *    if they want to save it to disk.
  118.      *
  119.      *    @returns Returns true if it can be saved, false if it cannot. 
  120.      */
  121.     public boolean shouldSave();
  122.  
  123.     /**
  124.      *    Returns the dirty state of the object. 
  125.      *
  126.      *    @returns    true if the object has been modified, false if it has not.
  127.      */
  128.     public boolean isDirty();
  129.  
  130.     /**
  131.      *    Sets the dirty flag of the object. 
  132.      *
  133.      *    @param    b    true if the object is to be set dirty, false if it is not
  134.      */
  135.     public void setDirtyFlag(boolean b);
  136.  
  137. }
  138.