View Javadoc

1   package com.explosion.expfmodules.texteditor;
2   
3   /* =============================================================================
4    *       
5    *     Copyright 2004 Stephen Cowx
6    *
7    *     Licensed under the Apache License, Version 2.0 (the "License");
8    *     you may not use this file except in compliance with the License.
9    *     You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   *     Unless required by applicable law or agreed to in writing, software
14   *     distributed under the License is distributed on an "AS IS" BASIS,
15   *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   *     See the License for the specific language governing permissions and
17   *     limitations under the License.
18   * 
19   * =============================================================================
20   */
21  
22  /***
23   * @author Stephen Cowx
24   * Date created:@06-Feb-2003
25   */
26  
27  import java.io.File;
28  
29  public class TextDocument
30  {
31      private File file;
32      private int documentNumber = -1;
33      private String documentName;
34      
35      public TextDocument(File file)
36      {
37         this.file = file;
38         this.documentName = file.getName();
39      }
40  
41      public TextDocument(int documentNumber, String extension)
42      {
43         this.documentNumber = documentNumber;
44         this.documentName = "Untitled" + documentNumber + ( extension.indexOf(".")>0 ? "." : "") + extension;
45      }
46  
47      public void setFile(File file)
48      {
49        this.file = file;
50      }
51  
52      public File getFile()
53      {
54        return this.file;
55      }
56  
57      public int getDocumentNumber()
58      {
59        return this.documentNumber;
60      }
61  
62      public void setDocumentNumber(int documentNumber)
63      {
64        this.documentNumber = documentNumber;
65      }
66  
67      public String getDocumentName()
68      {
69        return this.documentName;
70      }
71  
72      public void setDocumentName(String documentName)
73      {
74        this.documentName = documentName;
75      }
76  
77    }