1 33 34 package edu.rice.cs.drjava.project; 35 36 import java.io.File ; 37 import java.io.IOException ; 38 39 import edu.rice.cs.plt.tuple.Pair; 40 41 public class DocFile extends File { 42 43 private Pair<Integer ,Integer > _sel; 44 private Pair<Integer ,Integer > _scroll; 45 private boolean _active; 46 private String _package; 47 private long _mod; 48 49 50 public DocFile(File f) { this(f, null, null, false, null); } 51 52 53 public DocFile(String pathname) { this(pathname, null, null, false, null); } 54 55 56 public DocFile(String parent, String child) { this(parent, child, null, null, false, null); } 57 58 public DocFile(String pathname, Pair<Integer ,Integer > selection, Pair<Integer ,Integer > scroll, boolean active, String srcRoot) { 59 super(pathname); 60 init(selection, scroll, active, srcRoot); 61 } 62 public DocFile(File f, Pair<Integer ,Integer > selection, Pair<Integer ,Integer > scroll, boolean active, String srcRoot) { 63 super(f, ""); 64 init(selection, scroll, active, srcRoot); 65 } 66 67 public DocFile(String parent, String child, Pair<Integer ,Integer > selection, Pair<Integer ,Integer > scroll, boolean active, String srcRoot) { 68 super(parent, child); 69 init(selection, scroll, active, srcRoot); 70 } 71 72 private void init(Pair<Integer ,Integer > selection, Pair<Integer ,Integer > scroll, boolean active, String pack) { 73 _sel = selection; 74 _scroll = scroll; 75 _active = active; 76 _package = pack; 77 } 78 80 81 public DocFile getAbsoluteFile() { 82 if (isAbsolute()) return this; 83 else 84 return new DocFile(super.getAbsoluteFile(), _sel, _scroll, _active, _package); 85 } 86 87 public DocFile getCanonicalFile() throws IOException { 88 return new DocFile(super.getCanonicalFile(), _sel, _scroll, _active, _package); 89 } 90 92 95 public Pair<Integer ,Integer > getSelection() { return _sel; } 96 97 98 public void setSelection(Pair<Integer ,Integer > sel) { _sel = sel; } 99 100 103 public void setSelection(int start, int end) { 104 _sel = new Pair<Integer ,Integer >(new Integer (start), new Integer (end)); 105 } 106 107 public Pair<Integer ,Integer > getScroll() { return _scroll; } 108 109 110 public void setScroll(Pair<Integer ,Integer > scroll) { _scroll = scroll; } 111 112 115 public void setScroll(int vert, int horiz) { 116 _scroll = new Pair<Integer ,Integer >(new Integer (vert), new Integer (horiz)); 117 } 118 119 120 public boolean isActive() { return _active; } 121 122 123 124 public void setActive(boolean active) { _active = active; } 125 126 127 public String getPackage() { return _package; } 128 129 130 public void setPackage(String pkg) { _package = pkg; } 131 132 136 public void setSavedModDate(long mod) { _mod = mod; } 137 138 139 public long getSavedModDate() { return _mod; } 140 } | Popular Tags |