home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML Construction Kit / Dynamic HTML Construction Kit.iso / earthlink / nscomm / java40.jar / netscape / plugin / composer / ComposerDocument.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-11-03  |  2.7 KB  |  114 lines

  1. package netscape.plugin.composer;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5. import java.io.Reader;
  6. import java.io.Writer;
  7. import java.net.URL;
  8.  
  9. class ComposerDocument extends Document {
  10.    private Composer composer;
  11.    private String workDirectory;
  12.    private String text;
  13.    private URL base;
  14.    private URL workDirectoryURL;
  15.    private String eventName;
  16.    private URL documentURL;
  17.    // $FF: renamed from: in netscape.plugin.composer.ComposerDocumentReader
  18.    private ComposerDocumentReader field_0;
  19.    private ComposerDocumentWriter out;
  20.    private PluginManager manager;
  21.  
  22.    public ComposerDocument(Composer var1, String var2, URL var3, String var4, URL var5, String var6, URL var7) {
  23.       this.composer = var1;
  24.       this.text = var2;
  25.       this.workDirectory = var4;
  26.       this.base = var3;
  27.       this.workDirectoryURL = var5;
  28.       this.eventName = var6;
  29.       this.documentURL = var7;
  30.    }
  31.  
  32.    public URL getBase() {
  33.       return this.base;
  34.    }
  35.  
  36.    public File getWorkDirectory() {
  37.       return new File(this.workDirectory);
  38.    }
  39.  
  40.    public URL getWorkDirectoryURL() {
  41.       return this.workDirectoryURL;
  42.    }
  43.  
  44.    public Reader getInput() throws IOException {
  45.       if (this.field_0 != null) {
  46.          throw new IOException("Must close existing input stream first.");
  47.       } else {
  48.          this.field_0 = new ComposerDocumentReader(this, this.text.toCharArray());
  49.          return this.field_0;
  50.       }
  51.    }
  52.  
  53.    public Writer getOutput() throws IOException {
  54.       this.doOutputCheck();
  55.       this.out = new ComposerDocumentWriter(this);
  56.       return this.out;
  57.    }
  58.  
  59.    private void doOutputCheck() throws IOException {
  60.       if (this.out != null) {
  61.          throw new IOException("Must close existing output stream first.");
  62.       }
  63.    }
  64.  
  65.    public String getText() {
  66.       return this.text;
  67.    }
  68.  
  69.    public void setText(String var1) throws IOException {
  70.       this.doOutputCheck();
  71.       this.text = var1;
  72.       this.composer.newText(var1);
  73.    }
  74.  
  75.    void inputDone(ComposerDocumentReader var1) {
  76.       if (var1 == this.field_0) {
  77.          this.field_0 = null;
  78.       }
  79.  
  80.    }
  81.  
  82.    void outputDone(ComposerDocumentWriter var1, String var2) {
  83.       if (var1 == this.out) {
  84.          this.out = null;
  85.  
  86.          try {
  87.             this.setText(var2);
  88.          } catch (IOException var4) {
  89.             System.err.println("Couldn't set text.");
  90.             ((Throwable)var4).printStackTrace();
  91.          }
  92.       }
  93.    }
  94.  
  95.    public URL getDocumentURL() {
  96.       return this.documentURL;
  97.    }
  98.  
  99.    public String getEventName() {
  100.       return this.eventName;
  101.    }
  102.  
  103.    public void redirectDocumentOpen(String var1) {
  104.       if (this.eventName.equals("edit")) {
  105.          this.composer.newText(var1);
  106.       }
  107.  
  108.    }
  109.  
  110.    Composer getComposer() {
  111.       return this.composer;
  112.    }
  113. }
  114.