Changeset 15693
- Timestamp:
- 2008-05-23T18:51:55+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/util/AppendLineOnlyFileDocument.java
r15641 r15693 67 67 /** An independant thread responsible for writing the 'in memory' contents of the document model to the random access file as appropriate. This is done so IO lag does not effect the gui as much as it used to. */ 68 68 private WriterThread writer; 69 69 70 /** Keeps track of the document insert update event to be fired next (after a line element is written) */ 71 private DocumentEvent event = null; 70 72 71 73 public AppendLineOnlyFileDocument(String filename) { … … 117 119 } 118 120 121 /** Notifies listeners of a document insert update event */ 119 122 protected void fireInsertUpdate(DocumentEvent event) { 120 123 Object[] listeners = listeners_list.getListenerList(); … … 159 162 // Queue the content to be written. 160 163 writer.queue(new_line_element); 161 // moved the firing of DocumentEvent to the WriterThread.run() method for when the new line is *actually* written to the document 162 // DocumentEvent event = new AppendLineOnlyFileDocumentEvent(new_line_element, (int)start_offset, str_length, DocumentEvent.EventType.INSERT); 163 // fireInsertUpdate(event); 164 165 // moved the firing of DocumentEvent to the WriterThread.run() method for when the new line is *actually* written to the doc 166 event = new AppendLineOnlyFileDocumentEvent(new_line_element, (int)start_offset, str_length, DocumentEvent.EventType.INSERT); 167 //fireInsertUpdate(event); 164 168 new_line_element = null; 165 169 } … … 787 791 try { 788 792 write(element.getStartOffset(), element.getEndOffset(), content, content.getBytes("UTF-8").length); 789 790 // Now fire an event so everyone knows the Document's content has changed.791 int str_length = content.getBytes("UTF-8").length;792 long start_offset = length;793 DocumentEvent event = new AppendLineOnlyFileDocumentEvent(element, (int)start_offset, str_length, DocumentEvent.EventType.INSERT);794 AppendLineOnlyFileDocument.this.fireInsertUpdate(event);795 796 793 } 797 794 catch(Exception error) { 798 795 DebugStream.printStackTrace(error); 799 796 } 800 element.clearContent(); 797 // having written the element, we fire any document insert update event prepared earlier 798 if(event != null) { 799 AppendLineOnlyFileDocument.this.fireInsertUpdate(event); 800 } 801 element.clearContent(); 801 802 } 802 803 } … … 813 814 } 814 815 print("WriterThread.wait() complete"); 815 }816 } 816 817 } 817 818 }
Note:
See TracChangeset
for help on using the changeset viewer.