source: gli/trunk/src/org/greenstone/gatherer/gui/OptionsPane.java@ 16133

Last change on this file since 16133 was 16133, checked in by osborn, 16 years ago

Additions for Scheduling Component

  • Property svn:keywords set to Author Date Id Revision
File size: 25.1 KB
Line 
1/**
2 *#########################################################################
3 *
4 * A component of the Gatherer application, part of the Greenstone digital
5 * library suite from the New Zealand Digital Library Project at the
6 * University of Waikato, New Zealand.
7 *
8 * <BR><BR>
9 *
10 * Author: John Thompson, Greenstone Digital Library, University of Waikato
11 *
12 * <BR><BR>
13 *
14 * Copyright (C) 1999 New Zealand Digital Library Project
15 *
16 * <BR><BR>
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * <BR><BR>
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * <BR><BR>
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; if not, write to the Free Software
34 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 *########################################################################
36 */
37package org.greenstone.gatherer.gui;
38
39import java.awt.*;
40import java.awt.event.*;
41import java.io.*;
42import java.util.*;
43import javax.swing.*;
44import javax.swing.event.*;
45import javax.swing.text.*;
46import org.greenstone.gatherer.Configuration;
47import org.greenstone.gatherer.DebugStream;
48import org.greenstone.gatherer.Dictionary;
49import org.greenstone.gatherer.Gatherer;
50import org.greenstone.gatherer.cdm.Argument;
51import org.greenstone.gatherer.cdm.ArgumentControl;
52import org.greenstone.gatherer.collection.ScriptOptions;
53import org.greenstone.gatherer.collection.Collection;
54import org.greenstone.gatherer.collection.CollectionManager;
55import org.greenstone.gatherer.util.AppendLineOnlyFileDocument;
56import org.greenstone.gatherer.util.AppendLineOnlyFileDocumentOwner;
57import org.greenstone.gatherer.util.StaticStrings;
58
59/** This class serves as the data holder for all subclasses of option panes, such as Import options or All options. It also contains methods for creating each of the option lines as they would appear in the subpane. Futhermore it has a method for considering all the arguments and generating a <strong>String[]</strong> to allow you to pass them to the <strong>GShell</strong>.
60 * @author John Thompson, Greenstone Digital Library, University of Waikato
61 * @version 2.2
62 */
63public class OptionsPane
64 extends JPanel
65 implements AppendLineOnlyFileDocumentOwner, MouseListener {
66
67 static final public char SUCCESSFUL = 's';
68 static final public char UNSUCCESSFUL = 'u';
69 static final public char CANCELLED = 'c';
70 static final public char UNKNOWN = 'x';
71 static final public char SCHEDULED = 'd';
72
73 static private int BUILD = 0;
74 static private int IMPORT = 1;
75 static private int SCHEDULE = 2;
76 static private int MINIMUM_ROWS = 15;
77
78 /** All process messages are written to this log text area. */
79 public JTextArea log_textarea = null;
80
81 private ArrayList current_controls;
82
83 /** The <strong>ScriptOptions</strong> data object contains all the option settings we wish to persist between Gatherer sessions (and thus is stored in <strong>Collection</strong>). */
84 private ScriptOptions build_options = null;
85 private ScriptOptions import_options = null;
86 private ScriptOptions schedule_options = null;
87
88 private FileEntry file_entry = null;
89
90 /** the log pane - we only create it once now, not each time */
91 private JPanel log_pane = null;
92 /** the list of previous log messages */
93 private JList log_list = null;
94 private Vector writing_documents;
95
96
97 /** The default constructor creates the few session length options, but either retrieves the rest from the current collection, or creates a default set of options. */
98 public OptionsPane(ScriptOptions import_options, ScriptOptions build_options, ScriptOptions schedule_options) {
99 this.build_options = build_options;
100 this.import_options = import_options;
101 this.schedule_options = schedule_options;
102 this.current_controls = new ArrayList();
103 this.writing_documents = new Vector();
104
105 // Have to do this here, not in display, as the message log view may not have been displayed yet.
106 log_textarea = new JTextArea();
107 log_textarea.setEditable(false);
108 }
109
110 /** This method creates the panel with all the build only options on it.
111 * @param pane a JPanel which already has previous arguments available on it, to allow for lower moes to concatenate all of the arguments together
112 * @return a JPanel which can be used to display all the build only options
113 * @see org.greenstone.gatherer.Configuration#EXPERT_MODE
114 * @see org.greenstone.gatherer.Configuration#getColor
115 * @see org.greenstone.gatherer.Configuration#getMode
116 * @see org.greenstone.gatherer.Gatherer#config
117 * @see org.greenstone.gatherer.cdm.Argument
118 * @see org.greenstone.gatherer.collection.BuildOptions#getBuildArgument
119 * @see org.greenstone.gatherer.collection.BuildOptions#getBuildArgumentCount
120 * @see org.greenstone.gatherer.collection.BuildOptions#getBuildValue
121 * @see org.greenstone.gatherer.collection.BuildOptions#getBuildValueEnabled
122 * @see org.greenstone.gatherer.gui.OptionsPane.MyArgumentControl
123 */
124 public JPanel buildBuild(JPanel pane) {
125 // Reset the arguments
126 if(pane == null) {
127 current_controls.clear();
128 }
129 ArrayList build_arguments = new ArrayList();
130 int current_mode = Configuration.getMode();
131 int total_build_argument_count = build_options.getArgumentCount();
132
133 for(int i = 0; i < total_build_argument_count; i++) {
134 // Retrieve the argument so we know how to format the control.
135 Argument argument = build_options.getArgument(i);
136
137 //A hack to make the disable_OAI option visible in the GLI for Greenstone 3
138 if(argument.getName().equals(StaticStrings.DISABLEOAI_STR) && Gatherer.GS3) {
139 argument.setHiddenGLI(false);
140 }
141 if(!argument.isHiddenGLI() && argument.getModeLevel() <= current_mode) {
142 // Now attempt to retrieve any existing value for this argument.
143 boolean enabled = build_options.getValueEnabled(argument.getName());
144 String value = build_options.getValue(argument.getName());
145 MyArgumentControl argument_control = new MyArgumentControl(BUILD, argument, enabled, value);
146 build_arguments.add(argument_control);
147 }
148 }
149 current_controls.addAll(build_arguments);
150
151 // Now that we know how many arguments there are we can build the pane to view them on. Modes lower than EXPERT can provide a previous pane on which to add the arguments.
152 if(pane == null || current_mode >= Configuration.EXPERT_MODE) {
153 pane = new JPanel();
154 pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
155 pane.setBackground(Configuration.getColor("coloring.collection_tree_background", false));
156 int argument_count = build_arguments.size();
157 // If in any of the higher detail modes, and assuming we don't want super phat argument controls, we better ensure there is a minimum number of lines in the grid layout
158 if(current_mode >= Configuration.EXPERT_MODE) {
159 if(argument_count < MINIMUM_ROWS) {
160 argument_count = MINIMUM_ROWS;
161 }
162 pane.setLayout(new GridLayout(argument_count, 1, 5, 5));
163 }
164 // Otherwise we're just going to throw them on one after another and chuck it in a scroll pane anyway
165 else {
166 // use GridLayout with 0 rows == as many rows as needed. Unfortunately, rows will
167 // grow fat if space too large, but we don't know how many rows we'll need yet.
168 pane.setLayout(new GridLayout(0, 1, 5, 5));
169 }
170 }
171
172 for(int j = 0; j < build_arguments.size(); j++) {
173 pane.add((JComponent)build_arguments.get(j));
174 }
175 pane.addMouseListener(this);
176 build_arguments = null;
177 return pane;
178 }
179
180 /**Wendy's attempt at writing a buildSchedule Jpanel. */
181 public JPanel buildSchedule(JPanel pane) {
182 //reset the arguments
183 if(pane == null) {
184 current_controls.clear();
185 }
186
187 ArrayList schedule_arguments = new ArrayList();
188 int current_mode = Configuration.getMode();
189
190 int total_schedule_argument_count = schedule_options.getArgumentCount();
191
192 for(int i = 0; i < total_schedule_argument_count; i++) {
193 // Retrieve the argument so we know how to format the control.
194 Argument argument = schedule_options.getArgument(i);
195
196 //A hack to make the disable_OAI option visible in the GLI for Greenstone 3
197 if(argument.getName().equals(StaticStrings.DISABLEOAI_STR) && Gatherer.GS3) {
198 argument.setHiddenGLI(false);
199 }
200 if(!argument.isHiddenGLI() && argument.getModeLevel() <= current_mode) {
201 // Now attempt to retrieve any existing value for this argument.
202 boolean enabled = schedule_options.getValueEnabled(argument.getName());
203 String value = schedule_options.getValue(argument.getName());
204 MyArgumentControl argument_control = new MyArgumentControl(SCHEDULE, argument, enabled, value);
205 schedule_arguments.add(argument_control);
206 }
207 }
208 current_controls.addAll(schedule_arguments);
209
210 // Now that we know how many arguments there are we can build the pane to view them on. Modes lower than EXPERT can provide a previous pane on which to add the arguments.
211 if(pane == null || current_mode >= Configuration.EXPERT_MODE) {
212 pane = new JPanel();
213 pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
214 pane.setBackground(Configuration.getColor("coloring.collection_tree_background", false));
215 int argument_count = schedule_arguments.size();
216 // If in any of the higher detail modes, and assuming we don't want super phat argument controls, we better ensure there is a minimum number of lines in the grid layout
217 if(current_mode >= Configuration.EXPERT_MODE) {
218 if(argument_count < MINIMUM_ROWS) {
219 argument_count = MINIMUM_ROWS;
220 }
221 pane.setLayout(new GridLayout(argument_count, 1, 5, 5));
222 }
223 // Otherwise we're just going to throw them on one after another and chuck it in a scroll pane anyway
224 else {
225 // use GridLayout with 0 rows == as many rows as needed. Unfortunately, rows will
226 // grow fat if space too large, but we don't know how many rows we'll need yet.
227 pane.setLayout(new GridLayout(0, 1, 5, 5));
228 }
229 }
230
231 for(int j = 0; j < schedule_arguments.size(); j++) {
232 pane.add((JComponent)schedule_arguments.get(j));
233 }
234 pane.addMouseListener(this);
235 schedule_arguments = null;
236 return pane;
237
238 }
239
240 /** This method creates the panel with all the import only options on it.
241 * @param pane a JPanel which already has previous arguments available on it, to allow for lower moes to concatenate all of the arguments together
242 * @return a JPanel which can be used to display all the build only options
243 * @see org.greenstone.gatherer.Configuration#EXPERT_MODE
244 * @see org.greenstone.gatherer.Configuration#getColor
245 * @see org.greenstone.gatherer.Configuration#getMode
246 * @see org.greenstone.gatherer.Gatherer#config
247 * @see org.greenstone.gatherer.cdm.Argument
248 * @see org.greenstone.gatherer.collection.BuildOptions#getImportArgument
249 * @see org.greenstone.gatherer.collection.BuildOptions#getImportArgumentCount
250 * @see org.greenstone.gatherer.collection.BuildOptions#getImportValue
251 * @see org.greenstone.gatherer.collection.BuildOptions#getImportValueEnabled
252 * @see org.greenstone.gatherer.gui.OptionsPane.ArgumentControl
253 */
254 public JPanel buildImport(JPanel pane) {
255 // Reset the arguments
256 if(pane == null) {
257 current_controls.clear();
258 }
259 ArrayList import_arguments = new ArrayList();
260 int current_mode = Configuration.getMode();
261 int total_import_argument_count = import_options.getArgumentCount();
262 for(int i = 0; i < total_import_argument_count; i++) {
263 // Retrieve the argument so we know how to format the control.
264 Argument argument = import_options.getArgument(i);
265 if(!argument.isHiddenGLI() && argument.getModeLevel() <= current_mode) {
266 // Now attempt to retrieve any existing value for this argument.
267 boolean enabled = import_options.getValueEnabled(argument.getName());
268 String value = import_options.getValue(argument.getName());
269 MyArgumentControl argument_control = new MyArgumentControl(IMPORT, argument, enabled, value);
270 import_arguments.add(argument_control);
271 }
272 }
273 current_controls.addAll(import_arguments);
274 // Now that we know how many arguments there are we can build the pane to view them on. Modes lower than EXPERT can provide a previous pane on which to add the arguments.
275 if(pane == null || current_mode >= Configuration.EXPERT_MODE) {
276 pane = new JPanel();
277 pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
278 pane.setBackground(Configuration.getColor("coloring.collection_tree_background", false));
279 int argument_count = import_arguments.size();
280 // If in any of the higher detail modes, and assuming we don't want super phat argument controls, we better ensure there is a minimum number of lines in the grid layout
281 if(current_mode >= Configuration.EXPERT_MODE) {
282 if(argument_count < MINIMUM_ROWS) {
283 argument_count = MINIMUM_ROWS;
284 }
285 pane.setLayout(new GridLayout(argument_count, 1, 5, 5));
286 }
287 // Otherwise we're just going to throw them on one after another and chuck it in a scroll pane anyway
288 else {
289 // use GridLayout with 0 rows == as many rows as needed. Unfortunately, rows will
290 // grow fat if space too large, but we don't know how many rows we'll need yet.
291 pane.setLayout(new GridLayout(0, 1, 5, 5));
292 }
293 }
294
295 for(int j = 0; j < import_arguments.size(); j++) {
296 pane.add((JComponent)import_arguments.get(j));
297 }
298 pane.addMouseListener(this);
299 import_arguments = null;
300 return pane;
301 }
302
303 /** This method is used to build a panel based on the message log, which is nothing like any of the other panels.
304 * @return A <strong>JPanel</strong> containing a scrollable text area which represents the shell process message log.
305 */
306 public JPanel buildLog() {
307 // we now save the log pane
308 if (log_pane == null) {
309 log_pane = new JPanel(new BorderLayout());
310
311 // Build a list of the log files available, ordering by last modified. Log files are like build_log.date.txt
312 DefaultListModel contents = new DefaultListModel();
313 File log_directory = new File(CollectionManager.getLoadedCollectionLogDirectoryPath());
314 File children[] = log_directory.listFiles();
315 for(int i = 0; children != null && i < children.length; i++) {
316 String filename = children[i].getName();
317 if(filename.startsWith("build_log.") && filename.endsWith(".txt") ) {
318 String datestamp = filename.substring(filename.indexOf(".") + 1, filename.lastIndexOf(".")).toLowerCase();
319 if(datestamp.indexOf("s") == -1 && datestamp.indexOf("u") == -1 && datestamp.indexOf("c") == -1 && datestamp.indexOf("x") == -1) {
320 FileEntry entry = new FileEntry(children[i].getName(), children[i].getAbsolutePath());
321 // We are about to insert it. But where.
322 boolean found = false;
323 for(int j = 0; !found && j < contents.size(); j++) {
324 FileEntry sibling = (FileEntry) contents.getElementAt(j);
325 int order = entry.compareTo(sibling);
326 if(order > 0) {
327 contents.insertElementAt(entry, j);
328 found = true;
329 }
330 }
331 if(!found) {
332 contents.addElement(entry);
333 }
334 }
335 }
336 }
337
338 log_list = new JList(contents);
339 log_list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
340 log_list.setLayoutOrientation(JList.VERTICAL);
341 log_list.setPreferredSize(new Dimension(600, 100));
342 log_list.setVisibleRowCount(3);
343 log_list.addListSelectionListener(new LogListListener());
344
345 JLabel log_history_label = new JLabel(Dictionary.get("OptionsPane.LogHistory"));
346 JPanel log_history_pane = new JPanel();
347 log_history_pane.setPreferredSize(new Dimension(600, 100));
348 log_history_pane.setLayout(new BorderLayout());
349 log_history_pane.add(log_history_label, BorderLayout.NORTH);
350 log_history_pane.add(new JScrollPane(log_list), BorderLayout.CENTER);
351
352 log_pane.add(new JScrollPane(log_textarea), BorderLayout.CENTER);
353 log_pane.add(log_history_pane, BorderLayout.SOUTH);
354 }
355 return log_pane;
356 }
357
358 public AppendLineOnlyFileDocument createNewLogDocument() {
359 long time = System.currentTimeMillis();
360 StringBuffer name = new StringBuffer();
361 name.append("build_log.");
362 name.append(time);
363 name.append(".txt");
364 // just in case there is no log directory
365 File file = new File(CollectionManager.getLoadedCollectionLogDirectoryPath() + name.toString());
366 File parent_file = file.getParentFile();
367 parent_file.mkdirs();
368 parent_file = null;
369 // create the file entry and add it to the list at pos 0 - it will always be the newest one created
370 file_entry = new FileEntry(name.toString(), file.getAbsolutePath());
371 ((DefaultListModel)log_list.getModel()).add(0, file_entry);
372 log_list.setSelectedIndex(0);
373 // Finally retrieve and return the document associated with this file entry
374 return file_entry.getDocument();
375 }
376
377
378 /** Attempts to discover the latest document count.
379 * @return An <strong>int</strong> detailing the number of documents in this collection.
380 */
381 public int getDocumentCount() {
382 if(Gatherer.c_man.ready()) {
383 int count = Gatherer.c_man.getCollection().getDocumentCount();
384 if(count != 0) {
385 return count;
386 }
387 }
388 return 1;
389 }
390
391 /** Called by our magic log documents after they have finished writing themselves to file, whereapon it is no longer necessary to hold a reference to them. */
392 public void remove(AppendLineOnlyFileDocument document) {
393 writing_documents.remove(document);
394 }
395
396 public void resetFileEntry() {
397 if(file_entry != null) {
398 file_entry.reset();
399 }
400 }
401
402 /** Given a panel containing ArgumentControls, update the values associated with them. */
403 public void update(JPanel panel) {
404 if(panel == log_pane) {
405 return;
406 }
407
408 for(int i = 0; i < panel.getComponentCount(); i++) {
409 Component component = panel.getComponent(i);
410 if(component instanceof MyArgumentControl) {
411 ((MyArgumentControl)component).update();
412 }
413 }
414 }
415
416 /** Implementation side-effect
417 * @param e a MouseEvent
418 */
419 public void mouseClicked(MouseEvent e) {}
420
421 /** Implementation side-effect
422 * @param e a MouseEvent
423 */
424 public void mouseEntered(MouseEvent e) {}
425
426 /** Implemented to ensure that, by the time the mouse pointer leaves the current build options screen, ang changes to the value the JSpinners have been commited
427 * @param e a MouseEvent
428 */
429 public void mouseExited(MouseEvent e) {
430 // Loop through the controls, and if the current control is a JSpinner, commit its current editing
431 for(int i = 0; i < current_controls.size(); i++) {
432 MyArgumentControl control = (MyArgumentControl) current_controls.get(i);
433 JComponent value_control = control.getValueControl();
434 if(value_control instanceof JSpinner) {
435 try {
436 ((JSpinner)value_control).commitEdit();
437 }
438 catch(Exception exception) {
439 DebugStream.println("Exception in OptionsPane.mouseExited() - unexpected");
440 DebugStream.printStackTrace(exception);
441 }
442 }
443 value_control = null;
444 control = null;
445 }
446 }
447
448 /** Implementation side-effect
449 * @param e a MouseEvent
450 */
451 public void mousePressed(MouseEvent e) {}
452
453 /** Implementation side-effect
454 * @param e a MouseEvent
455 */
456 public void mouseReleased(MouseEvent e) {}
457
458 private class MyArgumentControl
459 extends ArgumentControl {
460 private int type;
461
462 public MyArgumentControl(int type, Argument argument, boolean enable, String value) {
463 super(argument, enable, value);
464 this.type = type;
465 }
466
467 /** Update the values stored in the collection so as to remember the current state of this argument. */
468 public void update() {
469 String name = getArgumentName();
470 boolean enable = isEnabled();
471 String value = getValue();
472 // If this argument was a flag, but is now disabled, remove from the build options altogether
473 if(!enable && value == null) {
474 if(type == BUILD) {
475 build_options.removeValue(name);
476 }
477 else if(type == SCHEDULE) {
478 schedule_options.removeValue(name);
479 }
480 else {
481 import_options.removeValue(name);
482 }
483 }
484 // Otherwise update the argument value
485 else {
486 if(type == BUILD) {
487 build_options.setValue(name, enable, value);
488 }
489 else if(type == SCHEDULE) {
490 schedule_options.setValue(name, enable, value);
491 }
492 else {
493 import_options.setValue(name, enable, value);
494 }
495 }
496 }
497 }
498
499 /** Holds a File which has a particular naming convention build_log.date.txt also keeps a Date corresponding to the date in its name*/
500 private class FileEntry {
501
502 private AppendLineOnlyFileDocument current_document;
503 private Date date;
504 private long last_modified;
505 private String display;
506 private String filename;
507 private String filepath;
508
509 public FileEntry(String filename, String filepath) {
510 this.date = null;
511 this.display = null;
512 this.filename = filename;
513 this.filepath = filepath;
514 this.last_modified = 0L;
515 }
516
517 /** returns 0 if the dates are the same, -ve number if the current FileEntry is earlier than the fe FileEntry ...*/
518 public int compareTo(FileEntry file_entry) {
519 Date our_date = getDate();
520 Date other_date = file_entry.getDate();
521 return our_date.compareTo(other_date);
522 }
523
524 public Date getDate() {
525 if(date == null) {
526 // Need to exclude first '.'
527 int first_index = filename.indexOf(".") + 1;
528 // Need to exclude the last '.'
529 int last_index = filename.lastIndexOf(".");
530 if(first_index > 0 && last_index > 0 && first_index < last_index) {
531 String date_string = filename.substring(first_index, last_index);
532 date = new Date(Long.parseLong(date_string));
533 }
534 else {
535 date = new Date(); // Current date
536 }
537 }
538 return date;
539 }
540
541 public AppendLineOnlyFileDocument getDocument() {
542 if(current_document == null) {
543 current_document = new AppendLineOnlyFileDocument(filepath);
544 }
545 return current_document;
546 }
547
548 public void reset() {
549 display = null;
550 }
551
552 /** we only want the date out of the file name, not the whole path */
553 public String toString() {
554 File file = new File(filename);
555 if(display == null) {
556 last_modified = file.lastModified();
557 StringBuffer d = new StringBuffer();
558 Date date = getDate();
559 d.append(date.toString());
560 char success = UNKNOWN;
561 File the_file = new File(filepath);
562 if(the_file.exists()) {
563 try {
564 FileInputStream in = new FileInputStream(the_file);
565 success = (char) in.read();
566 in.close();
567 in = null;
568 }
569 catch(Exception error) {
570 ///ystem.err.println("Log '" + filepath + "' not found!");
571 ///atherer.printStackTrace(error);
572 }
573 }
574 the_file = null;
575 switch (success) {
576 case SUCCESSFUL:
577 d.append(Dictionary.get("OptionsPane.Successful"));
578 break;
579 case UNSUCCESSFUL:
580 d.append(Dictionary.get("OptionsPane.Unsuccessful"));
581 break;
582 case CANCELLED:
583 d.append(Dictionary.get("OptionsPane.Cancelled"));
584 break;
585 case SCHEDULED:
586 d.append(Dictionary.get("OptionsPane.Scheduled"));
587 break;
588 default:
589 d.append(Dictionary.get("OptionsPane.Unknown"));
590 }
591 display = d.toString();
592 }
593 return display;
594 }
595 }
596
597 /** a ListSelectionListener that triggers the load of a newly selected log */
598 private class LogListListener implements ListSelectionListener {
599
600 public void valueChanged(ListSelectionEvent e) {
601 if (!e.getValueIsAdjusting()) { // we get two events for one change in list selection - use the false one ( the second one)
602 ///ystem.err.println("Log change detected.");
603 JList source = (JList)e.getSource();
604 file_entry = (FileEntry) source.getSelectedValue();
605 // First we determine if the old log has been completely written to file
606 Document document = log_textarea.getDocument();
607 ///ystem.err.println(" * current document: " + document);
608 ///ystem.err.println(" * new document: " + file_entry.getDocument());
609 // If we are dealing with the same document don't do anything.
610 if(document != file_entry.getDocument()) {
611 if(document instanceof AppendLineOnlyFileDocument) {
612 AppendLineOnlyFileDocument append_line_only_file_document = (AppendLineOnlyFileDocument) document;
613 if(append_line_only_file_document.isStillWriting()) {
614 ///ystem.err.println("Current log is still active... finishing.");
615 writing_documents.add(append_line_only_file_document); // We have to maintain a reference until they are all done.
616 append_line_only_file_document.setOwner(OptionsPane.this);
617 append_line_only_file_document.setExit();
618 }
619 else {
620 ///ystem.err.println("Current log is complete. Nothing to do.");
621 }
622 }
623 // Load the new log
624 log_textarea.setDocument(file_entry.getDocument());
625 }
626 }
627 }
628 }
629
630}
Note: See TracBrowser for help on using the repository browser.